From 97f50a5c47adb562581d0e15773cecbce1df2b22 Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Thu, 10 Jan 2019 20:17:08 +0100 Subject: [PATCH] Fix #425 --- modules/anagrafiche/actions.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/anagrafiche/actions.php b/modules/anagrafiche/actions.php index 3699c9b08..c288a3c72 100644 --- a/modules/anagrafiche/actions.php +++ b/modules/anagrafiche/actions.php @@ -26,16 +26,20 @@ switch (post('op')) { $sede->save(); - if (!empty(post('nome')) and !empty(post('cognome'))) { + if (empty(post('ragione_sociale'))) { $ragione_sociale = post('nome').' '.post('cognome'); } else { $ragione_sociale = post('ragione_sociale'); } + // Informazioni sull'anagrafica $anagrafica->codice = post('codice'); $anagrafica->tipo = post('tipo'); $anagrafica->codice_destinatario = post('codice_destinatario'); $anagrafica->ragione_sociale = $ragione_sociale; + $anagrafica->nome = post('nome'); + $anagrafica->cognome = post('cognome'); + $anagrafica->partita_iva = post('piva'); $anagrafica->codice_fiscale = post('codice_fiscale'); $anagrafica->tipo = post('tipo'); @@ -68,8 +72,6 @@ switch (post('op')) { $anagrafica->idagente = post('idagente'); $anagrafica->idrelazione = post('idrelazione'); $anagrafica->sitoweb = post('sitoweb'); - $anagrafica->nome = post('nome'); - $anagrafica->cognome = post('cognome'); $anagrafica->iscrizione_tribunale = post('iscrizione_tribunale'); $anagrafica->cciaa = post('cciaa'); $anagrafica->cciaa_citta = post('cciaa_citta'); @@ -126,7 +128,12 @@ switch (post('op')) { case 'add': $idtipoanagrafica = post('idtipoanagrafica'); - $ragione_sociale = post('ragione_sociale'); + + if (empty(post('ragione_sociale'))) { + $ragione_sociale = post('nome').' '.post('cognome'); + } else { + $ragione_sociale = post('ragione_sociale'); + } $anagrafica = Anagrafica::build($ragione_sociale, $idtipoanagrafica); $id_record = $anagrafica->id;