dolibarr  13.0.2
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 
26 include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
27 
28 
33 {
34 
40  public function __construct($db)
41  {
42  $this->db = $db;
43 
44  // Id for module (must be unique).
45  // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
46  $this->numero = 6000;
47  // Key text used to identify module (for permissions, menus, etc...)
48  $this->rights_class = 'workflow';
49 
50  $this->family = "technic";
51  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
52  $this->name = preg_replace('/^mod/i', '', get_class($this));
53  // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
54  $this->description = "Workflow management";
55  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
56  $this->version = 'dolibarr';
57  // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
58  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
59  // Name of png file (without png) used for this module.
60  // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
61  // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
62  $this->picto = 'technic';
63 
64  // Data directories to create when module is enabled
65  $this->dirs = array("/workflow/temp");
66 
67  // Config pages. Put here list of php page names stored in admmin directory used to setup module.
68  $this->config_page_url = array('workflow.php');
69 
70  // Dependencies
71  $this->hidden = false; // A condition to hide module
72  $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
73  $this->requiredby = array(); // List of module ids to disable if this one is disabled
74  $this->conflictwith = array(); // List of module class names as string this module is in conflict with
75  $this->phpmin = array(5, 4); // Minimum version of PHP required by module
76  $this->need_dolibarr_version = array(2, 8); // Minimum version of Dolibarr required by module
77  $this->langfiles = array("@workflow");
78 
79  // Constants
80  // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
81  // Example: $this->const=array(1 => array('MYMODULE_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
82  // 2 => array('MYMODULE_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
83  // );
84  $this->const = array(
85  //0=>array('WORKFLOW_PROPAL_AUTOCREATE_ORDER', 'chaine', '1', 'WORKFLOW_PROPAL_AUTOCREATE_ORDER', 0, 'current', 0),
86  //0=>array('WORKFLOW_ORDER_AUTOCREATE_INVOICE', 'chaine', '1', 'WORKFLOW_ORDER_AUTOCREATE_INVOICE', 0, 'current', 0),
87  0=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 0, 'current', 0),
88  1=>array('WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 0, 'current', 0),
89  2=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 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_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),
93  7=>array('WORKFLOW_BILL_ON_RECEPTION', 'chaine', '1', 'WORKFLOW_BILL_ON_RECEPTION', 0, 'current', 0)
94  );
95 
96  // Boxes
97  $this->boxes = array();
98 
99  // Permissions
100  $this->rights = array();
101  $r = 0;
102 
103  /*
104  $r++;
105  $this->rights[$r][0] = 6001; // id de la permission
106  $this->rights[$r][1] = "Lire les workflow"; // libelle de la permission
107  $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
108  $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
109  $this->rights[$r][4] = 'read';
110  */
111 
112  // Main menu entries
113  $this->menus = array(); // List of menus to add
114  $r = 0;
115  /*
116  $this->menu[$r]=array('fk_menu'=>0,
117  'type'=>'top',
118  'titre'=>'Workflow',
119  'mainmenu'=>'workflow',
120  'url'=>'/workflow/index.php',
121  'langs'=>'@workflow',
122  'position'=>100,
123  'perms'=>'$user->rights->workflow->read',
124  'enabled'=>'$conf->workflow->enabled',
125  'target'=>'',
126  'user'=>0);
127  $r++;
128 
129  $this->menu[$r]=array( 'fk_menu'=>'r=0',
130  'type'=>'left',
131  'titre'=>'Workflow',
132  'mainmenu'=>'workflow',
133  'url'=>'/workflow/index.php',
134  'langs'=>'@workflow',
135  'position'=>101,
136  'enabled'=>1,
137  'perms'=>'$user->rights->workflow->read',
138  'target'=>'',
139  'user'=>0);
140  $r++;
141  */
142  }
143 
144 
153  public function init($options = '')
154  {
155  // Permissions
156  $this->remove($options);
157 
158  $sql = array();
159 
160  return $this->_init($sql, $options);
161  }
162 }
init($options= '')
Function called when module is enabled.
Class DolibarrModules.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:750
__construct($db)
Constructor.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:108
$conf db
API class for accounts.
Definition: inc.php:54
Class to describe and enable module Workflow.
_init($array_sql, $options= '')
Enables a module.