|
|
@@ -1968,7 +1968,7 @@ SQL;
|
|
|
} while ($activeReloadingCache);
|
|
|
|
|
|
BiAuditPowiazania::saveToLog("Uruchamiam częściowe odświeżenie cache");
|
|
|
- $this->doReloadCache();
|
|
|
+ $this->doReloadCache(); //DUPA testowe wylaczanie
|
|
|
BiAuditPowiazania::saveToLog("Odświeżono częściowo cache");
|
|
|
|
|
|
$sqlArr = [
|
|
|
@@ -1984,7 +1984,7 @@ SQL;
|
|
|
$sqlArr = ['FILE_STATUS_info' => 'Generuję raporty PDF i HTML'];
|
|
|
DB::getPDO()->update('BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', "ID", $ID, $sqlArr);
|
|
|
|
|
|
- $BiAuditPowiazania->saveXml();
|
|
|
+ //$BiAuditPowiazania->saveXml();
|
|
|
$BiAuditPowiazania->generatePdfAndHtml();
|
|
|
file_put_contents($resultFile, json_encode(['result' => 'ok', 'parts' => $BiAuditPowiazania->getPartsCount()]));
|
|
|
} catch (Exception $e) {
|
|
|
@@ -2614,20 +2614,29 @@ class BiAuditPowiazania {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function saveXml() {
|
|
|
+ public function saveXml($resultsPart = null) {
|
|
|
if ($this->getPartsCount()) {
|
|
|
- self::saveToLog("Generuję pliki XML (liczba plików do wygenerowania: {$this->getPartsCount()})");
|
|
|
- for ($i =0; $i < $this->getPartsCount(); $i++) {
|
|
|
- $partNo = str_pad($i + 1, 6, '0', STR_PAD_LEFT);
|
|
|
+ if ($resultsPart === null) {
|
|
|
+ self::saveToLog("Generuję pliki XML (liczba plików do wygenerowania: {$this->getPartsCount()})");
|
|
|
+ for ($i =0; $i < $this->getPartsCount(); $i++) {
|
|
|
+ $partNo = str_pad($i + 1, 6, '0', STR_PAD_LEFT);
|
|
|
+ $xmlFile = "{$this->tasksDirLocation}/generatePowiazania-{$this->ID}_{$partNo}.xml";
|
|
|
+ file_put_contents($xmlFile, $this->asXml($i));
|
|
|
+ }
|
|
|
+ self::saveToLog("Zakończono generowanie plików XML");
|
|
|
+ } else {
|
|
|
+ if ($resultsPart >= $this->getPartsCount()) {
|
|
|
+ self::saveToLog("saveXml() error - bad result number");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $partNo = str_pad($resultsPart + 1, 6, '0', STR_PAD_LEFT);
|
|
|
$xmlFile = "{$this->tasksDirLocation}/generatePowiazania-{$this->ID}_{$partNo}.xml";
|
|
|
- file_put_contents($xmlFile, $this->asXml($i));
|
|
|
+ file_put_contents($xmlFile, $this->asXml($resultsPart));
|
|
|
}
|
|
|
- self::saveToLog("Zakończono generowanie plików XML");
|
|
|
} else {
|
|
|
$xmlFile = "{$this->tasksDirLocation}/generatePowiazania-{$this->ID}.xml";
|
|
|
file_put_contents($xmlFile, $this->asXml());
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public function asXml($resultsPart = null) {
|
|
|
@@ -2663,6 +2672,15 @@ class BiAuditPowiazania {
|
|
|
}
|
|
|
|
|
|
public function generatePdfAndHtml() {
|
|
|
+ $antDir = "/Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/recurse_ant/out";
|
|
|
+ if (!file_exists($antDir)) mkdir($antDir, 0770, true);
|
|
|
+ if (!is_dir($antDir)) {
|
|
|
+ $sqlArr['FILE_STATUS_info'] .= ", ale nie udało się utworzyć plików PDF i HTML";
|
|
|
+ self::saveToLog("Nie wygenerowano plików PDF oraz HTML - problem z utworzeniem katalogu dla ant ({$resultsPart})");
|
|
|
+ $this->saveProgress(['reportsCreated' => 1]);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
$this->saveProgress(['step' => 'reports']);
|
|
|
if ($this->getPartsCount()) {
|
|
|
self::saveToLog("Generuję raporty w plikach PDF oraz HTML (liczba raportów do wygenerowania: {$this->getPartsCount()})");
|
|
|
@@ -2679,20 +2697,20 @@ class BiAuditPowiazania {
|
|
|
$htmlDestDir = "{$this->tasksDirLocation}/generatePowiazania-{$id_part}.html";
|
|
|
$htmlZipDestFile = "{$this->tasksDirLocation}/generatePowiazania-{$id_part}.zip";
|
|
|
$antDir = "/Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/recurse_ant/out";
|
|
|
- if (!is_dir($antDir)) mkdir($antDir, 0777, true);
|
|
|
$antXmlFilename = "relations-{$id_part}.out_task.dita.final_with_RelatedFeatureLoop.xml";
|
|
|
$antXmlFile = $antDir . "/" . $antXmlFilename;
|
|
|
$ditamapFile = "/Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/temp/relations-{$id_part}/relations-{$id_part}.ditamap";
|
|
|
$pdfFile = "/Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/temp/relations-{$id_part}/pdf/relations-{$id_part}.pdf";
|
|
|
$htmlDir = "/Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/temp/relations-{$id_part}/html";
|
|
|
|
|
|
- if (!file_exists($antDir)) mkdir($antDir, 0770, true);
|
|
|
- if (!is_dir($antDir)) {
|
|
|
- $sqlArr['FILE_STATUS_info'] .= ", ale nie udało się utworzyć plików PDF i HTML";
|
|
|
- self::saveToLog("Nie wygenerowano plików PDF oraz HTML - problem z utworzeniem katalogu dla ant ({$resultsPart})");
|
|
|
+ if (!file_exists($xmlFile)) $this->saveXml($resultsPart);
|
|
|
+ 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})");
|
|
|
$this->saveProgress(['reportsCreated' => 1]);
|
|
|
return;
|
|
|
}
|
|
|
+ $this->saveProgress(['reportsCreated' => 0.05]);
|
|
|
|
|
|
copy($xmlFile, $antXmlFile);
|
|
|
self::saveToLog("Generuję plik przejściowy do wygenerowania plików PDF i HTML ({$resultsPart})");
|
|
|
@@ -2700,7 +2718,7 @@ class BiAuditPowiazania {
|
|
|
if (file_exists($ditamapFile))
|
|
|
{
|
|
|
self::saveToLog("Wygenerowano plik przejściowy");
|
|
|
- $this->saveProgress(['reportsCreated' => 0.3]);
|
|
|
+ $this->saveProgress(['reportsCreated' => 0.15]);
|
|
|
} else {
|
|
|
self::saveToLog("Nie udało się wygenerować pliku przejściowego, przerywm");
|
|
|
$this->saveProgress(['reportsCreated' => 1]);
|
|
|
@@ -2713,7 +2731,7 @@ class BiAuditPowiazania {
|
|
|
rename($pdfFile, $pdfDestFile);
|
|
|
self::saveToLog("Wygenerowano plik PDF ({$resultsPart})");
|
|
|
} else self::saveToLog("Nie udało się wygenerować pliku PDF ({$resultsPart})");
|
|
|
- $this->saveProgress(['reportsCreated' => 0.35]);
|
|
|
+ $this->saveProgress(['reportsCreated' => 0.45]);
|
|
|
|
|
|
self::saveToLog("Generuję pliki HTML ({$resultsPart})");
|
|
|
self::exec("cd \"/Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/temp/relations-{$id_part}\" && /Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita -o html -i relations-{$id_part}.ditamap -f tocjs");
|