|
@@ -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 = [];
|
|
|
+
|
|
|
+ $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',
|
|
|
+ ],
|
|
|
+
|
|
|
+ 'limit' => 0,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ], $searchParams, $filtersParams, $backRefFilter));
|
|
|
+
|
|
|
+ $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);
|
|
|
$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 = [];
|
|
|
+
|
|
|
+ $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',
|
|
|
+ ],
|
|
|
+
|
|
|
+ 'limit' => 0,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ], $searchParams, $filtersParams, $backRefFilter));
|
|
|
+
|
|
|
+ $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');
|
|
|
+ $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int');
|
|
|
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',
|
|
|
+ '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',
|
|
|
];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
$acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY');
|
|
|
$query = $acl->buildQuery(array_merge([
|
|
|
- 'cols' => [
|
|
|
+ 'cols' => [
|
|
|
'ID',
|
|
|
'imiona',
|
|
|
'nazwisko',
|
|
@@ -801,6 +909,8 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
$pagination['size'] = ceil($total/$limit);
|
|
|
$pagination['current'] = $page;
|
|
|
$pagination['limit'] = $limit;
|
|
|
+
|
|
|
+ if ($idGroup > 0) $pagination['filter_idGroup'] = $idGroup;
|
|
|
|
|
|
|
|
|
|