@@ -210,15 +210,15 @@ |
||
210 | 210 | */ |
211 | 211 | public function init($options = '') |
212 | 212 | { |
213 | - global $langs; |
|
213 | + global $langs; |
|
214 | 214 | |
215 | - $this->_load_tables('/datapolicy/sql/'); |
|
215 | + $this->_load_tables('/datapolicy/sql/'); |
|
216 | 216 | |
217 | 217 | // Create extrafields |
218 | 218 | include_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
219 | 219 | $extrafields = new ExtraFields($this->db); |
220 | 220 | |
221 | - /* |
|
221 | + /* |
|
222 | 222 | // Extrafield contact |
223 | 223 | $result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled'); |
224 | 224 | $result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled'); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \ingroup datapolicy |
26 | 26 | * \brief Description and activation file for module DATAPOLICY |
27 | 27 | */ |
28 | -include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php'; |
|
28 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' |
73 | 73 | $this->version = 'development'; |
74 | 74 | // Key used in llx_const table to save module status enabled/disabled (where datapolicy is value of property name of module in uppercase) |
75 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
75 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
76 | 76 | // Name of image file used for this module. |
77 | 77 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
78 | 78 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | $this->config_page_url = array("setup.php@datapolicy"); |
103 | 103 | |
104 | 104 | // Dependencies |
105 | - $this->hidden = false; // A condition to hide module |
|
106 | - $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
105 | + $this->hidden = false; // A condition to hide module |
|
106 | + $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
107 | 107 | $this->requiredby = array(); // List of module ids to disable if this one is disabled |
108 | 108 | $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
109 | 109 | $this->langfiles = array("datapolicy@datapolicy"); |
110 | - $this->phpmin = array(5, 3); // Minimum version of PHP required by module |
|
110 | + $this->phpmin = array(5, 3); // Minimum version of PHP required by module |
|
111 | 111 | $this->need_dolibarr_version = array(4, 0); // Minimum version of Dolibarr required by module |
112 | - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
113 | - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
112 | + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
113 | + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
114 | 114 | //$this->automatic_activation = array('FR'=>'datapolicyWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
115 | 115 | //$this->always_enabled = true; // If true, can't be disabled |
116 | 116 | // Constants |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true) |
195 | 195 | // ); |
196 | 196 | // Permissions |
197 | - $this->rights = array(); // Permission array used by this module |
|
197 | + $this->rights = array(); // Permission array used by this module |
|
198 | 198 | // Main menu entries |
199 | - $this->menu = array(); // List of menus to add |
|
199 | + $this->menu = array(); // List of menus to add |
|
200 | 200 | $r = 0; |
201 | 201 | } |
202 | 202 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $this->_load_tables('/datapolicy/sql/'); |
216 | 216 | |
217 | 217 | // Create extrafields |
218 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
218 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
219 | 219 | $extrafields = new ExtraFields($this->db); |
220 | 220 | |
221 | 221 | /* |
@@ -38,386 +38,386 @@ |
||
38 | 38 | class modAgenda extends DolibarrModules |
39 | 39 | { |
40 | 40 | |
41 | - /** |
|
42 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
43 | - * |
|
44 | - * @param DoliDB $db Database handler |
|
45 | - */ |
|
46 | - function __construct($db) |
|
47 | - { |
|
48 | - global $conf, $user; |
|
41 | + /** |
|
42 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
43 | + * |
|
44 | + * @param DoliDB $db Database handler |
|
45 | + */ |
|
46 | + function __construct($db) |
|
47 | + { |
|
48 | + global $conf, $user; |
|
49 | 49 | |
50 | - $this->db = $db; |
|
51 | - $this->numero = 2400; |
|
50 | + $this->db = $db; |
|
51 | + $this->numero = 2400; |
|
52 | 52 | |
53 | - $this->family = "projects"; |
|
54 | - $this->module_position = '15'; |
|
55 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
56 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
57 | - $this->description = "Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking."; |
|
58 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
59 | - $this->version = 'dolibarr'; |
|
60 | - // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
61 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
62 | - $this->picto='action'; |
|
53 | + $this->family = "projects"; |
|
54 | + $this->module_position = '15'; |
|
55 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
56 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
57 | + $this->description = "Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking."; |
|
58 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
59 | + $this->version = 'dolibarr'; |
|
60 | + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
61 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
62 | + $this->picto='action'; |
|
63 | 63 | |
64 | - // Data directories to create when module is enabled |
|
65 | - $this->dirs = array("/agenda/temp"); |
|
64 | + // Data directories to create when module is enabled |
|
65 | + $this->dirs = array("/agenda/temp"); |
|
66 | 66 | |
67 | - // Config pages |
|
68 | - $this->config_page_url = array("agenda_other.php"); |
|
67 | + // Config pages |
|
68 | + $this->config_page_url = array("agenda_other.php"); |
|
69 | 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->langfiles = array("companies"); |
|
76 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
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->langfiles = array("companies"); |
|
76 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
77 | 77 | |
78 | - // Module parts |
|
78 | + // Module parts |
|
79 | 79 | $this->module_parts = array(); |
80 | 80 | |
81 | - // Constants |
|
81 | + // Constants |
|
82 | 82 | //----------- |
83 | 83 | // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
84 | 84 | // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
85 | 85 | // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
86 | 86 | // ); |
87 | - $this->const = array(); |
|
88 | - //$this->const[] = array('AGENDA_DEFAULT_FILTER_TYPE', 'chaine', 'AC_NON_AUTO', 'Default filter for type of event on agenda', 0, 'current'); |
|
89 | - $sqlreadactions="SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; |
|
90 | - $resql = $this->db->query($sqlreadactions); |
|
91 | - if ($resql) |
|
92 | - { |
|
93 | - while ($obj = $this->db->fetch_object($resql)) |
|
94 | - { |
|
95 | - //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). |
|
96 | - if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. |
|
97 | - //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. |
|
98 | - $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); |
|
99 | - } |
|
100 | - } |
|
101 | - else |
|
102 | - { |
|
103 | - dol_print_error($this->db->lasterror()); |
|
104 | - } |
|
87 | + $this->const = array(); |
|
88 | + //$this->const[] = array('AGENDA_DEFAULT_FILTER_TYPE', 'chaine', 'AC_NON_AUTO', 'Default filter for type of event on agenda', 0, 'current'); |
|
89 | + $sqlreadactions="SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; |
|
90 | + $resql = $this->db->query($sqlreadactions); |
|
91 | + if ($resql) |
|
92 | + { |
|
93 | + while ($obj = $this->db->fetch_object($resql)) |
|
94 | + { |
|
95 | + //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). |
|
96 | + if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. |
|
97 | + //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. |
|
98 | + $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); |
|
99 | + } |
|
100 | + } |
|
101 | + else |
|
102 | + { |
|
103 | + dol_print_error($this->db->lasterror()); |
|
104 | + } |
|
105 | 105 | |
106 | - // New pages on tabs |
|
107 | - // ----------------- |
|
108 | - $this->tabs = array(); |
|
106 | + // New pages on tabs |
|
107 | + // ----------------- |
|
108 | + $this->tabs = array(); |
|
109 | 109 | |
110 | - // Boxes |
|
111 | - //------ |
|
112 | - $this->boxes = array(0=>array('file'=>'box_actions.php','enabledbydefaulton'=>'Home')); |
|
110 | + // Boxes |
|
111 | + //------ |
|
112 | + $this->boxes = array(0=>array('file'=>'box_actions.php','enabledbydefaulton'=>'Home')); |
|
113 | 113 | |
114 | - // Cronjobs |
|
115 | - //------------ |
|
116 | - $datestart=dol_now(); |
|
117 | - $this->cronjobs = array( |
|
118 | - 0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->agenda->enabled', 'datestart'=>$datestart), |
|
119 | - ); |
|
114 | + // Cronjobs |
|
115 | + //------------ |
|
116 | + $datestart=dol_now(); |
|
117 | + $this->cronjobs = array( |
|
118 | + 0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->agenda->enabled', 'datestart'=>$datestart), |
|
119 | + ); |
|
120 | 120 | |
121 | - // Permissions |
|
122 | - //------------ |
|
123 | - $this->rights = array(); |
|
124 | - $this->rights_class = 'agenda'; |
|
125 | - $r=0; |
|
121 | + // Permissions |
|
122 | + //------------ |
|
123 | + $this->rights = array(); |
|
124 | + $this->rights_class = 'agenda'; |
|
125 | + $r=0; |
|
126 | 126 | |
127 | - // $this->rights[$r][0] Id permission (unique tous modules confondus) |
|
128 | - // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
|
129 | - // $this->rights[$r][2] Non utilise |
|
130 | - // $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut |
|
131 | - // $this->rights[$r][4] Niveau 1 pour nommer permission dans code |
|
132 | - // $this->rights[$r][5] Niveau 2 pour nommer permission dans code |
|
133 | - // $r++; |
|
127 | + // $this->rights[$r][0] Id permission (unique tous modules confondus) |
|
128 | + // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
|
129 | + // $this->rights[$r][2] Non utilise |
|
130 | + // $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut |
|
131 | + // $this->rights[$r][4] Niveau 1 pour nommer permission dans code |
|
132 | + // $this->rights[$r][5] Niveau 2 pour nommer permission dans code |
|
133 | + // $r++; |
|
134 | 134 | |
135 | - $this->rights[$r][0] = 2401; |
|
136 | - $this->rights[$r][1] = 'Read actions/tasks linked to his account'; |
|
137 | - $this->rights[$r][2] = 'r'; |
|
138 | - $this->rights[$r][3] = 0; |
|
139 | - $this->rights[$r][4] = 'myactions'; |
|
140 | - $this->rights[$r][5] = 'read'; |
|
141 | - $r++; |
|
135 | + $this->rights[$r][0] = 2401; |
|
136 | + $this->rights[$r][1] = 'Read actions/tasks linked to his account'; |
|
137 | + $this->rights[$r][2] = 'r'; |
|
138 | + $this->rights[$r][3] = 0; |
|
139 | + $this->rights[$r][4] = 'myactions'; |
|
140 | + $this->rights[$r][5] = 'read'; |
|
141 | + $r++; |
|
142 | 142 | |
143 | - $this->rights[$r][0] = 2402; |
|
144 | - $this->rights[$r][1] = 'Create/modify actions/tasks linked to his account'; |
|
145 | - $this->rights[$r][2] = 'w'; |
|
146 | - $this->rights[$r][3] = 0; |
|
147 | - $this->rights[$r][4] = 'myactions'; |
|
148 | - $this->rights[$r][5] = 'create'; |
|
149 | - $r++; |
|
143 | + $this->rights[$r][0] = 2402; |
|
144 | + $this->rights[$r][1] = 'Create/modify actions/tasks linked to his account'; |
|
145 | + $this->rights[$r][2] = 'w'; |
|
146 | + $this->rights[$r][3] = 0; |
|
147 | + $this->rights[$r][4] = 'myactions'; |
|
148 | + $this->rights[$r][5] = 'create'; |
|
149 | + $r++; |
|
150 | 150 | |
151 | - $this->rights[$r][0] = 2403; |
|
152 | - $this->rights[$r][1] = 'Delete actions/tasks linked to his account'; |
|
153 | - $this->rights[$r][2] = 'w'; |
|
154 | - $this->rights[$r][3] = 0; |
|
155 | - $this->rights[$r][4] = 'myactions'; |
|
156 | - $this->rights[$r][5] = 'delete'; |
|
157 | - $r++; |
|
151 | + $this->rights[$r][0] = 2403; |
|
152 | + $this->rights[$r][1] = 'Delete actions/tasks linked to his account'; |
|
153 | + $this->rights[$r][2] = 'w'; |
|
154 | + $this->rights[$r][3] = 0; |
|
155 | + $this->rights[$r][4] = 'myactions'; |
|
156 | + $this->rights[$r][5] = 'delete'; |
|
157 | + $r++; |
|
158 | 158 | |
159 | - $this->rights[$r][0] = 2411; |
|
160 | - $this->rights[$r][1] = 'Read actions/tasks of others'; |
|
161 | - $this->rights[$r][2] = 'r'; |
|
162 | - $this->rights[$r][3] = 0; |
|
163 | - $this->rights[$r][4] = 'allactions'; |
|
164 | - $this->rights[$r][5] = 'read'; |
|
165 | - $r++; |
|
159 | + $this->rights[$r][0] = 2411; |
|
160 | + $this->rights[$r][1] = 'Read actions/tasks of others'; |
|
161 | + $this->rights[$r][2] = 'r'; |
|
162 | + $this->rights[$r][3] = 0; |
|
163 | + $this->rights[$r][4] = 'allactions'; |
|
164 | + $this->rights[$r][5] = 'read'; |
|
165 | + $r++; |
|
166 | 166 | |
167 | - $this->rights[$r][0] = 2412; |
|
168 | - $this->rights[$r][1] = 'Create/modify actions/tasks of others'; |
|
169 | - $this->rights[$r][2] = 'w'; |
|
170 | - $this->rights[$r][3] = 0; |
|
171 | - $this->rights[$r][4] = 'allactions'; |
|
172 | - $this->rights[$r][5] = 'create'; |
|
173 | - $r++; |
|
167 | + $this->rights[$r][0] = 2412; |
|
168 | + $this->rights[$r][1] = 'Create/modify actions/tasks of others'; |
|
169 | + $this->rights[$r][2] = 'w'; |
|
170 | + $this->rights[$r][3] = 0; |
|
171 | + $this->rights[$r][4] = 'allactions'; |
|
172 | + $this->rights[$r][5] = 'create'; |
|
173 | + $r++; |
|
174 | 174 | |
175 | - $this->rights[$r][0] = 2413; |
|
176 | - $this->rights[$r][1] = 'Delete actions/tasks of others'; |
|
177 | - $this->rights[$r][2] = 'w'; |
|
178 | - $this->rights[$r][3] = 0; |
|
179 | - $this->rights[$r][4] = 'allactions'; |
|
180 | - $this->rights[$r][5] = 'delete'; |
|
181 | - $r++; |
|
175 | + $this->rights[$r][0] = 2413; |
|
176 | + $this->rights[$r][1] = 'Delete actions/tasks of others'; |
|
177 | + $this->rights[$r][2] = 'w'; |
|
178 | + $this->rights[$r][3] = 0; |
|
179 | + $this->rights[$r][4] = 'allactions'; |
|
180 | + $this->rights[$r][5] = 'delete'; |
|
181 | + $r++; |
|
182 | 182 | |
183 | - $this->rights[$r][0] = 2414; |
|
184 | - $this->rights[$r][1] = 'Export actions/tasks of others'; |
|
185 | - $this->rights[$r][2] = 'w'; |
|
186 | - $this->rights[$r][3] = 0; |
|
187 | - $this->rights[$r][4] = 'export'; |
|
183 | + $this->rights[$r][0] = 2414; |
|
184 | + $this->rights[$r][1] = 'Export actions/tasks of others'; |
|
185 | + $this->rights[$r][2] = 'w'; |
|
186 | + $this->rights[$r][3] = 0; |
|
187 | + $this->rights[$r][4] = 'export'; |
|
188 | 188 | |
189 | - // Main menu entries |
|
190 | - $this->menu = array(); // List of menus to add |
|
191 | - $r=0; |
|
189 | + // Main menu entries |
|
190 | + $this->menu = array(); // List of menus to add |
|
191 | + $r=0; |
|
192 | 192 | |
193 | - // Add here entries to declare new menus |
|
194 | - // Example to declare the Top Menu entry: |
|
195 | - // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu |
|
196 | - // 'type'=>'top', // This is a Top menu entry |
|
197 | - // 'titre'=>'MyModule top menu', |
|
198 | - // 'mainmenu'=>'mymodule', |
|
199 | - // 'url'=>'/mymodule/pagetop.php', |
|
200 | - // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
201 | - // 'position'=>100, |
|
202 | - // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. |
|
203 | - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
204 | - // 'target'=>'', |
|
205 | - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
206 | - // $r++; |
|
207 | - $this->menu[$r]=array('fk_menu'=>0, |
|
208 | - 'type'=>'top', |
|
209 | - 'titre'=>'TMenuAgenda', |
|
210 | - 'mainmenu'=>'agenda', |
|
211 | - 'url'=>'/comm/action/index.php', |
|
212 | - 'langs'=>'agenda', |
|
213 | - 'position'=>86, |
|
214 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
215 | - 'enabled'=>'$conf->agenda->enabled', |
|
216 | - 'target'=>'', |
|
217 | - 'user'=>2); |
|
218 | - $r++; |
|
193 | + // Add here entries to declare new menus |
|
194 | + // Example to declare the Top Menu entry: |
|
195 | + // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu |
|
196 | + // 'type'=>'top', // This is a Top menu entry |
|
197 | + // 'titre'=>'MyModule top menu', |
|
198 | + // 'mainmenu'=>'mymodule', |
|
199 | + // 'url'=>'/mymodule/pagetop.php', |
|
200 | + // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
201 | + // 'position'=>100, |
|
202 | + // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. |
|
203 | + // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
204 | + // 'target'=>'', |
|
205 | + // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
206 | + // $r++; |
|
207 | + $this->menu[$r]=array('fk_menu'=>0, |
|
208 | + 'type'=>'top', |
|
209 | + 'titre'=>'TMenuAgenda', |
|
210 | + 'mainmenu'=>'agenda', |
|
211 | + 'url'=>'/comm/action/index.php', |
|
212 | + 'langs'=>'agenda', |
|
213 | + 'position'=>86, |
|
214 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
215 | + 'enabled'=>'$conf->agenda->enabled', |
|
216 | + 'target'=>'', |
|
217 | + 'user'=>2); |
|
218 | + $r++; |
|
219 | 219 | |
220 | - $this->menu[$r]=array('fk_menu'=>'r=0', |
|
221 | - 'type'=>'left', |
|
222 | - 'titre'=>'Actions', |
|
223 | - 'mainmenu'=>'agenda', |
|
224 | - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', |
|
225 | - 'langs'=>'agenda', |
|
226 | - 'position'=>100, |
|
227 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
228 | - 'enabled'=>'$conf->agenda->enabled', |
|
229 | - 'target'=>'', |
|
230 | - 'user'=>2); |
|
231 | - $r++; |
|
232 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
233 | - 'type'=>'left', |
|
234 | - 'titre'=>'NewAction', |
|
235 | - 'mainmenu'=>'agenda', |
|
236 | - 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', |
|
237 | - 'langs'=>'commercial', |
|
238 | - 'position'=>101, |
|
239 | - 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', |
|
240 | - 'enabled'=>'$conf->agenda->enabled', |
|
241 | - 'target'=>'', |
|
242 | - 'user'=>2); |
|
243 | - $r++; |
|
244 | - // Calendar |
|
245 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
246 | - 'type'=>'left', |
|
247 | - 'titre'=>'Calendar', |
|
248 | - 'mainmenu'=>'agenda', |
|
249 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', |
|
250 | - 'langs'=>'agenda', |
|
251 | - 'position'=>140, |
|
252 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
253 | - 'enabled'=>'$conf->agenda->enabled', |
|
254 | - 'target'=>'', |
|
255 | - 'user'=>2); |
|
256 | - $r++; |
|
257 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
258 | - 'type'=>'left', |
|
259 | - 'titre'=>'MenuToDoMyActions', |
|
260 | - 'mainmenu'=>'agenda', |
|
261 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', |
|
262 | - 'langs'=>'agenda', |
|
263 | - 'position'=>141, |
|
264 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
265 | - 'enabled'=>'$conf->agenda->enabled', |
|
266 | - 'target'=>'', |
|
267 | - 'user'=>2); |
|
268 | - $r++; |
|
269 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
270 | - 'type'=>'left', |
|
271 | - 'titre'=>'MenuDoneMyActions', |
|
272 | - 'mainmenu'=>'agenda', |
|
273 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', |
|
274 | - 'langs'=>'agenda', |
|
275 | - 'position'=>142, |
|
276 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
277 | - 'enabled'=>'$conf->agenda->enabled', |
|
278 | - 'target'=>'', |
|
279 | - 'user'=>2); |
|
280 | - $r++; |
|
281 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
282 | - 'type'=>'left', |
|
283 | - 'titre'=>'MenuToDoActions', |
|
284 | - 'mainmenu'=>'agenda', |
|
285 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', |
|
286 | - 'langs'=>'agenda', |
|
287 | - 'position'=>143, |
|
288 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
289 | - 'enabled'=>'$user->rights->agenda->allactions->read', |
|
290 | - 'target'=>'', |
|
291 | - 'user'=>2); |
|
292 | - $r++; |
|
293 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
294 | - 'type'=>'left', |
|
295 | - 'titre'=>'MenuDoneActions', |
|
296 | - 'mainmenu'=>'agenda', |
|
297 | - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', |
|
298 | - 'langs'=>'agenda', |
|
299 | - 'position'=>144, |
|
300 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
301 | - 'enabled'=>'$user->rights->agenda->allactions->read', |
|
302 | - 'target'=>'', |
|
303 | - 'user'=>2); |
|
220 | + $this->menu[$r]=array('fk_menu'=>'r=0', |
|
221 | + 'type'=>'left', |
|
222 | + 'titre'=>'Actions', |
|
223 | + 'mainmenu'=>'agenda', |
|
224 | + 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', |
|
225 | + 'langs'=>'agenda', |
|
226 | + 'position'=>100, |
|
227 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
228 | + 'enabled'=>'$conf->agenda->enabled', |
|
229 | + 'target'=>'', |
|
230 | + 'user'=>2); |
|
231 | + $r++; |
|
232 | + $this->menu[$r]=array('fk_menu'=>'r=1', |
|
233 | + 'type'=>'left', |
|
234 | + 'titre'=>'NewAction', |
|
235 | + 'mainmenu'=>'agenda', |
|
236 | + 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', |
|
237 | + 'langs'=>'commercial', |
|
238 | + 'position'=>101, |
|
239 | + 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', |
|
240 | + 'enabled'=>'$conf->agenda->enabled', |
|
241 | + 'target'=>'', |
|
242 | + 'user'=>2); |
|
243 | + $r++; |
|
244 | + // Calendar |
|
245 | + $this->menu[$r]=array('fk_menu'=>'r=1', |
|
246 | + 'type'=>'left', |
|
247 | + 'titre'=>'Calendar', |
|
248 | + 'mainmenu'=>'agenda', |
|
249 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', |
|
250 | + 'langs'=>'agenda', |
|
251 | + 'position'=>140, |
|
252 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
253 | + 'enabled'=>'$conf->agenda->enabled', |
|
254 | + 'target'=>'', |
|
255 | + 'user'=>2); |
|
256 | + $r++; |
|
257 | + $this->menu[$r]=array('fk_menu'=>'r=3', |
|
258 | + 'type'=>'left', |
|
259 | + 'titre'=>'MenuToDoMyActions', |
|
260 | + 'mainmenu'=>'agenda', |
|
261 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', |
|
262 | + 'langs'=>'agenda', |
|
263 | + 'position'=>141, |
|
264 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
265 | + 'enabled'=>'$conf->agenda->enabled', |
|
266 | + 'target'=>'', |
|
267 | + 'user'=>2); |
|
268 | + $r++; |
|
269 | + $this->menu[$r]=array('fk_menu'=>'r=3', |
|
270 | + 'type'=>'left', |
|
271 | + 'titre'=>'MenuDoneMyActions', |
|
272 | + 'mainmenu'=>'agenda', |
|
273 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', |
|
274 | + 'langs'=>'agenda', |
|
275 | + 'position'=>142, |
|
276 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
277 | + 'enabled'=>'$conf->agenda->enabled', |
|
278 | + 'target'=>'', |
|
279 | + 'user'=>2); |
|
280 | + $r++; |
|
281 | + $this->menu[$r]=array('fk_menu'=>'r=3', |
|
282 | + 'type'=>'left', |
|
283 | + 'titre'=>'MenuToDoActions', |
|
284 | + 'mainmenu'=>'agenda', |
|
285 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', |
|
286 | + 'langs'=>'agenda', |
|
287 | + 'position'=>143, |
|
288 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
289 | + 'enabled'=>'$user->rights->agenda->allactions->read', |
|
290 | + 'target'=>'', |
|
291 | + 'user'=>2); |
|
292 | + $r++; |
|
293 | + $this->menu[$r]=array('fk_menu'=>'r=3', |
|
294 | + 'type'=>'left', |
|
295 | + 'titre'=>'MenuDoneActions', |
|
296 | + 'mainmenu'=>'agenda', |
|
297 | + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', |
|
298 | + 'langs'=>'agenda', |
|
299 | + 'position'=>144, |
|
300 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
301 | + 'enabled'=>'$user->rights->agenda->allactions->read', |
|
302 | + 'target'=>'', |
|
303 | + 'user'=>2); |
|
304 | 304 | |
305 | - // List |
|
306 | - $r++; |
|
307 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
308 | - 'type'=>'left', |
|
309 | - 'titre'=>'List', |
|
310 | - 'mainmenu'=>'agenda', |
|
311 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', |
|
312 | - 'langs'=>'agenda', |
|
313 | - 'position'=>110, |
|
314 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
315 | - 'enabled'=>'$conf->agenda->enabled', |
|
316 | - 'target'=>'', |
|
317 | - 'user'=>2); |
|
318 | - $r++; |
|
319 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
320 | - 'type'=>'left', |
|
321 | - 'titre'=>'MenuToDoMyActions', |
|
322 | - 'mainmenu'=>'agenda', |
|
323 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', |
|
324 | - 'langs'=>'agenda', |
|
325 | - 'position'=>111, |
|
326 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
327 | - 'enabled'=>'$conf->agenda->enabled', |
|
328 | - 'target'=>'', |
|
329 | - 'user'=>2); |
|
330 | - $r++; |
|
331 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
332 | - 'type'=>'left', |
|
333 | - 'titre'=>'MenuDoneMyActions', |
|
334 | - 'mainmenu'=>'agenda', |
|
335 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', |
|
336 | - 'langs'=>'agenda', |
|
337 | - 'position'=>112, |
|
338 | - 'perms'=>'$user->rights->agenda->myactions->read', |
|
339 | - 'enabled'=>'$conf->agenda->enabled', |
|
340 | - 'target'=>'', |
|
341 | - 'user'=>2); |
|
342 | - $r++; |
|
343 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
344 | - 'type'=>'left', |
|
345 | - 'titre'=>'MenuToDoActions', |
|
346 | - 'mainmenu'=>'agenda', |
|
347 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', |
|
348 | - 'langs'=>'agenda', |
|
349 | - 'position'=>113, |
|
350 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
351 | - 'enabled'=>'$user->rights->agenda->allactions->read', |
|
352 | - 'target'=>'', |
|
353 | - 'user'=>2); |
|
354 | - $r++; |
|
355 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
356 | - 'type'=>'left', |
|
357 | - 'titre'=>'MenuDoneActions', |
|
358 | - 'mainmenu'=>'agenda', |
|
359 | - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', |
|
360 | - 'langs'=>'agenda', |
|
361 | - 'position'=>114, |
|
362 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
363 | - 'enabled'=>'$user->rights->agenda->allactions->read', |
|
364 | - 'target'=>'', |
|
365 | - 'user'=>2); |
|
366 | - $r++; |
|
367 | - // Reports |
|
368 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
369 | - 'type'=>'left', |
|
370 | - 'titre'=>'Reportings', |
|
371 | - 'mainmenu'=>'agenda', |
|
372 | - 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', |
|
373 | - 'langs'=>'agenda', |
|
374 | - 'position'=>160, |
|
375 | - 'perms'=>'$user->rights->agenda->allactions->read', |
|
376 | - 'enabled'=>'$conf->agenda->enabled', |
|
377 | - 'target'=>'', |
|
378 | - 'user'=>2); |
|
379 | - $r++; |
|
305 | + // List |
|
306 | + $r++; |
|
307 | + $this->menu[$r]=array('fk_menu'=>'r=1', |
|
308 | + 'type'=>'left', |
|
309 | + 'titre'=>'List', |
|
310 | + 'mainmenu'=>'agenda', |
|
311 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', |
|
312 | + 'langs'=>'agenda', |
|
313 | + 'position'=>110, |
|
314 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
315 | + 'enabled'=>'$conf->agenda->enabled', |
|
316 | + 'target'=>'', |
|
317 | + 'user'=>2); |
|
318 | + $r++; |
|
319 | + $this->menu[$r]=array('fk_menu'=>'r=8', |
|
320 | + 'type'=>'left', |
|
321 | + 'titre'=>'MenuToDoMyActions', |
|
322 | + 'mainmenu'=>'agenda', |
|
323 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', |
|
324 | + 'langs'=>'agenda', |
|
325 | + 'position'=>111, |
|
326 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
327 | + 'enabled'=>'$conf->agenda->enabled', |
|
328 | + 'target'=>'', |
|
329 | + 'user'=>2); |
|
330 | + $r++; |
|
331 | + $this->menu[$r]=array('fk_menu'=>'r=8', |
|
332 | + 'type'=>'left', |
|
333 | + 'titre'=>'MenuDoneMyActions', |
|
334 | + 'mainmenu'=>'agenda', |
|
335 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', |
|
336 | + 'langs'=>'agenda', |
|
337 | + 'position'=>112, |
|
338 | + 'perms'=>'$user->rights->agenda->myactions->read', |
|
339 | + 'enabled'=>'$conf->agenda->enabled', |
|
340 | + 'target'=>'', |
|
341 | + 'user'=>2); |
|
342 | + $r++; |
|
343 | + $this->menu[$r]=array('fk_menu'=>'r=8', |
|
344 | + 'type'=>'left', |
|
345 | + 'titre'=>'MenuToDoActions', |
|
346 | + 'mainmenu'=>'agenda', |
|
347 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', |
|
348 | + 'langs'=>'agenda', |
|
349 | + 'position'=>113, |
|
350 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
351 | + 'enabled'=>'$user->rights->agenda->allactions->read', |
|
352 | + 'target'=>'', |
|
353 | + 'user'=>2); |
|
354 | + $r++; |
|
355 | + $this->menu[$r]=array('fk_menu'=>'r=8', |
|
356 | + 'type'=>'left', |
|
357 | + 'titre'=>'MenuDoneActions', |
|
358 | + 'mainmenu'=>'agenda', |
|
359 | + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', |
|
360 | + 'langs'=>'agenda', |
|
361 | + 'position'=>114, |
|
362 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
363 | + 'enabled'=>'$user->rights->agenda->allactions->read', |
|
364 | + 'target'=>'', |
|
365 | + 'user'=>2); |
|
366 | + $r++; |
|
367 | + // Reports |
|
368 | + $this->menu[$r]=array('fk_menu'=>'r=1', |
|
369 | + 'type'=>'left', |
|
370 | + 'titre'=>'Reportings', |
|
371 | + 'mainmenu'=>'agenda', |
|
372 | + 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', |
|
373 | + 'langs'=>'agenda', |
|
374 | + 'position'=>160, |
|
375 | + 'perms'=>'$user->rights->agenda->allactions->read', |
|
376 | + 'enabled'=>'$conf->agenda->enabled', |
|
377 | + 'target'=>'', |
|
378 | + 'user'=>2); |
|
379 | + $r++; |
|
380 | 380 | |
381 | 381 | |
382 | - // Exports |
|
383 | - //-------- |
|
384 | - $r=0; |
|
382 | + // Exports |
|
383 | + //-------- |
|
384 | + $r=0; |
|
385 | 385 | |
386 | - $r++; |
|
387 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
388 | - $this->export_label[$r]="ExportDataset_event1"; |
|
389 | - $this->export_permission[$r]=array(array("agenda","export")); |
|
390 | - $this->export_fields_array[$r]=array('ac.id'=>"IdAgenda",'ac.ref_ext'=>"ExternalRef",'ac.datec'=>"DateCreation",'ac.datep'=>"DateActionBegin", |
|
391 | - 'ac.datep2'=>"DateActionEnd",'ac.label'=>"Title",'ac.note'=>"Note",'ac.percent'=>"Percent",'ac.durationp'=>"Duration", |
|
392 | - 'cac.libelle'=>"ActionType", |
|
393 | - 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town', |
|
394 | - 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6', |
|
395 | - 's.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra'); |
|
396 | - $this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date", |
|
397 | - 'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric", |
|
398 | - 'ac.durationp'=>"Duree", |
|
399 | - 'cac.libelle'=>"List:c_actioncomm:libelle:id", |
|
400 | - 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text', |
|
401 | - 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text', |
|
402 | - 's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text'); |
|
403 | - $this->export_entities_array[$r]=array('ac.id'=>"action",'ac.ref_ext'=>"action",'ac.datec'=>"action",'ac.datep'=>"action", |
|
404 | - 'ac.datep2'=>"action",'ac.label'=>"action",'ac.note'=>"action",'ac.percent'=>"action",'ac.durationp'=>"action", |
|
405 | - 'cac.libelle'=>"action", |
|
406 | - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company', |
|
407 | - 'co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company', |
|
408 | - 's.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company',); |
|
386 | + $r++; |
|
387 | + $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
388 | + $this->export_label[$r]="ExportDataset_event1"; |
|
389 | + $this->export_permission[$r]=array(array("agenda","export")); |
|
390 | + $this->export_fields_array[$r]=array('ac.id'=>"IdAgenda",'ac.ref_ext'=>"ExternalRef",'ac.datec'=>"DateCreation",'ac.datep'=>"DateActionBegin", |
|
391 | + 'ac.datep2'=>"DateActionEnd",'ac.label'=>"Title",'ac.note'=>"Note",'ac.percent'=>"Percent",'ac.durationp'=>"Duration", |
|
392 | + 'cac.libelle'=>"ActionType", |
|
393 | + 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town', |
|
394 | + 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6', |
|
395 | + 's.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra'); |
|
396 | + $this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date", |
|
397 | + 'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric", |
|
398 | + 'ac.durationp'=>"Duree", |
|
399 | + 'cac.libelle'=>"List:c_actioncomm:libelle:id", |
|
400 | + 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text', |
|
401 | + 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text', |
|
402 | + 's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text'); |
|
403 | + $this->export_entities_array[$r]=array('ac.id'=>"action",'ac.ref_ext'=>"action",'ac.datec'=>"action",'ac.datep'=>"action", |
|
404 | + 'ac.datep2'=>"action",'ac.label'=>"action",'ac.note'=>"action",'ac.percent'=>"action",'ac.durationp'=>"action", |
|
405 | + 'cac.libelle'=>"action", |
|
406 | + 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company', |
|
407 | + 'co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company', |
|
408 | + 's.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company',); |
|
409 | 409 | |
410 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
411 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
|
412 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
|
413 | - if (! empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
414 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
|
415 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
|
416 | - if (! empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
417 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
|
418 | - $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; |
|
419 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | - if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
421 | - $this->export_sql_end[$r] .=' ORDER BY ac.datep'; |
|
422 | - } |
|
410 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
411 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
|
412 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
|
413 | + if (! empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
414 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
|
415 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
|
416 | + if (! empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
417 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
|
418 | + $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; |
|
419 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | + if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
421 | + $this->export_sql_end[$r] .=' ORDER BY ac.datep'; |
|
422 | + } |
|
423 | 423 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * \ingroup agenda |
31 | 31 | * \brief File of class to describe and enable/disable module Agenda |
32 | 32 | */ |
33 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
33 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Class to describe and enable/disable module Agenda |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | $this->family = "projects"; |
54 | 54 | $this->module_position = '15'; |
55 | 55 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
56 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
56 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
57 | 57 | $this->description = "Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking."; |
58 | 58 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
59 | 59 | $this->version = 'dolibarr'; |
60 | 60 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
61 | 61 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
62 | - $this->picto='action'; |
|
62 | + $this->picto = 'action'; |
|
63 | 63 | |
64 | 64 | // Data directories to create when module is enabled |
65 | 65 | $this->dirs = array("/agenda/temp"); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | $this->config_page_url = array("agenda_other.php"); |
69 | 69 | |
70 | 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 |
|
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 | 75 | $this->langfiles = array("companies"); |
76 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
76 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
77 | 77 | |
78 | 78 | // Module parts |
79 | 79 | $this->module_parts = array(); |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | // ); |
87 | 87 | $this->const = array(); |
88 | 88 | //$this->const[] = array('AGENDA_DEFAULT_FILTER_TYPE', 'chaine', 'AC_NON_AUTO', 'Default filter for type of event on agenda', 0, 'current'); |
89 | - $sqlreadactions="SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; |
|
89 | + $sqlreadactions = "SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; |
|
90 | 90 | $resql = $this->db->query($sqlreadactions); |
91 | 91 | if ($resql) |
92 | 92 | { |
93 | 93 | while ($obj = $this->db->fetch_object($resql)) |
94 | 94 | { |
95 | 95 | //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). |
96 | - if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. |
|
96 | + if (preg_match('/^TASK_/', $obj->code)) continue; // We don't track such events by default. |
|
97 | 97 | //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. |
98 | 98 | $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); |
99 | 99 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | |
110 | 110 | // Boxes |
111 | 111 | //------ |
112 | - $this->boxes = array(0=>array('file'=>'box_actions.php','enabledbydefaulton'=>'Home')); |
|
112 | + $this->boxes = array(0=>array('file'=>'box_actions.php', 'enabledbydefaulton'=>'Home')); |
|
113 | 113 | |
114 | 114 | // Cronjobs |
115 | 115 | //------------ |
116 | - $datestart=dol_now(); |
|
116 | + $datestart = dol_now(); |
|
117 | 117 | $this->cronjobs = array( |
118 | 118 | 0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->agenda->enabled', 'datestart'=>$datestart), |
119 | 119 | ); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | //------------ |
123 | 123 | $this->rights = array(); |
124 | 124 | $this->rights_class = 'agenda'; |
125 | - $r=0; |
|
125 | + $r = 0; |
|
126 | 126 | |
127 | 127 | // $this->rights[$r][0] Id permission (unique tous modules confondus) |
128 | 128 | // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | $this->rights[$r][4] = 'export'; |
188 | 188 | |
189 | 189 | // Main menu entries |
190 | - $this->menu = array(); // List of menus to add |
|
191 | - $r=0; |
|
190 | + $this->menu = array(); // List of menus to add |
|
191 | + $r = 0; |
|
192 | 192 | |
193 | 193 | // Add here entries to declare new menus |
194 | 194 | // Example to declare the Top Menu entry: |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | // 'target'=>'', |
205 | 205 | // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
206 | 206 | // $r++; |
207 | - $this->menu[$r]=array('fk_menu'=>0, |
|
207 | + $this->menu[$r] = array('fk_menu'=>0, |
|
208 | 208 | 'type'=>'top', |
209 | 209 | 'titre'=>'TMenuAgenda', |
210 | 210 | 'mainmenu'=>'agenda', |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'user'=>2); |
218 | 218 | $r++; |
219 | 219 | |
220 | - $this->menu[$r]=array('fk_menu'=>'r=0', |
|
220 | + $this->menu[$r] = array('fk_menu'=>'r=0', |
|
221 | 221 | 'type'=>'left', |
222 | 222 | 'titre'=>'Actions', |
223 | 223 | 'mainmenu'=>'agenda', |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'target'=>'', |
230 | 230 | 'user'=>2); |
231 | 231 | $r++; |
232 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
232 | + $this->menu[$r] = array('fk_menu'=>'r=1', |
|
233 | 233 | 'type'=>'left', |
234 | 234 | 'titre'=>'NewAction', |
235 | 235 | 'mainmenu'=>'agenda', |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | 'user'=>2); |
243 | 243 | $r++; |
244 | 244 | // Calendar |
245 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
245 | + $this->menu[$r] = array('fk_menu'=>'r=1', |
|
246 | 246 | 'type'=>'left', |
247 | 247 | 'titre'=>'Calendar', |
248 | 248 | 'mainmenu'=>'agenda', |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | 'target'=>'', |
255 | 255 | 'user'=>2); |
256 | 256 | $r++; |
257 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
257 | + $this->menu[$r] = array('fk_menu'=>'r=3', |
|
258 | 258 | 'type'=>'left', |
259 | 259 | 'titre'=>'MenuToDoMyActions', |
260 | 260 | 'mainmenu'=>'agenda', |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'target'=>'', |
267 | 267 | 'user'=>2); |
268 | 268 | $r++; |
269 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
269 | + $this->menu[$r] = array('fk_menu'=>'r=3', |
|
270 | 270 | 'type'=>'left', |
271 | 271 | 'titre'=>'MenuDoneMyActions', |
272 | 272 | 'mainmenu'=>'agenda', |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | 'target'=>'', |
279 | 279 | 'user'=>2); |
280 | 280 | $r++; |
281 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
281 | + $this->menu[$r] = array('fk_menu'=>'r=3', |
|
282 | 282 | 'type'=>'left', |
283 | 283 | 'titre'=>'MenuToDoActions', |
284 | 284 | 'mainmenu'=>'agenda', |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | 'target'=>'', |
291 | 291 | 'user'=>2); |
292 | 292 | $r++; |
293 | - $this->menu[$r]=array('fk_menu'=>'r=3', |
|
293 | + $this->menu[$r] = array('fk_menu'=>'r=3', |
|
294 | 294 | 'type'=>'left', |
295 | 295 | 'titre'=>'MenuDoneActions', |
296 | 296 | 'mainmenu'=>'agenda', |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | // List |
306 | 306 | $r++; |
307 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
307 | + $this->menu[$r] = array('fk_menu'=>'r=1', |
|
308 | 308 | 'type'=>'left', |
309 | 309 | 'titre'=>'List', |
310 | 310 | 'mainmenu'=>'agenda', |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | 'target'=>'', |
317 | 317 | 'user'=>2); |
318 | 318 | $r++; |
319 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
319 | + $this->menu[$r] = array('fk_menu'=>'r=8', |
|
320 | 320 | 'type'=>'left', |
321 | 321 | 'titre'=>'MenuToDoMyActions', |
322 | 322 | 'mainmenu'=>'agenda', |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | 'target'=>'', |
329 | 329 | 'user'=>2); |
330 | 330 | $r++; |
331 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
331 | + $this->menu[$r] = array('fk_menu'=>'r=8', |
|
332 | 332 | 'type'=>'left', |
333 | 333 | 'titre'=>'MenuDoneMyActions', |
334 | 334 | 'mainmenu'=>'agenda', |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | 'target'=>'', |
341 | 341 | 'user'=>2); |
342 | 342 | $r++; |
343 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
343 | + $this->menu[$r] = array('fk_menu'=>'r=8', |
|
344 | 344 | 'type'=>'left', |
345 | 345 | 'titre'=>'MenuToDoActions', |
346 | 346 | 'mainmenu'=>'agenda', |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | 'target'=>'', |
353 | 353 | 'user'=>2); |
354 | 354 | $r++; |
355 | - $this->menu[$r]=array('fk_menu'=>'r=8', |
|
355 | + $this->menu[$r] = array('fk_menu'=>'r=8', |
|
356 | 356 | 'type'=>'left', |
357 | 357 | 'titre'=>'MenuDoneActions', |
358 | 358 | 'mainmenu'=>'agenda', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | 'user'=>2); |
366 | 366 | $r++; |
367 | 367 | // Reports |
368 | - $this->menu[$r]=array('fk_menu'=>'r=1', |
|
368 | + $this->menu[$r] = array('fk_menu'=>'r=1', |
|
369 | 369 | 'type'=>'left', |
370 | 370 | 'titre'=>'Reportings', |
371 | 371 | 'mainmenu'=>'agenda', |
@@ -381,43 +381,43 @@ discard block |
||
381 | 381 | |
382 | 382 | // Exports |
383 | 383 | //-------- |
384 | - $r=0; |
|
384 | + $r = 0; |
|
385 | 385 | |
386 | 386 | $r++; |
387 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
388 | - $this->export_label[$r]="ExportDataset_event1"; |
|
389 | - $this->export_permission[$r]=array(array("agenda","export")); |
|
390 | - $this->export_fields_array[$r]=array('ac.id'=>"IdAgenda",'ac.ref_ext'=>"ExternalRef",'ac.datec'=>"DateCreation",'ac.datep'=>"DateActionBegin", |
|
391 | - 'ac.datep2'=>"DateActionEnd",'ac.label'=>"Title",'ac.note'=>"Note",'ac.percent'=>"Percent",'ac.durationp'=>"Duration", |
|
387 | + $this->export_code[$r] = $this->rights_class.'_'.$r; |
|
388 | + $this->export_label[$r] = "ExportDataset_event1"; |
|
389 | + $this->export_permission[$r] = array(array("agenda", "export")); |
|
390 | + $this->export_fields_array[$r] = array('ac.id'=>"IdAgenda", 'ac.ref_ext'=>"ExternalRef", 'ac.datec'=>"DateCreation", 'ac.datep'=>"DateActionBegin", |
|
391 | + 'ac.datep2'=>"DateActionEnd", 'ac.label'=>"Title", 'ac.note'=>"Note", 'ac.percent'=>"Percent", 'ac.durationp'=>"Duration", |
|
392 | 392 | 'cac.libelle'=>"ActionType", |
393 | - 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town', |
|
394 | - 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6', |
|
395 | - 's.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra'); |
|
396 | - $this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date", |
|
397 | - 'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric", |
|
393 | + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', |
|
394 | + 'co.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', |
|
395 | + 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra'); |
|
396 | + $this->export_TypeFields_array[$r] = array('ac.ref_ext'=>"Text", 'ac.datec'=>"Date", 'ac.datep'=>"Date", |
|
397 | + 'ac.datep2'=>"Date", 'ac.label'=>"Text", 'ac.note'=>"Text", 'ac.percent'=>"Numeric", |
|
398 | 398 | 'ac.durationp'=>"Duree", |
399 | 399 | 'cac.libelle'=>"List:c_actioncomm:libelle:id", |
400 | - 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text', |
|
401 | - 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text', |
|
402 | - 's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text'); |
|
403 | - $this->export_entities_array[$r]=array('ac.id'=>"action",'ac.ref_ext'=>"action",'ac.datec'=>"action",'ac.datep'=>"action", |
|
404 | - 'ac.datep2'=>"action",'ac.label'=>"action",'ac.note'=>"action",'ac.percent'=>"action",'ac.durationp'=>"action", |
|
400 | + 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', |
|
401 | + 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', |
|
402 | + 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text'); |
|
403 | + $this->export_entities_array[$r] = array('ac.id'=>"action", 'ac.ref_ext'=>"action", 'ac.datec'=>"action", 'ac.datep'=>"action", |
|
404 | + 'ac.datep2'=>"action", 'ac.label'=>"action", 'ac.note'=>"action", 'ac.percent'=>"action", 'ac.durationp'=>"action", |
|
405 | 405 | 'cac.libelle'=>"action", |
406 | - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company', |
|
407 | - 'co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company', |
|
408 | - 's.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company',); |
|
406 | + 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', |
|
407 | + 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', |
|
408 | + 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company',); |
|
409 | 409 | |
410 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
411 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
|
412 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
|
413 | - if (! empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
414 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
|
415 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
|
416 | - if (! empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
417 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
|
418 | - $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; |
|
419 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | - if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
421 | - $this->export_sql_end[$r] .=' ORDER BY ac.datep'; |
|
410 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
411 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
|
412 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
|
413 | + if (!empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
414 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
|
415 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
|
416 | + if (!empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
417 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
|
418 | + $this->export_sql_end[$r] .= ' WHERE ac.entity IN ('.getEntity('agenda').')'; |
|
419 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | + if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .= ' AND acr.fk_element = '.(empty($user) ? 0 : $user->id); |
|
421 | + $this->export_sql_end[$r] .= ' ORDER BY ac.datep'; |
|
422 | 422 | } |
423 | 423 | } |
@@ -93,12 +93,14 @@ discard block |
||
93 | 93 | while ($obj = $this->db->fetch_object($resql)) |
94 | 94 | { |
95 | 95 | //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). |
96 | - if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. |
|
96 | + if (preg_match('/^TASK_/',$obj->code)) { |
|
97 | + continue; |
|
98 | + } |
|
99 | + // We don't track such events by default. |
|
97 | 100 | //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. |
98 | 101 | $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); |
99 | 102 | } |
100 | - } |
|
101 | - else |
|
103 | + } else |
|
102 | 104 | { |
103 | 105 | dol_print_error($this->db->lasterror()); |
104 | 106 | } |
@@ -410,14 +412,22 @@ discard block |
||
410 | 412 | $this->export_sql_start[$r]='SELECT DISTINCT '; |
411 | 413 | $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; |
412 | 414 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; |
413 | - if (! empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
415 | + if (! empty($user) && empty($user->rights->agenda->allactions->read)) { |
|
416 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; |
|
417 | + } |
|
414 | 418 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; |
415 | 419 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; |
416 | - if (! empty($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
420 | + if (! empty($user) && empty($user->rights->societe->client->voir)) { |
|
421 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
422 | + } |
|
417 | 423 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; |
418 | 424 | $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; |
419 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
420 | - if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
425 | + if (empty($user->rights->societe->client->voir)) { |
|
426 | + $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; |
|
427 | + } |
|
428 | + if (empty($user->rights->agenda->allactions->read)) { |
|
429 | + $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); |
|
430 | + } |
|
421 | 431 | $this->export_sql_end[$r] .=' ORDER BY ac.datep'; |
422 | 432 | } |
423 | 433 | } |
@@ -27,117 +27,117 @@ |
||
27 | 27 | */ |
28 | 28 | class modHRM extends DolibarrModules |
29 | 29 | { |
30 | - /** |
|
31 | - * Constructor. |
|
32 | - * Define names, constants, directories, boxes, permissions |
|
33 | - * |
|
34 | - * @param DoliDB $db Database handler |
|
35 | - */ |
|
36 | - public function __construct($db) |
|
37 | - { |
|
38 | - global $langs, $conf; |
|
39 | - |
|
40 | - $this->db = $db; |
|
41 | - |
|
42 | - $this->numero = 4000; |
|
43 | - $this->rights_class = 'hrm'; |
|
44 | - |
|
45 | - $this->family = "hr"; |
|
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 = "Management of employees carrier and feelings (department, employment contract)"; |
|
49 | - |
|
50 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
51 | - $this->version = 'development'; |
|
52 | - |
|
53 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
54 | - // Name of image file used for this module. |
|
55 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
56 | - // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
57 | - $this->picto='generic'; |
|
58 | - |
|
59 | - // define triggers |
|
60 | - $this->module_parts = array(); |
|
61 | - |
|
62 | - // Data directories to create when module is enabled |
|
63 | - $this->dirs = array(); |
|
64 | - |
|
65 | - // Config pages |
|
66 | - $this->config_page_url = array('admin_hrm.php@hrm'); |
|
67 | - |
|
68 | - // Dependencies |
|
69 | - $this->hidden = false; // A condition to hide module |
|
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(/*"modSalaries, modExpenseReport, modHoliday"*/); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | - $this->need_dolibarr_version = array (3,9); // Minimum version of Dolibarr required by module |
|
75 | - $this->langfiles = array ("hrm"); |
|
76 | - |
|
77 | - // Dictionaries |
|
78 | - $this->dictionaries=array(); |
|
79 | - |
|
80 | - // Constantes |
|
81 | - $this->const = array (); |
|
82 | - $r = 0; |
|
83 | - |
|
84 | - // Boxes |
|
85 | - $this->boxes = array (); |
|
86 | - |
|
87 | - // Permissions |
|
88 | - $this->rights = array(); // Permission array used by this module |
|
89 | - $r = 0; |
|
90 | - |
|
91 | - $this->rights[$r][0] = 4001; |
|
92 | - $this->rights[$r][1] = 'See employees'; |
|
93 | - $this->rights[$r][3] = 0; |
|
94 | - $this->rights[$r][4] = 'employee'; |
|
95 | - $this->rights[$r][5] = 'read'; |
|
96 | - $r ++; |
|
97 | - |
|
98 | - $this->rights[$r][0] = 4002; |
|
99 | - $this->rights[$r][1] = 'Create employees'; |
|
100 | - $this->rights[$r][3] = 0; |
|
101 | - $this->rights[$r][4] = 'employee'; |
|
102 | - $this->rights[$r][5] = 'write'; |
|
103 | - $r ++; |
|
104 | - |
|
105 | - $this->rights[$r][0] = 4003; |
|
106 | - $this->rights[$r][1] = 'Delete employees'; |
|
107 | - $this->rights[$r][3] = 0; |
|
108 | - $this->rights[$r][4] = 'employee'; |
|
109 | - $this->rights[$r][5] = 'delete'; |
|
110 | - $r ++; |
|
111 | - |
|
112 | - $this->rights[$r][0] = 4004; |
|
113 | - $this->rights[$r][1] = 'Export employees'; |
|
114 | - $this->rights[$r][3] = 0; |
|
115 | - $this->rights[$r][4] = 'employee'; |
|
116 | - $this->rights[$r][5] = 'export'; |
|
117 | - $r ++; |
|
118 | - |
|
119 | - |
|
120 | - // Menus |
|
121 | - //------- |
|
122 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Function called when module is enabled. |
|
127 | - * The init function add constants, boxes, permissions and menus |
|
128 | - * (defined in constructor) into Dolibarr database. |
|
129 | - * It also creates data directories |
|
130 | - * |
|
131 | - * @param string $options Enabling module ('', 'noboxes') |
|
132 | - * @return int if OK, 0 if KO |
|
133 | - */ |
|
134 | - function init($options='') |
|
135 | - { |
|
136 | - // Permissions |
|
137 | - $this->remove($options); |
|
138 | - |
|
139 | - $sql = array(); |
|
140 | - |
|
141 | - return $this->_init($sql,$options); |
|
142 | - } |
|
30 | + /** |
|
31 | + * Constructor. |
|
32 | + * Define names, constants, directories, boxes, permissions |
|
33 | + * |
|
34 | + * @param DoliDB $db Database handler |
|
35 | + */ |
|
36 | + public function __construct($db) |
|
37 | + { |
|
38 | + global $langs, $conf; |
|
39 | + |
|
40 | + $this->db = $db; |
|
41 | + |
|
42 | + $this->numero = 4000; |
|
43 | + $this->rights_class = 'hrm'; |
|
44 | + |
|
45 | + $this->family = "hr"; |
|
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 = "Management of employees carrier and feelings (department, employment contract)"; |
|
49 | + |
|
50 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
51 | + $this->version = 'development'; |
|
52 | + |
|
53 | + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
54 | + // Name of image file used for this module. |
|
55 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
56 | + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
57 | + $this->picto='generic'; |
|
58 | + |
|
59 | + // define triggers |
|
60 | + $this->module_parts = array(); |
|
61 | + |
|
62 | + // Data directories to create when module is enabled |
|
63 | + $this->dirs = array(); |
|
64 | + |
|
65 | + // Config pages |
|
66 | + $this->config_page_url = array('admin_hrm.php@hrm'); |
|
67 | + |
|
68 | + // Dependencies |
|
69 | + $this->hidden = false; // A condition to hide module |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(/*"modSalaries, modExpenseReport, modHoliday"*/); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | + $this->need_dolibarr_version = array (3,9); // Minimum version of Dolibarr required by module |
|
75 | + $this->langfiles = array ("hrm"); |
|
76 | + |
|
77 | + // Dictionaries |
|
78 | + $this->dictionaries=array(); |
|
79 | + |
|
80 | + // Constantes |
|
81 | + $this->const = array (); |
|
82 | + $r = 0; |
|
83 | + |
|
84 | + // Boxes |
|
85 | + $this->boxes = array (); |
|
86 | + |
|
87 | + // Permissions |
|
88 | + $this->rights = array(); // Permission array used by this module |
|
89 | + $r = 0; |
|
90 | + |
|
91 | + $this->rights[$r][0] = 4001; |
|
92 | + $this->rights[$r][1] = 'See employees'; |
|
93 | + $this->rights[$r][3] = 0; |
|
94 | + $this->rights[$r][4] = 'employee'; |
|
95 | + $this->rights[$r][5] = 'read'; |
|
96 | + $r ++; |
|
97 | + |
|
98 | + $this->rights[$r][0] = 4002; |
|
99 | + $this->rights[$r][1] = 'Create employees'; |
|
100 | + $this->rights[$r][3] = 0; |
|
101 | + $this->rights[$r][4] = 'employee'; |
|
102 | + $this->rights[$r][5] = 'write'; |
|
103 | + $r ++; |
|
104 | + |
|
105 | + $this->rights[$r][0] = 4003; |
|
106 | + $this->rights[$r][1] = 'Delete employees'; |
|
107 | + $this->rights[$r][3] = 0; |
|
108 | + $this->rights[$r][4] = 'employee'; |
|
109 | + $this->rights[$r][5] = 'delete'; |
|
110 | + $r ++; |
|
111 | + |
|
112 | + $this->rights[$r][0] = 4004; |
|
113 | + $this->rights[$r][1] = 'Export employees'; |
|
114 | + $this->rights[$r][3] = 0; |
|
115 | + $this->rights[$r][4] = 'employee'; |
|
116 | + $this->rights[$r][5] = 'export'; |
|
117 | + $r ++; |
|
118 | + |
|
119 | + |
|
120 | + // Menus |
|
121 | + //------- |
|
122 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Function called when module is enabled. |
|
127 | + * The init function add constants, boxes, permissions and menus |
|
128 | + * (defined in constructor) into Dolibarr database. |
|
129 | + * It also creates data directories |
|
130 | + * |
|
131 | + * @param string $options Enabling module ('', 'noboxes') |
|
132 | + * @return int if OK, 0 if KO |
|
133 | + */ |
|
134 | + function init($options='') |
|
135 | + { |
|
136 | + // Permissions |
|
137 | + $this->remove($options); |
|
138 | + |
|
139 | + $sql = array(); |
|
140 | + |
|
141 | + return $this->_init($sql,$options); |
|
142 | + } |
|
143 | 143 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * \ingroup HRM |
21 | 21 | * \brief Description and activation file for module HRM |
22 | 22 | */ |
23 | -include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; |
|
23 | +include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Class to describe and activate the HRM module |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | |
45 | 45 | $this->family = "hr"; |
46 | 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)); |
|
47 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
48 | 48 | $this->description = "Management of employees carrier and feelings (department, employment contract)"; |
49 | 49 | |
50 | 50 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
51 | 51 | $this->version = 'development'; |
52 | 52 | |
53 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
53 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
54 | 54 | // Name of image file used for this module. |
55 | 55 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
56 | 56 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
57 | - $this->picto='generic'; |
|
57 | + $this->picto = 'generic'; |
|
58 | 58 | |
59 | 59 | // define triggers |
60 | 60 | $this->module_parts = array(); |
@@ -66,23 +66,23 @@ discard block |
||
66 | 66 | $this->config_page_url = array('admin_hrm.php@hrm'); |
67 | 67 | |
68 | 68 | // Dependencies |
69 | - $this->hidden = false; // A condition to hide module |
|
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(/*"modSalaries, modExpenseReport, modHoliday"*/); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | - $this->need_dolibarr_version = array (3,9); // Minimum version of Dolibarr required by module |
|
75 | - $this->langfiles = array ("hrm"); |
|
69 | + $this->hidden = false; // A condition to hide module |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(/*"modSalaries, modExpenseReport, modHoliday"*/); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
74 | + $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module |
|
75 | + $this->langfiles = array("hrm"); |
|
76 | 76 | |
77 | 77 | // Dictionaries |
78 | - $this->dictionaries=array(); |
|
78 | + $this->dictionaries = array(); |
|
79 | 79 | |
80 | 80 | // Constantes |
81 | - $this->const = array (); |
|
81 | + $this->const = array(); |
|
82 | 82 | $r = 0; |
83 | 83 | |
84 | 84 | // Boxes |
85 | - $this->boxes = array (); |
|
85 | + $this->boxes = array(); |
|
86 | 86 | |
87 | 87 | // Permissions |
88 | 88 | $this->rights = array(); // Permission array used by this module |
@@ -93,33 +93,33 @@ discard block |
||
93 | 93 | $this->rights[$r][3] = 0; |
94 | 94 | $this->rights[$r][4] = 'employee'; |
95 | 95 | $this->rights[$r][5] = 'read'; |
96 | - $r ++; |
|
96 | + $r++; |
|
97 | 97 | |
98 | 98 | $this->rights[$r][0] = 4002; |
99 | 99 | $this->rights[$r][1] = 'Create employees'; |
100 | 100 | $this->rights[$r][3] = 0; |
101 | 101 | $this->rights[$r][4] = 'employee'; |
102 | 102 | $this->rights[$r][5] = 'write'; |
103 | - $r ++; |
|
103 | + $r++; |
|
104 | 104 | |
105 | 105 | $this->rights[$r][0] = 4003; |
106 | 106 | $this->rights[$r][1] = 'Delete employees'; |
107 | 107 | $this->rights[$r][3] = 0; |
108 | 108 | $this->rights[$r][4] = 'employee'; |
109 | 109 | $this->rights[$r][5] = 'delete'; |
110 | - $r ++; |
|
110 | + $r++; |
|
111 | 111 | |
112 | 112 | $this->rights[$r][0] = 4004; |
113 | 113 | $this->rights[$r][1] = 'Export employees'; |
114 | 114 | $this->rights[$r][3] = 0; |
115 | 115 | $this->rights[$r][4] = 'employee'; |
116 | 116 | $this->rights[$r][5] = 'export'; |
117 | - $r ++; |
|
117 | + $r++; |
|
118 | 118 | |
119 | 119 | |
120 | 120 | // Menus |
121 | 121 | //------- |
122 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
122 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | * @param string $options Enabling module ('', 'noboxes') |
132 | 132 | * @return int if OK, 0 if KO |
133 | 133 | */ |
134 | - function init($options='') |
|
134 | + function init($options = '') |
|
135 | 135 | { |
136 | 136 | // Permissions |
137 | 137 | $this->remove($options); |
138 | 138 | |
139 | 139 | $sql = array(); |
140 | 140 | |
141 | - return $this->_init($sql,$options); |
|
141 | + return $this->_init($sql, $options); |
|
142 | 142 | } |
143 | 143 | } |
@@ -32,33 +32,33 @@ discard block |
||
32 | 32 | { |
33 | 33 | |
34 | 34 | /** |
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | 38 | */ |
39 | 39 | function __construct($db) |
40 | 40 | { |
41 | - global $langs,$conf; |
|
41 | + global $langs,$conf; |
|
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | $this->numero = 30000; |
45 | 45 | |
46 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | - // It is used to group modules in module setup page |
|
46 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | + // It is used to group modules in module setup page |
|
48 | 48 | $this->family = "portal"; |
49 | 49 | $this->module_position = '51'; |
50 | 50 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
51 | 51 | $this->name = preg_replace('/^mod/i','',get_class($this)); |
52 | 52 | $this->description = "Enable the public collaboration features, like shared pad, shared online sheets, etc..."; |
53 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
53 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
54 | 54 | $this->version = 'development'; |
55 | 55 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
57 | 57 | // Name of image file used for this module. |
58 | 58 | $this->picto='globe'; |
59 | 59 | |
60 | - // Data directories to create when module is enabled |
|
61 | - $this->dirs = array("/collab/temp"); |
|
60 | + // Data directories to create when module is enabled |
|
61 | + $this->dirs = array("/collab/temp"); |
|
62 | 62 | |
63 | 63 | // Config pages |
64 | 64 | //------------- |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | |
67 | 67 | // Dependancies |
68 | 68 | //------------- |
69 | - $this->hidden = ! empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module |
|
70 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
69 | + $this->hidden = ! empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module |
|
70 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
71 | 71 | $this->requiredby = array(); // List of modules id to disable if this one is disabled |
72 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
72 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
73 | 73 | $this->langfiles = array("collab"); |
74 | 74 | |
75 | 75 | // Constants |
76 | 76 | //----------- |
77 | - $this->const = array(); |
|
77 | + $this->const = array(); |
|
78 | 78 | |
79 | 79 | // New pages on tabs |
80 | 80 | // ----------------- |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | //------ |
85 | 85 | $this->boxes = array(); |
86 | 86 | |
87 | - // Permissions |
|
88 | - $this->rights = array(); // Permission array used by this module |
|
89 | - $this->rights_class = 'collab'; |
|
90 | - $r=0; |
|
87 | + // Permissions |
|
88 | + $this->rights = array(); // Permission array used by this module |
|
89 | + $this->rights_class = 'collab'; |
|
90 | + $r=0; |
|
91 | 91 | |
92 | - /*$this->rights[$r][0] = 30001; |
|
92 | + /*$this->rights[$r][0] = 30001; |
|
93 | 93 | $this->rights[$r][1] = 'Read website content'; |
94 | 94 | $this->rights[$r][3] = 0; |
95 | 95 | $this->rights[$r][4] = 'read'; |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | // Main menu entries |
111 | 111 | $r=0; |
112 | 112 | $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
113 | - 'type'=>'top', // This is a Left menu entry |
|
114 | - 'titre'=>'Collab', |
|
113 | + 'type'=>'top', // This is a Left menu entry |
|
114 | + 'titre'=>'Collab', |
|
115 | 115 | 'mainmenu'=>'collab', |
116 | - 'url'=>'/collab/index.php', |
|
117 | - 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
118 | - 'position'=>100, |
|
119 | - 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
120 | - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
121 | - 'target'=>'', |
|
122 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
116 | + 'url'=>'/collab/index.php', |
|
117 | + 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
118 | + 'position'=>100, |
|
119 | + 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
120 | + 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
121 | + 'target'=>'', |
|
122 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
123 | 123 | $r++; |
124 | 124 | } |
125 | 125 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \ingroup collab |
23 | 23 | * \brief Description and activation file for module Collab |
24 | 24 | */ |
25 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
25 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function __construct($db) |
40 | 40 | { |
41 | - global $langs,$conf; |
|
41 | + global $langs, $conf; |
|
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | $this->numero = 30000; |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | $this->family = "portal"; |
49 | 49 | $this->module_position = '51'; |
50 | 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)); |
|
51 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
52 | 52 | $this->description = "Enable the public collaboration features, like shared pad, shared online sheets, etc..."; |
53 | 53 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
54 | 54 | $this->version = 'development'; |
55 | 55 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
57 | 57 | // Name of image file used for this module. |
58 | - $this->picto='globe'; |
|
58 | + $this->picto = 'globe'; |
|
59 | 59 | |
60 | 60 | // Data directories to create when module is enabled |
61 | 61 | $this->dirs = array("/collab/temp"); |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | |
67 | 67 | // Dependancies |
68 | 68 | //------------- |
69 | - $this->hidden = ! empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module |
|
70 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
69 | + $this->hidden = !empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module |
|
70 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
73 | 73 | $this->langfiles = array("collab"); |
74 | 74 | |
75 | 75 | // Constants |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | $this->boxes = array(); |
86 | 86 | |
87 | 87 | // Permissions |
88 | - $this->rights = array(); // Permission array used by this module |
|
88 | + $this->rights = array(); // Permission array used by this module |
|
89 | 89 | $this->rights_class = 'collab'; |
90 | - $r=0; |
|
90 | + $r = 0; |
|
91 | 91 | |
92 | 92 | /*$this->rights[$r][0] = 30001; |
93 | 93 | $this->rights[$r][1] = 'Read website content'; |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | $r++;*/ |
109 | 109 | |
110 | 110 | // Main menu entries |
111 | - $r=0; |
|
112 | - $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
113 | - 'type'=>'top', // This is a Left menu entry |
|
111 | + $r = 0; |
|
112 | + $this->menu[$r] = array('fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
113 | + 'type'=>'top', // This is a Left menu entry |
|
114 | 114 | 'titre'=>'Collab', |
115 | 115 | 'mainmenu'=>'collab', |
116 | 116 | 'url'=>'/collab/index.php', |
117 | - 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
117 | + 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
118 | 118 | 'position'=>100, |
119 | - 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
120 | - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
119 | + 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
120 | + 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
121 | 121 | 'target'=>'', |
122 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
122 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
123 | 123 | $r++; |
124 | 124 | } |
125 | 125 | } |
@@ -33,59 +33,59 @@ |
||
33 | 33 | class modMailmanSpip extends DolibarrModules |
34 | 34 | { |
35 | 35 | |
36 | - /** |
|
37 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | - * |
|
39 | - * @param DoliDB $db Database handler |
|
40 | - */ |
|
41 | - function __construct($db) |
|
42 | - { |
|
43 | - $this->db = $db; |
|
44 | - $this->numero = 105; |
|
36 | + /** |
|
37 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | + * |
|
39 | + * @param DoliDB $db Database handler |
|
40 | + */ |
|
41 | + function __construct($db) |
|
42 | + { |
|
43 | + $this->db = $db; |
|
44 | + $this->numero = 105; |
|
45 | 45 | |
46 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | - // It is used to group modules in module setup page |
|
48 | - $this->family = "interface"; |
|
49 | - // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
50 | - $this->module_position = '70'; |
|
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 | - $this->description = "Mailman or Spip interface for member module"; |
|
46 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | + // It is used to group modules in module setup page |
|
48 | + $this->family = "interface"; |
|
49 | + // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
50 | + $this->module_position = '70'; |
|
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 | + $this->description = "Mailman or Spip interface for member module"; |
|
54 | 54 | |
55 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
|
56 | - $this->version = 'dolibarr'; |
|
55 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
|
56 | + $this->version = 'dolibarr'; |
|
57 | 57 | |
58 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | - $this->picto='technic'; |
|
58 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | + $this->picto='technic'; |
|
60 | 60 | |
61 | - // Data directories to create when module is enabled |
|
62 | - $this->dirs = array(); |
|
61 | + // Data directories to create when module is enabled |
|
62 | + $this->dirs = array(); |
|
63 | 63 | |
64 | - // Dependencies |
|
65 | - $this->hidden = false; // A condition to hide module |
|
66 | - $this->depends = array('modAdherent'); // List of module class names as string that must be enabled if this module is enabled |
|
67 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
64 | + // Dependencies |
|
65 | + $this->hidden = false; // A condition to hide module |
|
66 | + $this->depends = array('modAdherent'); // List of module class names as string that must be enabled if this module is enabled |
|
67 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
70 | 70 | |
71 | - // Config pages |
|
72 | - $this->config_page_url = array('mailman.php'); |
|
71 | + // Config pages |
|
72 | + $this->config_page_url = array('mailman.php'); |
|
73 | 73 | |
74 | - // Constants |
|
75 | - $this->const = array(); |
|
76 | - $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman"); |
|
77 | - $this->const[2] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman"); |
|
78 | - $this->const[3] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to"); |
|
74 | + // Constants |
|
75 | + $this->const = array(); |
|
76 | + $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman"); |
|
77 | + $this->const[2] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman"); |
|
78 | + $this->const[3] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to"); |
|
79 | 79 | |
80 | - // Boxes |
|
81 | - $this->boxes = array(); |
|
80 | + // Boxes |
|
81 | + $this->boxes = array(); |
|
82 | 82 | |
83 | - // Permissions |
|
84 | - $this->rights = array(); |
|
85 | - $this->rights_class = 'clicktodial'; |
|
83 | + // Permissions |
|
84 | + $this->rights = array(); |
|
85 | + $this->rights_class = 'clicktodial'; |
|
86 | 86 | |
87 | - // Menus |
|
88 | - //------- |
|
89 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
90 | - } |
|
87 | + // Menus |
|
88 | + //------- |
|
89 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
90 | + } |
|
91 | 91 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \brief Fichier de description et activation du module de click to Dial |
25 | 25 | */ |
26 | 26 | |
27 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
27 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
@@ -49,33 +49,33 @@ discard block |
||
49 | 49 | // Module position in the family on 2 digits ('01', '10', '20', ...) |
50 | 50 | $this->module_position = '70'; |
51 | 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)); |
|
52 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
53 | 53 | $this->description = "Mailman or Spip interface for member module"; |
54 | 54 | |
55 | 55 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
56 | 56 | $this->version = 'dolibarr'; |
57 | 57 | |
58 | 58 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
59 | - $this->picto='technic'; |
|
59 | + $this->picto = 'technic'; |
|
60 | 60 | |
61 | 61 | // Data directories to create when module is enabled |
62 | 62 | $this->dirs = array(); |
63 | 63 | |
64 | 64 | // Dependencies |
65 | - $this->hidden = false; // A condition to hide module |
|
66 | - $this->depends = array('modAdherent'); // List of module class names as string that must be enabled if this module is enabled |
|
67 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
65 | + $this->hidden = false; // A condition to hide module |
|
66 | + $this->depends = array('modAdherent'); // List of module class names as string that must be enabled if this module is enabled |
|
67 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
70 | 70 | |
71 | 71 | // Config pages |
72 | 72 | $this->config_page_url = array('mailman.php'); |
73 | 73 | |
74 | 74 | // Constants |
75 | 75 | $this->const = array(); |
76 | - $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman"); |
|
77 | - $this->const[2] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman"); |
|
78 | - $this->const[3] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to"); |
|
76 | + $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL", "chaine", "http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%", "Url de désinscription aux listes mailman"); |
|
77 | + $this->const[2] = array("ADHERENT_MAILMAN_URL", "chaine", "http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%", "Url pour les inscriptions mailman"); |
|
78 | + $this->const[3] = array("ADHERENT_MAILMAN_LISTS", "chaine", "", "Mailing-list to subscribe new members to"); |
|
79 | 79 | |
80 | 80 | // Boxes |
81 | 81 | $this->boxes = array(); |
@@ -86,6 +86,6 @@ discard block |
||
86 | 86 | |
87 | 87 | // Menus |
88 | 88 | //------- |
89 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
89 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
90 | 90 | } |
91 | 91 | } |
@@ -31,71 +31,71 @@ |
||
31 | 31 | class modNotification extends DolibarrModules |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
38 | - */ |
|
39 | - function __construct($db) |
|
40 | - { |
|
41 | - $this->db = $db; |
|
42 | - $this->numero = 600; |
|
34 | + /** |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | + */ |
|
39 | + function __construct($db) |
|
40 | + { |
|
41 | + $this->db = $db; |
|
42 | + $this->numero = 600; |
|
43 | 43 | |
44 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
45 | - // It is used to group modules in module setup page |
|
46 | - $this->family = "interface"; |
|
47 | - // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
48 | - $this->module_position = '01'; |
|
49 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | - $this->description = "EMail notifications (push) on business Dolibarr events"; |
|
44 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
45 | + // It is used to group modules in module setup page |
|
46 | + $this->family = "interface"; |
|
47 | + // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
48 | + $this->module_position = '01'; |
|
49 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
50 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | + $this->description = "EMail notifications (push) on business Dolibarr events"; |
|
52 | 52 | $this->descriptionlong = 'Module600Long'; |
53 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
53 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
54 | 54 | $this->version = 'dolibarr'; |
55 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
56 | - $this->picto='email'; |
|
55 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
56 | + $this->picto='email'; |
|
57 | 57 | |
58 | - // Data directories to create when module is enabled. |
|
59 | - $this->dirs = array(); |
|
58 | + // Data directories to create when module is enabled. |
|
59 | + $this->dirs = array(); |
|
60 | 60 | |
61 | - // Dependencies |
|
62 | - $this->hidden = false; // A condition to hide module |
|
63 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
64 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
65 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
66 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
67 | - $this->langfiles = array("mails"); |
|
61 | + // Dependencies |
|
62 | + $this->hidden = false; // A condition to hide module |
|
63 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
64 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
65 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
66 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
67 | + $this->langfiles = array("mails"); |
|
68 | 68 | |
69 | - // Config pages |
|
70 | - $this->config_page_url = array("notification.php"); |
|
69 | + // Config pages |
|
70 | + $this->config_page_url = array("notification.php"); |
|
71 | 71 | |
72 | - // Constants |
|
73 | - $this->const = array(); |
|
72 | + // Constants |
|
73 | + $this->const = array(); |
|
74 | 74 | |
75 | - // Boxes |
|
76 | - $this->boxes = array(); |
|
75 | + // Boxes |
|
76 | + $this->boxes = array(); |
|
77 | 77 | |
78 | - // Permissions |
|
79 | - $this->rights = array(); |
|
80 | - $this->rights_class = 'notification'; |
|
81 | - } |
|
78 | + // Permissions |
|
79 | + $this->rights = array(); |
|
80 | + $this->rights_class = 'notification'; |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | - /** |
|
85 | - * Function called when module is enabled. |
|
86 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
87 | - * It also creates data directories |
|
88 | - * |
|
84 | + /** |
|
85 | + * Function called when module is enabled. |
|
86 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
87 | + * It also creates data directories |
|
88 | + * |
|
89 | 89 | * @param string $options Options when enabling module ('', 'noboxes') |
90 | - * @return int 1 if OK, 0 if KO |
|
91 | - */ |
|
92 | - function init($options='') |
|
93 | - { |
|
94 | - // Permissions |
|
95 | - $this->remove($options); |
|
90 | + * @return int 1 if OK, 0 if KO |
|
91 | + */ |
|
92 | + function init($options='') |
|
93 | + { |
|
94 | + // Permissions |
|
95 | + $this->remove($options); |
|
96 | 96 | |
97 | - $sql = array(); |
|
97 | + $sql = array(); |
|
98 | 98 | |
99 | - return $this->_init($sql,$options); |
|
100 | - } |
|
99 | + return $this->_init($sql,$options); |
|
100 | + } |
|
101 | 101 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup notification |
24 | 24 | * \brief Fichier de description et activation du module Notification |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
26 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Class to describe and enable module Mailing |
@@ -47,23 +47,23 @@ discard block |
||
47 | 47 | // Module position in the family on 2 digits ('01', '10', '20', ...) |
48 | 48 | $this->module_position = '01'; |
49 | 49 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
50 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
51 | 51 | $this->description = "EMail notifications (push) on business Dolibarr events"; |
52 | 52 | $this->descriptionlong = 'Module600Long'; |
53 | 53 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
54 | 54 | $this->version = 'dolibarr'; |
55 | 55 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
56 | - $this->picto='email'; |
|
56 | + $this->picto = 'email'; |
|
57 | 57 | |
58 | 58 | // Data directories to create when module is enabled. |
59 | 59 | $this->dirs = array(); |
60 | 60 | |
61 | 61 | // Dependencies |
62 | - $this->hidden = false; // A condition to hide module |
|
63 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
64 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
65 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
66 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
62 | + $this->hidden = false; // A condition to hide module |
|
63 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
64 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
65 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
66 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
67 | 67 | $this->langfiles = array("mails"); |
68 | 68 | |
69 | 69 | // Config pages |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | * @param string $options Options when enabling module ('', 'noboxes') |
90 | 90 | * @return int 1 if OK, 0 if KO |
91 | 91 | */ |
92 | - function init($options='') |
|
92 | + function init($options = '') |
|
93 | 93 | { |
94 | 94 | // Permissions |
95 | 95 | $this->remove($options); |
96 | 96 | |
97 | 97 | $sql = array(); |
98 | 98 | |
99 | - return $this->_init($sql,$options); |
|
99 | + return $this->_init($sql, $options); |
|
100 | 100 | } |
101 | 101 | } |
@@ -35,94 +35,94 @@ discard block |
||
35 | 35 | class modPrelevement extends DolibarrModules |
36 | 36 | { |
37 | 37 | |
38 | - /** |
|
39 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
40 | - * |
|
41 | - * @param DoliDB $db Database handler |
|
42 | - */ |
|
43 | - function __construct($db) |
|
44 | - { |
|
45 | - global $conf; |
|
46 | - |
|
47 | - $this->db = $db; |
|
48 | - $this->numero = 57; |
|
49 | - |
|
50 | - $this->family = "financial"; |
|
51 | - $this->module_position = '52'; |
|
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 | - $this->description = "Gestion des Prelevements"; |
|
55 | - |
|
56 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
57 | - $this->version = 'dolibarr'; |
|
58 | - |
|
59 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
60 | - // Name of png file (without png) used for this module |
|
61 | - $this->picto='payment'; |
|
62 | - |
|
63 | - // Data directories to create when module is enabled |
|
64 | - $this->dirs = array("/prelevement/temp","/prelevement/receipts"); |
|
65 | - |
|
66 | - // Dependencies |
|
67 | - $this->hidden = false; // A condition to hide module |
|
68 | - $this->depends = array("modFacture","modBanque"); // List of module class names as string that must be enabled if this module is enabled |
|
69 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
70 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
72 | - |
|
73 | - // Config pages |
|
74 | - $this->config_page_url = array("prelevement.php"); |
|
75 | - |
|
76 | - // Constants |
|
77 | - $this->const = array(); |
|
78 | - $r=0; |
|
79 | - |
|
80 | - $this->const[$r][0] = "BANK_ADDON_PDF"; |
|
81 | - $this->const[$r][1] = "chaine"; |
|
82 | - $this->const[$r][2] = "sepamandate"; |
|
83 | - $this->const[$r][3] = 'Name of manager to generate SEPA mandate'; |
|
84 | - $this->const[$r][4] = 0; |
|
85 | - $r++; |
|
86 | - |
|
87 | - |
|
88 | - // Boxes |
|
89 | - $this->boxes = array(); |
|
90 | - |
|
91 | - // Permissions |
|
92 | - $this->rights = array(); |
|
93 | - $this->rights_class = 'prelevement'; |
|
94 | - $r=0; |
|
95 | - $r++; |
|
96 | - $this->rights[$r][0] = 151; |
|
97 | - $this->rights[$r][1] = 'Read direct debit payment orders'; |
|
98 | - $this->rights[$r][2] = 'r'; |
|
99 | - $this->rights[$r][3] = 0; |
|
100 | - $this->rights[$r][4] = 'bons'; |
|
101 | - $this->rights[$r][5] = 'lire'; |
|
102 | - |
|
103 | - $r++; |
|
104 | - $this->rights[$r][0] = 152; |
|
105 | - $this->rights[$r][1] = 'Create/modify a direct debit payment order'; |
|
106 | - $this->rights[$r][2] = 'w'; |
|
107 | - $this->rights[$r][3] = 0; |
|
108 | - $this->rights[$r][4] = 'bons'; |
|
109 | - $this->rights[$r][5] = 'creer'; |
|
110 | - |
|
111 | - $r++; |
|
112 | - $this->rights[$r][0] = 153; |
|
113 | - $this->rights[$r][1] = 'Send/Transmit direct debit payment orders'; |
|
114 | - $this->rights[$r][2] = 'a'; |
|
115 | - $this->rights[$r][3] = 0; |
|
116 | - $this->rights[$r][4] = 'bons'; |
|
117 | - $this->rights[$r][5] = 'send'; |
|
118 | - |
|
119 | - $r++; |
|
120 | - $this->rights[$r][0] = 154; |
|
121 | - $this->rights[$r][1] = 'Record Credits/Rejects of direct debit payment orders'; |
|
122 | - $this->rights[$r][2] = 'a'; |
|
123 | - $this->rights[$r][3] = 0; |
|
124 | - $this->rights[$r][4] = 'bons'; |
|
125 | - $this->rights[$r][5] = 'credit'; |
|
38 | + /** |
|
39 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
40 | + * |
|
41 | + * @param DoliDB $db Database handler |
|
42 | + */ |
|
43 | + function __construct($db) |
|
44 | + { |
|
45 | + global $conf; |
|
46 | + |
|
47 | + $this->db = $db; |
|
48 | + $this->numero = 57; |
|
49 | + |
|
50 | + $this->family = "financial"; |
|
51 | + $this->module_position = '52'; |
|
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 | + $this->description = "Gestion des Prelevements"; |
|
55 | + |
|
56 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
57 | + $this->version = 'dolibarr'; |
|
58 | + |
|
59 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
60 | + // Name of png file (without png) used for this module |
|
61 | + $this->picto='payment'; |
|
62 | + |
|
63 | + // Data directories to create when module is enabled |
|
64 | + $this->dirs = array("/prelevement/temp","/prelevement/receipts"); |
|
65 | + |
|
66 | + // Dependencies |
|
67 | + $this->hidden = false; // A condition to hide module |
|
68 | + $this->depends = array("modFacture","modBanque"); // List of module class names as string that must be enabled if this module is enabled |
|
69 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
70 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
72 | + |
|
73 | + // Config pages |
|
74 | + $this->config_page_url = array("prelevement.php"); |
|
75 | + |
|
76 | + // Constants |
|
77 | + $this->const = array(); |
|
78 | + $r=0; |
|
79 | + |
|
80 | + $this->const[$r][0] = "BANK_ADDON_PDF"; |
|
81 | + $this->const[$r][1] = "chaine"; |
|
82 | + $this->const[$r][2] = "sepamandate"; |
|
83 | + $this->const[$r][3] = 'Name of manager to generate SEPA mandate'; |
|
84 | + $this->const[$r][4] = 0; |
|
85 | + $r++; |
|
86 | + |
|
87 | + |
|
88 | + // Boxes |
|
89 | + $this->boxes = array(); |
|
90 | + |
|
91 | + // Permissions |
|
92 | + $this->rights = array(); |
|
93 | + $this->rights_class = 'prelevement'; |
|
94 | + $r=0; |
|
95 | + $r++; |
|
96 | + $this->rights[$r][0] = 151; |
|
97 | + $this->rights[$r][1] = 'Read direct debit payment orders'; |
|
98 | + $this->rights[$r][2] = 'r'; |
|
99 | + $this->rights[$r][3] = 0; |
|
100 | + $this->rights[$r][4] = 'bons'; |
|
101 | + $this->rights[$r][5] = 'lire'; |
|
102 | + |
|
103 | + $r++; |
|
104 | + $this->rights[$r][0] = 152; |
|
105 | + $this->rights[$r][1] = 'Create/modify a direct debit payment order'; |
|
106 | + $this->rights[$r][2] = 'w'; |
|
107 | + $this->rights[$r][3] = 0; |
|
108 | + $this->rights[$r][4] = 'bons'; |
|
109 | + $this->rights[$r][5] = 'creer'; |
|
110 | + |
|
111 | + $r++; |
|
112 | + $this->rights[$r][0] = 153; |
|
113 | + $this->rights[$r][1] = 'Send/Transmit direct debit payment orders'; |
|
114 | + $this->rights[$r][2] = 'a'; |
|
115 | + $this->rights[$r][3] = 0; |
|
116 | + $this->rights[$r][4] = 'bons'; |
|
117 | + $this->rights[$r][5] = 'send'; |
|
118 | + |
|
119 | + $r++; |
|
120 | + $this->rights[$r][0] = 154; |
|
121 | + $this->rights[$r][1] = 'Record Credits/Rejects of direct debit payment orders'; |
|
122 | + $this->rights[$r][2] = 'a'; |
|
123 | + $this->rights[$r][3] = 0; |
|
124 | + $this->rights[$r][4] = 'bons'; |
|
125 | + $this->rights[$r][5] = 'credit'; |
|
126 | 126 | |
127 | 127 | /* $this->rights[2][0] = 154; |
128 | 128 | $this->rights[2][1] = 'Setup withdraw account'; |
@@ -132,32 +132,32 @@ discard block |
||
132 | 132 | $this->rights[2][5] = 'configurer'; |
133 | 133 | */ |
134 | 134 | |
135 | - // Menus |
|
136 | - //------- |
|
137 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
138 | - } |
|
135 | + // Menus |
|
136 | + //------- |
|
137 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
138 | + } |
|
139 | 139 | |
140 | 140 | |
141 | - /** |
|
142 | - * Function called when module is enabled. |
|
143 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
144 | - * It also creates data directories |
|
145 | - * |
|
141 | + /** |
|
142 | + * Function called when module is enabled. |
|
143 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
144 | + * It also creates data directories |
|
145 | + * |
|
146 | 146 | * @param string $options Options when enabling module ('', 'noboxes') |
147 | - * @return int 1 if OK, 0 if KO |
|
148 | - */ |
|
149 | - function init($options='') |
|
150 | - { |
|
151 | - global $conf; |
|
152 | - |
|
153 | - // Permissions |
|
154 | - $this->remove($options); |
|
155 | - |
|
156 | - $sql = array( |
|
157 | - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity, |
|
158 | - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")", |
|
159 | - ); |
|
160 | - |
|
161 | - return $this->_init($sql,$options); |
|
162 | - } |
|
147 | + * @return int 1 if OK, 0 if KO |
|
148 | + */ |
|
149 | + function init($options='') |
|
150 | + { |
|
151 | + global $conf; |
|
152 | + |
|
153 | + // Permissions |
|
154 | + $this->remove($options); |
|
155 | + |
|
156 | + $sql = array( |
|
157 | + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity, |
|
158 | + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")", |
|
159 | + ); |
|
160 | + |
|
161 | + return $this->_init($sql,$options); |
|
162 | + } |
|
163 | 163 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * \brief Fichier de description et activation du module Prelevement |
27 | 27 | */ |
28 | 28 | |
29 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
29 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $this->family = "financial"; |
51 | 51 | $this->module_position = '52'; |
52 | 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)); |
|
53 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
54 | 54 | $this->description = "Gestion des Prelevements"; |
55 | 55 | |
56 | 56 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -58,24 +58,24 @@ discard block |
||
58 | 58 | |
59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
60 | 60 | // Name of png file (without png) used for this module |
61 | - $this->picto='payment'; |
|
61 | + $this->picto = 'payment'; |
|
62 | 62 | |
63 | 63 | // Data directories to create when module is enabled |
64 | - $this->dirs = array("/prelevement/temp","/prelevement/receipts"); |
|
64 | + $this->dirs = array("/prelevement/temp", "/prelevement/receipts"); |
|
65 | 65 | |
66 | 66 | // Dependencies |
67 | - $this->hidden = false; // A condition to hide module |
|
68 | - $this->depends = array("modFacture","modBanque"); // List of module class names as string that must be enabled if this module is enabled |
|
69 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
70 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
67 | + $this->hidden = false; // A condition to hide module |
|
68 | + $this->depends = array("modFacture", "modBanque"); // List of module class names as string that must be enabled if this module is enabled |
|
69 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
70 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
72 | 72 | |
73 | 73 | // Config pages |
74 | 74 | $this->config_page_url = array("prelevement.php"); |
75 | 75 | |
76 | 76 | // Constants |
77 | 77 | $this->const = array(); |
78 | - $r=0; |
|
78 | + $r = 0; |
|
79 | 79 | |
80 | 80 | $this->const[$r][0] = "BANK_ADDON_PDF"; |
81 | 81 | $this->const[$r][1] = "chaine"; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | // Permissions |
92 | 92 | $this->rights = array(); |
93 | 93 | $this->rights_class = 'prelevement'; |
94 | - $r=0; |
|
94 | + $r = 0; |
|
95 | 95 | $r++; |
96 | 96 | $this->rights[$r][0] = 151; |
97 | 97 | $this->rights[$r][1] = 'Read direct debit payment orders'; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | // Menus |
136 | 136 | //------- |
137 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
137 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string $options Options when enabling module ('', 'noboxes') |
147 | 147 | * @return int 1 if OK, 0 if KO |
148 | 148 | */ |
149 | - function init($options='') |
|
149 | + function init($options = '') |
|
150 | 150 | { |
151 | 151 | global $conf; |
152 | 152 | |
@@ -158,6 +158,6 @@ discard block |
||
158 | 158 | "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")", |
159 | 159 | ); |
160 | 160 | |
161 | - return $this->_init($sql,$options); |
|
161 | + return $this->_init($sql, $options); |
|
162 | 162 | } |
163 | 163 | } |
@@ -30,119 +30,119 @@ |
||
30 | 30 | */ |
31 | 31 | class modMargin extends DolibarrModules |
32 | 32 | { |
33 | - /** |
|
34 | - * Constructor |
|
35 | - * |
|
36 | - * @param DoliDB $db Database handler |
|
37 | - */ |
|
38 | - function __construct($db) |
|
39 | - { |
|
40 | - $this->db = $db; |
|
41 | - |
|
42 | - // Id for module (must be unique). |
|
43 | - // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
44 | - $this->numero = 59000; |
|
45 | - // Key text used to identify module (for permissions, menus, etc...) |
|
46 | - $this->rights_class = 'margins'; |
|
47 | - |
|
48 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
49 | - // It is used to group modules in module setup page |
|
50 | - $this->family = "financial"; |
|
51 | - $this->module_position = '55'; |
|
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 = "Margin 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 | - // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. |
|
62 | - $this->picto='margin'; |
|
63 | - |
|
64 | - // Data directories to create when module is enabled. |
|
65 | - $this->dirs = array('/margin/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("margin.php@margin"); |
|
69 | - |
|
70 | - // Dependencies |
|
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array("modPropale", "modProduct"); // 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(3,2); // Minimum version of Dolibarr required by module |
|
77 | - $this->langfiles = array("margins"); |
|
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(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
82 | - // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
|
83 | - // ); |
|
84 | - $this->const = array(0=>array('MARGIN_TYPE','chaine','costprice','Rule for margin calculation by default',0,'current',0)); // List of particular constants to add when module is enabled |
|
85 | - |
|
86 | - // New pages on tabs |
|
87 | - $this->tabs = array( |
|
88 | - 'product:+margin:Margins:margins:$user->rights->margins->liretous:/margin/tabs/productMargins.php?id=__ID__', |
|
89 | - 'thirdparty:+margin:Margins:margins:empty($user->societe_id) && $user->rights->margins->liretous && ($object->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__' |
|
90 | - ); |
|
91 | - |
|
92 | - |
|
93 | - // Boxes |
|
94 | - $this->boxes = array(); // List of boxes |
|
95 | - $r=0; |
|
96 | - |
|
97 | - // Permissions |
|
98 | - $this->rights = array(); // Permission array used by this module |
|
99 | - $r=0; |
|
100 | - |
|
101 | - // Main menu entries |
|
102 | - $this->menu = array(); // List of menus to add |
|
103 | - $r = 0; |
|
104 | - |
|
105 | - // left menu entry |
|
106 | - $this->menu[$r]=array( |
|
107 | - 'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu |
|
108 | - 'type'=>'left', // This is a Top menu entry |
|
109 | - 'titre'=>'Margins', |
|
110 | - 'mainmenu'=>'billing', |
|
111 | - 'leftmenu'=>'margins', |
|
112 | - 'url'=>'/margin/index.php', |
|
113 | - 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
114 | - 'position'=>100, |
|
115 | - 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. |
|
116 | - 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules |
|
117 | - 'target'=>'', |
|
118 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
119 | - $r++; |
|
120 | - |
|
121 | - // Permissions |
|
122 | - $this->rights = array(); |
|
123 | - $r=0; |
|
124 | - |
|
125 | - $r++; |
|
126 | - $this->rights[$r][0] = 59001; // id de la permission |
|
127 | - $this->rights[$r][1] = 'Visualiser les marges'; // libelle de la permission |
|
128 | - $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
129 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
130 | - $this->rights[$r][4] = 'liretous'; |
|
131 | - |
|
132 | - $r++; |
|
133 | - $this->rights[$r][0] = 59002; // id de la permission |
|
134 | - $this->rights[$r][1] = 'Définir les marges'; // libelle de la permission |
|
135 | - $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) |
|
136 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
137 | - $this->rights[$r][4] = 'creer'; |
|
138 | - |
|
139 | - $r++; |
|
140 | - $this->rights[$r][0] = 59003; // id de la permission |
|
141 | - $this->rights[$r][1] = 'Read every user margin'; // libelle de la permission |
|
142 | - $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
143 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
144 | - $this->rights[$r][4] = 'read'; |
|
145 | - $this->rights[$r][5] = 'all'; |
|
146 | - } |
|
33 | + /** |
|
34 | + * Constructor |
|
35 | + * |
|
36 | + * @param DoliDB $db Database handler |
|
37 | + */ |
|
38 | + function __construct($db) |
|
39 | + { |
|
40 | + $this->db = $db; |
|
41 | + |
|
42 | + // Id for module (must be unique). |
|
43 | + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
44 | + $this->numero = 59000; |
|
45 | + // Key text used to identify module (for permissions, menus, etc...) |
|
46 | + $this->rights_class = 'margins'; |
|
47 | + |
|
48 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
49 | + // It is used to group modules in module setup page |
|
50 | + $this->family = "financial"; |
|
51 | + $this->module_position = '55'; |
|
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 = "Margin 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 | + // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. |
|
62 | + $this->picto='margin'; |
|
63 | + |
|
64 | + // Data directories to create when module is enabled. |
|
65 | + $this->dirs = array('/margin/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("margin.php@margin"); |
|
69 | + |
|
70 | + // Dependencies |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array("modPropale", "modProduct"); // 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(3,2); // Minimum version of Dolibarr required by module |
|
77 | + $this->langfiles = array("margins"); |
|
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(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
82 | + // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
|
83 | + // ); |
|
84 | + $this->const = array(0=>array('MARGIN_TYPE','chaine','costprice','Rule for margin calculation by default',0,'current',0)); // List of particular constants to add when module is enabled |
|
85 | + |
|
86 | + // New pages on tabs |
|
87 | + $this->tabs = array( |
|
88 | + 'product:+margin:Margins:margins:$user->rights->margins->liretous:/margin/tabs/productMargins.php?id=__ID__', |
|
89 | + 'thirdparty:+margin:Margins:margins:empty($user->societe_id) && $user->rights->margins->liretous && ($object->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__' |
|
90 | + ); |
|
91 | + |
|
92 | + |
|
93 | + // Boxes |
|
94 | + $this->boxes = array(); // List of boxes |
|
95 | + $r=0; |
|
96 | + |
|
97 | + // Permissions |
|
98 | + $this->rights = array(); // Permission array used by this module |
|
99 | + $r=0; |
|
100 | + |
|
101 | + // Main menu entries |
|
102 | + $this->menu = array(); // List of menus to add |
|
103 | + $r = 0; |
|
104 | + |
|
105 | + // left menu entry |
|
106 | + $this->menu[$r]=array( |
|
107 | + 'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu |
|
108 | + 'type'=>'left', // This is a Top menu entry |
|
109 | + 'titre'=>'Margins', |
|
110 | + 'mainmenu'=>'billing', |
|
111 | + 'leftmenu'=>'margins', |
|
112 | + 'url'=>'/margin/index.php', |
|
113 | + 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
114 | + 'position'=>100, |
|
115 | + 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. |
|
116 | + 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules |
|
117 | + 'target'=>'', |
|
118 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
119 | + $r++; |
|
120 | + |
|
121 | + // Permissions |
|
122 | + $this->rights = array(); |
|
123 | + $r=0; |
|
124 | + |
|
125 | + $r++; |
|
126 | + $this->rights[$r][0] = 59001; // id de la permission |
|
127 | + $this->rights[$r][1] = 'Visualiser les marges'; // libelle de la permission |
|
128 | + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
129 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
130 | + $this->rights[$r][4] = 'liretous'; |
|
131 | + |
|
132 | + $r++; |
|
133 | + $this->rights[$r][0] = 59002; // id de la permission |
|
134 | + $this->rights[$r][1] = 'Définir les marges'; // libelle de la permission |
|
135 | + $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) |
|
136 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
137 | + $this->rights[$r][4] = 'creer'; |
|
138 | + |
|
139 | + $r++; |
|
140 | + $this->rights[$r][0] = 59003; // id de la permission |
|
141 | + $this->rights[$r][1] = 'Read every user margin'; // libelle de la permission |
|
142 | + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
143 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
144 | + $this->rights[$r][4] = 'read'; |
|
145 | + $this->rights[$r][5] = 'all'; |
|
146 | + } |
|
147 | 147 | } |
148 | 148 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \ingroup margin |
23 | 23 | * \brief Description and activation file for module Margin |
24 | 24 | */ |
25 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
25 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $this->family = "financial"; |
51 | 51 | $this->module_position = '55'; |
52 | 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)); |
|
53 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
54 | 54 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
55 | 55 | $this->description = "Margin management"; |
56 | 56 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
60 | 60 | // Name of png file (without png) used for this module. |
61 | 61 | // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. |
62 | - $this->picto='margin'; |
|
62 | + $this->picto = 'margin'; |
|
63 | 63 | |
64 | 64 | // Data directories to create when module is enabled. |
65 | 65 | $this->dirs = array('/margin/temp'); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | $this->config_page_url = array("margin.php@margin"); |
69 | 69 | |
70 | 70 | // Dependencies |
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array("modPropale", "modProduct"); // 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(3,2); // Minimum version of Dolibarr required by module |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array("modPropale", "modProduct"); // 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(3, 2); // Minimum version of Dolibarr required by module |
|
77 | 77 | $this->langfiles = array("margins"); |
78 | 78 | |
79 | 79 | // Constants |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
82 | 82 | // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
83 | 83 | // ); |
84 | - $this->const = array(0=>array('MARGIN_TYPE','chaine','costprice','Rule for margin calculation by default',0,'current',0)); // List of particular constants to add when module is enabled |
|
84 | + $this->const = array(0=>array('MARGIN_TYPE', 'chaine', 'costprice', 'Rule for margin calculation by default', 0, 'current', 0)); // List of particular constants to add when module is enabled |
|
85 | 85 | |
86 | 86 | // New pages on tabs |
87 | 87 | $this->tabs = array( |
@@ -91,36 +91,36 @@ discard block |
||
91 | 91 | |
92 | 92 | |
93 | 93 | // Boxes |
94 | - $this->boxes = array(); // List of boxes |
|
95 | - $r=0; |
|
94 | + $this->boxes = array(); // List of boxes |
|
95 | + $r = 0; |
|
96 | 96 | |
97 | 97 | // Permissions |
98 | - $this->rights = array(); // Permission array used by this module |
|
99 | - $r=0; |
|
98 | + $this->rights = array(); // Permission array used by this module |
|
99 | + $r = 0; |
|
100 | 100 | |
101 | 101 | // Main menu entries |
102 | - $this->menu = array(); // List of menus to add |
|
102 | + $this->menu = array(); // List of menus to add |
|
103 | 103 | $r = 0; |
104 | 104 | |
105 | 105 | // left menu entry |
106 | - $this->menu[$r]=array( |
|
107 | - 'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu |
|
108 | - 'type'=>'left', // This is a Top menu entry |
|
106 | + $this->menu[$r] = array( |
|
107 | + 'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu |
|
108 | + 'type'=>'left', // This is a Top menu entry |
|
109 | 109 | 'titre'=>'Margins', |
110 | 110 | 'mainmenu'=>'billing', |
111 | 111 | 'leftmenu'=>'margins', |
112 | 112 | 'url'=>'/margin/index.php', |
113 | - 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
113 | + 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
114 | 114 | 'position'=>100, |
115 | - 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. |
|
116 | - 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules |
|
115 | + 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. |
|
116 | + 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules |
|
117 | 117 | 'target'=>'', |
118 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
118 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
119 | 119 | $r++; |
120 | 120 | |
121 | 121 | // Permissions |
122 | 122 | $this->rights = array(); |
123 | - $r=0; |
|
123 | + $r = 0; |
|
124 | 124 | |
125 | 125 | $r++; |
126 | 126 | $this->rights[$r][0] = 59001; // id de la permission |
@@ -36,409 +36,409 @@ discard block |
||
36 | 36 | */ |
37 | 37 | class doc_generic_user_odt extends ModelePDFUser |
38 | 38 | { |
39 | - /** |
|
40 | - * Issuer |
|
41 | - * @var Societe |
|
42 | - */ |
|
43 | - public $emetteur; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var array() Minimum version of PHP required by module. |
|
47 | - * e.g.: PHP ≥ 5.4 = array(5, 4) |
|
48 | - */ |
|
49 | - public $phpmin = array(5, 4); |
|
50 | - |
|
51 | - /** |
|
52 | - * Dolibarr version of the loaded document |
|
53 | - * @public string |
|
54 | - */ |
|
55 | - public $version = 'dolibarr'; |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * Constructor |
|
60 | - * |
|
61 | - * @param DoliDB $db Database handler |
|
62 | - */ |
|
63 | - function __construct($db) |
|
64 | - { |
|
65 | - global $conf, $langs, $mysoc; |
|
66 | - |
|
67 | - // Load translation files required by the page |
|
39 | + /** |
|
40 | + * Issuer |
|
41 | + * @var Societe |
|
42 | + */ |
|
43 | + public $emetteur; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var array() Minimum version of PHP required by module. |
|
47 | + * e.g.: PHP ≥ 5.4 = array(5, 4) |
|
48 | + */ |
|
49 | + public $phpmin = array(5, 4); |
|
50 | + |
|
51 | + /** |
|
52 | + * Dolibarr version of the loaded document |
|
53 | + * @public string |
|
54 | + */ |
|
55 | + public $version = 'dolibarr'; |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * Constructor |
|
60 | + * |
|
61 | + * @param DoliDB $db Database handler |
|
62 | + */ |
|
63 | + function __construct($db) |
|
64 | + { |
|
65 | + global $conf, $langs, $mysoc; |
|
66 | + |
|
67 | + // Load translation files required by the page |
|
68 | 68 | $langs->loadLangs(array("main","companies")); |
69 | 69 | |
70 | - $this->db = $db; |
|
71 | - $this->name = "ODT templates"; |
|
72 | - $this->description = $langs->trans("DocumentModelOdt"); |
|
73 | - $this->scandir = 'USER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan |
|
74 | - |
|
75 | - // Dimension page pour format A4 |
|
76 | - $this->type = 'odt'; |
|
77 | - $this->page_largeur = 0; |
|
78 | - $this->page_hauteur = 0; |
|
79 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
80 | - $this->marge_gauche=0; |
|
81 | - $this->marge_droite=0; |
|
82 | - $this->marge_haute=0; |
|
83 | - $this->marge_basse=0; |
|
84 | - |
|
85 | - $this->option_logo = 1; // Affiche logo |
|
86 | - $this->option_tva = 0; // Gere option tva USER_TVAOPTION |
|
87 | - $this->option_modereg = 0; // Affiche mode reglement |
|
88 | - $this->option_condreg = 0; // Affiche conditions reglement |
|
89 | - $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
90 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
91 | - $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
92 | - $this->option_credit_note = 0; // Support credit notes |
|
93 | - $this->option_freetext = 1; // Support add of a personalised text |
|
94 | - $this->option_draft_watermark = 0; // Support add of a watermark on drafts |
|
95 | - |
|
96 | - // Recupere emetteur |
|
97 | - $this->emetteur=$mysoc; |
|
98 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
99 | - } |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * Return description of a module |
|
104 | - * |
|
105 | - * @param Translate $langs Lang object to use for output |
|
106 | - * @return string Description |
|
107 | - */ |
|
108 | - function info($langs) |
|
109 | - { |
|
110 | - global $conf, $langs; |
|
111 | - |
|
112 | - // Load translation files required by the page |
|
70 | + $this->db = $db; |
|
71 | + $this->name = "ODT templates"; |
|
72 | + $this->description = $langs->trans("DocumentModelOdt"); |
|
73 | + $this->scandir = 'USER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan |
|
74 | + |
|
75 | + // Dimension page pour format A4 |
|
76 | + $this->type = 'odt'; |
|
77 | + $this->page_largeur = 0; |
|
78 | + $this->page_hauteur = 0; |
|
79 | + $this->format = array($this->page_largeur,$this->page_hauteur); |
|
80 | + $this->marge_gauche=0; |
|
81 | + $this->marge_droite=0; |
|
82 | + $this->marge_haute=0; |
|
83 | + $this->marge_basse=0; |
|
84 | + |
|
85 | + $this->option_logo = 1; // Affiche logo |
|
86 | + $this->option_tva = 0; // Gere option tva USER_TVAOPTION |
|
87 | + $this->option_modereg = 0; // Affiche mode reglement |
|
88 | + $this->option_condreg = 0; // Affiche conditions reglement |
|
89 | + $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
90 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
91 | + $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
92 | + $this->option_credit_note = 0; // Support credit notes |
|
93 | + $this->option_freetext = 1; // Support add of a personalised text |
|
94 | + $this->option_draft_watermark = 0; // Support add of a watermark on drafts |
|
95 | + |
|
96 | + // Recupere emetteur |
|
97 | + $this->emetteur=$mysoc; |
|
98 | + if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
99 | + } |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * Return description of a module |
|
104 | + * |
|
105 | + * @param Translate $langs Lang object to use for output |
|
106 | + * @return string Description |
|
107 | + */ |
|
108 | + function info($langs) |
|
109 | + { |
|
110 | + global $conf, $langs; |
|
111 | + |
|
112 | + // Load translation files required by the page |
|
113 | 113 | $langs->loadLangs(array('companies', 'errors')); |
114 | 114 | |
115 | - $form = new Form($this->db); |
|
116 | - |
|
117 | - $texte = $this->description.".<br>\n"; |
|
118 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
119 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
120 | - $texte.= '<input type="hidden" name="action" value="setModuleOptions">'; |
|
121 | - $texte.= '<input type="hidden" name="param1" value="USER_ADDON_PDF_ODT_PATH">'; |
|
122 | - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) |
|
123 | - { |
|
124 | - $texte.= '<input type="hidden" name="param2" value="USER_ADDON_PDF_ODT_DEFAULT">'; |
|
125 | - $texte.= '<input type="hidden" name="param3" value="USER_ADDON_PDF_ODT_TOBILL">'; |
|
126 | - $texte.= '<input type="hidden" name="param4" value="USER_ADDON_PDF_ODT_CLOSED">'; |
|
127 | - } |
|
128 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
129 | - |
|
130 | - // List of directories area |
|
131 | - $texte.= '<tr><td>'; |
|
132 | - $texttitle=$langs->trans("ListOfDirectories"); |
|
133 | - $listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->USER_ADDON_PDF_ODT_PATH))); |
|
134 | - $listoffiles=array(); |
|
135 | - foreach($listofdir as $key=>$tmpdir) |
|
136 | - { |
|
137 | - $tmpdir=trim($tmpdir); |
|
138 | - $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); |
|
139 | - if (! $tmpdir) { |
|
140 | - unset($listofdir[$key]); continue; |
|
141 | - } |
|
142 | - if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); |
|
143 | - else |
|
144 | - { |
|
145 | - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); |
|
146 | - if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); |
|
147 | - } |
|
148 | - } |
|
149 | - $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); |
|
150 | - // Add list of substitution keys |
|
151 | - $texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>'; |
|
152 | - $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it |
|
153 | - |
|
154 | - $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); |
|
155 | - $texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">'; |
|
156 | - $texte.= '<textarea class="flat" cols="60" name="value1">'; |
|
157 | - $texte.=$conf->global->USER_ADDON_PDF_ODT_PATH; |
|
158 | - $texte.= '</textarea>'; |
|
159 | - $texte.= '</div><div style="display: inline-block; vertical-align: middle;">'; |
|
160 | - $texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">'; |
|
161 | - $texte.= '<br></div></div>'; |
|
162 | - |
|
163 | - // Scan directories |
|
164 | - if (count($listofdir)) |
|
165 | - { |
|
166 | - $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; |
|
167 | - |
|
168 | - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) |
|
169 | - { |
|
170 | - // Model for creation |
|
171 | - $liste=ModelePDFUser::liste_modeles($this->db); |
|
172 | - $texte.= '<table width="50%;">'; |
|
173 | - $texte.= '<tr>'; |
|
174 | - $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>'; |
|
175 | - $texte.= '<td colspan="">'; |
|
176 | - $texte.= $form->selectarray('value2',$liste,$conf->global->USER_ADDON_PDF_ODT_DEFAULT); |
|
177 | - $texte.= "</td></tr>"; |
|
178 | - |
|
179 | - $texte.= '<tr>'; |
|
180 | - $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>'; |
|
181 | - $texte.= '<td colspan="">'; |
|
182 | - $texte.= $form->selectarray('value3',$liste,$conf->global->USER_ADDON_PDF_ODT_TOBILL); |
|
183 | - $texte.= "</td></tr>"; |
|
184 | - $texte.= '<tr>'; |
|
185 | - |
|
186 | - $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>'; |
|
187 | - $texte.= '<td colspan="">'; |
|
188 | - $texte.= $form->selectarray('value4',$liste,$conf->global->USER_ADDON_PDF_ODT_CLOSED); |
|
189 | - $texte.= "</td></tr>"; |
|
190 | - $texte.= '</table>'; |
|
191 | - } |
|
192 | - } |
|
193 | - |
|
194 | - $texte.= '</td>'; |
|
195 | - |
|
196 | - $texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">'; |
|
197 | - $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); |
|
198 | - $texte.= '</td>'; |
|
199 | - $texte.= '</tr>'; |
|
200 | - |
|
201 | - $texte.= '</table>'; |
|
202 | - $texte.= '</form>'; |
|
203 | - |
|
204 | - return $texte; |
|
205 | - } |
|
115 | + $form = new Form($this->db); |
|
116 | + |
|
117 | + $texte = $this->description.".<br>\n"; |
|
118 | + $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
119 | + $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
120 | + $texte.= '<input type="hidden" name="action" value="setModuleOptions">'; |
|
121 | + $texte.= '<input type="hidden" name="param1" value="USER_ADDON_PDF_ODT_PATH">'; |
|
122 | + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) |
|
123 | + { |
|
124 | + $texte.= '<input type="hidden" name="param2" value="USER_ADDON_PDF_ODT_DEFAULT">'; |
|
125 | + $texte.= '<input type="hidden" name="param3" value="USER_ADDON_PDF_ODT_TOBILL">'; |
|
126 | + $texte.= '<input type="hidden" name="param4" value="USER_ADDON_PDF_ODT_CLOSED">'; |
|
127 | + } |
|
128 | + $texte.= '<table class="nobordernopadding" width="100%">'; |
|
129 | + |
|
130 | + // List of directories area |
|
131 | + $texte.= '<tr><td>'; |
|
132 | + $texttitle=$langs->trans("ListOfDirectories"); |
|
133 | + $listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->USER_ADDON_PDF_ODT_PATH))); |
|
134 | + $listoffiles=array(); |
|
135 | + foreach($listofdir as $key=>$tmpdir) |
|
136 | + { |
|
137 | + $tmpdir=trim($tmpdir); |
|
138 | + $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); |
|
139 | + if (! $tmpdir) { |
|
140 | + unset($listofdir[$key]); continue; |
|
141 | + } |
|
142 | + if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); |
|
143 | + else |
|
144 | + { |
|
145 | + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); |
|
146 | + if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); |
|
147 | + } |
|
148 | + } |
|
149 | + $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); |
|
150 | + // Add list of substitution keys |
|
151 | + $texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>'; |
|
152 | + $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it |
|
153 | + |
|
154 | + $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); |
|
155 | + $texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">'; |
|
156 | + $texte.= '<textarea class="flat" cols="60" name="value1">'; |
|
157 | + $texte.=$conf->global->USER_ADDON_PDF_ODT_PATH; |
|
158 | + $texte.= '</textarea>'; |
|
159 | + $texte.= '</div><div style="display: inline-block; vertical-align: middle;">'; |
|
160 | + $texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">'; |
|
161 | + $texte.= '<br></div></div>'; |
|
162 | + |
|
163 | + // Scan directories |
|
164 | + if (count($listofdir)) |
|
165 | + { |
|
166 | + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; |
|
167 | + |
|
168 | + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) |
|
169 | + { |
|
170 | + // Model for creation |
|
171 | + $liste=ModelePDFUser::liste_modeles($this->db); |
|
172 | + $texte.= '<table width="50%;">'; |
|
173 | + $texte.= '<tr>'; |
|
174 | + $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>'; |
|
175 | + $texte.= '<td colspan="">'; |
|
176 | + $texte.= $form->selectarray('value2',$liste,$conf->global->USER_ADDON_PDF_ODT_DEFAULT); |
|
177 | + $texte.= "</td></tr>"; |
|
178 | + |
|
179 | + $texte.= '<tr>'; |
|
180 | + $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>'; |
|
181 | + $texte.= '<td colspan="">'; |
|
182 | + $texte.= $form->selectarray('value3',$liste,$conf->global->USER_ADDON_PDF_ODT_TOBILL); |
|
183 | + $texte.= "</td></tr>"; |
|
184 | + $texte.= '<tr>'; |
|
185 | + |
|
186 | + $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>'; |
|
187 | + $texte.= '<td colspan="">'; |
|
188 | + $texte.= $form->selectarray('value4',$liste,$conf->global->USER_ADDON_PDF_ODT_CLOSED); |
|
189 | + $texte.= "</td></tr>"; |
|
190 | + $texte.= '</table>'; |
|
191 | + } |
|
192 | + } |
|
193 | + |
|
194 | + $texte.= '</td>'; |
|
195 | + |
|
196 | + $texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">'; |
|
197 | + $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); |
|
198 | + $texte.= '</td>'; |
|
199 | + $texte.= '</tr>'; |
|
200 | + |
|
201 | + $texte.= '</table>'; |
|
202 | + $texte.= '</form>'; |
|
203 | + |
|
204 | + return $texte; |
|
205 | + } |
|
206 | 206 | |
207 | 207 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
208 | - /** |
|
209 | - * Function to build a document on disk using the generic odt module. |
|
210 | - * |
|
211 | - * @param User $object Object source to build document |
|
212 | - * @param Translate $outputlangs Lang output object |
|
213 | - * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
214 | - * @param int $hidedetails Do not show line details |
|
215 | - * @param int $hidedesc Do not show desc |
|
216 | - * @param int $hideref Do not show ref |
|
217 | - * @return int 1 if OK, <=0 if KO |
|
218 | - */ |
|
219 | - function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) |
|
220 | - { |
|
208 | + /** |
|
209 | + * Function to build a document on disk using the generic odt module. |
|
210 | + * |
|
211 | + * @param User $object Object source to build document |
|
212 | + * @param Translate $outputlangs Lang output object |
|
213 | + * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
214 | + * @param int $hidedetails Do not show line details |
|
215 | + * @param int $hidedesc Do not show desc |
|
216 | + * @param int $hideref Do not show ref |
|
217 | + * @return int 1 if OK, <=0 if KO |
|
218 | + */ |
|
219 | + function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) |
|
220 | + { |
|
221 | 221 | // phpcs:enable |
222 | - global $user, $langs, $conf, $mysoc, $hookmanager; |
|
223 | - |
|
224 | - if (empty($srctemplatepath)) |
|
225 | - { |
|
226 | - dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); |
|
227 | - return -1; |
|
228 | - } |
|
229 | - |
|
230 | - // Add odtgeneration hook |
|
231 | - if (! is_object($hookmanager)) |
|
232 | - { |
|
233 | - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
234 | - $hookmanager=new HookManager($this->db); |
|
235 | - } |
|
236 | - $hookmanager->initHooks(array('odtgeneration')); |
|
237 | - global $action; |
|
238 | - |
|
239 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
240 | - $sav_charset_output=$outputlangs->charset_output; |
|
241 | - $outputlangs->charset_output='UTF-8'; |
|
242 | - |
|
243 | - // Load translation files required by the page |
|
244 | - $outputlangs->loadLangs(array("main", "companies", "bills", "dict")); |
|
245 | - |
|
246 | - if ($conf->user->dir_output) |
|
247 | - { |
|
248 | - // If $object is id instead of object |
|
249 | - if (! is_object($object)) |
|
250 | - { |
|
251 | - $id = $object; |
|
252 | - $object = new User($this->db); |
|
253 | - $result=$object->fetch($id); |
|
254 | - if ($result < 0) |
|
255 | - { |
|
256 | - dol_print_error($this->db,$object->error); |
|
257 | - return -1; |
|
258 | - } |
|
259 | - } |
|
260 | - |
|
261 | - $dir = $conf->user->dir_output; |
|
262 | - $objectref = dol_sanitizeFileName($object->ref); |
|
263 | - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
264 | - $file = $dir . "/" . $objectref . ".odt"; |
|
265 | - |
|
266 | - if (! file_exists($dir)) |
|
267 | - { |
|
268 | - if (dol_mkdir($dir) < 0) |
|
269 | - { |
|
270 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
271 | - return -1; |
|
272 | - } |
|
273 | - } |
|
274 | - |
|
275 | - if (file_exists($dir)) |
|
276 | - { |
|
277 | - //print "srctemplatepath=".$srctemplatepath; // Src filename |
|
278 | - $newfile=basename($srctemplatepath); |
|
279 | - $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile); |
|
280 | - $newfiletmp=preg_replace('/template_/i','',$newfiletmp); |
|
281 | - $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); |
|
282 | - |
|
283 | - $newfiletmp=$objectref.'_'.$newfiletmp; |
|
284 | - |
|
285 | - // Get extension (ods or odt) |
|
286 | - $newfileformat=substr($newfile, strrpos($newfile, '.')+1); |
|
287 | - if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) |
|
288 | - { |
|
289 | - $format=$conf->global->MAIN_DOC_USE_TIMING; |
|
290 | - if ($format == '1') $format='%Y%m%d%H%M%S'; |
|
291 | - $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; |
|
292 | - } |
|
293 | - else |
|
294 | - { |
|
295 | - $filename=$newfiletmp.'.'.$newfileformat; |
|
296 | - } |
|
297 | - $file=$dir.'/'.$filename; |
|
298 | - //print "newdir=".$dir; |
|
299 | - //print "newfile=".$newfile; |
|
300 | - //print "file=".$file; |
|
301 | - //print "conf->user->dir_temp=".$conf->user->dir_temp; |
|
302 | - |
|
303 | - dol_mkdir($conf->user->dir_temp); |
|
304 | - |
|
305 | - |
|
306 | - // If CUSTOMER contact defined on user, we use it |
|
307 | - $usecontact=false; |
|
308 | - $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
309 | - if (count($arrayidcontact) > 0) |
|
310 | - { |
|
311 | - $usecontact=true; |
|
312 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
313 | - } |
|
314 | - |
|
315 | - // Recipient name |
|
316 | - if (! empty($usecontact)) |
|
317 | - { |
|
318 | - // On peut utiliser le nom de la societe du contact |
|
319 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; |
|
320 | - else { |
|
321 | - $socobject = $object->thirdparty; |
|
322 | - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use |
|
323 | - $contactobject = $object->contact; |
|
324 | - } |
|
325 | - } |
|
326 | - else |
|
327 | - { |
|
328 | - $socobject=$object->thirdparty; |
|
329 | - } |
|
330 | - |
|
331 | - // Open and load template |
|
332 | - require_once ODTPHP_PATH.'odf.php'; |
|
333 | - try { |
|
334 | - $odfHandler = new odf( |
|
335 | - $srctemplatepath, |
|
336 | - array( |
|
337 | - 'PATH_TO_TMP' => $conf->user->dir_temp, |
|
338 | - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. |
|
339 | - 'DELIMITER_LEFT' => '{', |
|
340 | - 'DELIMITER_RIGHT' => '}' |
|
341 | - ) |
|
342 | - ); |
|
343 | - } |
|
344 | - catch(Exception $e) |
|
345 | - { |
|
346 | - $this->error=$e->getMessage(); |
|
347 | - dol_syslog($e->getMessage(), LOG_WARNING); |
|
348 | - return -1; |
|
349 | - } |
|
350 | - |
|
351 | - // Make substitutions into odt |
|
352 | - $array_user=$this->get_substitutionarray_user($object,$outputlangs); |
|
353 | - $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); |
|
354 | - $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); |
|
355 | - $array_other=$this->get_substitutionarray_other($outputlangs); |
|
356 | - // retrieve contact information for use in object as contact_xxx tags |
|
357 | - $array_thirdparty_contact = array(); |
|
358 | - if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); |
|
359 | - |
|
360 | - $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact); |
|
361 | - complete_substitutions_array($tmparray, $outputlangs, $object); |
|
362 | - $object->fetch_optionals(); |
|
363 | - // Call the ODTSubstitution hook |
|
364 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); |
|
365 | - $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
366 | - foreach($tmparray as $key=>$value) |
|
367 | - { |
|
368 | - try { |
|
369 | - if (preg_match('/logo$/',$key)) // Image |
|
370 | - { |
|
371 | - if (file_exists($value)) $odfHandler->setImage($key, $value); |
|
372 | - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); |
|
373 | - } |
|
374 | - else // Text |
|
375 | - { |
|
376 | - $odfHandler->setVars($key, $value, true, 'UTF-8'); |
|
377 | - } |
|
378 | - } |
|
379 | - catch(OdfException $e) |
|
380 | - { |
|
381 | - dol_syslog($e->getMessage(), LOG_WARNING); |
|
382 | - } |
|
383 | - } |
|
384 | - |
|
385 | - // Replace labels translated |
|
386 | - $tmparray=$outputlangs->get_translations_for_substitutions(); |
|
387 | - foreach($tmparray as $key=>$value) |
|
388 | - { |
|
389 | - try { |
|
390 | - $odfHandler->setVars($key, $value, true, 'UTF-8'); |
|
391 | - } |
|
392 | - catch (OdfException $e) |
|
393 | - { |
|
394 | - dol_syslog($e->getMessage(), LOG_WARNING); |
|
395 | - } |
|
396 | - } |
|
397 | - |
|
398 | - // Call the beforeODTSave hook |
|
399 | - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
400 | - $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
401 | - |
|
402 | - // Write new file |
|
403 | - if (!empty($conf->global->MAIN_ODT_AS_PDF)) { |
|
404 | - try { |
|
405 | - $odfHandler->exportAsAttachedPDF($file); |
|
406 | - } catch (Exception $e) { |
|
407 | - $this->error=$e->getMessage(); |
|
408 | - dol_syslog($e->getMessage(), LOG_WARNING); |
|
409 | - return -1; |
|
410 | - } |
|
411 | - } |
|
412 | - else { |
|
413 | - try { |
|
414 | - $odfHandler->saveToDisk($file); |
|
415 | - } catch (Exception $e) { |
|
416 | - $this->error=$e->getMessage(); |
|
417 | - dol_syslog($e->getMessage(), LOG_WARNING); |
|
418 | - return -1; |
|
419 | - } |
|
420 | - } |
|
421 | - |
|
422 | - $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
423 | - |
|
424 | - if (! empty($conf->global->MAIN_UMASK)) |
|
425 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
426 | - |
|
427 | - $odfHandler=null; // Destroy object |
|
428 | - |
|
429 | - $this->result = array('fullpath'=>$file); |
|
430 | - |
|
431 | - return 1; // Success |
|
432 | - } |
|
433 | - else |
|
434 | - { |
|
435 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
436 | - return -1; |
|
437 | - } |
|
438 | - } |
|
439 | - |
|
440 | - return -1; |
|
441 | - } |
|
222 | + global $user, $langs, $conf, $mysoc, $hookmanager; |
|
223 | + |
|
224 | + if (empty($srctemplatepath)) |
|
225 | + { |
|
226 | + dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); |
|
227 | + return -1; |
|
228 | + } |
|
229 | + |
|
230 | + // Add odtgeneration hook |
|
231 | + if (! is_object($hookmanager)) |
|
232 | + { |
|
233 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
234 | + $hookmanager=new HookManager($this->db); |
|
235 | + } |
|
236 | + $hookmanager->initHooks(array('odtgeneration')); |
|
237 | + global $action; |
|
238 | + |
|
239 | + if (! is_object($outputlangs)) $outputlangs=$langs; |
|
240 | + $sav_charset_output=$outputlangs->charset_output; |
|
241 | + $outputlangs->charset_output='UTF-8'; |
|
242 | + |
|
243 | + // Load translation files required by the page |
|
244 | + $outputlangs->loadLangs(array("main", "companies", "bills", "dict")); |
|
245 | + |
|
246 | + if ($conf->user->dir_output) |
|
247 | + { |
|
248 | + // If $object is id instead of object |
|
249 | + if (! is_object($object)) |
|
250 | + { |
|
251 | + $id = $object; |
|
252 | + $object = new User($this->db); |
|
253 | + $result=$object->fetch($id); |
|
254 | + if ($result < 0) |
|
255 | + { |
|
256 | + dol_print_error($this->db,$object->error); |
|
257 | + return -1; |
|
258 | + } |
|
259 | + } |
|
260 | + |
|
261 | + $dir = $conf->user->dir_output; |
|
262 | + $objectref = dol_sanitizeFileName($object->ref); |
|
263 | + if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
264 | + $file = $dir . "/" . $objectref . ".odt"; |
|
265 | + |
|
266 | + if (! file_exists($dir)) |
|
267 | + { |
|
268 | + if (dol_mkdir($dir) < 0) |
|
269 | + { |
|
270 | + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
271 | + return -1; |
|
272 | + } |
|
273 | + } |
|
274 | + |
|
275 | + if (file_exists($dir)) |
|
276 | + { |
|
277 | + //print "srctemplatepath=".$srctemplatepath; // Src filename |
|
278 | + $newfile=basename($srctemplatepath); |
|
279 | + $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile); |
|
280 | + $newfiletmp=preg_replace('/template_/i','',$newfiletmp); |
|
281 | + $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); |
|
282 | + |
|
283 | + $newfiletmp=$objectref.'_'.$newfiletmp; |
|
284 | + |
|
285 | + // Get extension (ods or odt) |
|
286 | + $newfileformat=substr($newfile, strrpos($newfile, '.')+1); |
|
287 | + if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) |
|
288 | + { |
|
289 | + $format=$conf->global->MAIN_DOC_USE_TIMING; |
|
290 | + if ($format == '1') $format='%Y%m%d%H%M%S'; |
|
291 | + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; |
|
292 | + } |
|
293 | + else |
|
294 | + { |
|
295 | + $filename=$newfiletmp.'.'.$newfileformat; |
|
296 | + } |
|
297 | + $file=$dir.'/'.$filename; |
|
298 | + //print "newdir=".$dir; |
|
299 | + //print "newfile=".$newfile; |
|
300 | + //print "file=".$file; |
|
301 | + //print "conf->user->dir_temp=".$conf->user->dir_temp; |
|
302 | + |
|
303 | + dol_mkdir($conf->user->dir_temp); |
|
304 | + |
|
305 | + |
|
306 | + // If CUSTOMER contact defined on user, we use it |
|
307 | + $usecontact=false; |
|
308 | + $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
309 | + if (count($arrayidcontact) > 0) |
|
310 | + { |
|
311 | + $usecontact=true; |
|
312 | + $result=$object->fetch_contact($arrayidcontact[0]); |
|
313 | + } |
|
314 | + |
|
315 | + // Recipient name |
|
316 | + if (! empty($usecontact)) |
|
317 | + { |
|
318 | + // On peut utiliser le nom de la societe du contact |
|
319 | + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; |
|
320 | + else { |
|
321 | + $socobject = $object->thirdparty; |
|
322 | + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use |
|
323 | + $contactobject = $object->contact; |
|
324 | + } |
|
325 | + } |
|
326 | + else |
|
327 | + { |
|
328 | + $socobject=$object->thirdparty; |
|
329 | + } |
|
330 | + |
|
331 | + // Open and load template |
|
332 | + require_once ODTPHP_PATH.'odf.php'; |
|
333 | + try { |
|
334 | + $odfHandler = new odf( |
|
335 | + $srctemplatepath, |
|
336 | + array( |
|
337 | + 'PATH_TO_TMP' => $conf->user->dir_temp, |
|
338 | + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. |
|
339 | + 'DELIMITER_LEFT' => '{', |
|
340 | + 'DELIMITER_RIGHT' => '}' |
|
341 | + ) |
|
342 | + ); |
|
343 | + } |
|
344 | + catch(Exception $e) |
|
345 | + { |
|
346 | + $this->error=$e->getMessage(); |
|
347 | + dol_syslog($e->getMessage(), LOG_WARNING); |
|
348 | + return -1; |
|
349 | + } |
|
350 | + |
|
351 | + // Make substitutions into odt |
|
352 | + $array_user=$this->get_substitutionarray_user($object,$outputlangs); |
|
353 | + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); |
|
354 | + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); |
|
355 | + $array_other=$this->get_substitutionarray_other($outputlangs); |
|
356 | + // retrieve contact information for use in object as contact_xxx tags |
|
357 | + $array_thirdparty_contact = array(); |
|
358 | + if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); |
|
359 | + |
|
360 | + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact); |
|
361 | + complete_substitutions_array($tmparray, $outputlangs, $object); |
|
362 | + $object->fetch_optionals(); |
|
363 | + // Call the ODTSubstitution hook |
|
364 | + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); |
|
365 | + $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
366 | + foreach($tmparray as $key=>$value) |
|
367 | + { |
|
368 | + try { |
|
369 | + if (preg_match('/logo$/',$key)) // Image |
|
370 | + { |
|
371 | + if (file_exists($value)) $odfHandler->setImage($key, $value); |
|
372 | + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); |
|
373 | + } |
|
374 | + else // Text |
|
375 | + { |
|
376 | + $odfHandler->setVars($key, $value, true, 'UTF-8'); |
|
377 | + } |
|
378 | + } |
|
379 | + catch(OdfException $e) |
|
380 | + { |
|
381 | + dol_syslog($e->getMessage(), LOG_WARNING); |
|
382 | + } |
|
383 | + } |
|
384 | + |
|
385 | + // Replace labels translated |
|
386 | + $tmparray=$outputlangs->get_translations_for_substitutions(); |
|
387 | + foreach($tmparray as $key=>$value) |
|
388 | + { |
|
389 | + try { |
|
390 | + $odfHandler->setVars($key, $value, true, 'UTF-8'); |
|
391 | + } |
|
392 | + catch (OdfException $e) |
|
393 | + { |
|
394 | + dol_syslog($e->getMessage(), LOG_WARNING); |
|
395 | + } |
|
396 | + } |
|
397 | + |
|
398 | + // Call the beforeODTSave hook |
|
399 | + $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
400 | + $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
401 | + |
|
402 | + // Write new file |
|
403 | + if (!empty($conf->global->MAIN_ODT_AS_PDF)) { |
|
404 | + try { |
|
405 | + $odfHandler->exportAsAttachedPDF($file); |
|
406 | + } catch (Exception $e) { |
|
407 | + $this->error=$e->getMessage(); |
|
408 | + dol_syslog($e->getMessage(), LOG_WARNING); |
|
409 | + return -1; |
|
410 | + } |
|
411 | + } |
|
412 | + else { |
|
413 | + try { |
|
414 | + $odfHandler->saveToDisk($file); |
|
415 | + } catch (Exception $e) { |
|
416 | + $this->error=$e->getMessage(); |
|
417 | + dol_syslog($e->getMessage(), LOG_WARNING); |
|
418 | + return -1; |
|
419 | + } |
|
420 | + } |
|
421 | + |
|
422 | + $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
423 | + |
|
424 | + if (! empty($conf->global->MAIN_UMASK)) |
|
425 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
426 | + |
|
427 | + $odfHandler=null; // Destroy object |
|
428 | + |
|
429 | + $this->result = array('fullpath'=>$file); |
|
430 | + |
|
431 | + return 1; // Success |
|
432 | + } |
|
433 | + else |
|
434 | + { |
|
435 | + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
436 | + return -1; |
|
437 | + } |
|
438 | + } |
|
439 | + |
|
440 | + return -1; |
|
441 | + } |
|
442 | 442 | |
443 | 443 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
444 | 444 | /** |
@@ -452,12 +452,12 @@ discard block |
||
452 | 452 | function get_substitutionarray_object($object,$outputlangs,$array_key='object') |
453 | 453 | { |
454 | 454 | // phpcs:enable |
455 | - $array_other = array(); |
|
456 | - foreach($object as $key => $value) { |
|
457 | - if (!is_array($value) && !is_object($value)) { |
|
458 | - $array_other[$array_key.'_'.$key] = $value; |
|
459 | - } |
|
460 | - } |
|
461 | - return $array_other; |
|
462 | - } |
|
455 | + $array_other = array(); |
|
456 | + foreach($object as $key => $value) { |
|
457 | + if (!is_array($value) && !is_object($value)) { |
|
458 | + $array_other[$array_key.'_'.$key] = $value; |
|
459 | + } |
|
460 | + } |
|
461 | + return $array_other; |
|
462 | + } |
|
463 | 463 | } |
@@ -65,37 +65,37 @@ discard block |
||
65 | 65 | global $conf, $langs, $mysoc; |
66 | 66 | |
67 | 67 | // Load translation files required by the page |
68 | - $langs->loadLangs(array("main","companies")); |
|
68 | + $langs->loadLangs(array("main", "companies")); |
|
69 | 69 | |
70 | 70 | $this->db = $db; |
71 | 71 | $this->name = "ODT templates"; |
72 | 72 | $this->description = $langs->trans("DocumentModelOdt"); |
73 | - $this->scandir = 'USER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan |
|
73 | + $this->scandir = 'USER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan |
|
74 | 74 | |
75 | 75 | // Dimension page pour format A4 |
76 | 76 | $this->type = 'odt'; |
77 | 77 | $this->page_largeur = 0; |
78 | 78 | $this->page_hauteur = 0; |
79 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
80 | - $this->marge_gauche=0; |
|
81 | - $this->marge_droite=0; |
|
82 | - $this->marge_haute=0; |
|
83 | - $this->marge_basse=0; |
|
84 | - |
|
85 | - $this->option_logo = 1; // Affiche logo |
|
86 | - $this->option_tva = 0; // Gere option tva USER_TVAOPTION |
|
87 | - $this->option_modereg = 0; // Affiche mode reglement |
|
88 | - $this->option_condreg = 0; // Affiche conditions reglement |
|
89 | - $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
90 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
91 | - $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
92 | - $this->option_credit_note = 0; // Support credit notes |
|
93 | - $this->option_freetext = 1; // Support add of a personalised text |
|
94 | - $this->option_draft_watermark = 0; // Support add of a watermark on drafts |
|
79 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
80 | + $this->marge_gauche = 0; |
|
81 | + $this->marge_droite = 0; |
|
82 | + $this->marge_haute = 0; |
|
83 | + $this->marge_basse = 0; |
|
84 | + |
|
85 | + $this->option_logo = 1; // Affiche logo |
|
86 | + $this->option_tva = 0; // Gere option tva USER_TVAOPTION |
|
87 | + $this->option_modereg = 0; // Affiche mode reglement |
|
88 | + $this->option_condreg = 0; // Affiche conditions reglement |
|
89 | + $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
90 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
91 | + $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
92 | + $this->option_credit_note = 0; // Support credit notes |
|
93 | + $this->option_freetext = 1; // Support add of a personalised text |
|
94 | + $this->option_draft_watermark = 0; // Support add of a watermark on drafts |
|
95 | 95 | |
96 | 96 | // Recupere emetteur |
97 | - $this->emetteur=$mysoc; |
|
98 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
97 | + $this->emetteur = $mysoc; |
|
98 | + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -115,91 +115,91 @@ discard block |
||
115 | 115 | $form = new Form($this->db); |
116 | 116 | |
117 | 117 | $texte = $this->description.".<br>\n"; |
118 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
119 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
120 | - $texte.= '<input type="hidden" name="action" value="setModuleOptions">'; |
|
121 | - $texte.= '<input type="hidden" name="param1" value="USER_ADDON_PDF_ODT_PATH">'; |
|
118 | + $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
119 | + $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
120 | + $texte .= '<input type="hidden" name="action" value="setModuleOptions">'; |
|
121 | + $texte .= '<input type="hidden" name="param1" value="USER_ADDON_PDF_ODT_PATH">'; |
|
122 | 122 | if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) |
123 | 123 | { |
124 | - $texte.= '<input type="hidden" name="param2" value="USER_ADDON_PDF_ODT_DEFAULT">'; |
|
125 | - $texte.= '<input type="hidden" name="param3" value="USER_ADDON_PDF_ODT_TOBILL">'; |
|
126 | - $texte.= '<input type="hidden" name="param4" value="USER_ADDON_PDF_ODT_CLOSED">'; |
|
124 | + $texte .= '<input type="hidden" name="param2" value="USER_ADDON_PDF_ODT_DEFAULT">'; |
|
125 | + $texte .= '<input type="hidden" name="param3" value="USER_ADDON_PDF_ODT_TOBILL">'; |
|
126 | + $texte .= '<input type="hidden" name="param4" value="USER_ADDON_PDF_ODT_CLOSED">'; |
|
127 | 127 | } |
128 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
128 | + $texte .= '<table class="nobordernopadding" width="100%">'; |
|
129 | 129 | |
130 | 130 | // List of directories area |
131 | - $texte.= '<tr><td>'; |
|
132 | - $texttitle=$langs->trans("ListOfDirectories"); |
|
133 | - $listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->USER_ADDON_PDF_ODT_PATH))); |
|
134 | - $listoffiles=array(); |
|
135 | - foreach($listofdir as $key=>$tmpdir) |
|
131 | + $texte .= '<tr><td>'; |
|
132 | + $texttitle = $langs->trans("ListOfDirectories"); |
|
133 | + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USER_ADDON_PDF_ODT_PATH))); |
|
134 | + $listoffiles = array(); |
|
135 | + foreach ($listofdir as $key=>$tmpdir) |
|
136 | 136 | { |
137 | - $tmpdir=trim($tmpdir); |
|
138 | - $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); |
|
139 | - if (! $tmpdir) { |
|
137 | + $tmpdir = trim($tmpdir); |
|
138 | + $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); |
|
139 | + if (!$tmpdir) { |
|
140 | 140 | unset($listofdir[$key]); continue; |
141 | 141 | } |
142 | - if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); |
|
142 | + if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); |
|
143 | 143 | else |
144 | 144 | { |
145 | - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); |
|
146 | - if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); |
|
145 | + $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); |
|
146 | + if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); |
|
147 | 147 | } |
148 | 148 | } |
149 | - $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); |
|
149 | + $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT"); |
|
150 | 150 | // Add list of substitution keys |
151 | - $texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>'; |
|
152 | - $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it |
|
153 | - |
|
154 | - $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); |
|
155 | - $texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">'; |
|
156 | - $texte.= '<textarea class="flat" cols="60" name="value1">'; |
|
157 | - $texte.=$conf->global->USER_ADDON_PDF_ODT_PATH; |
|
158 | - $texte.= '</textarea>'; |
|
159 | - $texte.= '</div><div style="display: inline-block; vertical-align: middle;">'; |
|
160 | - $texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">'; |
|
161 | - $texte.= '<br></div></div>'; |
|
151 | + $texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>'; |
|
152 | + $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it |
|
153 | + |
|
154 | + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); |
|
155 | + $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">'; |
|
156 | + $texte .= '<textarea class="flat" cols="60" name="value1">'; |
|
157 | + $texte .= $conf->global->USER_ADDON_PDF_ODT_PATH; |
|
158 | + $texte .= '</textarea>'; |
|
159 | + $texte .= '</div><div style="display: inline-block; vertical-align: middle;">'; |
|
160 | + $texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">'; |
|
161 | + $texte .= '<br></div></div>'; |
|
162 | 162 | |
163 | 163 | // Scan directories |
164 | 164 | if (count($listofdir)) |
165 | 165 | { |
166 | - $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; |
|
166 | + $texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; |
|
167 | 167 | |
168 | 168 | if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) |
169 | 169 | { |
170 | 170 | // Model for creation |
171 | - $liste=ModelePDFUser::liste_modeles($this->db); |
|
172 | - $texte.= '<table width="50%;">'; |
|
173 | - $texte.= '<tr>'; |
|
174 | - $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>'; |
|
175 | - $texte.= '<td colspan="">'; |
|
176 | - $texte.= $form->selectarray('value2',$liste,$conf->global->USER_ADDON_PDF_ODT_DEFAULT); |
|
177 | - $texte.= "</td></tr>"; |
|
178 | - |
|
179 | - $texte.= '<tr>'; |
|
180 | - $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>'; |
|
181 | - $texte.= '<td colspan="">'; |
|
182 | - $texte.= $form->selectarray('value3',$liste,$conf->global->USER_ADDON_PDF_ODT_TOBILL); |
|
183 | - $texte.= "</td></tr>"; |
|
184 | - $texte.= '<tr>'; |
|
185 | - |
|
186 | - $texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>'; |
|
187 | - $texte.= '<td colspan="">'; |
|
188 | - $texte.= $form->selectarray('value4',$liste,$conf->global->USER_ADDON_PDF_ODT_CLOSED); |
|
189 | - $texte.= "</td></tr>"; |
|
190 | - $texte.= '</table>'; |
|
171 | + $liste = ModelePDFUser::liste_modeles($this->db); |
|
172 | + $texte .= '<table width="50%;">'; |
|
173 | + $texte .= '<tr>'; |
|
174 | + $texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>'; |
|
175 | + $texte .= '<td colspan="">'; |
|
176 | + $texte .= $form->selectarray('value2', $liste, $conf->global->USER_ADDON_PDF_ODT_DEFAULT); |
|
177 | + $texte .= "</td></tr>"; |
|
178 | + |
|
179 | + $texte .= '<tr>'; |
|
180 | + $texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>'; |
|
181 | + $texte .= '<td colspan="">'; |
|
182 | + $texte .= $form->selectarray('value3', $liste, $conf->global->USER_ADDON_PDF_ODT_TOBILL); |
|
183 | + $texte .= "</td></tr>"; |
|
184 | + $texte .= '<tr>'; |
|
185 | + |
|
186 | + $texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>'; |
|
187 | + $texte .= '<td colspan="">'; |
|
188 | + $texte .= $form->selectarray('value4', $liste, $conf->global->USER_ADDON_PDF_ODT_CLOSED); |
|
189 | + $texte .= "</td></tr>"; |
|
190 | + $texte .= '</table>'; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
194 | - $texte.= '</td>'; |
|
194 | + $texte .= '</td>'; |
|
195 | 195 | |
196 | - $texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">'; |
|
197 | - $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); |
|
198 | - $texte.= '</td>'; |
|
199 | - $texte.= '</tr>'; |
|
196 | + $texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">'; |
|
197 | + $texte .= $langs->trans("ExampleOfDirectoriesForModelGen"); |
|
198 | + $texte .= '</td>'; |
|
199 | + $texte .= '</tr>'; |
|
200 | 200 | |
201 | - $texte.= '</table>'; |
|
202 | - $texte.= '</form>'; |
|
201 | + $texte .= '</table>'; |
|
202 | + $texte .= '</form>'; |
|
203 | 203 | |
204 | 204 | return $texte; |
205 | 205 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param int $hideref Do not show ref |
217 | 217 | * @return int 1 if OK, <=0 if KO |
218 | 218 | */ |
219 | - function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) |
|
219 | + function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
220 | 220 | { |
221 | 221 | // phpcs:enable |
222 | 222 | global $user, $langs, $conf, $mysoc, $hookmanager; |
@@ -228,17 +228,17 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | // Add odtgeneration hook |
231 | - if (! is_object($hookmanager)) |
|
231 | + if (!is_object($hookmanager)) |
|
232 | 232 | { |
233 | 233 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
234 | - $hookmanager=new HookManager($this->db); |
|
234 | + $hookmanager = new HookManager($this->db); |
|
235 | 235 | } |
236 | 236 | $hookmanager->initHooks(array('odtgeneration')); |
237 | 237 | global $action; |
238 | 238 | |
239 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
240 | - $sav_charset_output=$outputlangs->charset_output; |
|
241 | - $outputlangs->charset_output='UTF-8'; |
|
239 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
240 | + $sav_charset_output = $outputlangs->charset_output; |
|
241 | + $outputlangs->charset_output = 'UTF-8'; |
|
242 | 242 | |
243 | 243 | // Load translation files required by the page |
244 | 244 | $outputlangs->loadLangs(array("main", "companies", "bills", "dict")); |
@@ -246,28 +246,28 @@ discard block |
||
246 | 246 | if ($conf->user->dir_output) |
247 | 247 | { |
248 | 248 | // If $object is id instead of object |
249 | - if (! is_object($object)) |
|
249 | + if (!is_object($object)) |
|
250 | 250 | { |
251 | 251 | $id = $object; |
252 | 252 | $object = new User($this->db); |
253 | - $result=$object->fetch($id); |
|
253 | + $result = $object->fetch($id); |
|
254 | 254 | if ($result < 0) |
255 | 255 | { |
256 | - dol_print_error($this->db,$object->error); |
|
256 | + dol_print_error($this->db, $object->error); |
|
257 | 257 | return -1; |
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | 261 | $dir = $conf->user->dir_output; |
262 | 262 | $objectref = dol_sanitizeFileName($object->ref); |
263 | - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
264 | - $file = $dir . "/" . $objectref . ".odt"; |
|
263 | + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; |
|
264 | + $file = $dir."/".$objectref.".odt"; |
|
265 | 265 | |
266 | - if (! file_exists($dir)) |
|
266 | + if (!file_exists($dir)) |
|
267 | 267 | { |
268 | 268 | if (dol_mkdir($dir) < 0) |
269 | 269 | { |
270 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
270 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
271 | 271 | return -1; |
272 | 272 | } |
273 | 273 | } |
@@ -275,26 +275,26 @@ discard block |
||
275 | 275 | if (file_exists($dir)) |
276 | 276 | { |
277 | 277 | //print "srctemplatepath=".$srctemplatepath; // Src filename |
278 | - $newfile=basename($srctemplatepath); |
|
279 | - $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile); |
|
280 | - $newfiletmp=preg_replace('/template_/i','',$newfiletmp); |
|
281 | - $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); |
|
278 | + $newfile = basename($srctemplatepath); |
|
279 | + $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); |
|
280 | + $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); |
|
281 | + $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); |
|
282 | 282 | |
283 | - $newfiletmp=$objectref.'_'.$newfiletmp; |
|
283 | + $newfiletmp = $objectref.'_'.$newfiletmp; |
|
284 | 284 | |
285 | 285 | // Get extension (ods or odt) |
286 | - $newfileformat=substr($newfile, strrpos($newfile, '.')+1); |
|
287 | - if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) |
|
286 | + $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); |
|
287 | + if (!empty($conf->global->MAIN_DOC_USE_TIMING)) |
|
288 | 288 | { |
289 | - $format=$conf->global->MAIN_DOC_USE_TIMING; |
|
290 | - if ($format == '1') $format='%Y%m%d%H%M%S'; |
|
291 | - $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; |
|
289 | + $format = $conf->global->MAIN_DOC_USE_TIMING; |
|
290 | + if ($format == '1') $format = '%Y%m%d%H%M%S'; |
|
291 | + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; |
|
292 | 292 | } |
293 | 293 | else |
294 | 294 | { |
295 | - $filename=$newfiletmp.'.'.$newfileformat; |
|
295 | + $filename = $newfiletmp.'.'.$newfileformat; |
|
296 | 296 | } |
297 | - $file=$dir.'/'.$filename; |
|
297 | + $file = $dir.'/'.$filename; |
|
298 | 298 | //print "newdir=".$dir; |
299 | 299 | //print "newfile=".$newfile; |
300 | 300 | //print "file=".$file; |
@@ -304,19 +304,19 @@ discard block |
||
304 | 304 | |
305 | 305 | |
306 | 306 | // If CUSTOMER contact defined on user, we use it |
307 | - $usecontact=false; |
|
308 | - $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
307 | + $usecontact = false; |
|
308 | + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); |
|
309 | 309 | if (count($arrayidcontact) > 0) |
310 | 310 | { |
311 | - $usecontact=true; |
|
312 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
311 | + $usecontact = true; |
|
312 | + $result = $object->fetch_contact($arrayidcontact[0]); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | // Recipient name |
316 | - if (! empty($usecontact)) |
|
316 | + if (!empty($usecontact)) |
|
317 | 317 | { |
318 | 318 | // On peut utiliser le nom de la societe du contact |
319 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; |
|
319 | + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; |
|
320 | 320 | else { |
321 | 321 | $socobject = $object->thirdparty; |
322 | 322 | // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | else |
327 | 327 | { |
328 | - $socobject=$object->thirdparty; |
|
328 | + $socobject = $object->thirdparty; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | // Open and load template |
@@ -335,38 +335,38 @@ discard block |
||
335 | 335 | $srctemplatepath, |
336 | 336 | array( |
337 | 337 | 'PATH_TO_TMP' => $conf->user->dir_temp, |
338 | - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. |
|
338 | + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. |
|
339 | 339 | 'DELIMITER_LEFT' => '{', |
340 | 340 | 'DELIMITER_RIGHT' => '}' |
341 | 341 | ) |
342 | 342 | ); |
343 | 343 | } |
344 | - catch(Exception $e) |
|
344 | + catch (Exception $e) |
|
345 | 345 | { |
346 | - $this->error=$e->getMessage(); |
|
346 | + $this->error = $e->getMessage(); |
|
347 | 347 | dol_syslog($e->getMessage(), LOG_WARNING); |
348 | 348 | return -1; |
349 | 349 | } |
350 | 350 | |
351 | 351 | // Make substitutions into odt |
352 | - $array_user=$this->get_substitutionarray_user($object,$outputlangs); |
|
353 | - $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); |
|
354 | - $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); |
|
355 | - $array_other=$this->get_substitutionarray_other($outputlangs); |
|
352 | + $array_user = $this->get_substitutionarray_user($object, $outputlangs); |
|
353 | + $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); |
|
354 | + $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); |
|
355 | + $array_other = $this->get_substitutionarray_other($outputlangs); |
|
356 | 356 | // retrieve contact information for use in object as contact_xxx tags |
357 | 357 | $array_thirdparty_contact = array(); |
358 | - if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); |
|
358 | + if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); |
|
359 | 359 | |
360 | - $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact); |
|
360 | + $tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact); |
|
361 | 361 | complete_substitutions_array($tmparray, $outputlangs, $object); |
362 | 362 | $object->fetch_optionals(); |
363 | 363 | // Call the ODTSubstitution hook |
364 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); |
|
365 | - $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
366 | - foreach($tmparray as $key=>$value) |
|
364 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); |
|
365 | + $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
366 | + foreach ($tmparray as $key=>$value) |
|
367 | 367 | { |
368 | 368 | try { |
369 | - if (preg_match('/logo$/',$key)) // Image |
|
369 | + if (preg_match('/logo$/', $key)) // Image |
|
370 | 370 | { |
371 | 371 | if (file_exists($value)) $odfHandler->setImage($key, $value); |
372 | 372 | else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); |
@@ -376,15 +376,15 @@ discard block |
||
376 | 376 | $odfHandler->setVars($key, $value, true, 'UTF-8'); |
377 | 377 | } |
378 | 378 | } |
379 | - catch(OdfException $e) |
|
379 | + catch (OdfException $e) |
|
380 | 380 | { |
381 | 381 | dol_syslog($e->getMessage(), LOG_WARNING); |
382 | 382 | } |
383 | 383 | } |
384 | 384 | |
385 | 385 | // Replace labels translated |
386 | - $tmparray=$outputlangs->get_translations_for_substitutions(); |
|
387 | - foreach($tmparray as $key=>$value) |
|
386 | + $tmparray = $outputlangs->get_translations_for_substitutions(); |
|
387 | + foreach ($tmparray as $key=>$value) |
|
388 | 388 | { |
389 | 389 | try { |
390 | 390 | $odfHandler->setVars($key, $value, true, 'UTF-8'); |
@@ -396,15 +396,15 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | // Call the beforeODTSave hook |
399 | - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
400 | - $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
399 | + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
400 | + $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
401 | 401 | |
402 | 402 | // Write new file |
403 | 403 | if (!empty($conf->global->MAIN_ODT_AS_PDF)) { |
404 | 404 | try { |
405 | 405 | $odfHandler->exportAsAttachedPDF($file); |
406 | 406 | } catch (Exception $e) { |
407 | - $this->error=$e->getMessage(); |
|
407 | + $this->error = $e->getMessage(); |
|
408 | 408 | dol_syslog($e->getMessage(), LOG_WARNING); |
409 | 409 | return -1; |
410 | 410 | } |
@@ -413,26 +413,26 @@ discard block |
||
413 | 413 | try { |
414 | 414 | $odfHandler->saveToDisk($file); |
415 | 415 | } catch (Exception $e) { |
416 | - $this->error=$e->getMessage(); |
|
416 | + $this->error = $e->getMessage(); |
|
417 | 417 | dol_syslog($e->getMessage(), LOG_WARNING); |
418 | 418 | return -1; |
419 | 419 | } |
420 | 420 | } |
421 | 421 | |
422 | - $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
422 | + $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
423 | 423 | |
424 | - if (! empty($conf->global->MAIN_UMASK)) |
|
424 | + if (!empty($conf->global->MAIN_UMASK)) |
|
425 | 425 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
426 | 426 | |
427 | - $odfHandler=null; // Destroy object |
|
427 | + $odfHandler = null; // Destroy object |
|
428 | 428 | |
429 | 429 | $this->result = array('fullpath'=>$file); |
430 | 430 | |
431 | - return 1; // Success |
|
431 | + return 1; // Success |
|
432 | 432 | } |
433 | 433 | else |
434 | 434 | { |
435 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
435 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
436 | 436 | return -1; |
437 | 437 | } |
438 | 438 | } |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | * @param string $array_key key for array |
450 | 450 | * @return array array of substitutions |
451 | 451 | */ |
452 | - function get_substitutionarray_object($object,$outputlangs,$array_key='object') |
|
452 | + function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') |
|
453 | 453 | { |
454 | 454 | // phpcs:enable |
455 | 455 | $array_other = array(); |
456 | - foreach($object as $key => $value) { |
|
456 | + foreach ($object as $key => $value) { |
|
457 | 457 | if (!is_array($value) && !is_object($value)) { |
458 | 458 | $array_other[$array_key.'_'.$key] = $value; |
459 | 459 | } |
@@ -95,7 +95,10 @@ discard block |
||
95 | 95 | |
96 | 96 | // Recupere emetteur |
97 | 97 | $this->emetteur=$mysoc; |
98 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
98 | + if (! $this->emetteur->country_code) { |
|
99 | + $this->emetteur->country_code=substr($langs->defaultlang,-2); |
|
100 | + } |
|
101 | + // By default if not defined |
|
99 | 102 | } |
100 | 103 | |
101 | 104 | |
@@ -139,11 +142,14 @@ discard block |
||
139 | 142 | if (! $tmpdir) { |
140 | 143 | unset($listofdir[$key]); continue; |
141 | 144 | } |
142 | - if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); |
|
143 | - else |
|
145 | + if (! is_dir($tmpdir)) { |
|
146 | + $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); |
|
147 | + } else |
|
144 | 148 | { |
145 | 149 | $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); |
146 | - if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); |
|
150 | + if (count($tmpfiles)) { |
|
151 | + $listoffiles=array_merge($listoffiles,$tmpfiles); |
|
152 | + } |
|
147 | 153 | } |
148 | 154 | } |
149 | 155 | $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); |
@@ -236,7 +242,9 @@ discard block |
||
236 | 242 | $hookmanager->initHooks(array('odtgeneration')); |
237 | 243 | global $action; |
238 | 244 | |
239 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
245 | + if (! is_object($outputlangs)) { |
|
246 | + $outputlangs=$langs; |
|
247 | + } |
|
240 | 248 | $sav_charset_output=$outputlangs->charset_output; |
241 | 249 | $outputlangs->charset_output='UTF-8'; |
242 | 250 | |
@@ -260,7 +268,9 @@ discard block |
||
260 | 268 | |
261 | 269 | $dir = $conf->user->dir_output; |
262 | 270 | $objectref = dol_sanitizeFileName($object->ref); |
263 | - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
271 | + if (! preg_match('/specimen/i',$objectref)) { |
|
272 | + $dir.= "/" . $objectref; |
|
273 | + } |
|
264 | 274 | $file = $dir . "/" . $objectref . ".odt"; |
265 | 275 | |
266 | 276 | if (! file_exists($dir)) |
@@ -287,10 +297,11 @@ discard block |
||
287 | 297 | if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) |
288 | 298 | { |
289 | 299 | $format=$conf->global->MAIN_DOC_USE_TIMING; |
290 | - if ($format == '1') $format='%Y%m%d%H%M%S'; |
|
300 | + if ($format == '1') { |
|
301 | + $format='%Y%m%d%H%M%S'; |
|
302 | + } |
|
291 | 303 | $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; |
292 | - } |
|
293 | - else |
|
304 | + } else |
|
294 | 305 | { |
295 | 306 | $filename=$newfiletmp.'.'.$newfileformat; |
296 | 307 | } |
@@ -316,14 +327,14 @@ discard block |
||
316 | 327 | if (! empty($usecontact)) |
317 | 328 | { |
318 | 329 | // On peut utiliser le nom de la societe du contact |
319 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; |
|
320 | - else { |
|
330 | + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { |
|
331 | + $socobject = $object->contact; |
|
332 | + } else { |
|
321 | 333 | $socobject = $object->thirdparty; |
322 | 334 | // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use |
323 | 335 | $contactobject = $object->contact; |
324 | 336 | } |
325 | - } |
|
326 | - else |
|
337 | + } else |
|
327 | 338 | { |
328 | 339 | $socobject=$object->thirdparty; |
329 | 340 | } |
@@ -340,8 +351,7 @@ discard block |
||
340 | 351 | 'DELIMITER_RIGHT' => '}' |
341 | 352 | ) |
342 | 353 | ); |
343 | - } |
|
344 | - catch(Exception $e) |
|
354 | + } catch(Exception $e) |
|
345 | 355 | { |
346 | 356 | $this->error=$e->getMessage(); |
347 | 357 | dol_syslog($e->getMessage(), LOG_WARNING); |
@@ -355,7 +365,9 @@ discard block |
||
355 | 365 | $array_other=$this->get_substitutionarray_other($outputlangs); |
356 | 366 | // retrieve contact information for use in object as contact_xxx tags |
357 | 367 | $array_thirdparty_contact = array(); |
358 | - if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); |
|
368 | + if ($usecontact && is_object($contactobject)) { |
|
369 | + $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); |
|
370 | + } |
|
359 | 371 | |
360 | 372 | $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact); |
361 | 373 | complete_substitutions_array($tmparray, $outputlangs, $object); |
@@ -366,17 +378,18 @@ discard block |
||
366 | 378 | foreach($tmparray as $key=>$value) |
367 | 379 | { |
368 | 380 | try { |
369 | - if (preg_match('/logo$/',$key)) // Image |
|
381 | + if (preg_match('/logo$/',$key)) { |
|
382 | + // Image |
|
370 | 383 | { |
371 | 384 | if (file_exists($value)) $odfHandler->setImage($key, $value); |
372 | - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); |
|
373 | - } |
|
374 | - else // Text |
|
385 | + } else { |
|
386 | + $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); |
|
387 | + } |
|
388 | + } else // Text |
|
375 | 389 | { |
376 | 390 | $odfHandler->setVars($key, $value, true, 'UTF-8'); |
377 | 391 | } |
378 | - } |
|
379 | - catch(OdfException $e) |
|
392 | + } catch(OdfException $e) |
|
380 | 393 | { |
381 | 394 | dol_syslog($e->getMessage(), LOG_WARNING); |
382 | 395 | } |
@@ -388,8 +401,7 @@ discard block |
||
388 | 401 | { |
389 | 402 | try { |
390 | 403 | $odfHandler->setVars($key, $value, true, 'UTF-8'); |
391 | - } |
|
392 | - catch (OdfException $e) |
|
404 | + } catch (OdfException $e) |
|
393 | 405 | { |
394 | 406 | dol_syslog($e->getMessage(), LOG_WARNING); |
395 | 407 | } |
@@ -408,8 +420,7 @@ discard block |
||
408 | 420 | dol_syslog($e->getMessage(), LOG_WARNING); |
409 | 421 | return -1; |
410 | 422 | } |
411 | - } |
|
412 | - else { |
|
423 | + } else { |
|
413 | 424 | try { |
414 | 425 | $odfHandler->saveToDisk($file); |
415 | 426 | } catch (Exception $e) { |
@@ -421,16 +432,16 @@ discard block |
||
421 | 432 | |
422 | 433 | $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
423 | 434 | |
424 | - if (! empty($conf->global->MAIN_UMASK)) |
|
425 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
435 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
436 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
437 | + } |
|
426 | 438 | |
427 | 439 | $odfHandler=null; // Destroy object |
428 | 440 | |
429 | 441 | $this->result = array('fullpath'=>$file); |
430 | 442 | |
431 | 443 | return 1; // Success |
432 | - } |
|
433 | - else |
|
444 | + } else |
|
434 | 445 | { |
435 | 446 | $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
436 | 447 | return -1; |