Skip to content

Commit f0ceb66

Browse files
committed
fix: salvataggio seriali vendita al banco
1 parent 1cf480c commit f0ceb66

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

modules/fatture/add_serial.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@
8585

8686
$table = $data[$modulo]['table'];
8787
$id = $data[$modulo]['id'];
88-
$riga = str_replace('id', 'id_riga_', $id);
88+
89+
// Fix per vendita banco: il nome della colonna è diverso
90+
if ($modulo == 'veb') {
91+
$riga = 'id_riga_venditabanco';
92+
} else {
93+
$riga = str_replace('id', 'id_riga_', $id);
94+
}
8995

9096
$idriga = get('idriga') ?: get('riga_id');
9197

@@ -170,7 +176,13 @@
170176
$pos = 'veb';
171177
}
172178

173-
$r = $dbo->select($data[$pos]['table'], $data[$pos]['id'], [], ['id' => $res[0][str_replace('id', 'id_riga_', $data[$pos]['id'])]]);
179+
// Fix per vendita banco: il nome della colonna è diverso
180+
if ($pos == 'veb') {
181+
$column_name = 'id_riga_venditabanco';
182+
} else {
183+
$column_name = str_replace('id', 'id_riga_', $data[$pos]['id']);
184+
}
185+
$r = $dbo->select($data[$pos]['table'], $data[$pos]['id'], [], ['id' => $res[0][$column_name]]);
174186

175187
echo '
176188
'.Modules::link($modulo, $r[0][$data[$pos]['id']], tr('Visualizza vendita'), null);
@@ -296,7 +308,12 @@ function generaSerial() {
296308
id_record: "'.$id_record.'",
297309
}).then(function(response) {
298310
form.getElement().closest("div[id^=bs-popup").modal("hide");
299-
caricaRighe(null);
311+
// Fix per vendita banco: usa reloadRows() invece di caricaRighe()
312+
if (typeof reloadRows === "function") {
313+
reloadRows();
314+
} else if (typeof caricaRighe === "function") {
315+
caricaRighe(null);
316+
}
300317
});
301318
302319
return false;

0 commit comments

Comments
 (0)