diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index ebe28237cc4..528828a628d 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -77,7 +77,10 @@ class FormOther $out .= ' Scan a product barcode
'; $out .= ' Scan a product lot or serial number
'; - $out .= $langs->trans("QtyToAddAfterBarcodeScan").'
'; + $stringaddbarcode = $langs->trans("QtyToAddAfterBarcodeScan", "tmphtml"); + $htmltoreplaceby = ''; + $stringaddbarcode = str_replace("tmphtml", $htmltoreplaceby, $stringaddbarcode); + $out .= $stringaddbarcode.'
'; $out .= ''; /*print '
'.$langs->trans("or").'
'; diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 71e44e8f281..dd1e0ea4027 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -30,7 +30,7 @@ ManageLotMask=Custom mask CustomMasks=Option to define a different numbering mask for each product BatchLotNumberingModules=Numbering rule for automatic generation of lot number BatchSerialNumberingModules=Numbering rule for automatic generation of serial number (for products with property 1 unique lot/serial for each product) -QtyToAddAfterBarcodeScan=Qty to add for each barcode/lot/serial scanned +QtyToAddAfterBarcodeScan=Qty to %s for each barcode/lot/serial scanned LifeTime=Life span (in days) EndOfLife=End of life ManufacturingDate=Manufacturing date @@ -42,3 +42,4 @@ HideLots=Hide lots #Traceability - qc status OutOfOrder=Out of order InWorkingOrder=In working order +ToReplace=Replace \ No newline at end of file diff --git a/htdocs/langs/fr_FR/productbatch.lang b/htdocs/langs/fr_FR/productbatch.lang index ccd5e43d3d7..bcef04e75ed 100644 --- a/htdocs/langs/fr_FR/productbatch.lang +++ b/htdocs/langs/fr_FR/productbatch.lang @@ -30,7 +30,7 @@ ManageLotMask=Masque personnalisé CustomMasks=Option pour définir un masque de numérotation différent pour chaque produit BatchLotNumberingModules=Règle de numérotation pour la génération automatique de numéro de lot BatchSerialNumberingModules=Règle de numérotation pour la génération automatique de numéro de série (pour les produits avec propriété 1 lot/série unique pour chaque produit) -QtyToAddAfterBarcodeScan=Quantité à ajouter pour chaque code à barres/lot/série scanné +QtyToAddAfterBarcodeScan=Quantité à %s pour chaque code à barres/lot/série scanné LifeTime=Durée de vie (en jours) EndOfLife=Fin d'utilisation ManufacturingDate=Date de fabrication diff --git a/htdocs/product/inventory/ajax/ajax.inventory.php b/htdocs/product/inventory/ajax/ajax.inventory.php deleted file mode 100644 index 920607f4c1e..00000000000 --- a/htdocs/product/inventory/ajax/ajax.inventory.php +++ /dev/null @@ -1,47 +0,0 @@ -rights->stock->creer)) { - echo -1; exit; - } - - $fk_det_inventory = GETPOST('fk_det_inventory'); - - $det = new InventoryLine($db); - if ($det->fetch($fk_det_inventory)) { - $det->qty_view += GETPOST('qty'); - $res = $det->update($user); - - echo $det->qty_view; - } else { - echo -2; - } - - break; - - case 'pmp': - if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { - echo -1; exit; - } - - $fk_det_inventory = GETPOST('fk_det_inventory'); - - $det = new InventoryLine($db); - if ($det->fetch($fk_det_inventory)) { - $det->new_pmp = price2num(GETPOST('pmp')); - $det->update($user); - - echo $det->new_pmp; - } else { - echo -2; - } - - break; -} diff --git a/htdocs/product/inventory/ajax/searchfrombarcode.php b/htdocs/product/inventory/ajax/searchfrombarcode.php new file mode 100644 index 00000000000..73b1943f4c7 --- /dev/null +++ b/htdocs/product/inventory/ajax/searchfrombarcode.php @@ -0,0 +1,79 @@ +. + */ + +/** + * \file /htdocs/product/inventory/ajax/searchfrombarcode.php + * \brief File to make Ajax action on product and stock + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); // Disables token renewal +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} +if (!defined('NOREQUIRESOC')) { + define('NOREQUIRESOC', '1'); +} +if (!defined('NOCSRFCHECK')) { + define('NOCSRFCHECK', '1'); +} +// Do not check anti CSRF attack test +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +// If there is no need to load and show top and left menu +if (!defined("NOLOGIN")) { + define("NOLOGIN", '1'); +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', '1'); +} +require '../../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php'; + +$action = GETPOST("action", "alpha"); +$barcode = GETPOST("barcode", "aZ09"); +$response = ""; +$fk_entrepot = -1; +if ($action == "existbarcode" && !empty($barcode)) { + $sql = "SELECT *"; + $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; + " WHERE p.barcode = '".$db->escape($barcode)."'"; + $result = $db->query($sql); + if ($result) { + $objecttab = $db->fetch_row($resql); + $nbline = $db->num_rows($resql); + for ($i=0; $i < $nbline; $i++) { + if ($fk_entrepot != $objecttab[$i]) { + // code... + } + } + } else { + $response = "No results found for barcode"; + } +} else { + $response = "Error on action"; +} + +echo $response; diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 9a4d61209ba..f2702fbc0db 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -542,6 +542,7 @@ if ($object->id > 0) { print ''; } include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $formother = new FormOther($db); - print $formother->getHTMLScannerForm(); + print $formother->getHTMLScannerForm("barcodescannerjs"); } //Call method to undo changes in real qty