From 6c3c66c45ddd8b66b600b003f04a1fba96a0ce3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jan 2014 12:29:20 +0100 Subject: [PATCH] New: Add menu entry to barcode genration page. --- ChangeLog | 1 + htdocs/core/class/commonobject.class.php | 10 ++++++---- htdocs/core/modules/modBarcode.class.php | 12 +++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4bfb6e73595..63c19ea52e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ For users: - New: Add graph stats for suppliers orders in tab "stats" on products. - New: Add option MAIN_HIDE_INACTIVETAB_ON_PRINT to hide inactive tabs when you use the "print" view on screen. +- New: Add menu entry to barcode genration page. For translators: - Update language files. diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index aa53d92d6c6..3434452c91d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -593,9 +593,11 @@ abstract class CommonObject /** - * Load data for barcode + * Load data for barcode into properties ->barcode_type* + * Properties ->barcode_type is used to find others. + * If not defined, ->element must be defined to know default barcode type. * - * @return int <0 if KO, >=0 if OK + * @return int <0 if KO, >=0 if OK */ function fetch_barcode() { @@ -2094,7 +2096,7 @@ abstract class CommonObject } $this->db->free($resql); - + if ($numrows) return $numrows; else return 0; } @@ -2150,7 +2152,7 @@ abstract class CommonObject $error=0; if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used - + if (! empty($this->array_options)) { // Check parameters diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index 899ad76b9fc..dc2614bdfcb 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -96,14 +96,16 @@ class modBarcode extends DolibarrModules // Main menu entries $r=0; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry + $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'mainmenu'=>'tools', + 'leftmenu'=>'barcodeprint', + 'type'=>'left', // This is a Left menu entry 'titre'=>'BarCodePrintsheet', 'url'=>'/barcode/printsheet.php', - 'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>200, - 'enabled'=>'$leftmenu==\'modulesadmintools\' && $conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++;