dolibarr 25.0.0-alpha
modWorkflow.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2026 Frédéric France <frederic.france@free.fr>
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 $this->db = $db;
44
45 // Id for module (must be unique).
46 // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
47 $this->numero = 6000;
48 // Key text used to identify module (for permissions, menus, etc...)
49 $this->rights_class = 'workflow';
50
51 $this->family = "technic";
52 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53 $this->name = preg_replace('/^mod/i', '', get_class($this));
54 // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
55 $this->description = "Inter-modules workflow management";
56 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57 $this->version = 'dolibarr';
58 // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
59 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60 // Name of png file (without png) used for this module.
61 // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
62 // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
63 $this->picto = 'technic';
64
65 // Data directories to create when module is enabled
66 $this->dirs = array("/workflow/temp");
67
68 // Config pages. Put here list of php page names stored in admmin directory used to setup module.
69 $this->config_page_url = array('workflow.php');
70
71 // Dependencies
72 $this->hidden = false; // A condition to hide module
73 $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
74 $this->requiredby = array(); // List of module ids to disable if this one is disabled
75 $this->conflictwith = array(); // List of module class names as string this module is in conflict with
76 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
77 $this->need_dolibarr_version = array(2, 8); // Minimum version of Dolibarr required by module
78 $this->langfiles = array("@workflow");
79
80 // Constants
81 // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
82 // Example: $this->const=array(1 => array('MYMODULE_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
83 // 2 => array('MYMODULE_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
84 // );
85 $this->const = array(
86 //0=>array('WORKFLOW_PROPAL_AUTOCREATE_ORDER', 'chaine', '1', 'WORKFLOW_PROPAL_AUTOCREATE_ORDER', 0, 'current', 0),
87 //0=>array('WORKFLOW_ORDER_AUTOCREATE_INVOICE', 'chaine', '1', 'WORKFLOW_ORDER_AUTOCREATE_INVOICE', 0, 'current', 0),
88 0 => array('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 0, 'current', 0),
89 1 => array('WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 0, 'current', 0),
90 2 => array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 0, 'current', 0),
91 3 => array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 0, 'current', 0),
92 4 => array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0),
93 5 => array('WORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0),
94 6 => array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0),
95 7 => array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0),
96 8 => array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0),
97 9 => array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),
98 10 => array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0),
99 11 => array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0),
100 12 => array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '0', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0),
101 );
102
103 // Boxes
104 $this->boxes = array();
105
106 // Permissions
107 $this->rights = array();
108 $r = 0;
109
110 /*
111 $r++;
112 $this->rights[$r][0] = 6001; // Permission id (must not be already used)
113 $this->rights[$r][1] = "Lire les workflow"; // Permission label
114 $this->rights[$r][2] = 'r'; // Permission type (deprecated)
115 $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
116 $this->rights[$r][4] = 'read';
117 */
118
119 // Main menu entries
120 $this->menu = array(); // List of menus to add
121 $r = 0;
122 /*
123 $this->menu[$r]=array('fk_menu'=>0,
124 'type'=>'top',
125 'titre'=>'Workflow',
126 'mainmenu'=>'workflow',
127 'url'=>'/workflow/index.php',
128 'langs'=>'@workflow',
129 'position'=>100,
130 'perms'=>'$user->hasRights("workflow", "read")',
131 'enabled'=>'isModEnabled("workflow")',
132 'target'=>'',
133 'user'=>0);
134 $r++;
135
136 $this->menu[$r]=array( 'fk_menu'=>'r=0',
137 'type'=>'left',
138 'titre'=>'Workflow',
139 'mainmenu'=>'workflow',
140 'url'=>'/workflow/index.php',
141 'langs'=>'@workflow',
142 'position'=>101,
143 'enabled'=>'isModEnabled("workflow")',
144 'perms'=>'$user->hasRight("workflow", "read")',
145 'target'=>'',
146 'user'=>0);
147 $r++;
148 */
149 }
150
151
160 public function init($options = '')
161 {
162 // Permissions
163 $this->remove($options);
164
165 $sql = array();
166
167 return $this->_init($sql, $options);
168 }
169}
Class DolibarrModules.
_init($array_sql, $options='')
Enables a module.
Class to describe and enable module Workflow.
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