diff --git a/modules/interventi/src/Components/Sessione.php b/modules/interventi/src/Components/Sessione.php index 034cc4690..f543e8395 100755 --- a/modules/interventi/src/Components/Sessione.php +++ b/modules/interventi/src/Components/Sessione.php @@ -68,15 +68,17 @@ class Sessione extends Model $model->orario_inizio = $inizio; $model->orario_fine = $fine; - // Sede secondaria - if (!empty($intervento['idsede_destinazione'])) { - $sede = database()->fetchOne('SELECT km FROM an_sedi WHERE id = '.prepare($intervento['idsede_destinazione'])); - $km = $sede['km']; - } + if ($tipo_sessione->calcola_km) { + // Sede secondaria + if (!empty($intervento['idsede_destinazione'])) { + $sede = database()->fetchOne('SELECT km FROM an_sedi WHERE id = '.prepare($intervento['idsede_destinazione'])); + $km = $sede['km']; + } - // Sede legale dell'anagrafica - else { - $km = $intervento->anagrafica->sedeLegale->km; + // Sede legale dell'anagrafica + else { + $km = $intervento->anagrafica->sedeLegale->km; + } } $model->km = empty($km) ? 0 : $km; diff --git a/modules/tipi_intervento/actions.php b/modules/tipi_intervento/actions.php index 826aa5d28..c5333ba92 100755 --- a/modules/tipi_intervento/actions.php +++ b/modules/tipi_intervento/actions.php @@ -24,6 +24,7 @@ include_once __DIR__.'/../../core.php'; switch (post('op')) { case 'update': $tipo->descrizione = post('descrizione'); + $tipo->calcola_km = post('calcola_km'); $tipo->tempo_standard = post('tempo_standard'); $tipo->costo_orario = post('costo_orario'); @@ -41,6 +42,7 @@ switch (post('op')) { case 'add': $codice = post('codice'); + $tipo->calcola_km = post('calcola_km'); $descrizione = post('descrizione'); $tipo = Tipo::build($codice, $descrizione); diff --git a/modules/tipi_intervento/add.php b/modules/tipi_intervento/add.php index 6e0123c36..af6137778 100755 --- a/modules/tipi_intervento/add.php +++ b/modules/tipi_intervento/add.php @@ -24,14 +24,18 @@ include_once __DIR__.'/../../core.php';
-
+
{[ "type": "text", "label": "", "name": "codice", "maxlength": 10, "class": "alphanumeric-mask", "required": 1 ]}
-
+
{[ "type": "text", "label": "", "name": "descrizione", "required": 1 ]}
+
+ {[ "type": "checkbox", "label": "", "id":"km", "name": "calcola_km", "help": ".", "value": "1" ]} +
+
{[ "type": "number", "label": "", "name": "tempo_standard", "help": "Esempi:
  • 60 minuti = 1 ora
  • 30 minuti = 0,5 ore
  • 15 minuti = 0,25 ore
'); ?>", "min-value": "0", "max-value": "24", "class": "text-center", "value": "$tempo_standard$", "icon-after": "ore" ]}
diff --git a/modules/tipi_intervento/edit.php b/modules/tipi_intervento/edit.php index 23dcfd56d..14ad1e8d4 100755 --- a/modules/tipi_intervento/edit.php +++ b/modules/tipi_intervento/edit.php @@ -25,14 +25,18 @@ include_once __DIR__.'/../../core.php';
-
+
{[ "type": "span", "label": "", "name": "codice", "value": "$codice$" ]}
-
+
{[ "type": "text", "label": "", "name": "descrizione", "required": 1, "value": "$descrizione$" ]}
+
+ {[ "type": "checkbox", "label": "", "name": "calcola_km", "help": ".", "value": "$calcola_km$" ]} +
+
{[ "type": "number", "label": "", "name": "tempo_standard", "help": "Esempi:
  • 60 minuti = 1 ora
  • 30 minuti = 0,5 ore
  • 15 minuti = 0,25 ore
Suggerisce il tempo solitamente impiegato per questa tipologia di attivita'); ?>.", "min-value": "0", "max-value": "24", "class": "text-center", "value": "$tempo_standard$", "icon-after": "ore" ]}
diff --git a/update/2_4_28.sql b/update/2_4_28.sql index 7e9c481b3..f2cc2ef00 100644 --- a/update/2_4_28.sql +++ b/update/2_4_28.sql @@ -1,2 +1,5 @@ -- Aggiunto help per impostazione -UPDATE `zz_settings` SET `help` = 'Documenti di Vendita quali Fatture, DDT e Attività' WHERE `zz_settings`.`nome` = 'Permetti selezione articoli con quantità minore o uguale a zero in Documenti di Vendita'; \ No newline at end of file +UPDATE `zz_settings` SET `help` = 'Documenti di Vendita quali Fatture, DDT e Attività' WHERE `zz_settings`.`nome` = 'Permetti selezione articoli con quantità minore o uguale a zero in Documenti di Vendita'; + +ALTER TABLE `in_tipiintervento` ADD `calcola_km` TINYINT NOT NULL AFTER `costo_diritto_chiamata_tecnico`; +UPDATE `in_tipiintervento` SET `calcola_km`=1; \ No newline at end of file