mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-11-08 23:43:32 -05:00
Move ExportPdfWriter out of export_helper.php into its own class file under App\Libraries so the PDF writer can be autoloaded and reused independently of the helper functions. - Add runtime detection of the PHP zip extension and surface it to the frontend via window.ospos_ext_zip_enabled (app/Views/partial/lang_lines.php) - Disable the XLSX export menu item in manage_tables.js and report_tables.js when ext-zip is missing, with a tooltip explaining why (new Common.export_xlsx_disabled_tooltip lang line) - Show Zip extension status on the system info page (app/Views/configs/system_info.php) - Document the new php-zip requirement and its optional nature for Excel/XLSX export in docs/BUILD.md and docs/INSTALL.md - Add explicit namespaces to helper test files (export_helperTest.php, tabular_helperTest.php, tax_helperTest.php) for consistency with PSR-4 autoloading This keeps the app fully functional without ext-zip, only disabling the Excel export feature that depends on openspout/openspout. Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
30 lines
759 B
PHP
30 lines
759 B
PHP
<?php
|
|
|
|
namespace App\Libraries;
|
|
|
|
class ExportPdfWriter extends \tFPDF
|
|
{
|
|
/** @var float[] */
|
|
public array $exportColumnWidths = [];
|
|
|
|
/** @var string[] */
|
|
public array $exportColumnAlignments = [];
|
|
|
|
/** @var string[] */
|
|
public array $exportHeaderValues = [];
|
|
|
|
public function Header(): void
|
|
{
|
|
$this->SetFont('DejaVuSans', 'B', EXPORT_PDF_FONT_SIZE);
|
|
|
|
foreach ($this->exportHeaderValues as $index => $value) {
|
|
$width = $this->exportColumnWidths[$index];
|
|
$text = exportPdfTruncateCellText($this, $value, $width);
|
|
$this->Cell($width, EXPORT_PDF_ROW_HEIGHT, $text, 1, 0, 'C');
|
|
}
|
|
$this->Ln();
|
|
|
|
$this->SetFont('DejaVuSans', '', EXPORT_PDF_FONT_SIZE);
|
|
}
|
|
}
|