fix: Freitext-Zeilen im Modal klickbar machen

Lines-Array wird jetzt gecacht für Click-Handler.
Freitext-Zeilen zeigen '(Freitext)' statt Lagerbestand.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-02-25 13:57:03 +01:00
parent 5f9c522db2
commit 707d7f50a0
3 changed files with 11 additions and 5 deletions

View file

@ -76,7 +76,7 @@ class modHandyBarcodeScanner extends DolibarrModules
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@handybarcodescanner'
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
$this->version = '5.3';
$this->version = '5.4';
// Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';

View file

@ -1169,10 +1169,16 @@
});
}
// Cache für aktuelle Bestellzeilen (Modal)
let currentModalLines = [];
function renderOrderLinesInModal(lines, order, orderId) {
const content = document.getElementById('orders-modal-detail-content');
if (!content) return;
// Lines cachen für Click-Handler
currentModalLines = lines;
if (lines.length === 0) {
content.innerHTML = '<div class="no-orders">Keine Positionen</div>';
return;
@ -1181,10 +1187,10 @@
const canEdit = order.status === 0;
content.innerHTML = lines.map(line => `
<div class="order-line ${canEdit ? 'editable' : ''}" data-line-id="${line.id}" data-order-id="${orderId}">
<div class="order-line ${canEdit ? 'editable' : ''}" data-line-id="${line.id}" data-order-id="${orderId}" data-is-freetext="${line.is_freetext ? '1' : '0'}">
<div class="order-line-info">
<div class="order-line-label">${escapeHtml(line.product_label)}</div>
<div class="order-line-ref">${line.product_ref ? 'Ref: ' + escapeHtml(line.product_ref) : ''} ${line.stock > 0 ? '| Lager: ' + line.stock : ''}</div>
<div class="order-line-ref">${line.product_ref ? 'Ref: ' + escapeHtml(line.product_ref) : ''} ${line.is_freetext ? '(Freitext)' : (line.stock > 0 ? '| Lager: ' + line.stock : '')}</div>
</div>
<div class="order-line-qty">${line.qty}x</div>
</div>
@ -1195,7 +1201,7 @@
lineEl.addEventListener('click', function() {
const lineId = parseInt(this.dataset.lineId);
const oId = parseInt(this.dataset.orderId);
const line = lines.find(l => l.id === lineId);
const line = currentModalLines.find(l => l.id === lineId);
if (line) {
showLineEditDialogInModal(line, oId);
}

2
sw.js
View file

@ -1,5 +1,5 @@
// Service Worker for HandyBarcodeScanner PWA
const CACHE_NAME = 'scanner-v5.4';
const CACHE_NAME = 'scanner-v5.5';
const ASSETS = [
'pwa.php',
'css/scanner.css',