diff --git a/modules/fatture/add_intervento.php b/modules/fatture/add_intervento.php index 30ceaeb20..2799c3ab6 100755 --- a/modules/fatture/add_intervento.php +++ b/modules/fatture/add_intervento.php @@ -22,6 +22,7 @@ include_once __DIR__.'/../../core.php'; use Modules\Fatture\Fattura; $module = Modules::get($id_module); +$module_interventi = Modules::get('Interventi'); if ($module['name'] == 'Fatture di vendita') { $dir = 'entrata'; @@ -73,13 +74,14 @@ foreach ($rs as $key => $value) { $rs[$key]['prezzo'] = Translator::numberToLocale($prezzo); $rs[$key]['descrizione_intervento'] = strip_tags($rs[$key]['descrizione_intervento']); + $rs[$key]['info'] = $module_interventi->replacePlaceholders($value['id'], setting('Descrizione personalizzata in fatturazione')) ?: $rs[$key]['info']; } // Intervento echo '
- {[ "type": "select", "label": "'.tr('Intervento').'", "name": "idintervento", "required": 1, "values": '.json_encode($rs).', "extra": "onchange=\"$data = $(this).selectData(); $(\'#descrizione\').val($data.info); if($(\'#copia_descrizione\').is(\':checked\')){ $(\'#descrizione\').val($data.info + $data.descrizione_intervento); }; $(\'#prezzo\').val($data.prezzo);\"" ]} + {[ "type": "select", "label": "'.tr('Intervento').'", "name": "idintervento", "required": 1, "values": '.json_encode($rs).', "extra": "onchange=\"$data = $(this).selectData(); if($data){ $(\'#descrizione\').val($data.info); $(\'#prezzo\').val($data.prezzo);};\"" ]}
diff --git a/modules/interventi/bulk.php b/modules/interventi/bulk.php index 29caa5747..6a352d685 100755 --- a/modules/interventi/bulk.php +++ b/modules/interventi/bulk.php @@ -116,10 +116,9 @@ switch (post('op')) { } } - $descrizione = tr('Attività numero _NUM_ del _DATE_ [_STATE_]', [ + $descrizione = $module->replacePlaceholders($intervento['id'], setting('Descrizione personalizzata in fatturazione')) ?: tr('Attività numero _NUM_ del _DATE_', [ '_NUM_' => $intervento['codice_intervento'], '_DATE_' => Translator::dateToLocale($intervento['data']), - '_STATE_' => $intervento['stato'], ]); aggiungi_intervento_in_fattura($intervento['id'], $id_documento, $descrizione, $id_iva, $id_conto); diff --git a/update/2_4_31.sql b/update/2_4_31.sql index 905fbf937..034fe536d 100644 --- a/update/2_4_31.sql +++ b/update/2_4_31.sql @@ -101,4 +101,7 @@ INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filen -- Aggiunto plugin Regole pagamenti INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`) VALUES (NULL, 'Regole pagamenti', 'Regole pagamenti', (SELECT `id` FROM `zz_modules` WHERE `name` = 'Anagrafiche'), (SELECT `id` FROM `zz_modules` WHERE `name` = 'Anagrafiche'), 'tab', '', '1', '1', '0', '', '', NULL, '{ \"main_query\": [ { \"type\": \"table\", \"fields\": \"Mese da posticipare, Giorno riprogrammazione scadenza\", \"query\": \"SELECT id, IF(mese=\'01\', \'Gennaio\', IF(mese=\'02\', \'Febbraio\',IF(mese=\'03\', \'Marzo\',IF(mese=\'04\', \'Aprile\',IF(mese=\'05\', \'Maggio\', IF(mese=\'06\', \'Giugno\', IF(mese=\'07\', \'Luglio\',IF(mese=\'08\', \'Agosto\',IF(mese=\'09\', \'Settembre\', IF(mese=\'10\', \'Ottobre\', IF(mese=\'11\', \'Novembre\',\'Dicembre\'))))))))))) AS `Mese da posticipare`, giorno_fisso AS `Giorno riprogrammazione scadenza` FROM an_pagamenti_anagrafiche WHERE 1=1 AND idanagrafica=|id_parent| GROUP BY id HAVING 2=2 ORDER BY an_pagamenti_anagrafiche.mese ASC\"} ]}', 'pagamenti_anagrafiche', ''); -CREATE TABLE `an_pagamenti_anagrafiche` ( `id` INT NOT NULL AUTO_INCREMENT , `mese` INT NOT NULL , `giorno_fisso` INT NOT NULL , `idanagrafica` INT NOT NULL , PRIMARY KEY (`id`)); \ No newline at end of file +CREATE TABLE `an_pagamenti_anagrafiche` ( `id` INT NOT NULL AUTO_INCREMENT , `mese` INT NOT NULL , `giorno_fisso` INT NOT NULL , `idanagrafica` INT NOT NULL , PRIMARY KEY (`id`)); + +-- Aggiunta impostazione per personalizzare dicitura riferimento attività +INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Descrizione personalizzata in fatturazione', '', 'textarea', '1', 'Attività', '17', 'Variabili utilizzabili: \n {email}\n {numero}\n {ragione_sociale}\n {richiesta}\n {descrizione}\n {data}\n {data richiesta}\n {data fine intervento}\n {id_anagrafica}\n {stato}\n'); \ No newline at end of file