m3 Security Fixes

This commit is contained in:
Mark Gregory
2026-09-16 17:16:25 +01:00
parent d68687f062
commit 8f37245e13
64 changed files with 4247 additions and 4426 deletions
+27 -28
View File
@@ -2,35 +2,35 @@
namespace Modules\M3\Services;
use Storage;
use setasign\Fpdi\Fpdi;
use Storage;
class BillOfLadingService
{
public function fillBillOfLading($data, $outputPath = null)
{
$templatePath = Storage::disk('public')->path('ETN-BOL2.pdf'); //storage_path('app/templates/ETN-BOL.pdf');
$newfile='BOL_' . $data['bol_number'] . '.pdf'; #was using time()
$outputPath = $outputPath ?? Storage::disk('public')->path($newfile); //storage_path('app/filled/BOL_' . $data['bol_number'] . '.pdf');
$templatePath = Storage::disk('public')->path('ETN-BOL2.pdf'); // storage_path('app/templates/ETN-BOL.pdf');
$newfile = 'BOL_' . $data['bol_number'] . '.pdf'; // was using time()
$outputPath = $outputPath ?? Storage::disk('public')->path($newfile); // storage_path('app/filled/BOL_' . $data['bol_number'] . '.pdf');
$pdf = new Fpdi;
$pdf = new Fpdi();
// Set source file
$pageCount = $pdf->setSourceFile($templatePath);
// Import first page (you have 5 pages in your PDF)
$tplIdx = $pdf->importPage(1);
$pdf->AddPage();
$pdf->useTemplate($tplIdx);
// Set font
$pdf->SetFont('Helvetica', '', 10);
$pdf->SetTextColor(0, 0, 0);
#$pdf->SetLineWidth(50);
// $pdf->SetLineWidth(50);
// Fill form fields at specific coordinates
// You'll need to adjust X,Y positions based on your PDF
// Bill of Lading No.
if (isset($data['bol_number'])) {
$pdf->SetXY(126, 44);
@@ -42,7 +42,7 @@ class BillOfLadingService
$pdf->SetXY(171, 44);
$pdf->Write(0, $data['date']);
}
// Shipper No.
if (isset($data['shipper_no'])) {
$pdf->SetXY(126, 53);
@@ -64,7 +64,7 @@ class BillOfLadingService
$pdf->SetXY(194, 55);
$pdf->Write(0, $data['master_bill_drops']);
}
// Consignor (FROM)
if (isset($data['consignor_name'])) {
$pdf->SetXY(21, 44);
@@ -82,7 +82,7 @@ class BillOfLadingService
$pdf->SetXY(21, 56);
$pdf->Write(0, $data['consignor_address3']);
}
// Consignee (TO)
if (isset($data['consignee_name'])) {
$pdf->SetXY(21, 72);
@@ -101,7 +101,7 @@ class BillOfLadingService
$pdf->Write(0, $data['consignee_address3']);
}
//Freight Collect
// Freight Collect
if (isset($data['freight_collect'])) {
$pdf->SetXY(127, 90);
$pdf->Write(0, $data['freight_collect']);
@@ -112,13 +112,13 @@ class BillOfLadingService
$pdf->SetXY(10, 100);
$pdf->Write(0, $data['carrier_name']);
}
// Pieces
if (isset($data['pieces'])) {
$pdf->SetXY(6, 142);
$pdf->Write(0, $data['pieces']);
}
// Line class
if (isset($data['line_class'])) {
$pdf->SetXY(145, 142);
@@ -136,19 +136,19 @@ class BillOfLadingService
$pdf->SetXY(6, 244);
$pdf->Write(0, $data['total_pieces']);
}
// Total weight
if (isset($data['total_line_weight'])) {
$pdf->SetXY(177, 244);
$pdf->Write(0, $data['total_line_weight']);
}
// Description of articles
if (isset($data['description'])) {
$pdf->SetXY(28, 140);
$pdf->MultiCell(67, 4.5, $data['description'], 0, 'L');
}
// Add more pages if needed (pages 2-5)
// Repeat for other pages as needed
$tplIdx = $pdf->importPage(2);
@@ -166,7 +166,7 @@ class BillOfLadingService
$pdf->SetXY(171, 44);
$pdf->Write(0, $data['date']);
}
// Shipper No.
if (isset($data['shipper_no'])) {
$pdf->SetXY(126, 53);
@@ -188,7 +188,7 @@ class BillOfLadingService
$pdf->SetXY(194, 55);
$pdf->Write(0, $data['master_bill_drops']);
}
// Consignor (FROM)
if (isset($data['consignor_name'])) {
$pdf->SetXY(21, 44);
@@ -206,7 +206,7 @@ class BillOfLadingService
$pdf->SetXY(21, 56);
$pdf->Write(0, $data['consignor_address3']);
}
// Consignee (TO)
if (isset($data['consignee_name'])) {
$pdf->SetXY(21, 72);
@@ -225,7 +225,7 @@ class BillOfLadingService
$pdf->Write(0, $data['consignee_address3']);
}
//Freight Collect
// Freight Collect
if (isset($data['freight_collect'])) {
$pdf->SetXY(127, 90);
$pdf->Write(0, $data['freight_collect']);
@@ -236,12 +236,11 @@ class BillOfLadingService
$pdf->SetXY(10, 100);
$pdf->Write(0, $data['carrier_name']);
}
# KD : add fields as you need
// KD : add fields as you need
// Save the PDF
$pdf->Output('F', $outputPath);
return $outputPath;
}
}
}