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