diff --git a/modules/tipi_intervento/edit.php b/modules/tipi_intervento/edit.php index 4fbb6700c..58847a24f 100644 --- a/modules/tipi_intervento/edit.php +++ b/modules/tipi_intervento/edit.php @@ -69,7 +69,7 @@ include_once __DIR__.'/../../core.php'; fetchArray('SELECT `in_interventi`.`idtipointervento` FROM `in_interventi` WHERE `in_interventi`.`idtipointervento` = '.prepare($id_record).' UNION SELECT `an_anagrafiche`.`idtipointervento_default` AS `idtipointervento` FROM `an_anagrafiche` WHERE `an_anagrafiche`.`idtipointervento_default` = '.prepare($id_record).' diff --git a/plugins/sedi/actions.php b/plugins/sedi/actions.php index 1c6a38a4d..7f1ac49da 100644 --- a/plugins/sedi/actions.php +++ b/plugins/sedi/actions.php @@ -53,6 +53,7 @@ switch ($operazione) { 'fax' => post('fax'), 'id_nazione' => !empty(post('id_nazione')) ? post('id_nazione') : null, 'idzona' => post('idzona'), + 'note' => post('note'), 'gaddress' => post('gaddress'), 'lat' => post('lat'), 'lng' => post('lng'), diff --git a/plugins/sedi/edit.php b/plugins/sedi/edit.php index 6baebfc83..de122f8ad 100644 --- a/plugins/sedi/edit.php +++ b/plugins/sedi/edit.php @@ -4,6 +4,7 @@ include_once __DIR__.'/../../core.php'; $google = setting('Google Maps API key'); + /* if (!empty($google)) { echo ' @@ -79,9 +80,14 @@ echo '
- {[ "type": "select", "label": "'.tr('Zona').'", "name": "idzona", "values": "query=SELECT `id`, CONCAT(`nome`, \' - \', `descrizione`) AS `descrizione` FROM `an_zone` ORDER BY `descrizione` ASC", "value": "$idzona$" ]} + {[ "type": "select", "label": "'.tr('Zona').'", "name": "idzona", "values": "query=SELECT `id`, CONCAT_WS(\' - \', `nome`, `descrizione`) AS `descrizione` FROM `an_zone` ORDER BY `descrizione` ASC", "value": "$idzona$", "placeholder": "'.tr('Nessuna zona').'", "icon-after": "add|'.Modules::get('Zone')['id'].'" ]}
- '; + +
+
+ {[ "type": "textarea", "label": "'.tr('Note').'", "name": "note", "value": "$note$" ]} +
+
'; if (!empty($google)) { echo ' @@ -125,15 +131,34 @@ if (!empty($google)) { '; } + + +// Permetto eliminazione tipo sede solo se non è utilizzata da nessun'altra parte nel gestionale +$elementi = $dbo->fetchArray('SELECT `zz_user_sedi`.`id_user` AS `id` FROM `zz_user_sedi` WHERE `zz_user_sedi`.`idsede` = '.prepare($id_parent).' +UNION +SELECT `an_referenti`.`id` AS `id` FROM `an_referenti` WHERE `an_referenti`.`idsede` = '.prepare($id_parent).' +ORDER BY `id`'); + +if (!empty($elementi)) { + echo ' +
+ '.tr('Ci sono _NUM_ documenti collegati', [ + '_NUM_' => count($elementi), + ]).'. +
'; + + $disabled = 'disabled'; +} + echo '
- + '.tr('Elimina').' - +
'; @@ -151,4 +176,4 @@ $(document).ready( function(){ $("#form_sedi #lng_").val(result.geometry.location.lng()); }); }); -'; +'; \ No newline at end of file diff --git a/plugins/sedi/init.php b/plugins/sedi/init.php index d29f68805..2b390ac8d 100644 --- a/plugins/sedi/init.php +++ b/plugins/sedi/init.php @@ -2,12 +2,12 @@ include_once __DIR__.'/../../core.php'; -if (isset($id_record)) { +if (isset($id_parent)) { $record = $dbo->fetchOne('SELECT *, (SELECT tipo FROM an_anagrafiche WHERE an_anagrafiche.idanagrafica = an_sedi.idanagrafica) AS tipo_anagrafica, (SELECT iso2 FROM an_nazioni WHERE id = id_nazione) AS iso2 - FROM an_sedi WHERE id='.prepare($id_record)); + FROM an_sedi WHERE id='.prepare($id_parent)); $record['lat'] = floatval($record['lat']); $record['lng'] = floatval($record['lng']); -} +} \ No newline at end of file diff --git a/update/2_4_11.sql b/update/2_4_11.sql index 2f4f708d3..24b0e9988 100644 --- a/update/2_4_11.sql +++ b/update/2_4_11.sql @@ -897,3 +897,5 @@ UPDATE `co_staticontratti` SET `can_delete` = '0' WHERE `co_staticontratti`.`des UPDATE `co_staticontratti` SET `can_delete` = '0' WHERE `co_staticontratti`.`descrizione` = 'Concluso'; UPDATE `co_staticontratti` SET `can_delete` = '0' WHERE `co_staticontratti`.`descrizione` = 'Fatturato'; UPDATE `co_staticontratti` SET `can_delete` = '0' WHERE `co_staticontratti`.`descrizione` = 'Parzialmente fatturato'; + +ALTER TABLE `an_sedi` ADD `note` TEXT NULL DEFAULT NULL AFTER `idzona`; \ No newline at end of file