|
|
@@ -1746,7 +1746,7 @@ SQL;
|
|
|
}
|
|
|
// echo implode(";\n", $queries) . ";\n";
|
|
|
foreach ($queries as $query) {
|
|
|
- echo "SQL: {$query}\n";
|
|
|
+// echo "SQL: {$query}\n";
|
|
|
DB::getPDO()->query($query);
|
|
|
}
|
|
|
|
|
|
@@ -1980,7 +1980,7 @@ class BiAuditPowiazania {
|
|
|
return json_encode(['ts' => microtime(true), 'type' => $type, 'data' => $data]);
|
|
|
}
|
|
|
|
|
|
- private static function saveToLog($message) {
|
|
|
+ public static function saveToLog($message) {
|
|
|
$messageJson = self::generateJson('message', ['message' => $message]);
|
|
|
echo $messageJson . "\n";
|
|
|
}
|
|
|
@@ -2008,8 +2008,8 @@ class BiAuditPowiazania {
|
|
|
$query = "select BI_analiza_minDepth, BI_analiza_maxDepth, BI_analiza_onlyTargets from BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA where ID = '{$ID}' and FILE_STATUS = 'IN_PROGRESS' and BI_analiza_reloadCache not in ('Full', 'Part')";
|
|
|
$result = DB::getPDO()->fetchAll($query);
|
|
|
if (!$result) self::throwException("Błąd danych");
|
|
|
-
|
|
|
$this->ID = $ID;
|
|
|
+
|
|
|
if ($this->loadResults()) {
|
|
|
$this->splitResults();
|
|
|
return;
|
|
|
@@ -2026,7 +2026,7 @@ class BiAuditPowiazania {
|
|
|
$subQueries = [];
|
|
|
foreach ($this->destTables as $destTable) {
|
|
|
$refTable = $this->getRefTable('BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', $destTable);
|
|
|
- $subQueries[] = "select `all`.ID from BI_audit_ALL `all` join `{$refTable}` ref on `all`.REMOTE_TABLE = '{$destTable}' and `all`.REMOTE_ID = ref.REMOTE_PRIMARY_KEY and ref.PRIMARY_KEY = '{$ID}'";
|
|
|
+ $subQueries[] = "select `all`.ID from BI_audit_ALL `all` join `{$refTable}` ref on `all`.REMOTE_TABLE = '{$destTable}' and `all`.REMOTE_ID = ref.REMOTE_PRIMARY_KEY and ref.PRIMARY_KEY = '{$this->ID}'";
|
|
|
}
|
|
|
$query = implode(" union ", $subQueries);
|
|
|
$result = DB::getPDO()->fetchAll($query);
|
|
|
@@ -2035,10 +2035,10 @@ class BiAuditPowiazania {
|
|
|
|
|
|
self::saveToLog("Rozpoczynam wyszukiwanie powiązań");
|
|
|
|
|
|
- $this->progressFile = "{$this->tasksDirLocation}/generatePowiazania-{$ID}.progress";
|
|
|
+ $this->progressFile = "{$this->tasksDirLocation}/generatePowiazania-{$this->ID}.progress";
|
|
|
$refPowiazaniaToPracownicy = $this->getRefTable('BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', 'BI_audit_ENERGA_PRACOWNICY');
|
|
|
$query = "select `all`.ID as ID from BI_audit_ALL `all` join `{$refPowiazaniaToPracownicy}` ref
|
|
|
- on `all`.REMOTE_TABLE = 'BI_audit_ENERGA_PRACOWNICY' and `all`.REMOTE_ID = ref.REMOTE_PRIMARY_KEY and ref.PRIMARY_KEY = '{$ID}' order by `all`.`ID` asc";
|
|
|
+ on `all`.REMOTE_TABLE = 'BI_audit_ENERGA_PRACOWNICY' and `all`.REMOTE_ID = ref.REMOTE_PRIMARY_KEY and ref.PRIMARY_KEY = '{$this->ID}' order by `all`.`ID` asc";
|
|
|
$result = DB::getPDO()->fetchAll($query);
|
|
|
$this->count = count($result);
|
|
|
$this->saveProgress(0);
|