|
@@ -24,7 +24,9 @@ class RouteTool_Bocian extends RouteToolBase {
|
|
|
'URL_FETCH_TEST_KRS' => $this->getLink('fetchTestKrsAjax'),
|
|
|
'URL_FETCH_TEST_CEIDG' => $this->getLink('fetchTestCeidgAjax'),
|
|
|
'URL_FETCH_PRACOWNICY' => $this->getLink('fetchPracownicyAjax'),
|
|
|
+ 'URL_FETCH_PRACOWNICY_IDS_AJAX' => $this->getLink('fetchPracownicyIdsAjax'),
|
|
|
'URL_FETCH_KONTRAHENCI' => $this->getLink('fetchKontrahenciAjax'),
|
|
|
+ 'URL_FETCH_KONTRAHENCI_IDS_AJAX' => $this->getLink('fetchKontrahenciIdsAjax'),
|
|
|
'URL_CREATE_PRACOWNICY_GROUP' => $this->getLink('createPracownicyGroupAjax'),
|
|
|
'URL_CREATE_KONTRAHENCIS_GROUP' => $this->getLink('createKontrahenciGroupAjax'),
|
|
|
'URL_ADD_PRACOWNICY_TO_GROUP' => $this->getLink('addPracownicyToGroupAjax'),
|
|
@@ -453,6 +455,61 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ public function fetchKontrahenciIdsAjaxAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'fetchKontrahenciIdsAjax'), $args = 'JSON_FROM_REQUEST_BODY');
|
|
|
+ }
|
|
|
+ public function fetchKontrahenciIdsAjax($args) {
|
|
|
+ $idGroup = V::get('filter_idGroup', 0, $args, 'int');
|
|
|
+ if ($idGroup < 0) $idGroup = 0;
|
|
|
+ $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',
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ $searchParams = []; // TODO: ???
|
|
|
+
|
|
|
+ $filtersParams = [];
|
|
|
+ $fieldFilterKeys = array_filter(array_keys($args), function ($key) {
|
|
|
+ return ('f_' === substr($key, 0, 2));
|
|
|
+ });
|
|
|
+ foreach ($fieldFilterKeys as $key) {
|
|
|
+ $filtersParams[ $key ] = $args[ $key ];
|
|
|
+ }
|
|
|
+
|
|
|
+ $acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI');
|
|
|
+ $query = $acl->buildQuery(array_merge([
|
|
|
+ 'cols' => [
|
|
|
+ 'ID',
|
|
|
+ ],
|
|
|
+ //'f_ID' => $id,
|
|
|
+ 'limit' => 0,
|
|
|
+ // 'limitstart' => $limitstart, // offset
|
|
|
+ // 'order_by' => 'ID', // sortowanie po kolumnie
|
|
|
+ // 'order_dir' => 'DESC', // kierunek sortowania
|
|
|
+ // 'f_nip' = "=12345", // szukamy dokładnie tej wartości - mysql: where nip = "12345"
|
|
|
+ // 'f_nip' = "12345", // szukamy dokładnie tej wartości - mysql: where nip like "%12345%"
|
|
|
+ // 'f_nip' = "12345%", // szukamy dokładnie tej wartości - mysql: where nip like "12345%"
|
|
|
+ // 'f_ID' = "=12345", // szukamy dokładnie tej wartości - mysql: where ID = "12345"
|
|
|
+ ], $searchParams, $filtersParams, $backRefFilter));
|
|
|
+ // $total = $query->getTotal();
|
|
|
+ $items = $query->getItems();
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'type' => 'success',
|
|
|
+ 'msg' => 'kontrahenci ids',
|
|
|
+ 'body' => [
|
|
|
+ 'ids' => array_map( V::makePick('ID'), $items ),
|
|
|
+ ],
|
|
|
+ '__args' => $args,
|
|
|
+ '__args_$idGroup' => $idGroup,
|
|
|
+ '__args_$filtersParams' => $filtersParams,
|
|
|
+ '__args_$backRefFilter' => $backRefFilter,
|
|
|
+ ];
|
|
|
+ }
|
|
|
/**
|
|
|
* KONTRAHENCI
|
|
|
*/
|
|
@@ -551,6 +608,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
$pagination['size'] = ceil($total/$limit); // pages size
|
|
|
$pagination['current'] = $page;
|
|
|
$pagination['limit'] = $limit;
|
|
|
+ if ($idGroup > 0) $pagination['filter_idGroup'] = $idGroup;
|
|
|
|
|
|
return [
|
|
|
'type' => 'success',
|
|
@@ -711,6 +769,61 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public function fetchPracownicyIdsAjaxAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'fetchPracownicyIdsAjax'), $args = 'JSON_FROM_REQUEST_BODY');
|
|
|
+ }
|
|
|
+ public function fetchPracownicyIdsAjax($args) {
|
|
|
+ $idGroup = V::get('filter_idGroup', 0, $args, 'int');
|
|
|
+ if ($idGroup < 0) $idGroup = 0;
|
|
|
+ $backRefFilter = [];
|
|
|
+ if ($idGroup > 0) {
|
|
|
+ $backRefFilter['__backRef'] = [
|
|
|
+ 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group',
|
|
|
+ 'primaryKey' => $idGroup,
|
|
|
+ 'fieldName' => 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ $searchParams = []; // TODO: ???
|
|
|
+
|
|
|
+ $filtersParams = [];
|
|
|
+ $fieldFilterKeys = array_filter(array_keys($args), function ($key) {
|
|
|
+ return ('f_' === substr($key, 0, 2));
|
|
|
+ });
|
|
|
+ foreach ($fieldFilterKeys as $key) {
|
|
|
+ $filtersParams[ $key ] = $args[ $key ];
|
|
|
+ }
|
|
|
+
|
|
|
+ $acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY');
|
|
|
+ $query = $acl->buildQuery(array_merge([
|
|
|
+ 'cols' => [
|
|
|
+ 'ID',
|
|
|
+ ],
|
|
|
+ //'f_ID' => $id,
|
|
|
+ 'limit' => 0,
|
|
|
+ // 'limitstart' => $limitstart, // offset
|
|
|
+ // 'order_by' => 'ID', // sortowanie po kolumnie
|
|
|
+ // 'order_dir' => 'DESC', // kierunek sortowania
|
|
|
+ // 'f_nip' = "=12345", // szukamy dokładnie tej wartości - mysql: where nip = "12345"
|
|
|
+ // 'f_nip' = "12345", // szukamy dokładnie tej wartości - mysql: where nip like "%12345%"
|
|
|
+ // 'f_nip' = "12345%", // szukamy dokładnie tej wartości - mysql: where nip like "12345%"
|
|
|
+ // 'f_ID' = "=12345", // szukamy dokładnie tej wartości - mysql: where ID = "12345"
|
|
|
+ ], $searchParams, $filtersParams, $backRefFilter));
|
|
|
+ // $total = $query->getTotal();
|
|
|
+ $items = $query->getItems();
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'type' => 'success',
|
|
|
+ 'msg' => 'pracownicy ids',
|
|
|
+ 'body' => [
|
|
|
+ 'ids' => array_map( V::makePick('ID'), $items ),
|
|
|
+ ],
|
|
|
+ '__args' => $args,
|
|
|
+ '__args_$idGroup' => $idGroup,
|
|
|
+ '__args_$filtersParams' => $filtersParams,
|
|
|
+ '__args_$backRefFilter' => $backRefFilter,
|
|
|
+ ];
|
|
|
+ }
|
|
|
/*
|
|
|
* PRACOWNICY
|
|
|
*/
|
|
@@ -719,7 +832,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
}
|
|
|
public function fetchPracownicyAjax($args) {
|
|
|
|
|
|
- $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
|
|
|
+ $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
|
|
|
if ($idGroup < 0) $idGroup = 0;
|
|
|
|
|
|
$limit = 20;
|
|
@@ -755,20 +868,15 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
$backRefFilter = [];
|
|
|
if ($idGroup > 0) {
|
|
|
$backRefFilter['__backRef'] = [
|
|
|
- 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group', // TODO: nowy rejetr na grupy / filty pracowników
|
|
|
+ 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group',
|
|
|
'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_group/BI_audit_ENERGA_PRACOWNICY_group:
|
|
|
- // - 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_PRACOWNICY' minOccurs="0" maxOccurs="unbounded"
|
|
|
}
|
|
|
|
|
|
$acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY');
|
|
|
$query = $acl->buildQuery(array_merge([
|
|
|
- 'cols' => [ // TODO:? propertyName = []
|
|
|
+ 'cols' => [
|
|
|
'ID',
|
|
|
'imiona',
|
|
|
'nazwisko',
|
|
@@ -801,6 +909,8 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
$pagination['size'] = ceil($total/$limit); // pages size
|
|
|
$pagination['current'] = $page;
|
|
|
$pagination['limit'] = $limit;
|
|
|
+ // $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
|
|
|
+ if ($idGroup > 0) $pagination['filter_idGroup'] = $idGroup;
|
|
|
|
|
|
// { // tworzenie własnego zapytanie mysql
|
|
|
// $rootTableName = $acl->getRootTableName();
|