1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-24 14:31:42 +01:00

Se ci sono seriali caricati per l'articolo, 'abilita serial' è attivo e in sola lettura

This commit is contained in:
Luca 2018-03-27 01:12:34 +02:00
parent b128541c35
commit 5802c3f932
2 changed files with 3 additions and 2 deletions

View File

@ -69,6 +69,7 @@ $_SESSION['superselect']['id_categoria'] = $records[0]['id_categoria'];
</div>
<?php
($records[0]['serial']>0) ? $records[0]['abilita_serial'] = 1 : $records[0]['abilita_serial'] = $records[0]['abilita_serial'];
if (empty($records[0]['abilita_serial'])) {
$plugin = $dbo->fetchArray("SELECT id FROM zz_plugins WHERE name='Serial'");
echo '<script>$("#link-tab_'.$plugin[0]['id'].'").addClass("disabled");</script>';
@ -76,7 +77,7 @@ $_SESSION['superselect']['id_categoria'] = $records[0]['id_categoria'];
?>
<div class="col-md-3">
{[ "type": "checkbox", "label": "<?php echo tr('Abilita serial number'); ?>", "name": "abilita_serial", "value": "$abilita_serial$", "help": "", "placeholder": "<?php echo tr('Abilita serial number in fase di aggiunta articolo in fattura o ddt'); ?>" ]}
{[ "type": "checkbox", "label": "<?php echo tr('Abilita serial number'); ?>", "name": "abilita_serial", "value": "$abilita_serial$", "help": "", "placeholder": "<?php echo tr('Abilita serial number in fase di aggiunta articolo in fattura o ddt'); ?>", "extra": "<?php echo ($records[0]['serial']>0) ? 'readonly' : ''; ?>" ]}
</div>

View File

@ -3,5 +3,5 @@
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
$records = $dbo->fetchArray('SELECT * FROM mg_articoli WHERE id='.prepare($id_record));
$records = $dbo->fetchArray('SELECT *, (SELECT COUNT(id) FROM mg_prodotti WHERE id_articolo = mg_articoli.id) AS serial FROM mg_articoli WHERE id='.prepare($id_record));
}