From a45ba4dd531d7ddad2b2bc4662ea2a5be6ff06e9 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 15 Oct 2020 17:38:11 +0200 Subject: [PATCH] Migliorie minori compilazione attributi avanzati --- modules/fatture/edit.php | 2 +- .../fatture/fe/components/dati_documento.php | 33 +++++++++++++++---- src/Traits/ReferenceTrait.php | 6 ++-- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/modules/fatture/edit.php b/modules/fatture/edit.php index 950376107..1832edc8f 100755 --- a/modules/fatture/edit.php +++ b/modules/fatture/edit.php @@ -207,7 +207,7 @@ elseif ($record['stato'] == 'Bozza') { if ($dir == 'entrata') { ?> - {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "ajax-source": "clienti", "help": "fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare(setting('Azienda predefinita')))['ragione_sociale']); ?>", "value": "$idanagrafica$" ]} + {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "ajax-source": "clienti","select-options": $record['idanagrafica']]); ?>, "help": "fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare(setting('Azienda predefinita')))['ragione_sociale']); ?>", "value": "$idanagrafica$" ]} diff --git a/modules/fatture/fe/components/dati_documento.php b/modules/fatture/fe/components/dati_documento.php index 4328a0758..3d9f5c99d 100755 --- a/modules/fatture/fe/components/dati_documento.php +++ b/modules/fatture/fe/components/dati_documento.php @@ -61,7 +61,7 @@ foreach ($dato['riferimento_linea'] as $linea) { echo ' - {[ "type": "number", "name": "'.$nome.'['.$key.'][riferimento_linea][]", "value": "'.$linea.'", "maxlength": 4, "decimals": 0 ]} + {[ "type": "number", "name": "'.$nome.'['.$key.'][riferimento_linea][]", "value": "'.$linea.'", "maxlength": 4, "decimals": 0, "extra": " title=\"\" " ]} '; @@ -82,7 +82,7 @@ echo ' '.str_repeat($space, 4).$info['code'].'.3 Data - {[ "type": "date", "name": "'.$nome.'['.$key.'][data]", "value": "'.$dato['data'].'" ]} + {[ "type": "date", "name": "'.$nome.'['.$key.'][data]", "value": "'.$dato['data'].'", "readonly": '.(empty($dato['id_documento']) ? 1:0 ).' ]} '; @@ -91,7 +91,7 @@ echo ' '.str_repeat($space, 4).$info['code'].'.4 NumItem - {[ "type": "text", "name": "'.$nome.'['.$key.'][num_item]", "value": "'.$dato['num_item'].'", "maxlength": 20 ]} + {[ "type": "text", "name": "'.$nome.'['.$key.'][num_item]", "value": "'.$dato['num_item'].'", "maxlength": 20, "readonly": '.(empty($dato['id_documento']) ? 1:0 ).' ]} '; @@ -100,7 +100,7 @@ echo ' '.str_repeat($space, 4).$info['code'].'.5 CodiceCommessaConvenzione - {[ "type": "text", "name": "'.$nome.'['.$key.'][codice_commessa]", "value": "'.$dato['codice_commessa'].'", "maxlength": 100 ]} + {[ "type": "text", "name": "'.$nome.'['.$key.'][codice_commessa]", "value": "'.$dato['codice_commessa'].'", "maxlength": 100, "readonly": '.(empty($dato['id_documento']) ? 1:0 ).' ]} '; @@ -109,7 +109,7 @@ echo ' '.str_repeat($space, 4).$info['code'].'.6 CodiceCUP - {[ "type": "text", "name": "'.$nome.'['.$key.'][codice_cup]", "value": "'.$dato['codice_cup'].'", "maxlength": 15 ]} + {[ "type": "text", "name": "'.$nome.'['.$key.'][codice_cup]", "value": "'.$dato['codice_cup'].'", "maxlength": 15, "readonly": '.(empty($dato['id_documento']) ? 1:0 ).' ]} '; @@ -118,7 +118,28 @@ echo ' '.str_repeat($space, 4).$info['code'].'.7 CodiceCIG - {[ "type": "text", "name": "'.$nome.'['.$key.'][codice_cig]", "value": "'.$dato['codice_cig'].'", "maxlength": 15 ]} + {[ "type": "text", "name": "'.$nome.'['.$key.'][codice_cig]", "value": "'.$dato['codice_cig'].'", "maxlength": 15, "readonly": '.(empty($dato['id_documento']) ? 1:0 ).' ]} '; + +echo ' +'; \ No newline at end of file diff --git a/src/Traits/ReferenceTrait.php b/src/Traits/ReferenceTrait.php index c5a1df80c..3aa1cd471 100755 --- a/src/Traits/ReferenceTrait.php +++ b/src/Traits/ReferenceTrait.php @@ -37,10 +37,10 @@ trait ReferenceTrait $number = $this->getReferenceNumber(); $date = $this->getReferenceDate(); - $idanagrafica = $this->getReferenceRagioneSociale(); + $ragione_sociale = $this->getReferenceRagioneSociale(); // Testi predefiniti - if (!empty($date) && !empty($number) && !empty($idanagrafica) && !empty($show_ragione_sociale) ) { + if (!empty($date) && !empty($number) && !empty($ragione_sociale) && !empty($show_ragione_sociale) ) { $description = tr('_DOC_ num. _NUM_ del _DATE_ (_RAGIONE_SOCIALE_)'); } elseif (!empty($date) && !empty($number)) { @@ -57,7 +57,7 @@ trait ReferenceTrait $description = replace($description, [ '_DOC_' => $name, '_NUM_' => $number, - '_RAGIONE_SOCIALE_' => $idanagrafica, + '_RAGIONE_SOCIALE_' => $ragione_sociale, '_DATE_' => dateFormat($date), ]);