This commit is contained in:
Laurent Destailleur 2021-12-19 15:59:34 +01:00
parent e2e2e69379
commit 19afcbbc40
3 changed files with 38 additions and 33 deletions

View File

@ -88,7 +88,7 @@ class FormOther
$stringaddbarcode = str_replace("tmphtml", $htmltoreplaceby, $stringaddbarcode);
$out .= $stringaddbarcode.' <input type="text" name="barcodeproductqty" class="width50 right" value="1"><br>';
$out .= '<br>';
$out .= '<textarea type="text" name="barcodelist" class="centpercent" autofocus rows="'.ROWS_3.'"></textarea>';
$out .= '<textarea type="text" name="barcodelist" class="centpercent" autofocus rows="'.ROWS_3.'" placeholder="'.$langs->trans("ScanOrTypeOrCopyPasteYouBarCode").'"></textarea>';
/*print '<br>'.$langs->trans("or").'<br>';

View File

@ -264,3 +264,5 @@ ProductBatchDoesNotExist=Le produit avec ce lot/série n'existe pas
ProductBarcodeDoesNotExist=Le produit avec ce code-barres n'existe pas
WarehouseId=ID entrepôt
WarehouseRef=Réf entrepôt
ClearQtys=Reset quantities
ScanOrTypeOrCopyPasteYouBarCode=Scan your barcodes, type them or copy-paste them (use new line, tab or space or ',' or ';' as separator)

View File

@ -567,37 +567,35 @@ if ($object->id > 0) {
if ($object->status == Inventory::STATUS_VALIDATED) {
print '<center>';
if ($permissiontoadd) {
/*
if (!empty($conf->barcode->enabled)) {
print '<a href="#" class="butAction">'.$langs->trans("UpdateByScaningProductBarcode").'</a>';
}
if (!empty($conf->productbatch->enabled)) {
print '<a href="#" class="butAction">'.$langs->trans('UpdateByScaningLot').'</a>';
}*/
if (!empty($conf->barcode->enabled) || !empty($conf->productbatch->enabled)) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatebyscaning" class="">'.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").'</a>';
}
} else {
print '<a class="classfortooltip marginrightonly paddingright marginleftonly paddingleft" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Save").'</a>'."\n";
}
if ($permissiontoadd && $conf->use_javascript_ajax) {
print '<a id="fillwithexpected" class="marginrightonly paddingright marginleftonly paddingleft" href="#">'.img_picto('', 'autofill', 'class="paddingrightonly"').$langs->trans('AutofillWithExpected').'</a>';
if (!empty($conf->use_javascript_ajax)) {
if ($permissiontoadd) {
// Link to launch scan tool
if (!empty($conf->barcode->enabled) || !empty($conf->productbatch->enabled)) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatebyscaning" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").'</a>';
}
print '<script>';
print '$( document ).ready(function() {';
print ' $("#fillwithexpected").on("click",function fillWithExpected(){
$(".expectedqty").each(function(){
var object = $(this)[0];
var objecttofill = $("#"+object.id+"_input")[0];
objecttofill.value = object.innerText;
})
console.log("Values filled (after click on fillwithexpected)");
disablebuttonmakemovementandclose();
return false;
});';
print '});';
print '</script>';
// Link to autofill
print '<a id="fillwithexpected" class="marginrightonly paddingright marginleftonly paddingleft" href="#">'.img_picto('', 'autofill', 'class="paddingrightonly"').$langs->trans('AutofillWithExpected').'</a>';
print '<script>';
print '$( document ).ready(function() {';
print ' $("#fillwithexpected").on("click",function fillWithExpected(){
$(".expectedqty").each(function(){
var object = $(this)[0];
var objecttofill = $("#"+object.id+"_input")[0];
objecttofill.value = object.innerText;
})
console.log("Values filled (after click on fillwithexpected)");
disablebuttonmakemovementandclose();
return false;
});';
print '});';
print '</script>';
// Link to reset qty
print '<a href="#" id="clearqty" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto('', 'eraser', 'class="paddingrightonly"').$langs->trans("ClearQtys").'</a>';
} else {
print '<a class="classfortooltip marginrightonly paddingright marginleftonly paddingleft" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Save").'</a>'."\n";
}
}
print '<br>';
print '<br>';
@ -623,7 +621,7 @@ if ($object->id > 0) {
var barcodemode = $("input[name=barcodemode]:checked").val();
var barcodeproductqty = $("input[name=barcodeproductqty]").val();
var textarea = $("textarea[name=barcodelist]").val();
var textarray = textarea.split(/[\s,]+/);
var textarray = textarea.split(/[\s,;]+/);
var tabproduct = [];
errortab1 = [];
errortab2 = [];
@ -813,7 +811,12 @@ if ($object->id > 0) {
//Call method to undo changes in real qty
print '<script>';
print 'jQuery(document).ready(function() {
$(".undochangesqty").on("click",function undochangesqty() {
$("#clearqty").on("click", function() {
console.log("Clear all values");
jQuery(".realqty").val("");
return false; /* disable submit */
});
$(".undochangesqty").on("click", function undochangesqty() {
console.log("Clear value of inventory line");
id = this.id;
id = id.split("_")[1];