@zxing udpated to latest version

This commit is contained in:
2025-12-19 12:55:49 +01:00
parent 7a09e3c98a
commit 7467f9d595
3 changed files with 17 additions and 48 deletions

View File

@@ -50,22 +50,8 @@ export const BillEditForm: FC<BillEditFormProps> = ({ location, bill }) => {
const [barcodeResults, setBarcodeResults] = React.useState<Array<DecodeResult> | null>(null);
useEffect(() => {
// migrating the legacy `barcodeImage` field to `hub3aText`
// by converting it to `hub3aText`
if (!hub3aText && bill?.barcodeImage) {
decodeFromImage(bill.barcodeImage).then(results => {
if (results) {
const {
hub3aText: decodedHub3aText,
} = results;
setHub3aText(decodedHub3aText);
}
}).catch(error => {
console.error('Failed to migrate barcodeImage to hub3aText:', error);
});
}
}, [bill?.barcodeImage, hub3aText]);
console.log("[BillEditForm] hub3a text from DB:", bill?.hub3aText);
}, [bill?.hub3aText]);
const billedTo_handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
@@ -98,11 +84,15 @@ export const BillEditForm: FC<BillEditFormProps> = ({ location, bill }) => {
setPayedAmount(`${billInfo.amount / 100}`);
setHub3aText(hub3aText);
console.log("[BillEditForm] Single barcode result found:", hub3aText);
} else {
console.log("[BillEditForm] Multiple barcode results found:", results);
setPayedAmount("");
setBarcodeResults(results);
setHub3aText(undefined);
}
} else {
console.log("[BillEditForm] No barcode results found.");
}
setIsScanningPDF(false);