|
@@ -390,224 +390,221 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
];
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * KONTRAHENCI
|
|
|
- */
|
|
|
-public function fetchKontrahenciAjaxAction() {
|
|
|
- Response::sendTryCatchJson(array($this, 'fetchKontrahenciAjax'));
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * KONTRAHENCI
|
|
|
+ */
|
|
|
+ public function fetchKontrahenciAjaxAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'fetchKontrahenciAjax'));
|
|
|
+ }
|
|
|
+ public function fetchKontrahenciAjax($args) {
|
|
|
+ $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
|
|
|
+ if ($idGroup < 0) $idGroup = 0;
|
|
|
|
|
|
-public function fetchKontrahenciAjax($args) {
|
|
|
-
|
|
|
- $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
|
|
|
- if ($idGroup < 0) $idGroup = 0;
|
|
|
-
|
|
|
- $limit = 5;
|
|
|
-
|
|
|
- $limitstart = V::get('limitstart', 0, $_REQUEST, 'int');
|
|
|
- if ($limitstart < 0) $limitstart = 0;
|
|
|
-
|
|
|
- $page = V::get('page', 0, $_REQUEST, 'int');
|
|
|
- $limitstart = ($page - 1) * $limit;
|
|
|
-
|
|
|
- $search = V::get('search', '', $_REQUEST);
|
|
|
- $searchParams = [];
|
|
|
- if (!empty($search)) {
|
|
|
- $ogcSearch = "*{$search}*"; // wildCard="*" -> mysql '%'
|
|
|
- $searchParams['ogc:Filter'] = '
|
|
|
- <ogc:Filter>
|
|
|
- <ogc:Or>
|
|
|
- <ogc:PropertyIsLike wildCard="" singleChar="%23" escapeChar="!">
|
|
|
- <ogc:PropertyName>NIP</ogc:PropertyName>
|
|
|
- <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
- </ogc:PropertyIsLike>
|
|
|
- <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
- <ogc:PropertyName>Nazwa_grupy_kapitalowej</ogc:PropertyName>
|
|
|
- <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
- </ogc:PropertyIsLike>
|
|
|
- <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
- <ogc:PropertyName>Pelna_nazwa_kontrahenta</ogc:PropertyName>
|
|
|
- <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
- </ogc:PropertyIsLike>
|
|
|
- </ogc:Or>
|
|
|
- </ogc:Filter>
|
|
|
- ';
|
|
|
- }
|
|
|
+ $limit = 5;
|
|
|
|
|
|
- $backRefFilter = [];
|
|
|
- if ($idGroup > 0) {
|
|
|
- $backRefFilter['__backRef'] = [
|
|
|
- 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_KONTRAHENCIS_GRUPY', // TODO: nowy rejetr na grupy / filty KONTRAHENCI
|
|
|
- 'primaryKey' => $idGroup,
|
|
|
- 'fieldName' => 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_KONTRAHENCIS',
|
|
|
- ];
|
|
|
- // TODO: Storage dodać obiekt xsd default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY:
|
|
|
- // - ID
|
|
|
- // - ID_USER - id usera który stworzył grupę (tylko dla niego będzie widoczna)
|
|
|
- // - NAZWA - nazwa grupy
|
|
|
- // - 'default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_KONTRAHENCI' minOccurs="0" maxOccurs="unbounded"
|
|
|
- }
|
|
|
+ $limitstart = V::get('limitstart', 0, $_REQUEST, 'int');
|
|
|
+ if ($limitstart < 0) $limitstart = 0;
|
|
|
+
|
|
|
+ $page = V::get('page', 0, $_REQUEST, 'int');
|
|
|
+ $limitstart = ($page - 1) * $limit;
|
|
|
|
|
|
- $acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI');
|
|
|
- $query = $acl->buildQuery(array_merge([
|
|
|
- 'cols' => [ // TODO:? propertyName = []
|
|
|
- 'ID',
|
|
|
- 'Nazwa_grupy_kapitalowej',
|
|
|
- 'Pelna_nazwa_kontrahenta',
|
|
|
- 'Numer_kontrahenta',
|
|
|
- 'Skrocona_Nazwa_Kontrahenta',
|
|
|
- 'Typ_kontrahenta',
|
|
|
- 'NIP',
|
|
|
- 'KRS',
|
|
|
- 'REGON',
|
|
|
- 'PESEL',
|
|
|
- 'Forma_prawna_dzialalnosci',
|
|
|
- 'Ulica',
|
|
|
- 'Numer_budynku',
|
|
|
- 'Numer_mieszkania_lokalu',
|
|
|
- 'Miejscowosc',
|
|
|
- 'Kod_pocztowy',
|
|
|
- 'Kraj',
|
|
|
- 'Telefon',
|
|
|
- 'Fax',
|
|
|
- 'Mail',
|
|
|
- 'A_ADM_COMPANY',
|
|
|
- 'A_CLASSIFIED',
|
|
|
- 'A_STATUS',
|
|
|
- 'A_STATUS_INFO',
|
|
|
- 'Dodano',
|
|
|
- 'L_APPOITMENT_USER',
|
|
|
- 'Podmiot_dominujacy',
|
|
|
- 'Tytul_dokumentu',
|
|
|
- 'ownCompany',
|
|
|
- 'uwagi',
|
|
|
- ],
|
|
|
- //'f_ID' => $id,
|
|
|
- 'limit' => $limit,
|
|
|
- 'limitstart' => $limitstart, // offset
|
|
|
- ], $searchParams, $backRefFilter));
|
|
|
- $total = $query->getTotal();
|
|
|
- $items = $query->getItems();
|
|
|
-
|
|
|
- $pagination = array();
|
|
|
- $pagination['total_items'] = $total;
|
|
|
- $pagination['size'] = ceil($total/$limit); // pages size
|
|
|
- $pagination['current'] = $page;
|
|
|
- $pagination['limit'] = $limit;
|
|
|
-
|
|
|
- return [
|
|
|
- 'type' => 'success',
|
|
|
- 'msg' => 'showKontrajenci',
|
|
|
- '__req_args' => $_REQUEST,
|
|
|
- '__args' => $args,
|
|
|
- 'body' => [
|
|
|
- 'items' => $items,
|
|
|
- //'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI'),
|
|
|
- 'pagination' => $pagination
|
|
|
- ]
|
|
|
+ $search = V::get('search', '', $_REQUEST);
|
|
|
+ $searchParams = [];
|
|
|
+ if (!empty($search)) {
|
|
|
+ $ogcSearch = "*{$search}*"; // wildCard="*" -> mysql '%'
|
|
|
+ $searchParams['ogc:Filter'] = '
|
|
|
+ <ogc:Filter>
|
|
|
+ <ogc:Or>
|
|
|
+ <ogc:PropertyIsLike wildCard="" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>NIP</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>Nazwa_grupy_kapitalowej</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>Pelna_nazwa_kontrahenta</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ </ogc:Or>
|
|
|
+ </ogc:Filter>
|
|
|
+ ';
|
|
|
+ }
|
|
|
+
|
|
|
+ $backRefFilter = [];
|
|
|
+ if ($idGroup > 0) {
|
|
|
+ $backRefFilter['__backRef'] = [
|
|
|
+ 'namespace' => 'default_db/BI_audit_ENERGA_KONTRAHENCI_group/BI_audit_ENERGA_KONTRAHENCI_group',
|
|
|
+ 'primaryKey' => $idGroup,
|
|
|
+ 'fieldName' => 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI',
|
|
|
];
|
|
|
+ // - ID
|
|
|
+ // - ID_USER - id usera który stworzył grupę (tylko dla niego będzie widoczna)
|
|
|
+ // - NAZWA - nazwa grupy
|
|
|
+ // - 'default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_KONTRAHENCI' minOccurs="0" maxOccurs="unbounded"
|
|
|
}
|
|
|
-//
|
|
|
-// public function fetchKontrahenciAjaxOld($args) {
|
|
|
-// //$id = V::get('ID', 1, $_REQUEST, 'int');
|
|
|
-// $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI')->buildQuery([
|
|
|
-// 'cols' => [ // TODO:? propertyName = []
|
|
|
-// 'ID',
|
|
|
-// 'Nazwa_grupy_kapitalowej',
|
|
|
-// 'Pelna_nazwa_kontrahenta',
|
|
|
-// 'NIP',
|
|
|
-// 'KRS',
|
|
|
-// 'REGON',
|
|
|
-// 'Miejscowosc',
|
|
|
-// 'Kod_pocztowy',
|
|
|
-// 'Telefon'
|
|
|
-// ],
|
|
|
-// //'f_ID' => $id,
|
|
|
-// ])->getItems([
|
|
|
-// 'limit' => 10
|
|
|
-// ]);
|
|
|
-//
|
|
|
-// return [
|
|
|
-// 'type' => 'success',
|
|
|
-// 'msg' => 'showKontrahenci',
|
|
|
-// '__req_args' => $_REQUEST,
|
|
|
-// '__args' => $args,
|
|
|
-// 'body' => [
|
|
|
-// 'items' => $items,
|
|
|
-// 'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI')
|
|
|
-// ]
|
|
|
-// ];
|
|
|
-// }
|
|
|
-
|
|
|
-public function showTableKontrahenci($items) {
|
|
|
- $view = '<form class="form-horizontal" method="post">
|
|
|
- <table class="table table-bordered table-hover table-striped" height=5>
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <td width=1><input type="checkbox" name="checkAll" id="checkAll-KONTRAHENCI" /></td>
|
|
|
- <td width=1>ID</td>
|
|
|
- <td>Nazwa grupy kapitalowej</td>
|
|
|
- <td>Pelna nazwa kontrahenta</td>
|
|
|
- <td>Numer kontrahenta</td>
|
|
|
- <td>Skrócona nazwa kontrahenta</td>
|
|
|
- <td>Typ_kontrahenta</td>
|
|
|
- <td>NIP</td>
|
|
|
- <td>KRS</td>
|
|
|
- <td>Regon</td>
|
|
|
- <td>PESEL</td>
|
|
|
- <td>Forma prawna działalności</td>
|
|
|
- <td>Ulica</td>
|
|
|
- <td>Numer budynku</td>
|
|
|
- <td>Numer mieszkania lokalu</td>
|
|
|
- <td>Miejscowosc</td>
|
|
|
- <td>Kod pocztowy</td>
|
|
|
- <td>Kraj</td>
|
|
|
- <td>Telefon</td>
|
|
|
- <td>Fax</td>
|
|
|
- <td>Mail</td>
|
|
|
- <td>A_ADM_COMPANY</td>
|
|
|
- <td>A_CLASSIFIED</td>
|
|
|
- <td>A_STATUS</td>
|
|
|
- <td>A_STATUS_INFO</td>
|
|
|
- <td>Dodano</td>
|
|
|
- <td>L_APPOITMENT_USER</td>
|
|
|
- <td>Podmiot dominujacy</td>
|
|
|
- <td>Tytul dokumentu</td>
|
|
|
- <td>ownCompany</td>
|
|
|
- <td>uwagi</td>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody id="body-kontrahenci">
|
|
|
- </tbody></table>
|
|
|
- </form>
|
|
|
- ';
|
|
|
|
|
|
- return $view;
|
|
|
-}
|
|
|
+ $acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI');
|
|
|
+ $query = $acl->buildQuery(array_merge([
|
|
|
+ 'cols' => [ // TODO:? propertyName = []
|
|
|
+ 'ID',
|
|
|
+ 'Nazwa_grupy_kapitalowej',
|
|
|
+ 'Pelna_nazwa_kontrahenta',
|
|
|
+ 'Numer_kontrahenta',
|
|
|
+ 'Skrocona_Nazwa_Kontrahenta',
|
|
|
+ 'Typ_kontrahenta',
|
|
|
+ 'NIP',
|
|
|
+ 'KRS',
|
|
|
+ 'REGON',
|
|
|
+ 'PESEL',
|
|
|
+ 'Forma_prawna_dzialalnosci',
|
|
|
+ 'Ulica',
|
|
|
+ 'Numer_budynku',
|
|
|
+ 'Numer_mieszkania_lokalu',
|
|
|
+ 'Miejscowosc',
|
|
|
+ 'Kod_pocztowy',
|
|
|
+ 'Kraj',
|
|
|
+ 'Telefon',
|
|
|
+ 'Fax',
|
|
|
+ 'Mail',
|
|
|
+ 'A_ADM_COMPANY',
|
|
|
+ 'A_CLASSIFIED',
|
|
|
+ 'A_STATUS',
|
|
|
+ 'A_STATUS_INFO',
|
|
|
+ 'Dodano',
|
|
|
+ 'L_APPOITMENT_USER',
|
|
|
+ 'Podmiot_dominujacy',
|
|
|
+ 'Tytul_dokumentu',
|
|
|
+ 'ownCompany',
|
|
|
+ 'uwagi',
|
|
|
+ ],
|
|
|
+ //'f_ID' => $id,
|
|
|
+ 'limit' => $limit,
|
|
|
+ 'limitstart' => $limitstart, // offset
|
|
|
+ ], $searchParams, $backRefFilter));
|
|
|
+ $total = $query->getTotal();
|
|
|
+ $items = $query->getItems();
|
|
|
|
|
|
-// tworzenie grupy kontrahentów
|
|
|
-public function createKontrahenciGroupAjaxAction() {
|
|
|
- Response::sendTryCatchJson(array($this, 'createKontrahenciGroupAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em
|
|
|
-}
|
|
|
+ $pagination = array();
|
|
|
+ $pagination['total_items'] = $total;
|
|
|
+ $pagination['size'] = ceil($total/$limit); // pages size
|
|
|
+ $pagination['current'] = $page;
|
|
|
+ $pagination['limit'] = $limit;
|
|
|
|
|
|
-public function createKontrahenciGroupAjax($args) {
|
|
|
- $nazwa = V::get('NAZWA', '', $args);
|
|
|
- // TODO: vlaidacja nazwy - sprawdzenie czy już nie występuje
|
|
|
-
|
|
|
- $idGroup = DB::getPDO()->insert('BI_audit_ENERGA_KONTRAHENCI_GRUPY', [
|
|
|
- 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
- 'A_RECORD_CREATE_DATE' => 'NOW()',
|
|
|
- 'NAZWA' => $nazwa,
|
|
|
- ]);
|
|
|
-
|
|
|
- return [
|
|
|
- 'msg' => "Utworzona grupę {$idGroup}",
|
|
|
- 'type' => "success",
|
|
|
- 'body' => [
|
|
|
- 'id' => $idGroup,
|
|
|
- ]
|
|
|
- ];
|
|
|
-}
|
|
|
+ return [
|
|
|
+ 'type' => 'success',
|
|
|
+ 'msg' => 'showKontrajenci',
|
|
|
+ '__req_args' => $_REQUEST,
|
|
|
+ '__args' => $args,
|
|
|
+ 'body' => [
|
|
|
+ 'items' => $items,
|
|
|
+ //'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI'),
|
|
|
+ 'pagination' => $pagination
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ // public function fetchKontrahenciAjaxOld($args) {
|
|
|
+ // //$id = V::get('ID', 1, $_REQUEST, 'int');
|
|
|
+ // $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI')->buildQuery([
|
|
|
+ // 'cols' => [ // TODO:? propertyName = []
|
|
|
+ // 'ID',
|
|
|
+ // 'Nazwa_grupy_kapitalowej',
|
|
|
+ // 'Pelna_nazwa_kontrahenta',
|
|
|
+ // 'NIP',
|
|
|
+ // 'KRS',
|
|
|
+ // 'REGON',
|
|
|
+ // 'Miejscowosc',
|
|
|
+ // 'Kod_pocztowy',
|
|
|
+ // 'Telefon'
|
|
|
+ // ],
|
|
|
+ // //'f_ID' => $id,
|
|
|
+ // ])->getItems([
|
|
|
+ // 'limit' => 10
|
|
|
+ // ]);
|
|
|
+ //
|
|
|
+ // return [
|
|
|
+ // 'type' => 'success',
|
|
|
+ // 'msg' => 'showKontrahenci',
|
|
|
+ // '__req_args' => $_REQUEST,
|
|
|
+ // '__args' => $args,
|
|
|
+ // 'body' => [
|
|
|
+ // 'items' => $items,
|
|
|
+ // 'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI')
|
|
|
+ // ]
|
|
|
+ // ];
|
|
|
+ // }
|
|
|
+
|
|
|
+ public function showTableKontrahenci($items) {
|
|
|
+ $view = '<form class="form-horizontal" method="post">
|
|
|
+ <table class="table table-bordered table-hover table-striped" height=5>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <td width=1><input type="checkbox" name="checkAll" id="checkAll-KONTRAHENCI" /></td>
|
|
|
+ <td width=1>ID</td>
|
|
|
+ <td>Nazwa grupy kapitalowej</td>
|
|
|
+ <td>Pelna nazwa kontrahenta</td>
|
|
|
+ <td>Numer kontrahenta</td>
|
|
|
+ <td>Skrócona nazwa kontrahenta</td>
|
|
|
+ <td>Typ_kontrahenta</td>
|
|
|
+ <td>NIP</td>
|
|
|
+ <td>KRS</td>
|
|
|
+ <td>Regon</td>
|
|
|
+ <td>PESEL</td>
|
|
|
+ <td>Forma prawna działalności</td>
|
|
|
+ <td>Ulica</td>
|
|
|
+ <td>Numer budynku</td>
|
|
|
+ <td>Numer mieszkania lokalu</td>
|
|
|
+ <td>Miejscowosc</td>
|
|
|
+ <td>Kod pocztowy</td>
|
|
|
+ <td>Kraj</td>
|
|
|
+ <td>Telefon</td>
|
|
|
+ <td>Fax</td>
|
|
|
+ <td>Mail</td>
|
|
|
+ <td>A_ADM_COMPANY</td>
|
|
|
+ <td>A_CLASSIFIED</td>
|
|
|
+ <td>A_STATUS</td>
|
|
|
+ <td>A_STATUS_INFO</td>
|
|
|
+ <td>Dodano</td>
|
|
|
+ <td>L_APPOITMENT_USER</td>
|
|
|
+ <td>Podmiot dominujacy</td>
|
|
|
+ <td>Tytul dokumentu</td>
|
|
|
+ <td>ownCompany</td>
|
|
|
+ <td>uwagi</td>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody id="body-kontrahenci">
|
|
|
+ </tbody></table>
|
|
|
+ </form>
|
|
|
+ ';
|
|
|
+
|
|
|
+ return $view;
|
|
|
+ }
|
|
|
+
|
|
|
+ // tworzenie grupy kontrahentów
|
|
|
+ public function createKontrahenciGroupAjaxAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'createKontrahenciGroupAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em
|
|
|
+ }
|
|
|
+
|
|
|
+ public function createKontrahenciGroupAjax($args) {
|
|
|
+ $nazwa = V::get('NAZWA', '', $args);
|
|
|
+ // TODO: vlaidacja nazwy - sprawdzenie czy już nie występuje
|
|
|
+
|
|
|
+ $idGroup = DB::getPDO()->insert('BI_audit_ENERGA_KONTRAHENCI_GRUPY', [
|
|
|
+ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
+ 'A_RECORD_CREATE_DATE' => 'NOW()',
|
|
|
+ 'NAZWA' => $nazwa,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'msg' => "Utworzona grupę {$idGroup}",
|
|
|
+ 'type' => "success",
|
|
|
+ 'body' => [
|
|
|
+ 'id' => $idGroup,
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -624,7 +621,7 @@ public function createKontrahenciGroupAjax($args) {
|
|
|
if (!$idGroup) throw new Exception("Nie wybrano grupa");
|
|
|
if (!$kontrahenciIds || count($kontrahenciIds) == 0 ) throw new Exception("Proszę wybrać kontrahentów");
|
|
|
|
|
|
- $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY')->buildQuery([
|
|
|
+ $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_group/BI_audit_ENERGA_KONTRAHENCI_group')->buildQuery([
|
|
|
'cols' => [ // TODO:? propertyName = []
|
|
|
'ID',
|
|
|
'ID_USER',
|
|
@@ -636,8 +633,8 @@ public function createKontrahenciGroupAjax($args) {
|
|
|
if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
|
|
|
|
|
|
// $refGrupyToPracownicy = ACL::getRefTable('obiekt główny', 'nazwa pola - powiązane rekordy');
|
|
|
- $refGrupyToKontrahenci = ACL::getRefTable('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY',
|
|
|
- 'default_db__x3A__BI_audit_ENERGA_KONTRAHENCI:BI_audit_ENERGA_KONTRAHENCI');
|
|
|
+ $refGrupyToKontrahenci = ACL::getRefTable('default_db/BI_audit_ENERGA_KONTRAHENCI_group/BI_audit_ENERGA_KONTRAHENCI_group',
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI');
|
|
|
foreach ($kontrahenciIds as $kontrahentIds) {
|
|
|
DB::getPDO()->insert($refGrupyToKontrahenci, ['PRIMARY_KEY' => $idGroup, 'REMOTE_PRIMARY_KEY' => $kontrahentIds]);
|
|
|
}
|
|
@@ -649,75 +646,49 @@ public function createKontrahenciGroupAjax($args) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-public function fetchGroupKontrahenciAjaxAction() {
|
|
|
- Response::sendTryCatchJson(array($this, 'fetchGroupKontrahenciAjax'));
|
|
|
-}
|
|
|
+ public function fetchGroupKontrahenciAjaxAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'fetchGroupKontrahenciAjax'));
|
|
|
+ }
|
|
|
+ public function fetchGroupKontrahenciAjax() {
|
|
|
+ $query = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_group/BI_audit_ENERGA_KONTRAHENCI_group')->buildQuery([
|
|
|
+ 'cols' => [ // TODO:? propertyName = []
|
|
|
+ 'ID',
|
|
|
+ 'ID_USER',
|
|
|
+ 'NAZWA',
|
|
|
+ ],
|
|
|
+ 'f_ID_USER' => "=" . User::getID(),
|
|
|
+ 'f_A_STATUS' => "!DELETED",
|
|
|
+ ]);
|
|
|
+ $itemsKontrahenci = $query->getItems();
|
|
|
+ if (empty($itemsKontrahenci)) throw new AlertWarningException("Grupy nie istnieją");
|
|
|
+
|
|
|
+ $arrayGroupKontrahenci = array();
|
|
|
+ foreach ($itemsKontrahenci as $item) {
|
|
|
+ // if (User::getID() != $item['ID_USER']) throw new Exception("Brak uprawnień do grupy");
|
|
|
+ $arrayGroupKontrahenci[] = [
|
|
|
+ 'NAZWA' => $item['NAZWA'],
|
|
|
+ 'ID' => $item['ID'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
-public function fetchGroupKontrahenciAjax() {
|
|
|
-// TODO: odkomentować jak zostanie dodana tabela default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY
|
|
|
- /*$group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY')->buildQuery([
|
|
|
- 'cols' => [ // TODO:? propertyName = []
|
|
|
- 'ID',
|
|
|
- 'ID_USER',
|
|
|
- 'NAZWA',
|
|
|
- ],
|
|
|
- 'f_ID_USER' => User::getID()
|
|
|
- ])->getItem($idGroup);
|
|
|
- if (!$group) throw new Exception("Grupa nie istnieje");
|
|
|
- if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
|
|
|
-
|
|
|
- $itemsKontrahenci = $query->getItems();
|
|
|
-
|
|
|
- $arrayGroupKontrahenci = array();
|
|
|
- foreach ($itemsKontrahenci as $key => $value) {
|
|
|
- $arrayGroupKontrahenci[$value['ID']] = $value['NAZWA'];
|
|
|
+ return [
|
|
|
+ 'type' => 'success',
|
|
|
+ 'msg' => 'fetchGroupKontrahenciAjax',
|
|
|
+ '__req_args' => $_REQUEST,
|
|
|
+ '__args' => $args,
|
|
|
+ 'body' => [
|
|
|
+ 'itemsGroupKontrahenci' => $arrayGroupKontrahenci
|
|
|
+ ]
|
|
|
+ ];
|
|
|
}
|
|
|
-*/
|
|
|
- //TODO: USUNAĆ listę grup wpisane na sztywno
|
|
|
- $arrayGroupKontrahenci = array();
|
|
|
- $arrayGroupKontrahenci[0]["ID"] = 1;
|
|
|
- $arrayGroupKontrahenci[0]["NAZWA"] = "Grupa 1";
|
|
|
- $arrayGroupKontrahenci[1]["ID"] = 2;
|
|
|
- $arrayGroupKontrahenci[1]["NAZWA"] = "Grupa 2";
|
|
|
- $arrayGroupKontrahenci[2]["ID"] = 3;
|
|
|
- $arrayGroupKontrahenci[2]["NAZWA"] = "Grupa 3";
|
|
|
- $arrayGroupKontrahenci[3]["ID"] = 4;
|
|
|
- $arrayGroupKontrahenci[3]["NAZWA"] = "Grupa 4";
|
|
|
- $arrayGroupKontrahenci[4]["ID"] = 5;
|
|
|
- $arrayGroupKontrahenci[4]["NAZWA"] = "Grupa 5";
|
|
|
- $arrayGroupKontrahenci[5]["ID"] = 6;
|
|
|
- $arrayGroupKontrahenci[5]["NAZWA"] = "Grupa 6";
|
|
|
- $arrayGroupKontrahenci[6]["ID"] = 7;
|
|
|
- $arrayGroupKontrahenci[6]["NAZWA"] = "Grupa 7";
|
|
|
- $arrayGroupKontrahenci[7]["ID"] = 8;
|
|
|
- $arrayGroupKontrahenci[7]["NAZWA"] = "Grupa 8";
|
|
|
- $arrayGroupKontrahenci[8]["ID"] = 9;
|
|
|
- $arrayGroupKontrahenci[8]["NAZWA"] = "Grupa 9";
|
|
|
- $arrayGroupKontrahenci[9]["ID"] = 10;
|
|
|
- $arrayGroupKontrahenci[9]["NAZWA"] = "Grupa 10";
|
|
|
- $arrayGroupKontrahenci[9]["ID"] = 11;
|
|
|
- $arrayGroupKontrahenci[9]["NAZWA"] = "Grupa 11";
|
|
|
-
|
|
|
- return [
|
|
|
- 'type' => 'success',
|
|
|
- 'msg' => 'fetchKontrahenciToGroup',
|
|
|
- '__req_args' => $_REQUEST,
|
|
|
- '__args' => $args,
|
|
|
- 'body' => [
|
|
|
- 'itemsGroupKontrahenci' => $arrayGroupKontrahenci
|
|
|
- ]
|
|
|
- ];
|
|
|
-}
|
|
|
|
|
|
|
|
|
-/*
|
|
|
- * PRACOWNICY
|
|
|
- */
|
|
|
+ /*
|
|
|
+ * PRACOWNICY
|
|
|
+ */
|
|
|
public function fetchPracownicyAjaxAction() {
|
|
|
- // sleep(2);
|
|
|
Response::sendTryCatchJson(array($this, 'fetchPracownicyAjax'));
|
|
|
}
|
|
|
-
|
|
|
public function fetchPracownicyAjax($args) {
|
|
|
|
|
|
$idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
|
|
@@ -756,11 +727,11 @@ public function fetchGroupKontrahenciAjax() {
|
|
|
$backRefFilter = [];
|
|
|
if ($idGroup > 0) {
|
|
|
$backRefFilter['__backRef'] = [
|
|
|
- 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY', // TODO: nowy rejetr na grupy / filty pracowników
|
|
|
+ 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group', // TODO: nowy rejetr na grupy / filty pracowników
|
|
|
'primaryKey' => $idGroup,
|
|
|
'fieldName' => 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
|
|
|
];
|
|
|
- // TODO: Storage dodać obiekt xsd default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY:
|
|
|
+ // TODO: Storage dodać obiekt xsd default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group:
|
|
|
// - ID
|
|
|
// - ID_USER - id usera który stworzył grupę (tylko dla niego będzie widoczna)
|
|
|
// - NAZWA - nazwa grupy
|
|
@@ -874,13 +845,13 @@ public function fetchGroupKontrahenciAjax() {
|
|
|
if (!$nazwa) throw new Exception("Nie wybrano grupa");
|
|
|
if (!$kontrahenciIds || count($kontrahenciIds) == 0 ) throw new Exception("Proszę wybrać kontrahentów");
|
|
|
|
|
|
- $idGroup = DB::getPDO()->insert('BI_audit_ENERGA_PRACOWNICY_GRUPY', [
|
|
|
+ $idGroup = DB::getPDO()->insert('BI_audit_ENERGA_PRACOWNICY_group', [
|
|
|
'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
'A_RECORD_CREATE_DATE' => 'NOW()',
|
|
|
// 'A_STATUS' => 'WAITING', // jeśli trzeba to ustawić
|
|
|
'NAZWA' => $nazwa,
|
|
|
]);
|
|
|
- // DB::getPDO()->insert('BI_audit_ENERGA_PRACOWNICY_GRUPY_HIST', [
|
|
|
+ // DB::getPDO()->insert('BI_audit_ENERGA_PRACOWNICY_group_HIST', [
|
|
|
// 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
// 'A_RECORD_CREATE_DATE' => 'NOW()',
|
|
|
// 'ID_USERS2' => $idRaport,
|
|
@@ -910,10 +881,10 @@ public function fetchGroupKontrahenciAjax() {
|
|
|
if (!$pracownicyIds || count($pracownicyIds) == 0 ) throw new Exception("Proszę wybrać pracowników");
|
|
|
|
|
|
// TODO: SPRWADZENIE CZY NIE DODANOU JUZ PRACOWNIKAS
|
|
|
- // default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY
|
|
|
+ // default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group
|
|
|
// default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY
|
|
|
|
|
|
- $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY')->buildQuery([
|
|
|
+ $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group')->buildQuery([
|
|
|
'cols' => [ // TODO:? propertyName = []
|
|
|
'ID',
|
|
|
'ID_USER',
|
|
@@ -925,7 +896,7 @@ public function fetchGroupKontrahenciAjax() {
|
|
|
if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
|
|
|
|
|
|
// $refGrupyToPracownicy = ACL::getRefTable('obiekt główny', 'nazwa pola - powiązane rekordy');
|
|
|
- $refGrupyToPracownicy = ACL::getRefTable('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY',
|
|
|
+ $refGrupyToPracownicy = ACL::getRefTable('default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group',
|
|
|
'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY');
|
|
|
foreach ($pracownicyIds as $idPracownik) {
|
|
|
DB::getPDO()->insert($refGrupyToPracownicy, ['PRIMARY_KEY' => $idGroup, 'REMOTE_PRIMARY_KEY' => $idPracownik]);
|
|
@@ -941,41 +912,40 @@ public function fetchGroupKontrahenciAjax() {
|
|
|
public function fetchGroupPracownicyAjaxAction() {
|
|
|
Response::sendTryCatchJson(array($this, 'fetchGroupPracownicyAjax'));
|
|
|
}
|
|
|
-
|
|
|
public function fetchGroupPracownicyAjax() {
|
|
|
-
|
|
|
-// TODO: odkomentować jak zostanie dodana tabela default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY
|
|
|
- /*$group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY')->buildQuery([
|
|
|
+ $query = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group')->buildQuery([
|
|
|
'cols' => [ // TODO:? propertyName = []
|
|
|
'ID',
|
|
|
'ID_USER',
|
|
|
'NAZWA',
|
|
|
],
|
|
|
- 'f_ID_USER' => User::getID()
|
|
|
- ])->getItem($idGroup);
|
|
|
- if (!$group) throw new Exception("Grupa nie istnieje");
|
|
|
- if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
|
|
|
-
|
|
|
+ 'f_ID_USER' => "=" . User::getID(), // szukamy dokładnie tej wartości - mysql: where ID_USER = "1"
|
|
|
+ 'f_A_STATUS' => "!DELETED", // `A_STATUS` != 'DELETED'
|
|
|
+ ]);
|
|
|
$items = $query->getItems();
|
|
|
+ if (empty($items)) throw new AlertWarningException("Grupy nie istnieją");
|
|
|
|
|
|
$arrayGroupPracownicy = array();
|
|
|
- foreach ($items as $key => $value) {
|
|
|
- $arrayGroupPracownicy[$value['ID']] = $value['NAZWA'];
|
|
|
+ foreach ($items as $item) {
|
|
|
+ // if (User::getID() != $item['ID_USER']) throw new Exception("Brak uprawnień do grupy"); // or skip - continue;
|
|
|
+ $arrayGroupPracownicy[] = [
|
|
|
+ 'ID' => $item['ID'],
|
|
|
+ 'NAZWA' => $item['NAZWA'],
|
|
|
+ ];
|
|
|
}
|
|
|
-*/
|
|
|
- //TODO: USUNAĆ listę grup wpisane na sztywno
|
|
|
- $arrayGroupPracownicy = array();
|
|
|
- $arrayGroupPracownicy[0]["ID"] = 1;
|
|
|
- $arrayGroupPracownicy[0]["NAZWA"] = "Grupa 1";
|
|
|
- $arrayGroupPracownicy[1]["ID"] = 2;
|
|
|
- $arrayGroupPracownicy[1]["NAZWA"] = "Grupa 2";
|
|
|
- $arrayGroupPracownicy[2]["ID"] = 3;
|
|
|
- $arrayGroupPracownicy[2]["NAZWA"] = "Grupa 3";
|
|
|
- $arrayGroupPracownicy[3]["ID"] = 4;
|
|
|
- $arrayGroupPracownicy[3]["NAZWA"] = "Grupa 4";
|
|
|
- $arrayGroupPracownicy[4]["ID"] = 5;
|
|
|
- $arrayGroupPracownicy[4]["NAZWA"] = "Grupa 5";
|
|
|
|
|
|
+ // //TODO: USUNAĆ listę grup wpisane na sztywno
|
|
|
+ // $arrayGroupPracownicy = array();
|
|
|
+ // $arrayGroupPracownicy[0]["ID"] = 1;
|
|
|
+ // $arrayGroupPracownicy[0]["NAZWA"] = "Grupa 1";
|
|
|
+ // $arrayGroupPracownicy[1]["ID"] = 2;
|
|
|
+ // $arrayGroupPracownicy[1]["NAZWA"] = "Grupa 2";
|
|
|
+ // $arrayGroupPracownicy[2]["ID"] = 3;
|
|
|
+ // $arrayGroupPracownicy[2]["NAZWA"] = "Grupa 3";
|
|
|
+ // $arrayGroupPracownicy[3]["ID"] = 4;
|
|
|
+ // $arrayGroupPracownicy[3]["NAZWA"] = "Grupa 4";
|
|
|
+ // $arrayGroupPracownicy[4]["ID"] = 5;
|
|
|
+ // $arrayGroupPracownicy[4]["NAZWA"] = "Grupa 5";
|
|
|
|
|
|
return [
|
|
|
'type' => 'success',
|