Merge pull request #7626 from rekonder/aj_SCI_9833

Fix small zebra print issues [SCI-9833]
This commit is contained in:
ajugo 2024-06-04 15:59:25 +02:00 committed by GitHub
commit 596844cc07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 16 deletions

View file

@ -201,23 +201,27 @@ var zebraPrint = (function() {
});
}
updateProgressModalData(progressModal, printData.printer_name, PRINTER_STATUS_SEARCH, PRINTER_STATUS_SEARCH);
device = findDevice(printData.printer_name);
if (dataZebra?.responseJSON?.labels?.length && printData.number_of_copies > 0) {
updateProgressModalData(progressModal, printData.printer_name, PRINTER_STATUS_SEARCH, PRINTER_STATUS_SEARCH);
device = findDevice(printData.printer_name);
getPrinterStatus(device).then((device) => {
if (device.status === I18n.t('label_printers.modal_printing_status.printer_status.ready')) {
print(
device,
progressModal,
printData.number_of_copies,
printData.printer_name,
dataZebra.responseJSON.labels,
0,
);
} else {
updateProgressModalData(progressModal, printData.printer_name, PRINTER_STATUS_ERROR, PRINTER_STATUS_ERROR);
}
});
getPrinterStatus(device).then((device) => {
if (device.status === I18n.t('label_printers.modal_printing_status.printer_status.ready')) {
print(
device,
progressModal,
printData.number_of_copies,
printData.printer_name,
dataZebra.responseJSON.labels,
0
);
} else {
updateProgressModalData(progressModal, printData.printer_name, PRINTER_STATUS_ERROR, PRINTER_STATUS_ERROR);
}
});
} else {
updateProgressModalData(progressModal, printData.printer_name, PRINTER_STATUS_ERROR, PRINTER_STATUS_ERROR);
}
}).fail(() => {
HelperModule.flashAlertMsg(I18n.t('repository_row.modal_print_label.general_error'), 'danger');
});

View file

@ -255,6 +255,7 @@ export default {
});
},
initZebraPrinter() {
this.printers = this.printers.filter((printer) => !printer.id.startsWith('zebra'));
this.zebraPrinters = zebraPrint.init($('#LabelPrinterSelector'), {
clearSelectorOnFirstDevice: false,
appendDevice: (device) => {