|
|
@@ -1692,8 +1692,14 @@ function toggleCheckSecond(check) {
|
|
|
$array[self::getNamespace($mainTable, $mainTable)]['firstStep'] = $firstStep;
|
|
|
|
|
|
$xml = V::arrayToXML($array, true, $root);
|
|
|
- file_put_contents($dir . DIRECTORY_SEPARATOR . "{$mainTable}_{$benfordId}.xml", $xml);
|
|
|
+ $basename = $dir . DIRECTORY_SEPARATOR . "{$mainTable}_{$benfordId}";
|
|
|
+ $xmlFile = $basename . ".xml";
|
|
|
+ $pdfFile = $basename . ".pdf";
|
|
|
+ file_put_contents($xmlFile, $xml);
|
|
|
+ $pdf = self::antXmlToPdf($xmlFile);
|
|
|
+ copy($pdf, $pdfFile);
|
|
|
DB::getPDO()->update($mainTable, 'ID', $benfordId, ['A_STATUS' => 'NORMAL', 'A_STATUS_INFO' => 'Poprawnie wygenerowano raport']);
|
|
|
+ SE_Layout::alert('success', 'Poprawnie wygenerowano raport');
|
|
|
} catch (Exception $e) {
|
|
|
if ($benfordId) DB::getPDO()->update($mainTable, 'ID', $benfordId, ['A_STATUS' => 'DELETED', 'A_STATUS_INFO' => $e->getMessage()]);
|
|
|
SE_Layout::alert('danger', $e->getMessage());
|
|
|
@@ -1860,6 +1866,12 @@ function toggleCheckSecond(check) {
|
|
|
|
|
|
$xml = V::arrayToXML($array, true, $root);
|
|
|
file_put_contents($dir . DIRECTORY_SEPARATOR . "{$mainTable}_{$validateId}.xml", $xml);
|
|
|
+ $basename = $dir . DIRECTORY_SEPARATOR . "{$mainTable}_{$validateId}";
|
|
|
+ $xmlFile = $basename . ".xml";
|
|
|
+ $pdfFile = $basename . ".pdf";
|
|
|
+ file_put_contents($xmlFile, $xml);
|
|
|
+ $pdf = self::antXmlToPdf($xmlFile);
|
|
|
+ copy($pdf, $pdfFile);
|
|
|
DB::getPDO()->update($mainTable, 'ID', $validateId, ['A_STATUS' => 'NORMAL', 'A_STATUS_INFO' => 'Poprawnie wygenerowano raport']);
|
|
|
SE_Layout::alert('success', "Poprawnie wygenerowano raport");
|
|
|
} catch (Exception $e) {
|
|
|
@@ -1883,6 +1895,23 @@ function toggleCheckSecond(check) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static function antXmlToPdf($xmlFile) {
|
|
|
+ if (!file_exists($xmlFile)) throw new Exception("Nie znaleziono pliku XML");
|
|
|
+ $basename = basename($xmlFile, '.xml');
|
|
|
+ $antDir = "/Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/recurse_ant/out";
|
|
|
+ $antXmlFilename = "{$basename}.out_task.dita.final_with_RelatedFeatureLoop.xml";
|
|
|
+ $antXmlFile = $antDir . "/" . $antXmlFilename;
|
|
|
+ $baseDir = "/opt/local/pl.procesy5/p5build_SE/temp/WPS_Functions/default_db/CRM_PROCES_tree/{$basename}";
|
|
|
+ $ditamapFile = "{$baseDir}/{$basename}.ditamap";
|
|
|
+ $pdfFile = "{$baseDir}/pdf/{$basename}.pdf";
|
|
|
+ copy($xmlFile, $antXmlFile);
|
|
|
+ shell_exec("cd /Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/CRM_PROCES_tree && sudo /opt/local/bin/ant -f build_CRM_PROCES_tree.xml default_db:PROCES_INIT:tree:dita -Duuid={$basename}");
|
|
|
+ if (!file_exists($ditamapFile)) throw new Exception("Nie udało się wygenerować pliku ditamap");
|
|
|
+ shell_exec("cd \"{$baseDir}\" && sudo /Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita -o pdf -i {$basename}.ditamap -f pdf");
|
|
|
+ if (!file_exists($pdfFile)) throw new Exception("Nie udało się wygenerować pliku PDF");
|
|
|
+ return $pdfFile;
|
|
|
+ }
|
|
|
+
|
|
|
public function defaultAction() {
|
|
|
$showMenu = !(V::get('_noMenu', false, $_POST));
|
|
|
if ($showMenu) {
|
|
|
@@ -4045,7 +4074,7 @@ class BiAuditPowiazania {
|
|
|
$antXmlFilename = "relations-{$id_part}.out_task.dita.final_with_RelatedFeatureLoop.xml";
|
|
|
$antXmlFile = $antDir . "/" . $antXmlFilename;
|
|
|
//$baseDir = "/Library/Server/Web/Data/Sites/Default/SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/temp/relations-{$id_part}";
|
|
|
- $baseDir = "/opt/local/pl.procesy5/p5build_SE/temp/WPS_Functions/temp/default_db/CRM_PROCES_tree/relations-{$id_part}";
|
|
|
+ $baseDir = "/opt/local/pl.procesy5/p5build_SE/temp/WPS_Functions/default_db/CRM_PROCES_tree/relations-{$id_part}";
|
|
|
$ditamapFile = "{$baseDir}/relations-{$id_part}.ditamap";
|
|
|
$pdfFile = "{$baseDir}/pdf/relations-{$id_part}.pdf";
|
|
|
$htmlDir = "{$baseDir}/html";
|