diff --git a/modules/anagrafiche/add.php b/modules/anagrafiche/add.php
index a2c9f2cd7..01cf2b032 100644
--- a/modules/anagrafiche/add.php
+++ b/modules/anagrafiche/add.php
@@ -21,7 +21,7 @@ echo '
{[ "type": "select", "label": "'.tr('Tipo di anagrafica').'", "name": "idtipoanagrafica[]", "multiple": "1", "required": 1, "values": "query=SELECT idtipoanagrafica AS id, descrizione FROM an_tipianagrafiche WHERE idtipoanagrafica NOT IN (SELECT DISTINCT(x.idtipoanagrafica) FROM an_tipianagrafiche_anagrafiche x INNER JOIN an_tipianagrafiche t ON x.idtipoanagrafica = t.idtipoanagrafica INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = x.idanagrafica WHERE t.descrizione = \'Azienda\' AND deleted_at IS NULL) ORDER BY descrizione", "value": "'.(isset($idtipoanagrafica) ? $idtipoanagrafica : null).'", "readonly": '.(!empty($readonly_tipo) ? 1 : 0).' ]}
-
+
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "required": 0 ]}
@@ -31,7 +31,7 @@ echo '
{[ "type": "text", "label": "'.tr('Cognome').'", "name": "cognome", "required": 0 ]}
';
-
+
echo '
@@ -100,3 +100,27 @@ echo
';
+?>
+
+
\ No newline at end of file
diff --git a/modules/anagrafiche/edit.php b/modules/anagrafiche/edit.php
index e7e09943f..ff30377c7 100644
--- a/modules/anagrafiche/edit.php
+++ b/modules/anagrafiche/edit.php
@@ -41,30 +41,30 @@ if (!$cliente) {
{[ "type": "text", "label": "", "name": "ragione_sociale", "required": 1, "value": "$ragione_sociale$" ]}
-
+
{[ "type": "text", "label": "", "maxlength": 13, "name": "piva", "class": "text-center alphanumeric-mask text-uppercase", "value": "$piva$" ]}
-
+
{[ "type": "select", "label": "", "name": "tipo", "values": "list=\"\": \"\", \"Azienda\": \"\", \"Privato\": \"\", \"Ente pubblico\": \"\"", "value": "$tipo$" ]}
-
+
-
+
{[ "type": "text", "label": "", "name": "nome", "required": 0, "value": "$nome$" ]}
-
+
{[ "type": "text", "label": "", "name": "cognome", "required": 0, "value": "$cognome$" ]}
-
+
{[ "type": "text", "label": "", "maxlength": 16, "name": "codice_fiscale", "class": "text-center alphanumeric-mask text-uppercase", "value": "$codice_fiscale$" ]}
-
+
@@ -86,7 +86,7 @@ if (!$cliente) {
-
+
@@ -264,7 +264,7 @@ if (!empty($google)) {
{[ "type": "select", "label": "", "name": "idlistino_acquisti", "values": "query=SELECT id, nome AS descrizione FROM mg_listini ORDER BY nome ASC", "value": "$idlistino_acquisti$", "extra": "" ]}
-
+
", "name": "piano_dei_conti_cliente", "values": "list=\"\": \"\"", "readonly": 1, "value": "", "extra": "" ]}
-
+
@@ -443,21 +443,21 @@ if (!empty($google)) {
{[ "type": "text", "label": "", "name": "bic", "value": "$bic$" ]}
-
+
-
+
{[ "type": "checkbox", "label": "", "name": "split_payment", "value": "$split_payment$", "help": "è obbligatorio per:
- Stato;
- organi statali ancorché dotati di personalità giuridica;
- enti pubblici territoriali e dei consorzi tra essi costituiti;
- Camere di Commercio;
- Istituti universitari;
- ASL e degli enti ospedalieri;
- enti pubblici di ricovero e cura aventi prevalente carattere scientifico;
- enti pubblici di assistenza e beneficienza;
- enti di previdenza;
- consorzi tra questi costituiti.
'); ?>", "placeholder": "", "extra" : "" ]}
-
+
{[ "type": "text", "label": "", "name": "diciturafissafattura", "value": "$diciturafissafattura$" ]}
-
-
+
+
@@ -650,42 +650,29 @@ if (empty($record['deleted_at'])) {
$("#lat").val(result.geometry.location.lat());
$("#lng").val(result.geometry.location.lng());
});
-
- /* Campo nome e cognome*/
- if ($('#ragione_sociale').val()!='' && $('#ragione_sociale').val() != $('#nome').val()+' '+$('#cognome').val()){
- $('#nome').prop('disabled', true);
- $('#cognome').prop('disabled', true);
- };
-
- if ($('#nome').val()!='' && $('#cognome').val()!=''){
- $('#ragione_sociale').prop('disabled', true);
- $("#ragione_sociale").attr('required', false);
- };
-
+
+ // Abilito solo ragione sociale oppure solo nome-cognome in base a cosa compilo
$('#nome, #cognome').keyup(function(){
- if ($('#nome').val() =='' && $('#cognome').val() =='' ){
- $('#ragione_sociale').prop('disabled', false);
- $("#ragione_sociale").attr('required', true);
+ if ($('#nome').val() == '' && $('#cognome').val() == '' ){
+ $('#nome, #cognome').prop('disabled', true).prop('required', false);
+ $('#ragione_sociale').prop('disabled', false).prop('required', true);
}else{
-
- $('#ragione_sociale').prop('disabled', true);
- $("#ragione_sociale").attr('required', false);
+ $('#nome, #cognome').prop('disabled', false).prop('required', true);
+ $('#ragione_sociale').prop('disabled', true).prop('required', false);
}
});
-
- $('#ragione_sociale').keyup(function(){
-
- if ($(this).val()!=''){
- $('#nome').prop('disabled', true);
- $('#cognome').prop('disabled', true);
- $("#ragione_sociale").attr('required', true);
+
+ $('#ragione_sociale').keyup(function(){
+ if ($('#ragione_sociale').val() == '' ){
+ $('#nome, #cognome').prop('disabled', false).prop('required', true);
+ $('#ragione_sociale').prop('disabled', true).prop('required', false);
}else{
- $('#nome').prop('disabled', false);
- $('#cognome').prop('disabled', false);
- $("#ragione_sociale").attr('required', false);
+ $('#nome, #cognome').prop('disabled', true).prop('required', false);
+ $('#ragione_sociale').prop('disabled', false).prop('required', true);
}
});
-
+
+ $('#ragione_sociale, #nome').trigger('keyup');
});