|
@@ -266,6 +266,10 @@ TODO: dodać możliwość wysyłania maila używajac mail()
|
|
|
case 'default_db/BI_audit_KRS_person/BI_audit_KRS_person': return $this->saveKRSPersonToPracownicyAjax($item);
|
|
|
case 'default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI': return $this->saveKonrahentToPracownicyAjax($item);
|
|
|
case 'default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY': return $this->savePracownikToPracownicyAjax($item);
|
|
|
+ case 'default_db/BI_audit_MSIG/BI_audit_MSIG': return $this->saveMSIGToPracownicyAjax($item);
|
|
|
+ case 'default_db/BI_audit_MSIG_person/BI_audit_MSIG_person': return $this->saveMSIGPersonToPracownicyAjax($item);
|
|
|
+ case 'default_db/BI_audit_CEIDG/BI_audit_CEIDG': return $this->saveCEIDGToPracownicyAjax($item);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
// "@primaryKey": "161323",
|
|
@@ -380,6 +384,118 @@ TODO: dodać możliwość wysyłania maila używajac mail()
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ public function saveToKontahenciAjaxAction() {
|
|
|
+ Response::sendTryCatchJson(array($this, 'saveToKontahenciAjax'), $args = 'JSON_FROM_REQUEST_BODY');
|
|
|
+ }
|
|
|
+ public function saveToKontahenciAjax($args) {
|
|
|
+ DBG::log($args, 'array', "saveToKontahenciAjaxActionAjax args");
|
|
|
+ $baza = V::get('baza', '', $args);
|
|
|
+ $item = V::get('item', [], $args);
|
|
|
+ if (empty($item)) throw new Exception("Brak danych do zapisania");
|
|
|
+ switch ($baza) {
|
|
|
+ case 'default_db/BI_audit_KRS/BI_audit_KRS': return $this->saveKRSToKontrahenciAjax($item);
|
|
|
+ case 'default_db/BI_audit_KRS_person/BI_audit_KRS_person': return $this->saveKRSPersonToKontrahenciAjax($item);
|
|
|
+ case 'default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI': return $this->saveKonrahentToKontrahenciAjax($item);
|
|
|
+ case 'default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY': return $this->savePracownikToKontrahenciAjax($item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function saveKRSToKontrahenciAjax($item) {
|
|
|
+ $companyName = V::get('nazwa', '', $item);
|
|
|
+ $companyNip = V::get('nip', '', $item);
|
|
|
+ $comapanyRegon = V::get('regon', '', $item);
|
|
|
+ $comapanyKrs = V::get('krs', '', $item);
|
|
|
+
|
|
|
+ // validate
|
|
|
+ if (!$companyName) throw new Exception("Nie podano nazwy");
|
|
|
+ if (!$companyNip) throw new Exception("Nie podano nip");
|
|
|
+
|
|
|
+ $idOd = DB::getPDO()->insert('BI_audit_ENERGA_RUM_KONTRAHENCI', [
|
|
|
+ 'Pelna_nazwa_kontrahenta' => $companyName,
|
|
|
+ 'NIP' => ($companyNip) ? $companyNip : NULL,
|
|
|
+ 'REGON' => ($comapanyRegon) ? $comapanyRegon : NULL,
|
|
|
+ 'KRS' => ($comapanyKrs) ? $comapanyKrs : NULL,
|
|
|
+ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
+ 'A_RECORD_CREATE_DATE' => 'NOW()',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'msg' => "Dodano podmiot",
|
|
|
+ 'type' => "success",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ function saveKRSPersonToKontrahenciAjax($item) {
|
|
|
+ $personName = V::get('imiona', '', $item);
|
|
|
+ $personSurname = V::get('nazwisko', '', $item);
|
|
|
+ $personPesel = V::get('pesel', '', $item);
|
|
|
+
|
|
|
+ // validate
|
|
|
+ if (!$personName) throw new Exception("Nie podano imienia");
|
|
|
+ if (!$personSurname) throw new Exception("Nie podano nazwiska");
|
|
|
+
|
|
|
+ $idOd = DB::getPDO()->insert('BI_audit_ENERGA_RUM_KONTRAHENCI', [
|
|
|
+ 'Skrocona_Nazwa_Kontrahenta' => $personName,
|
|
|
+ 'Pelna_nazwa_kontrahenta' => $personSurname,
|
|
|
+ 'PESEL' => ($personPesel) ? $personPesel : NULL,
|
|
|
+ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
+ 'A_RECORD_CREATE_DATE' => 'NOW()',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'msg' => "Dodano osobę",
|
|
|
+ 'type' => "success",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ function saveKonrahentToKontrahenciAjax($item) {
|
|
|
+ // companyName: document.getElementById('companyName').value,
|
|
|
+ // companyNip: document.getElementById('companyNip').value,
|
|
|
+ // comapanyRegon: document.getElementById('comapanyRegon').value,
|
|
|
+ $companyName = V::get('companyName', '', $item);
|
|
|
+ $companyNip = V::get('companyNip', '', $item);
|
|
|
+ $comapanyRegon = V::get('comapanyRegon', '', $item);
|
|
|
+
|
|
|
+ // validate
|
|
|
+ if (!$companyName) throw new Exception("Nie wpisano nazwy");
|
|
|
+ if (!$companyNip) throw new Exception("Nie wpisano nip");
|
|
|
+
|
|
|
+ $idOd = DB::getPDO()->insert('BI_audit_ENERGA_RUM_KONTRAHENCI', [
|
|
|
+ 'Pelna_nazwa_kontrahenta' => $companyName,
|
|
|
+ 'NIP' => ($companyNip) ? $companyNip : NULL,
|
|
|
+ 'REGON' => ($comapanyRegon) ? $comapanyRegon : NULL,
|
|
|
+ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
+ 'A_RECORD_CREATE_DATE' => 'NOW()',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'msg' => "Dodano podmiot",
|
|
|
+ 'type' => "success",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ function savePracownikToKontrahenciAjax($item) {
|
|
|
+ $personName = V::get('personName', '', $item);
|
|
|
+ $personSurname = V::get('personSurname', '', $item);
|
|
|
+ $personNip = V::get('personNip', '', $item);
|
|
|
+ $personPesel = V::get('personPesel', '', $item);
|
|
|
+
|
|
|
+ // validate
|
|
|
+ if (!$personName) throw new Exception("Nie wpisano imienia");
|
|
|
+ if (!$personSurname) throw new Exception("Nie wpisano nazwiska");
|
|
|
+
|
|
|
+ $idOd = DB::getPDO()->insert('BI_audit_ENERGA_RUM_KONTRAHENCI', [
|
|
|
+ 'Skrocona_Nazwa_Kontrahenta' => $personName,
|
|
|
+ 'Pelna_nazwa_kontrahenta' => $personSurname,
|
|
|
+ 'NIP' => ($personNip) ? $personNip : NULL,
|
|
|
+ 'PESEL' => ($personPesel) ? $personPesel : NULL,
|
|
|
+ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
+ 'A_RECORD_CREATE_DATE' => 'NOW()',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'msg' => "Dodano osobę",
|
|
|
+ 'type' => "success",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Dodanie nowego pracownika
|
|
@@ -1074,7 +1190,16 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
$baza = V::get('baza', '', $args);
|
|
|
$query = V::get('query', '', $args);
|
|
|
if (strlen($query) < 3) throw new Exception("Query must be more then 2 chars");
|
|
|
+ switch ($baza) {
|
|
|
+ case 'default_db/BI_audit_KRS/BI_audit_KRS': return $this->fetchFromKRS($query);
|
|
|
+ case 'default_db/BI_audit_KRS_person/BI_audit_KRS_person': return $this->fetchFromKRSPerson($query);
|
|
|
+ case 'default_db/BI_audit_MSIG/BI_audit_MSIG': return $this->fetchFromMSIG($query);
|
|
|
+ case 'default_db/BI_audit_MSIG_person/BI_audit_MSIG_person': return $this->fetchFromMSIGPerson($query);
|
|
|
+ case 'default_db/BI_audit_CEIDG/BI_audit_CEIDG': return $this->fetchFromCEIDG($query);
|
|
|
|
|
|
+ }
|
|
|
+}
|
|
|
+function fetchFromKRS($query){
|
|
|
$ogcSearch = "*{$query}*";
|
|
|
$searchParams = [];
|
|
|
$searchParams['ogc:Filter'] = '
|
|
@@ -1158,6 +1283,321 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ function fetchFromKRSPerson($query){
|
|
|
+ $ogcSearch = "*{$query}*";
|
|
|
+ $searchParams = [];
|
|
|
+ $searchParams['ogc:Filter'] = '
|
|
|
+ <ogc:Filter>
|
|
|
+ <ogc:Or>
|
|
|
+ <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>nazwisko</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>imiona</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>pesel</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ </ogc:Or>
|
|
|
+ </ogc:Filter>
|
|
|
+ ';
|
|
|
+ $items = ACL::getAclByNamespace('default_db/BI_audit_KRS_person/BI_audit_KRS_person')->buildQuery(array_merge([
|
|
|
+ 'cols' => [ // TODO:? propertyName = []
|
|
|
+ 'nazwisko',
|
|
|
+ 'imiona',
|
|
|
+ 'pesel',
|
|
|
+ 'ID',
|
|
|
+ // 'dataDokumentu',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/ID',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/krs',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/nazwa',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/regon',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/ID',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/imiona',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/nazwisko',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/pesel',
|
|
|
+ ],
|
|
|
+ // 'f_ID' => "{$id}",
|
|
|
+ ], $searchParams))->getItems([
|
|
|
+ 'limit' => 10
|
|
|
+ ]);
|
|
|
+ DBG::log($items, 'array', "DBG: items query({$query}) from '{$baza}'");
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'type' => 'success',
|
|
|
+ 'msg' => 'KRS person',
|
|
|
+ '__args' => $args,
|
|
|
+ 'body' => [
|
|
|
+ 'items' => array_map(function ($item) {
|
|
|
+ //$nazwa = str_replace([ '"', "'" ], '', $item['nazwa']);
|
|
|
+ //$nazwa = $item['nazwisko'];
|
|
|
+ //$item['nazwa'] = $nazwa;
|
|
|
+ $item['label'] = "{$item['nazwisko']}, {$item['imiona']}, {$item['pesel']}";
|
|
|
+ // 'searchLabel' => "{$item['nazwa']}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}",
|
|
|
+
|
|
|
+ return $item;
|
|
|
+
|
|
|
+ // return [
|
|
|
+ // 'ID' => $item['ID'],
|
|
|
+ // 'nazwa' => $shortNazwa,
|
|
|
+ // 'nip' => $item['nip'],
|
|
|
+ // 'krs' => $item['krs'],
|
|
|
+ // 'regon' => $item['regon'],
|
|
|
+ // 'S_miejscowosc' => $item['S_miejscowosc'],
|
|
|
+ // 'label' => "{$nazwa}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}",
|
|
|
+ // ];
|
|
|
+ }, $items),
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ function fetchFromMSIG($query){
|
|
|
+ $ogcSearch = "*{$query}*";
|
|
|
+ $searchParams = [];
|
|
|
+ $searchParams['ogc:Filter'] = '
|
|
|
+ <ogc:Filter>
|
|
|
+ <ogc:Or>
|
|
|
+ <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>nazwa</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ <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>S_miejscowosc</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ </ogc:Or>
|
|
|
+ </ogc:Filter>
|
|
|
+ ';
|
|
|
+ $items = ACL::getAclByNamespace('default_db/BI_audit_KRS/BI_audit_MSIG')->buildQuery(array_merge([
|
|
|
+ 'cols' => [ // TODO:? propertyName = []
|
|
|
+ 'A_kod',
|
|
|
+ 'A_kraj',
|
|
|
+ 'A_miejscowosc',
|
|
|
+ 'A_nrDomu',
|
|
|
+ 'A_nrLokalu',
|
|
|
+ 'A_poczta',
|
|
|
+ 'A_ulica',
|
|
|
+ 'ID',
|
|
|
+ // 'S_gmina',
|
|
|
+ 'S_kraj',
|
|
|
+ 'S_miejscowosc',
|
|
|
+ // 'S_powiat',
|
|
|
+ 'S_wojewodztwo',
|
|
|
+ // 'dataDokumentu',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/ID',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/krs',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/nazwa',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/regon',
|
|
|
+ 'default_db__x3A__BI_audit_KRS_person:BI_audit_MSIG_person/ID',
|
|
|
+ 'default_db__x3A__BI_audit_KRS_person:BI_audit_MSIG_person/imiona',
|
|
|
+ 'default_db__x3A__BI_audit_KRS_person:BI_audit_MSIG_person/nazwisko',
|
|
|
+ 'default_db__x3A__BI_audit_KRS_person:BI_audit_MSIG_person/pesel',
|
|
|
+ 'krs',
|
|
|
+ 'nazwa',
|
|
|
+ 'nip',
|
|
|
+ 'regon',
|
|
|
+ ],
|
|
|
+ // 'f_ID' => "{$id}",
|
|
|
+ ], $searchParams))->getItems([
|
|
|
+ 'limit' => 10
|
|
|
+ ]);
|
|
|
+ DBG::log($items, 'array', "DBG: items query({$query}) from '{$baza}'");
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'type' => 'success',
|
|
|
+ 'msg' => 'MSIG',
|
|
|
+ '__args' => $args,
|
|
|
+ 'body' => [
|
|
|
+ 'items' => array_map(function ($item) {
|
|
|
+ $nazwa = str_replace([ '"', "'" ], '', $item['nazwa']);
|
|
|
+ $nazwa = str_replace("SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", "Sp. z o.o.", $nazwa);
|
|
|
+ $item['nazwa'] = $nazwa;
|
|
|
+ $item['label'] = "{$nazwa}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}";
|
|
|
+ // 'searchLabel' => "{$item['nazwa']}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}",
|
|
|
+
|
|
|
+ return $item;
|
|
|
+
|
|
|
+ // return [
|
|
|
+ // 'ID' => $item['ID'],
|
|
|
+ // 'nazwa' => $shortNazwa,
|
|
|
+ // 'nip' => $item['nip'],
|
|
|
+ // 'krs' => $item['krs'],
|
|
|
+ // 'regon' => $item['regon'],
|
|
|
+ // 'S_miejscowosc' => $item['S_miejscowosc'],
|
|
|
+ // 'label' => "{$nazwa}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}",
|
|
|
+ // ];
|
|
|
+ }, $items),
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ function fetchFromMSIGPerson($query){
|
|
|
+ $ogcSearch = "*{$query}*";
|
|
|
+ $searchParams = [];
|
|
|
+ $searchParams['ogc:Filter'] = '
|
|
|
+ <ogc:Filter>
|
|
|
+ <ogc:Or>
|
|
|
+ <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>nazwa</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ <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>S_miejscowosc</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ </ogc:Or>
|
|
|
+ </ogc:Filter>
|
|
|
+ ';
|
|
|
+ $items = ACL::getAclByNamespace('default_db/BI_audit_KRS/BI_audit_MSIG_person')->buildQuery(array_merge([
|
|
|
+ 'cols' => [ // TODO:? propertyName = []
|
|
|
+ 'nazwisko',
|
|
|
+ 'imiona',
|
|
|
+ 'pesel',
|
|
|
+ 'ID',
|
|
|
+ // 'dataDokumentu',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/ID',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/krs',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/nazwa',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/regon',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/ID',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/imiona',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/nazwisko',
|
|
|
+ // 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/pesel',
|
|
|
+ ],
|
|
|
+ // 'f_ID' => "{$id}",
|
|
|
+ ], $searchParams))->getItems([
|
|
|
+ 'limit' => 10
|
|
|
+ ]);
|
|
|
+ DBG::log($items, 'array', "DBG: items query({$query}) from '{$baza}'");
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'type' => 'success',
|
|
|
+ 'msg' => 'KRS',
|
|
|
+ '__args' => $args,
|
|
|
+ 'body' => [
|
|
|
+ 'items' => array_map(function ($item) {
|
|
|
+ //$nazwa = str_replace([ '"', "'" ], '', $item['nazwa']);
|
|
|
+ //$nazwa = str_replace("SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", "Sp. z o.o.", $nazwa);
|
|
|
+ //$item['nazwa'] = $nazwa;
|
|
|
+ $item['label'] = "{$item['nazwisko']}, {$item['imiona']}, {$item['pesel']}";
|
|
|
+ // 'searchLabel' => "{$item['nazwa']}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}",
|
|
|
+
|
|
|
+ return $item;
|
|
|
+
|
|
|
+ // return [
|
|
|
+ // 'ID' => $item['ID'],
|
|
|
+ // 'nazwa' => $shortNazwa,
|
|
|
+ // 'nip' => $item['nip'],
|
|
|
+ // 'krs' => $item['krs'],
|
|
|
+ // 'regon' => $item['regon'],
|
|
|
+ // 'S_miejscowosc' => $item['S_miejscowosc'],
|
|
|
+ // 'label' => "{$nazwa}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}",
|
|
|
+ // ];
|
|
|
+ }, $items),
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ function fetchFromCEIDG($query){
|
|
|
+ $ogcSearch = "*{$query}*";
|
|
|
+ $searchParams = [];
|
|
|
+ $searchParams['ogc:Filter'] = '
|
|
|
+ <ogc:Filter>
|
|
|
+ <ogc:Or>
|
|
|
+ <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ <ogc:PropertyName>nazwa</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ <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>S_miejscowosc</ogc:PropertyName>
|
|
|
+ <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
|
|
|
+ </ogc:PropertyIsLike>
|
|
|
+ </ogc:Or>
|
|
|
+ </ogc:Filter>
|
|
|
+ ';
|
|
|
+ $items = ACL::getAclByNamespace('default_db/BI_audit_KRS/BI_audit_CEIDG')->buildQuery(array_merge([
|
|
|
+ 'cols' => [ // TODO:? propertyName = []
|
|
|
+ 'ID',
|
|
|
+ 'budynek',
|
|
|
+ 'firma',
|
|
|
+ 'gmina',
|
|
|
+ 'identyfikatorWpisu',
|
|
|
+ 'imie',
|
|
|
+ 'kodPocztowy',
|
|
|
+ 'kraj',
|
|
|
+ 'lokal',
|
|
|
+ 'miejscowosc',
|
|
|
+ 'nazwisko',
|
|
|
+ 'nip',
|
|
|
+ 'poczta',
|
|
|
+ 'powiat',
|
|
|
+ 'regon',
|
|
|
+ 'ulica',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/ID',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/budynek',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/gmina',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/kodPocztowy',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/lokal',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/miejscowosc',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/nazwa',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/nip',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/poczta',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/powiat',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/ulica',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/wojewodztwo',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/ID',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/nip',
|
|
|
+ // 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/regon',
|
|
|
+ ],
|
|
|
+ // 'f_ID' => "{$id}",
|
|
|
+ ], $searchParams))->getItems([
|
|
|
+ 'limit' => 10
|
|
|
+ ]);
|
|
|
+ DBG::log($items, 'array', "DBG: items query({$query}) from '{$baza}'");
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'type' => 'success',
|
|
|
+ 'msg' => 'CEIDG',
|
|
|
+ '__args' => $args,
|
|
|
+ 'body' => [
|
|
|
+ 'items' => array_map(function ($item) {
|
|
|
+ //$nazwa = str_replace([ '"', "'" ], '', $item['nazwa']);
|
|
|
+ //$nazwa = str_replace("SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", "Sp. z o.o.", $nazwa);
|
|
|
+ //$item['nazwa'] = $nazwa;
|
|
|
+ $item['label'] = "{$item['imie']}, {$item['nazwisko']}, {$item['krs']}, {$item['nip']}, {$item['regon']}";
|
|
|
+ // 'searchLabel' => "{$item['nazwa']}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}",
|
|
|
+
|
|
|
+ return $item;
|
|
|
+
|
|
|
+ // return [
|
|
|
+ // 'ID' => $item['ID'],
|
|
|
+ // 'nazwa' => $shortNazwa,
|
|
|
+ // 'nip' => $item['nip'],
|
|
|
+ // 'krs' => $item['krs'],
|
|
|
+ // 'regon' => $item['regon'],
|
|
|
+ // 'S_miejscowosc' => $item['S_miejscowosc'],
|
|
|
+ // 'label' => "{$nazwa}, {$item['A_miejscowosc']}, {$item['krs']}, {$item['nip']}, {$item['regon']}",
|
|
|
+ // ];
|
|
|
+ }, $items),
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function showTableKontrahenci($labels = []) {
|
|
|
// TODO: use self::$FIELD_LIST_KONTRAHENCI
|