fix: wrap logo/QR Drawing in try-catch, use $logoPath var, add cURL fallback for QR download
This commit is contained in:
@@ -171,14 +171,18 @@ $summarySheet->getStyle("A1")->applyFromArray([
|
||||
$summarySheet->getRowDimension(1)->setRowHeight(45);
|
||||
|
||||
// --- Add Logo ---
|
||||
$logoSummary = new Drawing();
|
||||
$logoSummary->setName('Musadaq Logo');
|
||||
$logoSummary->setPath(ROOT_PATH . '/public/assets/img/logo.jpg');
|
||||
$logoSummary->setHeight(38);
|
||||
$logoSummary->setCoordinates('A1');
|
||||
$logoSummary->setOffsetX(15);
|
||||
$logoSummary->setOffsetY(5);
|
||||
$logoSummary->setWorksheet($summarySheet);
|
||||
try {
|
||||
if (file_exists($logoPath)) {
|
||||
$logoSummary = new Drawing();
|
||||
$logoSummary->setName('Musadaq Logo');
|
||||
$logoSummary->setPath($logoPath);
|
||||
$logoSummary->setHeight(38);
|
||||
$logoSummary->setCoordinates('A1');
|
||||
$logoSummary->setOffsetX(15);
|
||||
$logoSummary->setOffsetY(5);
|
||||
$logoSummary->setWorksheet($summarySheet);
|
||||
}
|
||||
} catch(\Exception $e) { error_log('Logo Summary Error: ' . $e->getMessage()); }
|
||||
|
||||
// --- Add Clickable Website Link ---
|
||||
$summarySheet->setCellValue("J1", 'musadaq.intaleqapp.com');
|
||||
@@ -329,14 +333,18 @@ foreach ($invoices as $invIdx => $inv) {
|
||||
$sheet->getRowDimension($invRow)->setRowHeight(45);
|
||||
|
||||
// --- Add Logo ---
|
||||
$logoInv = new Drawing();
|
||||
$logoInv->setName('Musadaq Logo');
|
||||
$logoInv->setPath(ROOT_PATH . '/public/assets/img/logo.jpg');
|
||||
$logoInv->setHeight(38);
|
||||
$logoInv->setCoordinates('A' . $invRow);
|
||||
$logoInv->setOffsetX(15);
|
||||
$logoInv->setOffsetY(5);
|
||||
$logoInv->setWorksheet($sheet);
|
||||
try {
|
||||
if (file_exists($logoPath)) {
|
||||
$logoInv = new Drawing();
|
||||
$logoInv->setName('Musadaq Logo');
|
||||
$logoInv->setPath($logoPath);
|
||||
$logoInv->setHeight(38);
|
||||
$logoInv->setCoordinates('A' . $invRow);
|
||||
$logoInv->setOffsetX(15);
|
||||
$logoInv->setOffsetY(5);
|
||||
$logoInv->setWorksheet($sheet);
|
||||
}
|
||||
} catch(\Exception $e) { error_log('Logo Invoice Error: ' . $e->getMessage()); }
|
||||
|
||||
// --- Add Clickable Website Link ---
|
||||
$sheet->setCellValue("I" . $invRow, 'musadaq.intaleqapp.com');
|
||||
|
||||
Reference in New Issue
Block a user