Merge pull request #6061 from mrsof/patch-6
Fix: Product barcode generation in edit mode
This commit is contained in:
commit
592b9d0b20
@ -14,6 +14,7 @@
|
|||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
|
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -820,6 +821,23 @@ $formfile = new FormFile($db);
|
|||||||
$formproduct = new FormProduct($db);
|
$formproduct = new FormProduct($db);
|
||||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||||
|
|
||||||
|
// Load object modBarCodeProduct
|
||||||
|
$res=0;
|
||||||
|
if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM))
|
||||||
|
{
|
||||||
|
$module=strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM);
|
||||||
|
$dirbarcode=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']);
|
||||||
|
foreach ($dirbarcode as $dirroot)
|
||||||
|
{
|
||||||
|
$res=dol_include_once($dirroot.$module.'.php');
|
||||||
|
if ($res) break;
|
||||||
|
}
|
||||||
|
if ($res > 0)
|
||||||
|
{
|
||||||
|
$modBarCodeProduct =new $module();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||||
{
|
{
|
||||||
@ -857,22 +875,6 @@ else
|
|||||||
$modCodeProduct = new $module();
|
$modCodeProduct = new $module();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load object modBarCodeProduct
|
|
||||||
if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM))
|
|
||||||
{
|
|
||||||
$module=strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM);
|
|
||||||
$dirbarcode=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']);
|
|
||||||
foreach ($dirbarcode as $dirroot)
|
|
||||||
{
|
|
||||||
$res=dol_include_once($dirroot.$module.'.php');
|
|
||||||
if ($res) break;
|
|
||||||
}
|
|
||||||
if ($res > 0)
|
|
||||||
{
|
|
||||||
$modBarCodeProduct =new $module();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
@ -1483,10 +1485,13 @@ else
|
|||||||
if (($action != 'editbarcodetype') && ! empty($user->rights->produit->creer) && $createbarcode) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbarcodetype&id='.$object->id.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
|
if (($action != 'editbarcodetype') && ! empty($user->rights->produit->creer) && $createbarcode) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbarcodetype&id='.$object->id.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if ($action == 'editbarcodetype')
|
if ($action == 'editbarcodetype' || $action == 'editbarcode')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
||||||
$formbarcode = new FormBarCode($db);
|
$formbarcode = new FormBarCode($db);
|
||||||
|
}
|
||||||
|
if ($action == 'editbarcodetype')
|
||||||
|
{
|
||||||
$formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'fk_barcode_type');
|
$formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'fk_barcode_type');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1506,11 +1511,14 @@ else
|
|||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if ($action == 'editbarcode')
|
if ($action == 'editbarcode')
|
||||||
{
|
{
|
||||||
|
$tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode;
|
||||||
|
if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type);
|
||||||
|
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="setbarcode">';
|
print '<input type="hidden" name="action" value="setbarcode">';
|
||||||
print '<input type="hidden" name="barcode_type_code" value="'.$object->barcode_type_code.'">';
|
print '<input type="hidden" name="barcode_type_code" value="'.$object->barcode_type_code.'">';
|
||||||
print '<input size="40" class="maxwidthonsmartphone" type="text" name="barcode" value="'.$object->barcode.'">';
|
print '<input size="40" class="maxwidthonsmartphone" type="text" name="barcode" value="'.$tmpcode.'">';
|
||||||
print ' <input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print ' <input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user