dolibarr  7.0.0-beta
modVariants.class.php
1 <?php
2 
3 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
4  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
6  * Copyright (C) 2016 Marcos GarcĂ­a <marcosgdf@gmail.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
29 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
30 
31 
36 {
42  public function __construct($db)
43  {
44  global $langs,$conf;
45 
46  $this->db = $db;
47 
48  // Id for module (must be unique).
49  // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
50  $this->numero = 610;
51  // Key text used to identify module (for permissions, menus, etc...)
52  $this->rights_class = 'variants';
53 
54  // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55  // It is used to group modules in module setup page
56  $this->family = "products";
57  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
58  $this->name = preg_replace('/^mod/i','',get_class($this));
59  // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
60  $this->description = 'Allows creating products variant based on new attributes';
61  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
62  $this->version = 'dolibarr';
63  // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
64  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
65  // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
66  $this->special = 0;
67  // Name of image file used for this module.
68  // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
69  // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
70  $this->picto='product';
71 
72  // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
73  $this->module_parts = array();
74 
75  // Data directories to create when module is enabled.
76  // Example: this->dirs = array("/mymodule/temp");
77  $this->dirs = array();
78 
79  // Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module.
80  $this->config_page_url = array(
81  'admin.php@variants'
82  );
83 
84  // Dependencies
85  $this->hidden = false; // A condition to hide module
86  $this->depends = array(
87  'modProduct'
88  ); // List of modules id that must be enabled if this module is enabled
89  $this->requiredby = array(); // List of modules id to disable if this one is disabled
90  $this->conflictwith = array(); // List of modules id this module is in conflict with
91  $this->phpmin = array(5,0); // Minimum version of PHP required by module
92  $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module
93  $this->langfiles = array("products");
94 
95  // Constants
96  $this->const = array();
97 
98  // Array to add new pages in new tabs
99  $this->tabs = array(
100 // 'product:+combinations:Combinaciones:products:1:/variants/combinations.php?id=__ID__'
101  );
102 
103  // Dictionaries
104  if (! isset($conf->mymodule->enabled))
105  {
106  $conf->mymodule=new stdClass();
107  $conf->mymodule->enabled=0;
108  }
109  $this->dictionaries=array();
110 
111  // Boxes
112  // Add here list of php file(s) stored in core/boxes that contains class to show a box.
113  $this->boxes = array(); // List of boxes
114 
115  // Permissions
116  $this->rights = array(); // Permission array used by this module
117 
118  // Main menu entries
119  $this->menu = array(
120  array(
121  'fk_menu' => 'fk_mainmenu=products,fk_leftmenu=product',
122  'type' => 'left',
123  'titre' => 'VariantAttributes',
124  'mainmenu' => 'products',
125  'leftmenu' => 'product',
126  'url' => '/variants/list.php',
127  'langs' => 'products',
128  'position' => 100,
129  'enabled' => '$conf->product->enabled',
130  'perms' => 1,
131  'target' => '',
132  'user' => 0
133  )
134  ); // List of menus to add
135  }
136 }
137 
Class DolibarrModules.
Description and activation class for module Product variants.
</td >< tdclass="liste_titre"align="right"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="'.$i.'"'.$disabled.'></td >< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"></td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:554
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
__construct($db)
Constructor.