dolibarr 19.0.3
modDynamicPrices.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2014 Ion Agorria <ion@agorria.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
25include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
26
27
32{
38 public function __construct($db)
39 {
40 $this->db = $db;
41 $this->numero = 2200;
42
43 $this->family = "products";
44 $this->module_position = '85';
45 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
46 $this->name = preg_replace('/^mod/i', '', get_class($this));
47 $this->description = "Enable the usage of math expressions for prices";
48 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
49 $this->version = 'experimental';
50 // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
51 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
52 // Name of image file used for this module.
53 $this->picto = 'dynamicprice';
54
55 // Data directories to create when module is enabled
56 $this->dirs = array();
57
58 // Config pages
59 //-------------
60 $this->config_page_url = array("dynamic_prices.php@product");
61
62 // Dependancies
63 //-------------
64 $this->depends = array();
65 $this->requiredby = array();
66 $this->langfiles = array("other");
67
68 // Constants
69 //-----------
70 $this->const = array();
71
72 // New pages on tabs
73 // -----------------
74 $this->tabs = array();
75
76 // Boxes
77 //------
78 $this->boxes = array();
79
80 // Permissions
81 //------------
82 $this->rights = array();
83 $this->rights_class = 'dynamicprices';
84 $r = 0;
85 }
86
95 public function init($options = '')
96 {
97 $result = $this->_load_tables('/install/mysql/', 'dynamicprices');
98 if ($result < 0) {
99 return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
100 }
101
102 // Remove permissions and default values
103 $this->remove($options);
104
105 $sql = array();
106
107 return $this->_init($sql, $options);
108 }
109}
Class DolibarrModules.
_init($array_sql, $options='')
Enables a module.
_load_tables($reldir, $onlywithsuffix='')
Create tables and keys required by module:
Class descriptor of DynamicPrices module.
init($options='')
Function called when module is enabled.
__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:124