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); $stringaddbarcode = str_replace("tmphtml", $htmltoreplaceby, $stringaddbarcode);
$out .= $stringaddbarcode.' <input type="text" name="barcodeproductqty" class="width50 right" value="1"><br>'; $out .= $stringaddbarcode.' <input type="text" name="barcodeproductqty" class="width50 right" value="1"><br>';
$out .= '<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>'; /*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 ProductBarcodeDoesNotExist=Le produit avec ce code-barres n'existe pas
WarehouseId=ID entrepôt WarehouseId=ID entrepôt
WarehouseRef=Réf 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) { if ($object->status == Inventory::STATUS_VALIDATED) {
print '<center>'; print '<center>';
if ($permissiontoadd) { if (!empty($conf->use_javascript_ajax)) {
/* if ($permissiontoadd) {
if (!empty($conf->barcode->enabled)) { // Link to launch scan tool
print '<a href="#" class="butAction">'.$langs->trans("UpdateByScaningProductBarcode").'</a>'; 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>';
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>';
print '<script>'; // Link to autofill
print '$( document ).ready(function() {'; print '<a id="fillwithexpected" class="marginrightonly paddingright marginleftonly paddingleft" href="#">'.img_picto('', 'autofill', 'class="paddingrightonly"').$langs->trans('AutofillWithExpected').'</a>';
print ' $("#fillwithexpected").on("click",function fillWithExpected(){ print '<script>';
$(".expectedqty").each(function(){ print '$( document ).ready(function() {';
var object = $(this)[0]; print ' $("#fillwithexpected").on("click",function fillWithExpected(){
var objecttofill = $("#"+object.id+"_input")[0]; $(".expectedqty").each(function(){
objecttofill.value = object.innerText; var object = $(this)[0];
}) var objecttofill = $("#"+object.id+"_input")[0];
console.log("Values filled (after click on fillwithexpected)"); objecttofill.value = object.innerText;
disablebuttonmakemovementandclose(); })
return false; console.log("Values filled (after click on fillwithexpected)");
});'; disablebuttonmakemovementandclose();
print '});'; return false;
print '</script>'; });';
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>';
print '<br>'; print '<br>';
@ -623,7 +621,7 @@ if ($object->id > 0) {
var barcodemode = $("input[name=barcodemode]:checked").val(); var barcodemode = $("input[name=barcodemode]:checked").val();
var barcodeproductqty = $("input[name=barcodeproductqty]").val(); var barcodeproductqty = $("input[name=barcodeproductqty]").val();
var textarea = $("textarea[name=barcodelist]").val(); var textarea = $("textarea[name=barcodelist]").val();
var textarray = textarea.split(/[\s,]+/); var textarray = textarea.split(/[\s,;]+/);
var tabproduct = []; var tabproduct = [];
errortab1 = []; errortab1 = [];
errortab2 = []; errortab2 = [];
@ -813,7 +811,12 @@ if ($object->id > 0) {
//Call method to undo changes in real qty //Call method to undo changes in real qty
print '<script>'; print '<script>';
print 'jQuery(document).ready(function() { 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"); console.log("Clear value of inventory line");
id = this.id; id = this.id;
id = id.split("_")[1]; id = id.split("_")[1];