|
|
@@ -3618,7 +3618,8 @@ class BiAuditPowiazania {
|
|
|
}
|
|
|
|
|
|
public function run($debug = false) {
|
|
|
- if ($debug) $query = "select L_APPOITMENT_INFO, BI_analiza_minDepth, BI_analiza_maxDepth, BI_analiza_onlyTargets from BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA where ID = '{$this->ID}' and FILE_STATUS = 'GENERATED' and BI_analiza_reloadCache not in ('Full')";
|
|
|
+// if ($debug) $query = "select L_APPOITMENT_INFO, BI_analiza_minDepth, BI_analiza_maxDepth, BI_analiza_onlyTargets from BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA where ID = '{$this->ID}' and BI_analiza_reloadCache not in ('Full')"; // test IPN
|
|
|
+ if ($debug) $query = "select L_APPOITMENT_INFO, BI_analiza_minDepth, BI_analiza_maxDepth, BI_analiza_onlyTargets from BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA where ID = '{$this->ID}' and FILE_STATUS = 'GENERATED' and BI_analiza_reloadCache not in ('Full')";
|
|
|
else $query = "select L_APPOITMENT_INFO, BI_analiza_minDepth, BI_analiza_maxDepth, BI_analiza_onlyTargets from BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA where ID = '{$this->ID}' and FILE_STATUS = 'IN_PROGRESS' and BI_analiza_reloadCache not in ('Full')";
|
|
|
$result = DB::getPDO()->fetchAll($query);
|
|
|
if (!$result) self::throwException("Błąd danych");
|
|
|
@@ -3953,6 +3954,7 @@ class BiAuditPowiazania {
|
|
|
$items_kw_person = [];
|
|
|
$kontrahenci = [];
|
|
|
$kw_person = [];
|
|
|
+ $_items_ipn = [];
|
|
|
$_items_results = [];
|
|
|
|
|
|
$refUmowyToKontrahenci = BiAuditRefTables::getRefTable('BI_audit_ENERGA_RUM_UMOWY', 'BI_audit_ENERGA_RUM_KONTRAHENCI', true);
|
|
|
@@ -4013,6 +4015,20 @@ class BiAuditPowiazania {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if ($refTable = BiAuditRefTables::getRefTable($row['REMOTE_TABLE'], 'BI_audit_IPN', false)) {
|
|
|
+ $query = "select `ipn`.* from `{$refTable}` `ref` join `BI_audit_IPN` `ipn` on `ref`.`REMOTE_PRIMARY_KEY` = `ipn`.`ID` where `ref`.`PRIMARY_KEY` = '{$row['REMOTE_ID']}'";
|
|
|
+ $ipns = DB::getPDO()->fetchAll($query);
|
|
|
+ foreach ($ipns as $ipn) {
|
|
|
+ if (!in_array($ipn['ID'], $items_ipn)) {
|
|
|
+ $ipn['ipn'] = unserialize(gzuncompress($ipn['array']));
|
|
|
+ unset($ipn['array']);
|
|
|
+ $items_ipn[$ipn['ID']] = array_merge(['@attributes' => ['fid' => "BI_audit_IPN.{$ipn['ID']}"]], $ipn);
|
|
|
+ unset($ipn['ipn']);
|
|
|
+ } else unset($ipn['array']);
|
|
|
+ $item_result[$row['REMOTE_TABLE']]['BI_audit_IPN'][] = array_merge(['@attributes' => ['fid' => "BI_audit_IPN.{$ipn['ID']}"]], $ipn);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
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()->fetchAll($query);
|
|
|
@@ -4094,6 +4110,7 @@ class BiAuditPowiazania {
|
|
|
}
|
|
|
$this->items_results[$resultsPart][$xmlTask]['BI_audit_ENERGA_RUM_KONTRAHENCI'] = $items_kontrahenci;
|
|
|
$this->items_results[$resultsPart][$xmlTask]['BI_audit_KW_requested_person'] = $items_kw_person;
|
|
|
+ if ($items_ipn) $this->items_results[$resultsPart][$xmlTask]['BI_audit_IPN'] = $items_ipn;
|
|
|
self::saveToLog("Wygenerowano dane na potrzeby utworzenia pliku XML ({$resultsPart})");
|
|
|
}
|
|
|
|
|
|
@@ -4231,6 +4248,7 @@ class BiAuditPowiazania {
|
|
|
|
|
|
//if (!file_exists($xmlFile))
|
|
|
$this->saveXml($resultsPart);
|
|
|
+//return; //test IPN
|
|
|
if (!file_exists($xmlFile)) {
|
|
|
$sqlArr['FILE_STATUS_info'] .= ", ale nie udało się utworzyć plików XML, PDF i HTML";
|
|
|
self::saveToLog("Nie wygenerowano plików XML, PDF oraz HTML - problem z wygenerowaniem pliku XML ({$resultsPart})");
|