mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-03 01:08:08 +01:00
Aggiunto controllo per seriali duplicati
This commit is contained in:
parent
122936c7fa
commit
2fff505752
@ -895,6 +895,13 @@ switch (post('op')) {
|
||||
$fattura->data_competenza = post('data');
|
||||
$fattura->save();
|
||||
|
||||
break;
|
||||
|
||||
case 'controlla_serial':
|
||||
$has_serial = $dbo->fetchOne('SELECT id FROM mg_prodotti WHERE serial='.prepare(post('serial')).' AND dir="uscita" AND id_articolo='.prepare(post('id_articolo')).' AND (id_riga_documento IS NOT NULL OR id_riga_ordine IS NOT NULL OR id_riga_ddt IS NOT NULL)')['id'];
|
||||
|
||||
echo json_encode($has_serial);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ if ($dir == 'entrata') {
|
||||
|
||||
echo '
|
||||
<div class="col-md-4">
|
||||
{[ "type": "text", "name": "serial[]", "value": "'.$serials[$i].'"'.(!empty($res) ? ', "readonly": 1' : '').' ]}';
|
||||
{[ "type": "text", "name": "serial[]", "class": "serial", "value": "'.$serials[$i].'"'.(!empty($res) ? ', "readonly": 1' : '').' ]}';
|
||||
|
||||
if (!empty($res)) {
|
||||
if (!empty($res[0]['id_riga_intervento'])) {
|
||||
@ -143,6 +143,40 @@ if ($dir == 'entrata') {
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
|
||||
$module_fatture = Modules::get('Fatture di acqusito')['id'];
|
||||
echo '
|
||||
<br>
|
||||
<div class="alert alert-warning text-center has_serial hidden">
|
||||
<i class="fa fa-warning"></i>
|
||||
<b>'.tr('Attenzione!').'</b> '.tr('Il Serial su questo articolo è già stato utilizzato in un altro documento di acquisto').'.
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(".serial").on("keyup", function() {
|
||||
$.ajax({
|
||||
url: globals.rootdir + "/actions.php",
|
||||
type: "post",
|
||||
data: {
|
||||
id_module: "'.$module_fatture.'",
|
||||
id_record: globals.id_record,
|
||||
serial: $(this).val(),
|
||||
id_articolo: input("idarticolo").get(),
|
||||
op: "controlla_serial",
|
||||
},
|
||||
success: function(data){
|
||||
data = JSON.parse(data);
|
||||
if (data) {
|
||||
$(".has_serial").removeClass("hidden");
|
||||
$("#aggiorna").addClass("disabled");
|
||||
} else {
|
||||
$(".has_serial").addClass("hidden");
|
||||
$("#aggiorna").removeClass("disabled");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
echo '
|
||||
@ -150,7 +184,7 @@ echo '
|
||||
<!-- PULSANTI -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<button type="submit" class="btn btn-primary pull-right"><i class="fa fa-barcode"></i> '.tr('Aggiorna').'</button>
|
||||
<button type="submit" id="aggiorna" class="btn btn-primary pull-right"><i class="fa fa-barcode"></i> '.tr('Aggiorna').'</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user