A PocketBase file PATCH under the bare field name replaces the whole list. On 2026-10-19 a buyer's "Add supplier invoice" on PO202610008LIF deleted the driver's delivery-note photo (uploaded 14:38, read by the AI 14:40, replaced 14:41). Generating or regenerating a delivery-note PDF did the same to every line on the DN. - New src/lib/server/order-item-files.ts: addAttachmentForm() adds with `order_item_attachements+` and removes (`-`) only older stored copies of the same document; pickStoredCopy() finds a file by its uploaded name (PB stores "DN26101913.pdf" as "dn26101913_<10>.pdf"). - Used by the Collection Confirm invoice upload, DN create, DN regenerate (replaces only its own previous PDF) and /api/invoicing/delivery-note. - /api/invoicing/delivery-note-pdf finds the DN PDF by name instead of taking the line's first file (falls back to the old behaviour for legacy names). - AGENTS.md: always add, never replace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| (app) | ||
| (auth) | ||
| (counter) | ||
| (mobile) | ||
| (print) | ||
| (rep)/rep | ||
| (tv) | ||
| api | ||
| scan | ||
| favicon.ico | ||
| globals.css | ||
| layout.tsx | ||
| offline.tsx | ||
| page.tsx | ||