mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 08:56:48 +01:00
Fix sulla gestione dei seriali
This commit is contained in:
parent
c8bdd086c9
commit
f06b1cc34c
@ -294,17 +294,10 @@ $riga = $intervento->getRiga($type, $id_riga);
|
||||
break;
|
||||
|
||||
case 'add_serial':
|
||||
$idriga = post('idriga');
|
||||
$idarticolo = post('idarticolo');
|
||||
$articolo = Articolo::find(post('idriga'));
|
||||
|
||||
$serials = (array) post('serial');
|
||||
foreach ($serials as $key => $value) {
|
||||
if (empty($value)) {
|
||||
unset($serials[$key]);
|
||||
}
|
||||
}
|
||||
$articolo->serials = post('serial');
|
||||
|
||||
$dbo->sync('mg_prodotti', ['id_riga_intervento' => $idriga, 'dir' => 'entrata', 'id_articolo' => $idarticolo], ['serial' => $serials]);
|
||||
aggiorna_sedi_movimenti('interventi', $id_record);
|
||||
break;
|
||||
|
||||
|
@ -619,9 +619,11 @@ class Database extends Util\Singleton
|
||||
$sync = array_unique((array) current($list));
|
||||
|
||||
if (!empty($field) && !empty($sync)) {
|
||||
$conditions[$field] = $sync;
|
||||
foreach ($sync as $element) {
|
||||
$conditions[$field] = $element;
|
||||
|
||||
$this->delete($table, $conditions);
|
||||
$this->delete($table, $conditions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,3 +101,9 @@ ALTER TABLE `co_righe_promemoria` ADD `id_dettaglio_fornitore` int(11) NULL,
|
||||
-- Aggiunta campo prezzo_vendita_ivato per gli Articoli
|
||||
ALTER TABLE `mg_articoli` ADD `prezzo_vendita_ivato` decimal(15,6) NOT NULL AFTER `prezzo_vendita`;
|
||||
UPDATE `mg_articoli` SET `prezzo_vendita_ivato` = `prezzo_vendita`;
|
||||
|
||||
-- Aggiornamento ID per gli articoli degli Interventi
|
||||
ALTER TABLE `mg_prodotti` DROP FOREIGN KEY `mg_prodotti_ibfk_4`;
|
||||
UPDATE mg_prodotti SET mg_prodotti.id_riga_intervento = NULL WHERE mg_prodotti.id_riga_intervento NOT IN (SELECT old_id FROM in_righe_interventi);
|
||||
UPDATE mg_prodotti SET mg_prodotti.id_riga_intervento = (SELECT id FROM in_righe_interventi WHERE mg_prodotti.id_riga_intervento = in_righe_interventi.old_id);
|
||||
ALTER TABLE `mg_prodotti` ADD FOREIGN KEY (`id_riga_intervento`) REFERENCES `in_righe_interventi`(`id`) ON DELETE CASCADE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user