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