From 91be05932e4ef150e2d525c598fb503698c019fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 27 Nov 2016 21:50:27 +0100 Subject: [PATCH] Added missing modAttributes file --- htdocs/core/modules/modAttributes.class.php | 137 ++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 htdocs/core/modules/modAttributes.class.php diff --git a/htdocs/core/modules/modAttributes.class.php b/htdocs/core/modules/modAttributes.class.php new file mode 100644 index 00000000000..a21ae756bf2 --- /dev/null +++ b/htdocs/core/modules/modAttributes.class.php @@ -0,0 +1,137 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2016 Marcos GarcĂ­a + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \defgroup produit Module product attributes + * \brief Module to manage product combinations based on product attributes + * \file htdocs/core/modules/modAttributes.class.php + * \ingroup produit + * \brief File to describe module to manage catalog of predefined products + */ +include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; + + +/** + * Description and activation class for module Product attributes + */ +class modAttributes extends DolibarrModules +{ + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $langs,$conf; + + $this->db = $db; + + // Id for module (must be unique). + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). + $this->numero = 610; + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'attributes'; + + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' + // It is used to group modules in module setup page + $this->family = "products"; + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) + $this->name = preg_replace('/^mod/i','',get_class($this)); + // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) + $this->description = 'Allows creating product combinations based on product attributes'; + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) + $this->special = 0; + // Name of image file used for this module. + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' + $this->picto='product'; + + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) + $this->module_parts = array(); + + // Data directories to create when module is enabled. + // Example: this->dirs = array("/mymodule/temp"); + $this->dirs = array(); + + // Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module. + $this->config_page_url = array( + 'admin.php@attributes' + ); + + // Dependencies + $this->hidden = false; // A condition to hide module + $this->depends = array( + 'modProduct' + ); // List of modules id that must be enabled if this module is enabled + $this->requiredby = array(); // List of modules id to disable if this one is disabled + $this->conflictwith = array(); // List of modules id this module is in conflict with + $this->phpmin = array(5,0); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module + $this->langfiles = array("products"); + + // Constants + $this->const = array(); + + // Array to add new pages in new tabs + $this->tabs = array( +// 'product:+combinations:Combinaciones:products:1:/attributes/combinations.php?id=__ID__' + ); + + // Dictionaries + if (! isset($conf->mymodule->enabled)) + { + $conf->mymodule=new stdClass(); + $conf->mymodule->enabled=0; + } + $this->dictionaries=array(); + + // Boxes + // Add here list of php file(s) stored in core/boxes that contains class to show a box. + $this->boxes = array(); // List of boxes + + // Permissions + $this->rights = array(); // Permission array used by this module + + // Main menu entries + $this->menu = array( + array( + 'fk_menu' => 'fk_mainmenu=products,fk_leftmenu=product', + 'type' => 'left', + 'titre' => $langs->trans('Attributes'), + 'mainmenu' => 'products', + 'leftmenu' => 'product', + 'url' => '/attributes/list.php', + 'langs' => 'products', + 'position' => 100, + 'enabled' => '$conf->product->enabled', + 'perms' => 1, + 'target' => '', + 'user' => 0 + ) + ); // List of menus to add + } +} +