diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index 4ee6084aaf6e86e1c95936665a38abb3b62a17b3..ff23fd4bffa38091cdef5e19c39e4aa58cd8a7b0 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -1,7 +1,8 @@ <?php -/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> +/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es> * * 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 @@ -10,7 +11,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -18,11 +19,11 @@ */ /** - * \defgroup barcode Module barcode - * \brief Module pour gerer les codes barres - * \file htdocs/core/modules/modBarcode.class.php - * \ingroup barcode,produit - * \brief Fichier de description et activation du module Barcode + * \defgroup barcode Module barcode + * \brief Module pour gerer les codes barres + * \file htdocs/core/modules/modBarcode.class.php + * \ingroup barcode,produit + * \brief Fichier de description et activation du module Barcode */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; @@ -34,9 +35,9 @@ class modBarcode extends DolibarrModules { /** - * Constructor. Define names, constants, directories, boxes, permissions + * Constructor. Define names, constants, directories, boxes, permissions * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ function __construct($db) { @@ -56,7 +57,7 @@ class modBarcode extends DolibarrModules $this->dirs = array("/barcode/temp"); // Dependances - $this->depends = array(); // May be used for product or service or third party module + $this->depends = array(); // May be used for product or service or third party module $this->requiredby = array(); // Config pages @@ -90,43 +91,43 @@ class modBarcode extends DolibarrModules $this->rights[2][3] = 0; // La permission est-elle une permission par defaut $this->rights[2][4] = 'creer_advance'; - // Main menu entries - $r=0; - $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?mainmenu=tools&leftmenu=barcodeprint', - 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>200, - '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 + // Main menu entries + $r=0; + $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?mainmenu=tools&leftmenu=barcodeprint', + 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>200, + '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'=>'$user->rights->barcode->lire_advance', // 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++; - $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=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 'titre'=>'MassBarcodeInit', 'url'=>'/barcode/codeinit.php?mainmenu=home&leftmenu=modulesadmintools', - 'langs'=>'products', // 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'=>300, - 'enabled'=>'$conf->barcode->enabled && $leftmenu=="modulesadmintools"', // 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 && $leftmenu=="modulesadmintools"', // 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'=>'$user->rights->barcode->creer_advance', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', - 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both + 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both $r++; } - /** - * Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. - * It also creates data directories. - * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories. + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO */ function init($options='') {