Migliorie minori compilazione attributi avanzati

This commit is contained in:
Luca 2020-10-15 17:38:11 +02:00
parent 49c2f828bb
commit a45ba4dd53
3 changed files with 31 additions and 10 deletions

View File

@ -207,7 +207,7 @@ elseif ($record['stato'] == 'Bozza') {
if ($dir == 'entrata') {
?>
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "ajax-source": "clienti", "help": "<?php echo tr("In caso di autofattura indicare l'azienda: ").stripslashes($database->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare(setting('Azienda predefinita')))['ragione_sociale']); ?>", "value": "$idanagrafica$" ]}
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "ajax-source": "clienti","select-options": <?php echo json_encode(['id_anagrafica' => $record['idanagrafica']]); ?>, "help": "<?php echo tr("In caso di autofattura indicare l'azienda: ").stripslashes($database->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare(setting('Azienda predefinita')))['ragione_sociale']); ?>", "value": "$idanagrafica$" ]}
<?php
} else {
?>

View File

@ -61,7 +61,7 @@ foreach ($dato['riferimento_linea'] as $linea) {
echo '
</td>
<td>
{[ "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=\"\" " ]}
</td>
</tr>';
@ -82,7 +82,7 @@ echo '
<tr class="fifth-level">
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.3 Data</td>
<td>
{[ "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 ).' ]}
</td>
</tr>';
@ -91,7 +91,7 @@ echo '
<tr class="fifth-level">
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.4 NumItem</td>
<td>
{[ "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 ).' ]}
</td>
</tr>';
@ -100,7 +100,7 @@ echo '
<tr class="fifth-level">
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.5 CodiceCommessaConvenzione</td>
<td>
{[ "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 ).' ]}
</td>
</tr>';
@ -109,7 +109,7 @@ echo '
<tr class="fifth-level">
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.6 CodiceCUP</td>
<td>
{[ "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 ).' ]}
</td>
</tr>';
@ -118,7 +118,28 @@ echo '
<tr class="fifth-level" id="last-'.$nome.'-'.$key.'">
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.7 CodiceCIG</td>
<td>
{[ "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 ).' ]}
</td>
</tr>
</tbody>';
echo '
<script type="text/javascript">
$( document ).ready(function() {
$(\'input[name="'.$nome.'['.$key.'][id_documento]"]\').keyup(function() {
if ( $(\'input[name="'.$nome.'['.$key.'][id_documento]"]\').val() != ""){
$(\'input[name="'.$nome.'['.$key.'][data]"]\').prop("readonly", false);
$(\'input[name="'.$nome.'['.$key.'][num_item]"]\').prop("readonly", false);
$(\'input[name="'.$nome.'['.$key.'][codice_commessa]"]\').prop("readonly", false);
$(\'input[name="'.$nome.'['.$key.'][codice_cup]"]\').prop("readonly", false);
$(\'input[name="'.$nome.'['.$key.'][codice_cig]"]\').prop("readonly", false);
}else{
$(\'input[name="'.$nome.'['.$key.'][data]"]\').prop("readonly", true);
$(\'input[name="'.$nome.'['.$key.'][num_item]"]\').prop("readonly", true);
$(\'input[name="'.$nome.'['.$key.'][codice_commessa]"]\').prop("readonly", true);
$(\'input[name="'.$nome.'['.$key.'][codice_cup]"]\').prop("readonly", true);
$(\'input[name="'.$nome.'['.$key.'][codice_cig]"]\').prop("readonly", true);
}
});
});
</script>';

View File

@ -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),
]);