From a69f016a29e44686c142d0d7e4d003145276ac05 Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Fri, 1 Mar 2024 17:32:31 +0100 Subject: [PATCH] Fix vari --- include/common/importa.php | 2 +- modules/liste_newsletter/actions.php | 1 + modules/liste_newsletter/edit.php | 151 ++++++++++++++------------- modules/stati_intervento/actions.php | 2 +- modules/stati_intervento/edit.php | 5 +- modules/stati_intervento/init.php | 3 +- modules/tipi_intervento/actions.php | 7 +- modules/tipi_intervento/src/Tipo.php | 3 +- 8 files changed, 90 insertions(+), 84 deletions(-) diff --git a/include/common/importa.php b/include/common/importa.php index d2ea72486..3bffb7863 100755 --- a/include/common/importa.php +++ b/include/common/importa.php @@ -120,7 +120,7 @@ if (!empty($options['create_document'])) { elseif ($final_module['name'] == 'Interventi') { echo '
- {[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato_intervento", "required": 1, "values": "query=SELECT `id_statiintervento`.`id`, `in_statiintervento_lang`.`name` as `descrizione`, `colore` AS _bgcolor_ FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `deleted_at` IS NULL AND `is_completato` = 0 ORDER BY `name`" ]} + {[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato_intervento", "required": 1, "values": "query=SELECT `in_statiintervento`.`id`, `in_statiintervento_lang`.`name` as `descrizione`, `colore` AS _bgcolor_ FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `deleted_at` IS NULL AND `is_completato` = 0 ORDER BY `name`" ]}
diff --git a/modules/liste_newsletter/actions.php b/modules/liste_newsletter/actions.php index d5e657c37..426113ef9 100755 --- a/modules/liste_newsletter/actions.php +++ b/modules/liste_newsletter/actions.php @@ -63,6 +63,7 @@ switch (filter('op')) { break; case 'delete': + $lista = Lista::find($id_record); $lista->delete(); flash()->info(tr('Lista newsletter rimossa!')); diff --git a/modules/liste_newsletter/edit.php b/modules/liste_newsletter/edit.php index 6eee14477..564e6bd26 100755 --- a/modules/liste_newsletter/edit.php +++ b/modules/liste_newsletter/edit.php @@ -99,85 +99,86 @@ echo '
'; -$numero_destinatari = $lista->destinatari()->count(); -$destinatari_senza_mail = $lista->getNumeroDestinatariSenzaEmail(); +if ($lista) { + $numero_destinatari = $lista->destinatari()->count(); + $destinatari_senza_mail = $lista->getNumeroDestinatariSenzaEmail(); -echo ' - -
-
-

- '.tr('Destinatari').' - ('.$numero_destinatari.')
- '.(($destinatari_senza_mail > 0) ? ' '.$destinatari_senza_mail.'' : '') - .'
-

+ echo ' + +
+
+

+ '.tr('Destinatari').' + ('.$numero_destinatari.')
+ '.(($destinatari_senza_mail > 0) ? ' '.$destinatari_senza_mail.'' : '') + .'
+

+
+ +
+ + + + + + + + + + + +
'.tr('Ragione sociale').''.tr('Tipo').''.tr('Tipologia').''.tr('E-mail').''.tr('Newsletter').'#
+ + + '.tr('Elimina tutti').' + +
-
- - - - - - - - - - - -
'.tr('Ragione sociale').''.tr('Tipo').''.tr('Tipologia').''.tr('E-mail').''.tr('Newsletter').'#
+ + '.tr('Elimina').' + + + '; + '; +} \ No newline at end of file diff --git a/modules/stati_intervento/actions.php b/modules/stati_intervento/actions.php index a8fc78c54..272d02257 100755 --- a/modules/stati_intervento/actions.php +++ b/modules/stati_intervento/actions.php @@ -35,7 +35,7 @@ switch (post('op')) { ], ['id' => $id_record]); $dbo->update('in_statiintervento_lang', [ - 'descrizione' => post('descrizione'), + 'name' => post('descrizione'), ], ['id_record' => $id_record, 'id_lang' => setting('Lingua')]); flash()->info(tr('Informazioni salvate correttamente.')); diff --git a/modules/stati_intervento/edit.php b/modules/stati_intervento/edit.php index 3fd80ca3a..ab5bd2d0e 100755 --- a/modules/stati_intervento/edit.php +++ b/modules/stati_intervento/edit.php @@ -19,6 +19,9 @@ include_once __DIR__.'/../../core.php'; +use Modules\Interventi\Stato; + +$stato = Stato::find($id_record); if ($record['can_delete']) { $attr = ''; } else { @@ -39,7 +42,7 @@ if ($record['can_delete']) {
- {[ "type": "text", "label": "", "name": "descrizione", "required": 1, "value": "$descrizione$" ]} + {[ "type": "text", "label": "", "name": "descrizione", "required": 1, "value": "name; ?>" ]}
diff --git a/modules/stati_intervento/init.php b/modules/stati_intervento/init.php index 9aca20e90..4092e3d92 100755 --- a/modules/stati_intervento/init.php +++ b/modules/stati_intervento/init.php @@ -20,5 +20,6 @@ include_once __DIR__.'/../../core.php'; if (isset($id_record)) { - $record = $dbo->fetchOne('SELECT * FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = "'.prepare(setting('Lingua')).'") WHERE `id`='.prepare($id_record)); + $record = $dbo->fetchOne('SELECT * FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = "'.prepare(setting('Lingua')).'") WHERE `in_statiintervento`.`id`='.prepare($id_record)); + } diff --git a/modules/tipi_intervento/actions.php b/modules/tipi_intervento/actions.php index 84170888e..4c77d6fec 100755 --- a/modules/tipi_intervento/actions.php +++ b/modules/tipi_intervento/actions.php @@ -23,7 +23,6 @@ include_once __DIR__.'/../../core.php'; switch (post('op')) { case 'update': - $tipo->name = post('descrizione'); $tipo->calcola_km = post('calcola_km'); $tipo->tempo_standard = post('tempo_standard'); $tipo->costo_orario = post('costo_orario'); @@ -34,6 +33,8 @@ switch (post('op')) { $tipo->costo_diritto_chiamata_tecnico = post('costo_diritto_chiamata_tecnico'); $tipo->save(); + $database->query('UPDATE `in_tipiintervento_lang` SET `name` = '.prepare(post('descrizione')).' WHERE `id_record` = '.prepare($id_record).' AND `id_lang` = '.prepare(setting('Lingua'))); + $fasce_ore = (array) post('fascia_ore'); $fascia_km = (array) post('fascia_km'); $fascia_diritto_chiamata = (array) post('fascia_diritto_chiamata'); @@ -60,9 +61,9 @@ switch (post('op')) { case 'add': $codice = post('codice'); - $descrizione = post('descrizione'); - $tipo = Tipo::build($codice, $descrizione); + $tipo = Tipo::build($codice); + $database->query('INSERT INTO `in_tipiintervento_lang` (`id_lang`, `id_record`, `name`) VALUES ('.prepare(setting('Lingua')).', '.prepare($tipo->id).', '.prepare(post('descrizione')).')'); $tipo->tempo_standard = post('tempo_standard'); $tipo->calcola_km = post('calcola_km'); diff --git a/modules/tipi_intervento/src/Tipo.php b/modules/tipi_intervento/src/Tipo.php index 1de1946fe..6a8e75fbd 100755 --- a/modules/tipi_intervento/src/Tipo.php +++ b/modules/tipi_intervento/src/Tipo.php @@ -37,12 +37,11 @@ class Tipo extends Model * * @return self */ - public static function build($codice, $descrizione) + public static function build($codice) { $model = new static(); $model->codice = $codice; - $model->name = $descrizione; // Salvataggio delle informazioni $model->save();