+ '.Modules::link('Interventi', $r->id, $r->codice).' |
+ '.Modules::link('Anagrafiche', $r->idanagrafica, $dbo->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica='.prepare($r->idanagrafica))['ragione_sociale']).' Presso: ';
// Sede promemoria
- if ($r['idsede'] == '-1') {
+ if ($r->idsede == '-1') {
echo '- Nessuna -';
- } elseif (empty($r['idsede'])) {
+ } elseif (empty($r->idsede)) {
echo tr('Sede legale');
} else {
- $rsp2 = $dbo->fetchArray("SELECT id, CONCAT( CONCAT_WS( ' (', CONCAT_WS(', ', nomesede, citta), indirizzo ), ')') AS descrizione FROM an_sedi WHERE id=".prepare($r['idsede']));
+ $rsp2 = $dbo->fetchArray("SELECT id, CONCAT( CONCAT_WS( ' (', CONCAT_WS(', ', nomesede, citta), indirizzo ), ')') AS descrizione FROM an_sedi WHERE id=".prepare($r->idsede));
echo $rsp2[0]['descrizione'];
}
echo '
|
- '.Translator::dateToLocale($r['data_richiesta']).' '.((empty($r['data_scadenza'])) ? '' : ' Entro il '.Translator::dateToLocale($r['data_scadenza']).'').' |
+ '.Translator::dateToLocale($r->data_richiesta).' '.((empty($r->data_scadenza)) ? '' : ' Entro il '.Translator::dateToLocale($r->data_scadenza).'').' |
'.$rs_tecnici[0]['tecnici'].'
|
- '.$dbo->fetchOne("SELECT CONCAT_WS(' - ', `codice`, `name`) AS descrizione FROM `in_tipiintervento` LEFT JOIN `in_tipiintervento_lang` ON (`in_tipiintervento`.`id` = `in_tipiintervento_lang`.`id_record` AND `in_tipiintervento_lang`.`id_lang` = ".prepare(setting('Lingua')).") WHERE `id`=".prepare($r['idtipointervento']))['descrizione'].' |
+ '.$dbo->fetchOne("SELECT CONCAT_WS(' - ', `codice`, `name`) AS descrizione FROM `in_tipiintervento` LEFT JOIN `in_tipiintervento_lang` ON (`in_tipiintervento`.`id` = `in_tipiintervento_lang`.`id_record` AND `in_tipiintervento_lang`.`id_lang` = ".prepare(setting('Lingua')).") WHERE `in_tipiintervento`.`id`=".prepare($r->idtipointervento))['descrizione'].' |
- '.nl2br($r['richiesta']).' |
+ '.nl2br($r->richiesta).' |
';
echo '
diff --git a/modules/iva/actions.php b/modules/iva/actions.php
index 0afb6ac3f..9b53e4b58 100755
--- a/modules/iva/actions.php
+++ b/modules/iva/actions.php
@@ -22,12 +22,12 @@ use Modules\Iva\Aliquota;
switch (filter('op')) {
case 'update':
- $esente = post('esente');
+ $esente = post('esente') ?: 0;
$percentuale = empty($esente) ? post('percentuale') : 0;
$indetraibile = post('indetraibile');
$dicitura = post('dicitura');
$codice = post('codice');
- $codice_natura_fe = post('codice_natura_fe');
+ $codice_natura_fe = post('codice_natura_fe') ?: null;
$esigibilita = post('esigibilita');
$descrizione = post('descrizione');
@@ -36,7 +36,7 @@ switch (filter('op')) {
$iva->esente = $esente;
$iva->percentuale = $percentuale;
$iva->indetraibile = $indetraibile;
- $iva->dicitura = $dicitura;
+ $iva->dicitura = $dicitura?: 0;
$iva->codice = $codice;
$iva->codice_natura_fe = $codice_natura_fe;
$iva->esigibilita = $esigibilita;
@@ -44,9 +44,9 @@ switch (filter('op')) {
$iva->save();
// Messaggio di avvertenza
- if ((stripos('N6', (string) $codice_natura) === 0) && $esigibilita == 'S') {
+ if ((stripos('N6', (string) $codice_natura_fe) === 0) && $esigibilita == 'S') {
flash()->warning(tr('Combinazione di natura IVA _TYPE_ ed esigibilità non compatibile', [
- '_TYPE_' => $codice_natura,
+ '_TYPE_' => $codice_natura_fe,
]));
}
@@ -63,7 +63,7 @@ switch (filter('op')) {
$codice = post('codice');
$esente = post('esente');
$percentuale = empty($esente) ? post('percentuale') : 0;
- $codice_natura = post('codice_natura_fe') ?: null;
+ $codice_natura = post('codice_natura_fe') ?: '';
$esigibilita = post('esigibilita');
$indetraibile = post('indetraibile');
diff --git a/modules/preventivi/widgets/preventivi.dashboard.php b/modules/preventivi/widgets/preventivi.dashboard.php
index 82f5d7052..4385ae698 100755
--- a/modules/preventivi/widgets/preventivi.dashboard.php
+++ b/modules/preventivi/widgets/preventivi.dashboard.php
@@ -19,21 +19,12 @@
include_once __DIR__.'/../../../core.php';
use Models\Module;
+use Modules\Preventivi\Preventivo;
+use Modules\Preventivi\Stato;
$id_module = (new Module())->GetByName('Preventivi')->id_record;
-$rs = $dbo->fetchArray("SELECT *,
- `an_anagrafiche`.`ragione_sociale` AS ragione_sociale
- FROM
- `co_preventivi`
- INNER JOIN `an_anagrafiche` ON `co_preventivi`.`idanagrafica`=`an_anagrafiche`.`idanagrafica`
- INNER JOIN `co_statipreventivi` ON `co_preventivi`.`idstato`=`co_statipreventivi`.`id`
- LEFT JOIN `co_statipreventivi_lang` ON (`co_statipreventivi`.`id`=`co_statipreventivi_lang`.`id_record` AND `co_statipreventivi_lang`.`id_lang` = ".prepare(setting('Lingua')).")
- WHERE
- `co_statipreventivi_lang`.`name` = 'In lavorazione'
- AND `default_revision` = 1
- ORDER BY
- `data_conclusione` ASC");
+$rs = Preventivo::where('idstato', '=', (new Stato())->getByName('In lavorazione')->id_record)->where('default_revision', '=', 1)->get();
if (!empty($rs)) {
echo "
@@ -45,16 +36,16 @@ if (!empty($rs)) {
";
foreach ($rs as $preventivo) {
- $data_accettazione = ($preventivo['data_accettazione'] != '0000-00-00') ? Translator::dateToLocale($preventivo['data_accettazione']) : '';
- $data_conclusione = ($preventivo['data_conclusione'] != '0000-00-00') ? Translator::dateToLocale($preventivo['data_conclusione']) : '';
+ $data_accettazione = ($preventivo->data_accettazione != '0000-00-00') ? Translator::dateToLocale($preventivo->data_accettazione) : '';
+ $data_conclusione = ($preventivo->data_conclusione != '0000-00-00') ? Translator::dateToLocale($preventivo->data_conclusione) : '';
- if (strtotime($preventivo['data_conclusione']) < strtotime(date('Y-m-d')) && $data_conclusione != '') {
+ if (strtotime($preventivo->data_conclusione) < strtotime(date('Y-m-d')) && $data_conclusione != '') {
$attr = ' class="danger"';
} else {
$attr = '';
}
- echo '