ソースを参照

Drobne poprawki

Mariusz Muszyński 5 年 前
コミット
624e7f9472
1 ファイル変更7 行追加6 行削除
  1. 7 6
      SE/se-lib/Route/UrlAction/BiAuditGenerate.php

+ 7 - 6
SE/se-lib/Route/UrlAction/BiAuditGenerate.php

@@ -3618,7 +3618,6 @@ 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 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);
@@ -4016,16 +4015,18 @@ 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']}'";
+					$query = "select `REMOTE_PRIMARY_KEY` as `ID` from `{$refTable}` where `PRIMARY_KEY` = '{$row['REMOTE_ID']}'";
 					$ipns = DB::getPDO()->fetchAll($query);
 					foreach ($ipns as $ipn) {
 						if (!in_array($ipn['ID'], $items_ipn)) {
+							$query = "select * from `BI_audit_IPN` where `ID` = '{$ipn['ID']}'";
+							$ipn = DB::getPDO()->fetchFirst($query);
+							if (!$ipn) continue;
 							$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);
+						}
+						$item_result[$row['REMOTE_TABLE']]['BI_audit_IPN'][] = ['@attributes' => ['fid' => "BI_audit_IPN.{$ipn['ID']}"]];
 					}
 				}
 
@@ -4248,7 +4249,7 @@ class BiAuditPowiazania {
 
 		//if (!file_exists($xmlFile))
 			$this->saveXml($resultsPart);
-//return; //test IPN
+		//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})");