diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index bfa124c02e5..21fd07d9ba7 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -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 "\n"; + +print "
"; + +/* + * Autres options + * + */ +print_titre($langs->trans("OtherOptions")); + +$var=true; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +// Chemin du binaire genbarcode sous linux +if (!isset($_ENV['windir']) && !file_exists($_ENV['windir'])) +{ + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; +} + +// Module produits +if ($conf->produit->enabled) +{ + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; +} + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'.$langs->trans("GenbarcodeLocation").''; + print ''; + print '
'.$langs->trans("UseBarcodeInProductModule").''; + print $html->selectyesno('value',$conf->global->PRODUIT_USE_BARCODE,1); + print '
'; /* //EAN13 $var=!$var; @@ -208,7 +271,6 @@ if ($resql) print "\n"; $i++; */ -print "\n"; print "
"; diff --git a/htdocs/includes/barcode/php-barcode/php-barcode.php b/htdocs/includes/barcode/php-barcode/php-barcode.php index 629420ccdd8..0ffd4813414 100644 --- a/htdocs/includes/barcode/php-barcode/php-barcode.php +++ b/htdocs/includes/barcode/php-barcode/php-barcode.php @@ -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; } diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index 3d297d2a3fb..50b18efdae0 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -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 diff --git a/mysql/data/data.sql b/mysql/data/data.sql index 8ddfee04ed7..b8dbc7a18ec 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -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 -- diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql index 56f27144a46..352888f5925 100644 --- a/mysql/migration/2.1.0-2.2.0.sql +++ b/mysql/migration/2.1.0-2.2.0.sql @@ -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; \ No newline at end of file +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); \ No newline at end of file