Fix ulteriore #338

This commit is contained in:
Thomas Zilio 2018-10-26 19:39:34 +02:00
parent fac977bc12
commit b89d9424ba
3 changed files with 14 additions and 6 deletions

View File

@ -103,7 +103,7 @@ switch (post('op')) {
], ['id' => $id_record]);
// Aggiornamento sconto
$dbo->update('co_documenti', [
$dbo->update('dt_ddt', [
'tipo_sconto_globale' => post('tipo_sconto_generico'),
'sconto_globale' => post('sconto_generico'),
], ['id' => $id_record]);

View File

@ -3,9 +3,17 @@
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT *, dt_ddt.note, dt_ddt.idpagamento, dt_ddt.id AS idddt, dt_statiddt.descrizione AS `stato`, dt_tipiddt.descrizione AS `descrizione_tipodoc`, (SELECT completato FROM dt_statiddt WHERE dt_statiddt.id=dt_ddt.idstatoddt) AS flag_completato FROM ((dt_ddt LEFT OUTER JOIN dt_statiddt ON dt_ddt.idstatoddt=dt_statiddt.id) INNER JOIN an_anagrafiche ON dt_ddt.idanagrafica=an_anagrafiche.idanagrafica) INNER JOIN dt_tipiddt ON dt_ddt.idtipoddt=dt_tipiddt.id WHERE dt_ddt.id='.prepare($id_record));
$record = $dbo->fetchOne('SELECT *, dt_ddt.note, dt_ddt.idpagamento, dt_ddt.id AS idddt, dt_statiddt.descrizione AS `stato`, dt_tipiddt.descrizione AS `descrizione_tipodoc`,
(SELECT completato FROM dt_statiddt WHERE dt_statiddt.id=dt_ddt.idstatoddt) AS flag_completato
FROM dt_ddt
LEFT OUTER JOIN dt_statiddt ON dt_ddt.idstatoddt=dt_statiddt.id
INNER JOIN an_anagrafiche ON dt_ddt.idanagrafica=an_anagrafiche.idanagrafica
INNER JOIN dt_tipiddt ON dt_ddt.idtipoddt=dt_tipiddt.id
WHERE dt_ddt.id='.prepare($id_record));
if (!empty($record)) {
$record['idporto'] = $record['idporto'] ?: $dbo->fetchOne('SELECT id FROM dt_porto WHERE predefined = 1')['id'];
$record['idcausalet'] = $record['idcausalet'] ?: $dbo->fetchOne('SELECT id FROM dt_causalet WHERE predefined = 1')['id'];
$record['idspedizione'] = $record['idspedizione'] ?: $dbo->fetchOne('SELECT id FROM dt_spedizione WHERE predefined = 1')['id'];
}
}

View File

@ -145,7 +145,7 @@ if (!empty($rs)) {
<td class="text-center">';
if ($record['flag_completato'] == 0 && empty($r['sconto_globale'])) {
echo "
<form action='".$rootdir.'/editor.php?id_module='.Modules::get($name)['id'].'&id_record='.$id_record."' method='post' id='delete-form-".$r['id']."' role='form'>
<form action='".$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record."' method='post' id='delete-form-".$r['id']."' role='form'>
<input type='hidden' name='backto' value='record-edit'>
<input type='hidden' name='id_record' value='".$id_record."'>
<input type='hidden' name='idriga' value='".$r['id']."'>