|
@@ -1228,8 +1228,7 @@ class Report extends Component
|
|
|
|
|
|
|
|
$targa = $this->vei_targa;
|
|
$targa = $this->vei_targa;
|
|
|
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ try {
|
|
|
Log::info("veicolo con targa: " . $targa);
|
|
Log::info("veicolo con targa: " . $targa);
|
|
|
|
|
|
|
|
$wd = "dettaglioAutoveicoloBase";
|
|
$wd = "dettaglioAutoveicoloBase";
|
|
@@ -1297,14 +1296,10 @@ class Report extends Component
|
|
|
$this->vei_carta_circolazione_rilasciata_il = @$obj->DatiAmministrativiVeicolo[0]->DataEmissioneDocumento;
|
|
$this->vei_carta_circolazione_rilasciata_il = @$obj->DatiAmministrativiVeicolo[0]->DataEmissioneDocumento;
|
|
|
$this->vei_cilindrata = @$obj->DatiTecniciVeicolo->CilindrataInCentimetriCubi;
|
|
$this->vei_cilindrata = @$obj->DatiTecniciVeicolo->CilindrataInCentimetriCubi;
|
|
|
$this->vei_peso_complessivo = @$obj->DatiTecniciVeicolo->TaraInKG;
|
|
$this->vei_peso_complessivo = @$obj->DatiTecniciVeicolo->TaraInKG;
|
|
|
- }
|
|
|
|
|
- catch(\SoapFault $fault)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } catch (\SoapFault $fault) {
|
|
|
$this->loadTarga = $fault->getMessage();
|
|
$this->loadTarga = $fault->getMessage();
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- catch(\Exception $ex)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } catch (\Exception $ex) {
|
|
|
Log::error($ex->getMessage());
|
|
Log::error($ex->getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1389,16 +1384,12 @@ class Report extends Component
|
|
|
'</xmp><br/><br/> Error Message : <br/>',
|
|
'</xmp><br/><br/> Error Message : <br/>',
|
|
|
$fault->getMessage();
|
|
$fault->getMessage();
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- catch(\SoapFault $ex)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } catch (\SoapFault $ex) {
|
|
|
Log::error($ex->getMessage());
|
|
Log::error($ex->getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->emit('hideLoading', 'btPatente');
|
|
$this->emit('hideLoading', 'btPatente');
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected function handleMCTCError($response)
|
|
protected function handleMCTCError($response)
|
|
@@ -1409,7 +1400,8 @@ class Report extends Component
|
|
|
session()->flash('error', 'Errore di validazione numero di caratteri errato');
|
|
session()->flash('error', 'Errore di validazione numero di caratteri errato');
|
|
|
} else {
|
|
} else {
|
|
|
session()->flash('error', $response->errore->descrizioneErrore);
|
|
session()->flash('error', $response->errore->descrizioneErrore);
|
|
|
- } return false;
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -1521,7 +1513,6 @@ class Report extends Component
|
|
|
$mainPageCount = $pdf->getDomPDF()->getCanvas()->get_page_count();
|
|
$mainPageCount = $pdf->getDomPDF()->getCanvas()->get_page_count();
|
|
|
Log::info("Main PDF has {$mainPageCount} pages");
|
|
Log::info("Main PDF has {$mainPageCount} pages");
|
|
|
|
|
|
|
|
- // Calculate total pages and regenerate PDF with correct count
|
|
|
|
|
$totalPages = $mainPageCount + $totalAttachmentPages;
|
|
$totalPages = $mainPageCount + $totalAttachmentPages;
|
|
|
Log::info("Total pages (main + attachments): {$totalPages}");
|
|
Log::info("Total pages (main + attachments): {$totalPages}");
|
|
|
|
|
|
|
@@ -1585,7 +1576,6 @@ class Report extends Component
|
|
|
}
|
|
}
|
|
|
return $pdf->stream($pdfName);
|
|
return $pdf->stream($pdfName);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
Log::error("PDF merging failed: " . $e->getMessage());
|
|
Log::error("PDF merging failed: " . $e->getMessage());
|
|
|
return $pdf->stream($pdfName);
|
|
return $pdf->stream($pdfName);
|
|
@@ -1598,24 +1588,19 @@ class Report extends Component
|
|
|
private function mergeWithGhostScript($pdfFiles, $outputPath)
|
|
private function mergeWithGhostScript($pdfFiles, $outputPath)
|
|
|
{
|
|
{
|
|
|
try {
|
|
try {
|
|
|
- // Check if GhostScript is installed
|
|
|
|
|
exec('which gs', $output, $returnVar);
|
|
exec('which gs', $output, $returnVar);
|
|
|
if ($returnVar !== 0) {
|
|
if ($returnVar !== 0) {
|
|
|
Log::error("GhostScript (gs) not found on system");
|
|
Log::error("GhostScript (gs) not found on system");
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Build GhostScript command
|
|
|
|
|
$fileList = implode(' ', array_map('escapeshellarg', $pdfFiles));
|
|
$fileList = implode(' ', array_map('escapeshellarg', $pdfFiles));
|
|
|
$outputFile = escapeshellarg($outputPath);
|
|
$outputFile = escapeshellarg($outputPath);
|
|
|
|
|
|
|
|
- // GhostScript command to merge PDFs
|
|
|
|
|
$command = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outputFile $fileList";
|
|
$command = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outputFile $fileList";
|
|
|
|
|
|
|
|
- // Execute command
|
|
|
|
|
exec($command, $output, $returnVar);
|
|
exec($command, $output, $returnVar);
|
|
|
|
|
|
|
|
- // Check if command was successful
|
|
|
|
|
if ($returnVar !== 0) {
|
|
if ($returnVar !== 0) {
|
|
|
Log::error("GhostScript command failed: " . implode("\n", $output));
|
|
Log::error("GhostScript command failed: " . implode("\n", $output));
|
|
|
return false;
|
|
return false;
|
|
@@ -1660,19 +1645,32 @@ class Report extends Component
|
|
|
$separatorPath = $tempDir . '/separator_' . uniqid() . '.pdf';
|
|
$separatorPath = $tempDir . '/separator_' . uniqid() . '.pdf';
|
|
|
Log::info("Separator path: $separatorPath");
|
|
Log::info("Separator path: $separatorPath");
|
|
|
|
|
|
|
|
- // Check if view exists
|
|
|
|
|
- if (!view()->exists('pdf.separator')) {
|
|
|
|
|
- Log::warning("Separator view 'pdf.separator' does not exist");
|
|
|
|
|
- // Create an alternative simple view
|
|
|
|
|
- $html = '<html><body><h1 style="text-align:center;margin-top:50%;">' . $title . '</h1></body></html>';
|
|
|
|
|
- $separatorPdf = Pdf::loadHTML($html);
|
|
|
|
|
- } else {
|
|
|
|
|
- // Create a simple PDF with the title
|
|
|
|
|
- Log::info("Loading separator view");
|
|
|
|
|
- $separatorPdf = Pdf::loadView('pdf.separator', [
|
|
|
|
|
- 'title' => $title
|
|
|
|
|
- ]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $html = '
|
|
|
|
|
+ <!DOCTYPE html>
|
|
|
|
|
+ <html>
|
|
|
|
|
+ <head>
|
|
|
|
|
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
|
|
|
+ <style>
|
|
|
|
|
+ body {
|
|
|
|
|
+ font-family: Helvetica, sans-serif;
|
|
|
|
|
+ color: rgb(80, 80, 80);
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ }
|
|
|
|
|
+ .separator-title {
|
|
|
|
|
+ margin-top: 300px;
|
|
|
|
|
+ font-size: 24px;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ text-transform: uppercase;
|
|
|
|
|
+ }
|
|
|
|
|
+ </style>
|
|
|
|
|
+ </head>
|
|
|
|
|
+ <body>
|
|
|
|
|
+ <div class="separator-title">' . $title . '</div>
|
|
|
|
|
+ </body>
|
|
|
|
|
+ </html>
|
|
|
|
|
+ ';
|
|
|
|
|
+
|
|
|
|
|
+ $separatorPdf = Pdf::loadHTML($html);
|
|
|
|
|
|
|
|
Log::info("Generating separator PDF");
|
|
Log::info("Generating separator PDF");
|
|
|
$separatorContent = $separatorPdf->output();
|
|
$separatorContent = $separatorPdf->output();
|