Add PDF validation in email script; add Nat_SubSubGroupSequence column

- Skip attachment if downloaded content is not a valid PDF (HTML error response)
- Add Nat_SubSubGroupSequence to nat_subsubgroup table (missing column
  referenced by sp_rpt_hasil_lab in SELECT and ORDER BY)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sas.fajri
2026-05-24 21:37:50 +07:00
parent 1be2531f82
commit 81b699db01
2 changed files with 10 additions and 0 deletions

View File

@@ -292,6 +292,11 @@ foreach ($rows as $row) {
continue;
}
if (substr($pdf, 0, 4) !== '%PDF') {
log_msg(" Not a PDF (got HTML/error response), skipping");
continue;
}
$tmp = tempnam(sys_get_temp_dir(), 'ibl_email_') . '.pdf';
file_put_contents($tmp, $pdf);
$tmp_files[] = $tmp;

View File

@@ -0,0 +1,5 @@
-- Add missing Nat_SubSubGroupSequence column to nat_subsubgroup
-- Required by sp_rpt_hasil_lab which references this column in SELECT and ORDER BY
ALTER TABLE nat_subsubgroup
ADD COLUMN Nat_SubSubGroupSequence char(2) NOT NULL DEFAULT '' AFTER Nat_SubSubGroupCode;