dolibarr 23.0.3
modSubtotals.class.php
1<?php
2/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
6 * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
7 * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
8 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 * or see https://www.gnu.org/
23 */
24
33include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php";
34require_once DOL_DOCUMENT_ROOT.'/subtotals/class/commonsubtotal.class.php';
35
40{
46 public function __construct($db)
47 {
48 $this->db = $db;
49
50 // Id for module (must be unique).
51 // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
52 $this->numero = SUBTOTALS_SPECIAL_CODE;
53 // Key text used to identify module (for permissions, menus, etc...)
54 $this->rights_class = 'subtotals';
55
56 // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
57 // It is used to group modules in module setup page
58 $this->family = "technic";
59 $this->module_position = '42';
60 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
61 $this->name = preg_replace('/^mod/i', '', get_class($this));
62 // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
63 $this->description = "SubTotalModuleDesc";
64 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
65 $this->version = 'dolibarr';
66 // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
67 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
68 // Name of image file used for this module.
69 // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
70 // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
71 $this->picto = 'donation';
72
73 // Data directories to create when module is enabled.
74 // Example: this->dirs = array("/mymodule/temp");
75 $this->dirs = array("/subtotals/temp");
76
77 // Config pages
78 $this->config_page_url = array("subtotals.php");
79
80 // Dependencies
81 $this->hidden = false; // A condition to hide module
82 $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
83 $this->requiredby = array(); // List of module ids to disable if this one is disabled
84 $this->conflictwith = array(); // List of module class names as string this module is in conflict with
85 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
86 $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module
87 $this->langfiles = array("subtotals");
88
89 // Constants
90 // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
91 // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
92 $this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities')
93
94 // Array to add new pages in new tabs
95 //$this->tabs[] = array('data'=>'user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=hrm&id=__ID__'); // We avoid to get one tab for each module. RH data are already in RH tab.
96 $this->tabs[] = array(); // To add a new tab identified by code tabname1
97
98 // Boxes
99 $this->boxes = array(); // List of boxes
100
101 // Permissions
102 $this->rights = array(); // Permission array used by this module
103
104 // Menus
105 //-------
106 $this->menu = 1; // This module add menu entries. They are coded into menu manager.
107
108 $this->module_parts = array('substitutions' => 1);
109 }
110
119 public function init($options = '')
120 {
121 // Permissions
122 $this->remove($options);
123
124 $sql = array(
125 // "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'holiday' AND entity = ".((int) $conf->entity),
126 // "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','holiday',".((int) $conf->entity).")"
127 );
128
129 return $this->_init($sql, $options);
130 }
131}
Class DolibarrModules.
_init($array_sql, $options='')
Enables a module.
Description and activation class for module subtotals.
__construct($db)
Constructor.
init($options='')
Function called when module is enabled.
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:128