|
|
@@ -3837,6 +3837,8 @@ class BiAuditPowiazania {
|
|
|
}
|
|
|
|
|
|
private function generateItemsResults($resultsPart = null) {
|
|
|
+ Lib::loadClass('Teryt');
|
|
|
+
|
|
|
if ($resultsPart === null) self::saveToLog("Generuję dane na potrzeby utworzenia pojedynczego pliku XML");
|
|
|
else {
|
|
|
self::saveToLog("Generuję dane na potrzeby utworzenia pliku XML ({$resultsPart})");
|
|
|
@@ -3856,6 +3858,7 @@ class BiAuditPowiazania {
|
|
|
$refUmowyToKontrahenci = BiAuditRefTables::getRefTable('BI_audit_ENERGA_RUM_UMOWY', 'BI_audit_ENERGA_RUM_KONTRAHENCI', true);
|
|
|
$refFakturyToKontrahenci = BiAuditRefTables::getRefTable('BI_audit_ENERGA_FAKTURY', 'BI_audit_ENERGA_RUM_KONTRAHENCI', true);
|
|
|
$refKwRequestedToKwRequestedPerson = BiAuditRefTables::getRefTable('BI_audit_KW_requested', 'BI_audit_KW_requested_person', true);
|
|
|
+ $refPracownicyToPracownicyAdresy = BiAuditRefTables::getRefTable('BI_audit_ENERGA_PRACOWNICY', 'BI_audit_ENERGA_PRACOWNICY_adresy', true);
|
|
|
|
|
|
$this->items_results[$resultsPart] = [];
|
|
|
$this->items_results[$resultsPart]['@attributes'] = ['xmlns:system_cache__dita' => 'http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd'];
|
|
|
@@ -3897,6 +3900,20 @@ class BiAuditPowiazania {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if ($row['REMOTE_TABLE'] == "BI_audit_ENERGA_PRACOWNICY") {
|
|
|
+ $query = "select pa.* from BI_audit_ENERGA_PRACOWNICY_adresy pa join `{$refPracownicyToPracownicyAdresy}` ref on pa.ID = ref.REMOTE_PRIMARY_KEY where ref.PRIMARY_KEY = '{$row['REMOTE_ID']}'";
|
|
|
+ $adresy = DB::getPDO()->fetch_all($query);
|
|
|
+ foreach ($adresy as $adres) {
|
|
|
+ $item_result[$row['REMOTE_TABLE']]['BI_audit_ENERGA_PRACOWNICY_adresy'][] = array_merge(['@attributes' => ['fid' => "BI_audit_ENERGA_PRACOWNICY_adresy.{$adres['ID']}"]], $adres);
|
|
|
+ }
|
|
|
+ } elseif ($row['REMOTE_TABLE'] == 'TERYT_adresy']) {
|
|
|
+ try {
|
|
|
+ $teryt = Teryt::getNames(['SYM' => $row['TERYT_SYM'], 'SYM_UL' => $row['TERYT_SYM_UL']]);
|
|
|
+ $item_result[$row['REMOTE_TABLE']]['TERYT_names'] = $teryt;
|
|
|
+ } catch (Exception $e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if ($rel) $item_result['relation_from'] = $this->relationName($rel);
|
|
|
$item_results[$xmlObject][] = $item_result;
|
|
|
|
|
|
@@ -3926,6 +3943,7 @@ class BiAuditPowiazania {
|
|
|
}
|
|
|
|
|
|
if ($faktury || $umowy) {
|
|
|
+ $item_kontrahenci = [];
|
|
|
$item_kontrahenci['@attributes'] = ['fid' => "{$row['REMOTE_TABLE']}.{$row['REMOTE_ID']}"];
|
|
|
$item_kontrahenci['ID'] = $row['REMOTE_ID'];
|
|
|
if ($faktury) $item_kontrahenci['BI_audit_ENERGA_FAKTURY'] = $faktury;
|