Le module code barre va pouvoir tre activ/dsactiv dans diffrents module

This commit is contained in:
Regis Houssin 2007-09-29 20:15:02 +00:00
parent 923e6d8db1
commit ef5f549838
5 changed files with 88 additions and 22 deletions

View File

@ -35,13 +35,25 @@ $langs->load("admin");
if (!$user->admin)
accessforbidden();
if ($_POST["action"] == 'setcoder' && $user->admin)
if ($_POST["action"] == 'setcoder')
{
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = " . $_POST["coder"];
$sqlp.= " WHERE rowid = ". $_POST["code_id"];
$resql=$db->query($sqlp);
}
else if ($_POST["action"] == 'setgenbarcodelocation')
{
dolibarr_set_const($db, "GENBARCODE_LOCATION",$_POST["genbarcodelocation"]);
Header("Location: barcode.php");
exit;
}
else if ($_POST["action"] == 'setproductusebarcode')
{
dolibarr_set_const($db, "PRODUIT_USE_BARCODE",$_POST["value"]);
Header("Location: barcode.php");
exit;
}
$html = new Form($db);
@ -96,6 +108,57 @@ if ($resql)
$i++;
}
}
print "</table>\n";
print "<br>";
/*
* Autres options
*
*/
print_titre($langs->trans("OtherOptions"));
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td width="60" align="center">'.$langs->trans("Value").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
// Chemin du binaire genbarcode sous linux
if (!isset($_ENV['windir']) && !file_exists($_ENV['windir']))
{
$var=!$var;
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="action" value="setgenbarcodelocation">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("GenbarcodeLocation").'</td>';
print '<td width="60" align="center">';
print '<input type="text" size="100" name="genbarcodelocation" value="'.$conf->global->GENBARCODE_LOCATION.'">';
print '</td>';
print '<td width="60" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</form>';
}
// Module produits
if ($conf->produit->enabled)
{
$var=!$var;
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="action" value="setproductusebarcode">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("UseBarcodeInProductModule").'</td>';
print '<td width="60" align="center">';
print $html->selectyesno('value',$conf->global->PRODUIT_USE_BARCODE,1);
print '</td>';
print '<td width="60" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</form>';
}
print '</table>';
/*
//EAN13
$var=!$var;
@ -208,7 +271,6 @@ if ($resql)
print "</td></tr>\n";
$i++;
*/
print "</table>\n";
print "<br>";

View File

@ -83,7 +83,8 @@ if (isset($_ENV['windir']) && file_exists($_ENV['windir']))
}
else
{
$genbarcode_loc="/usr/local/bin/genbarcode";
//$genbarcode_loc = "/usr/local/bin/genbarcode";
$genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
}

View File

@ -50,26 +50,21 @@ function product_prepare_head($product, $user)
//affichage onglet catégorie
if ($conf->categorie->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id;
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';
$h++;
}
{
$head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id;
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';
$h++;
}
if($product->isproduct())
{
if ($user->rights->barcode->lire)
{
if ($conf->barcode->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
$head[$h][1] = $langs->trans("BarCode");
$head[$h][2] = 'barcode';
$h++;
}
// Affichage onglet code barre
if ($product->isproduct() && $conf->barcode->enabled && $user->rights->barcode->lire && $conf->global->PRODUIT_USE_BARCODE)
{
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
$head[$h][1] = $langs->trans("BarCode");
$head[$h][2] = 'barcode';
$h++;
}
}
// Multilangs
// TODO Ecran a virer et à remplacer par

View File

@ -209,6 +209,12 @@ insert into llx_const (name, value, type, visible, note) VALUES ('PROPALE_VALIDI
insert into llx_const(name,value,type,visible,note) values('PRODUCT_SHOW_WHEN_CREATE','0','yesno',1,'Add products list in first step of proposal, invoice, order creation');
--
-- Barcode
--
insert into llx_const (name, value, type, note, visible) values ('GENBARCODE_LOCATION','/usr/local/bin/genbarcode','chaine','location of genbarcode',0);
--
-- Descriptif des plans comptables FR PCG99-ABREGE
--

View File

@ -901,4 +901,6 @@ INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (5,
INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (6, 'C128', 'Code 128', 0, 'ABCD1234567890');
ALTER TABLE llx_product CHANGE gencode barcode varchar(255) DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN fk_barcode_type integer DEFAULT 0 after barcode;
ALTER TABLE llx_product ADD COLUMN fk_barcode_type integer DEFAULT 0 after barcode;
INSERT INTO llx_const (name, value, type, note, visible) VALUES ('GENBARCODE_LOCATION','/usr/local/bin/genbarcode','chaine','location of genbarcode',0);