dolibarr 21.0.0-alpha
modVariants.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2016 Marcos GarcĂ­a <marcosgdf@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
28include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
29
30
35{
41 public function __construct($db)
42 {
43 global $langs, $conf;
44
45 $this->db = $db;
46
47 // Id for module (must be unique).
48 // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
49 $this->numero = 610;
50 // Key text used to identify module (for permissions, menus, etc...)
51 $this->rights_class = 'variants';
52
53 // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
54 // It is used to group modules in module setup page
55 $this->family = "products";
56 // Module position in the family on 2 digits ('01', '10', '20', ...)
57 $this->module_position = '50';
58 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
59 $this->name = preg_replace('/^mod/i', '', get_class($this));
60 // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
61 $this->description = 'Allows creating products variant based on new attributes';
62 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
63 $this->version = 'dolibarr';
64 // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
65 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
66 // Name of image file used for this module.
67 // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
68 // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
69 $this->picto = 'product';
70
71 // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
72 $this->module_parts = array();
73
74 // Data directories to create when module is enabled.
75 // Example: this->dirs = array("/variants/temp");
76 $this->dirs = array();
77
78 // Config pages. Put here list of php page, stored into variants/admin directory, to use to setup module.
79 $this->config_page_url = array('admin.php@variants');
80
81 // Dependencies
82 $this->hidden = false; // A condition to hide module
83 $this->depends = array('modProduct'); // List of module class names as string that must be enabled if this module is enabled
84 $this->requiredby = array(); // List of module ids to disable if this one is disabled
85 $this->conflictwith = array(); // List of module class names as string this module is in conflict with
86 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
87 $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module
88 $this->langfiles = array("products");
89
90 // Constants
91 $this->const = array();
92
93 // Array to add new pages in new tabs
94 $this->tabs = array(
95 // 'product:+combinations:Combinaciones:products:1:/variants/combinations.php?id=__ID__'
96 );
97
98 // Dictionaries
99 if (!isset($conf->variants->enabled)) {
100 $conf->variants = new stdClass();
101 $conf->variants->enabled = 0;
102 }
103 $this->dictionaries = array();
104
105 // Boxes
106 // Add here list of php file(s) stored in core/boxes that contains class to show a box.
107 $this->boxes = array(); // List of boxes
108
109 // Permissions
110 $this->rights = array(); // Permission array used by this module
111 $r = 0;
112
113 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
114 $this->rights[$r][1] = 'Read attributes of variants'; // Permission label
115 $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
116 $r++;
117 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
118 $this->rights[$r][1] = 'Create/Update attributes of variants'; // Permission label
119 $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
120 $r++;
121 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
122 $this->rights[$r][1] = 'Delete attributes of variants'; // Permission label
123 $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
124 $r++;
125 }
126}
Class DolibarrModules.
Description and activation class for module Product variants.
__construct($db)
Constructor.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:142