2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
2019-02-14 17:49:58 +01:00
|
|
|
use Modules\DDT\DDT;
|
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
if (isset($id_record)) {
|
2019-02-14 17:49:58 +01:00
|
|
|
$ddt = DDT::with('tipo', 'stato')->find($id_record);
|
2019-01-01 11:39:20 +01:00
|
|
|
|
2018-10-26 19:39:34 +02:00
|
|
|
$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));
|
2018-09-26 10:49:38 +02:00
|
|
|
|
2018-10-26 19:39:34 +02:00
|
|
|
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'];
|
|
|
|
}
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|