@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
73 | 73 | { |
74 | - if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing |
|
74 | + if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing |
|
75 | 75 | |
76 | 76 | $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; |
77 | 77 | |
@@ -82,25 +82,25 @@ discard block |
||
82 | 82 | |
83 | 83 | $langs->load("agenda"); |
84 | 84 | |
85 | - if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO'; |
|
85 | + if (empty($object->actiontypecode)) $object->actiontypecode = 'AC_OTH_AUTO'; |
|
86 | 86 | |
87 | 87 | // Actions |
88 | 88 | if ($action == 'COMPANY_CREATE') |
89 | 89 | { |
90 | 90 | // Load translation files required by the page |
91 | - $langs->loadLangs(array("agenda","other","companies")); |
|
91 | + $langs->loadLangs(array("agenda", "other", "companies")); |
|
92 | 92 | |
93 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->name); |
|
94 | - $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->name); |
|
95 | - if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")"; |
|
93 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("NewCompanyToDolibarr", $object->name); |
|
94 | + $object->actionmsg = $langs->transnoentities("NewCompanyToDolibarr", $object->name); |
|
95 | + if (!empty($object->prefix)) $object->actionmsg .= " (".$object->prefix.")"; |
|
96 | 96 | |
97 | - $object->sendtoid=0; |
|
98 | - $object->socid=$object->id; |
|
97 | + $object->sendtoid = 0; |
|
98 | + $object->socid = $object->id; |
|
99 | 99 | } |
100 | 100 | elseif ($action == 'COMPANY_SENTBYMAIL') |
101 | 101 | { |
102 | 102 | // Load translation files required by the page |
103 | - $langs->loadLangs(array("agenda","other","orders")); |
|
103 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
104 | 104 | |
105 | 105 | if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR); |
106 | 106 | |
@@ -110,22 +110,22 @@ discard block |
||
110 | 110 | elseif ($action == 'CONTRACT_VALIDATE') |
111 | 111 | { |
112 | 112 | // Load translation files required by the page |
113 | - $langs->loadLangs(array("agenda","other","contracts")); |
|
113 | + $langs->loadLangs(array("agenda", "other", "contracts")); |
|
114 | 114 | |
115 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
116 | - $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
115 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
116 | + $object->actionmsg = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
117 | 117 | |
118 | - $object->sendtoid=0; |
|
118 | + $object->sendtoid = 0; |
|
119 | 119 | } |
120 | 120 | elseif ($action == 'CONTRACT_SENTBYMAIL') |
121 | 121 | { |
122 | 122 | // Load translation files required by the page |
123 | - $langs->loadLangs(array("agenda","other","contracts")); |
|
123 | + $langs->loadLangs(array("agenda", "other", "contracts")); |
|
124 | 124 | |
125 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail",$object->ref); |
|
125 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractSentByEMail", $object->ref); |
|
126 | 126 | if (empty($object->actionmsg)) |
127 | 127 | { |
128 | - $object->actionmsg=$langs->transnoentities("ContractSentByEMail",$object->ref); |
|
128 | + $object->actionmsg = $langs->transnoentities("ContractSentByEMail", $object->ref); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Parameters $object->sendtoid defined by caller |
@@ -134,22 +134,22 @@ discard block |
||
134 | 134 | elseif ($action == 'PROPAL_VALIDATE') |
135 | 135 | { |
136 | 136 | // Load translation files required by the page |
137 | - $langs->loadLangs(array("agenda","other","propal")); |
|
137 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
138 | 138 | |
139 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
140 | - $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
139 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
140 | + $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
141 | 141 | |
142 | - $object->sendtoid=0; |
|
142 | + $object->sendtoid = 0; |
|
143 | 143 | } |
144 | 144 | elseif ($action == 'PROPAL_SENTBYMAIL') |
145 | 145 | { |
146 | 146 | // Load translation files required by the page |
147 | - $langs->loadLangs(array("agenda","other","propal")); |
|
147 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
148 | 148 | |
149 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
|
149 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref); |
|
150 | 150 | if (empty($object->actionmsg)) |
151 | 151 | { |
152 | - $object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
|
152 | + $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // Parameters $object->sendtoid defined by caller |
@@ -158,82 +158,82 @@ discard block |
||
158 | 158 | elseif ($action == 'PROPAL_CLOSE_SIGNED') |
159 | 159 | { |
160 | 160 | // Load translation files required by the page |
161 | - $langs->loadLangs(array("agenda","other","propal")); |
|
161 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
162 | 162 | |
163 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
|
164 | - $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
|
163 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref); |
|
164 | + $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref); |
|
165 | 165 | |
166 | - $object->sendtoid=0; |
|
166 | + $object->sendtoid = 0; |
|
167 | 167 | } |
168 | 168 | elseif ($action == 'PROPAL_CLASSIFY_BILLED') |
169 | 169 | { |
170 | 170 | // Load translation files required by the page |
171 | - $langs->loadLangs(array("agenda","other","propal")); |
|
171 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
172 | 172 | |
173 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref); |
|
174 | - $object->actionmsg=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref); |
|
173 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref); |
|
174 | + $object->actionmsg = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref); |
|
175 | 175 | |
176 | - $object->sendtoid=0; |
|
176 | + $object->sendtoid = 0; |
|
177 | 177 | } |
178 | 178 | elseif ($action == 'PROPAL_CLOSE_REFUSED') |
179 | 179 | { |
180 | 180 | // Load translation files required by the page |
181 | - $langs->loadLangs(array("agenda","other","propal")); |
|
181 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
182 | 182 | |
183 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
|
184 | - $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
|
183 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref); |
|
184 | + $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref); |
|
185 | 185 | |
186 | - $object->sendtoid=0; |
|
186 | + $object->sendtoid = 0; |
|
187 | 187 | } |
188 | 188 | elseif ($action == 'ORDER_VALIDATE') |
189 | 189 | { |
190 | 190 | // Load translation files required by the page |
191 | - $langs->loadLangs(array("agenda","orders")); |
|
191 | + $langs->loadLangs(array("agenda", "orders")); |
|
192 | 192 | |
193 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
194 | - $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
193 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
194 | + $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
195 | 195 | |
196 | - $object->sendtoid=0; |
|
196 | + $object->sendtoid = 0; |
|
197 | 197 | } |
198 | 198 | elseif ($action == 'ORDER_CLOSE') |
199 | 199 | { |
200 | 200 | // Load translation files required by the page |
201 | - $langs->loadLangs(array("agenda","other","orders")); |
|
201 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
202 | 202 | |
203 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref); |
|
204 | - $object->actionmsg=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref); |
|
203 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref); |
|
204 | + $object->actionmsg = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref); |
|
205 | 205 | |
206 | - $object->sendtoid=0; |
|
206 | + $object->sendtoid = 0; |
|
207 | 207 | } |
208 | 208 | elseif ($action == 'ORDER_CLASSIFY_BILLED') |
209 | 209 | { |
210 | 210 | // Load translation files required by the page |
211 | - $langs->loadLangs(array("agenda","other","orders")); |
|
211 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
212 | 212 | |
213 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderBilledInDolibarr",$object->ref); |
|
214 | - $object->actionmsg=$langs->transnoentities("OrderBilledInDolibarr",$object->ref); |
|
213 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderBilledInDolibarr", $object->ref); |
|
214 | + $object->actionmsg = $langs->transnoentities("OrderBilledInDolibarr", $object->ref); |
|
215 | 215 | |
216 | - $object->sendtoid=0; |
|
216 | + $object->sendtoid = 0; |
|
217 | 217 | } |
218 | 218 | elseif ($action == 'ORDER_CANCEL') |
219 | 219 | { |
220 | 220 | // Load translation files required by the page |
221 | - $langs->loadLangs(array("agenda","other","orders")); |
|
221 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
222 | 222 | |
223 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref); |
|
224 | - $object->actionmsg=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref); |
|
223 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref); |
|
224 | + $object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref); |
|
225 | 225 | |
226 | - $object->sendtoid=0; |
|
226 | + $object->sendtoid = 0; |
|
227 | 227 | } |
228 | 228 | elseif ($action == 'ORDER_SENTBYMAIL') |
229 | 229 | { |
230 | 230 | // Load translation files required by the page |
231 | - $langs->loadLangs(array("agenda","other","orders")); |
|
231 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
232 | 232 | |
233 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref); |
|
233 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderSentByEMail", $object->ref); |
|
234 | 234 | if (empty($object->actionmsg)) |
235 | 235 | { |
236 | - $object->actionmsg=$langs->transnoentities("OrderSentByEMail",$object->ref); |
|
236 | + $object->actionmsg = $langs->transnoentities("OrderSentByEMail", $object->ref); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | // Parameters $object->sendtoid defined by caller |
@@ -242,32 +242,32 @@ discard block |
||
242 | 242 | elseif ($action == 'BILL_VALIDATE') |
243 | 243 | { |
244 | 244 | // Load translation files required by the page |
245 | - $langs->loadLangs(array("agenda","other","bills")); |
|
245 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
246 | 246 | |
247 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
248 | - $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
247 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
248 | + $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
249 | 249 | |
250 | - $object->sendtoid=0; |
|
250 | + $object->sendtoid = 0; |
|
251 | 251 | } |
252 | 252 | elseif ($action == 'BILL_UNVALIDATE') |
253 | 253 | { |
254 | 254 | // Load translation files required by the page |
255 | - $langs->loadLangs(array("agenda","other","bills")); |
|
255 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
256 | 256 | |
257 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
|
258 | - $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
|
257 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref); |
|
258 | + $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref); |
|
259 | 259 | |
260 | - $object->sendtoid=0; |
|
260 | + $object->sendtoid = 0; |
|
261 | 261 | } |
262 | 262 | elseif ($action == 'BILL_SENTBYMAIL') |
263 | 263 | { |
264 | 264 | // Load translation files required by the page |
265 | - $langs->loadLangs(array("agenda","other","bills")); |
|
265 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
266 | 266 | |
267 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref); |
|
267 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceSentByEMail", $object->ref); |
|
268 | 268 | if (empty($object->actionmsg)) |
269 | 269 | { |
270 | - $object->actionmsg=$langs->transnoentities("InvoiceSentByEMail",$object->ref); |
|
270 | + $object->actionmsg = $langs->transnoentities("InvoiceSentByEMail", $object->ref); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // Parameters $object->sendtoid defined by caller |
@@ -276,69 +276,69 @@ discard block |
||
276 | 276 | elseif ($action == 'BILL_PAYED') |
277 | 277 | { |
278 | 278 | // Load translation files required by the page |
279 | - $langs->loadLangs(array("agenda","other","bills")); |
|
279 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
280 | 280 | |
281 | 281 | // Values for this action can't be defined by caller. |
282 | - $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); |
|
283 | - $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); |
|
282 | + $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref); |
|
283 | + $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref); |
|
284 | 284 | |
285 | - $object->sendtoid=0; |
|
285 | + $object->sendtoid = 0; |
|
286 | 286 | } |
287 | 287 | elseif ($action == 'BILL_CANCEL') |
288 | 288 | { |
289 | 289 | // Load translation files required by the page |
290 | - $langs->loadLangs(array("agenda","other","bills")); |
|
290 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
291 | 291 | |
292 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
|
293 | - $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
|
292 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref); |
|
293 | + $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref); |
|
294 | 294 | |
295 | - $object->sendtoid=0; |
|
295 | + $object->sendtoid = 0; |
|
296 | 296 | } |
297 | 297 | elseif ($action == 'FICHINTER_CREATE') |
298 | 298 | { |
299 | 299 | // Load translation files required by the page |
300 | - $langs->loadLangs(array("agenda","other","interventions")); |
|
300 | + $langs->loadLangs(array("agenda", "other", "interventions")); |
|
301 | 301 | |
302 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref); |
|
303 | - $object->actionmsg=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref); |
|
302 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref); |
|
303 | + $object->actionmsg = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref); |
|
304 | 304 | |
305 | - $object->sendtoid=0; |
|
306 | - $object->fk_element=0; |
|
307 | - $object->elementtype=''; |
|
305 | + $object->sendtoid = 0; |
|
306 | + $object->fk_element = 0; |
|
307 | + $object->elementtype = ''; |
|
308 | 308 | } |
309 | 309 | elseif ($action == 'FICHINTER_VALIDATE') |
310 | 310 | { |
311 | 311 | // Load translation files required by the page |
312 | - $langs->loadLangs(array("agenda","other","interventions")); |
|
312 | + $langs->loadLangs(array("agenda", "other", "interventions")); |
|
313 | 313 | |
314 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
315 | - $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
314 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
315 | + $object->actionmsg = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
316 | 316 | |
317 | - $object->sendtoid=0; |
|
318 | - $object->fk_element=0; |
|
319 | - $object->elementtype=''; |
|
317 | + $object->sendtoid = 0; |
|
318 | + $object->fk_element = 0; |
|
319 | + $object->elementtype = ''; |
|
320 | 320 | } |
321 | 321 | elseif ($action == 'FICHINTER_MODIFY') |
322 | 322 | { |
323 | 323 | // Load translation files required by the page |
324 | - $langs->loadLangs(array("agenda","other","interventions")); |
|
324 | + $langs->loadLangs(array("agenda", "other", "interventions")); |
|
325 | 325 | |
326 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref); |
|
327 | - $object->actionmsg=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref); |
|
326 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref); |
|
327 | + $object->actionmsg = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref); |
|
328 | 328 | |
329 | - $object->sendtoid=0; |
|
330 | - $object->fk_element=0; |
|
331 | - $object->elementtype=''; |
|
329 | + $object->sendtoid = 0; |
|
330 | + $object->fk_element = 0; |
|
331 | + $object->elementtype = ''; |
|
332 | 332 | } |
333 | 333 | elseif ($action == 'FICHINTER_SENTBYMAIL') |
334 | 334 | { |
335 | 335 | // Load translation files required by the page |
336 | - $langs->loadLangs(array("agenda","other","interventions")); |
|
336 | + $langs->loadLangs(array("agenda", "other", "interventions")); |
|
337 | 337 | |
338 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); |
|
338 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionSentByEMail", $object->ref); |
|
339 | 339 | if (empty($object->actionmsg)) |
340 | 340 | { |
341 | - $object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref); |
|
341 | + $object->actionmsg = $langs->transnoentities("InterventionSentByEMail", $object->ref); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | // Parameters $object->sendtoid defined by caller |
@@ -347,44 +347,44 @@ discard block |
||
347 | 347 | elseif ($action == 'FICHINTER_CLASSIFY_BILLED') |
348 | 348 | { |
349 | 349 | // Load translation files required by the page |
350 | - $langs->loadLangs(array("agenda","other","interventions")); |
|
350 | + $langs->loadLangs(array("agenda", "other", "interventions")); |
|
351 | 351 | |
352 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref); |
|
353 | - $object->actionmsg=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref); |
|
352 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref); |
|
353 | + $object->actionmsg = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref); |
|
354 | 354 | |
355 | - $object->sendtoid=0; |
|
355 | + $object->sendtoid = 0; |
|
356 | 356 | } |
357 | 357 | elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') |
358 | 358 | { |
359 | 359 | // Load translation files required by the page |
360 | - $langs->loadLangs(array("agenda","other","interventions")); |
|
360 | + $langs->loadLangs(array("agenda", "other", "interventions")); |
|
361 | 361 | |
362 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref); |
|
363 | - $object->actionmsg=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref); |
|
362 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref); |
|
363 | + $object->actionmsg = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref); |
|
364 | 364 | |
365 | - $object->sendtoid=0; |
|
365 | + $object->sendtoid = 0; |
|
366 | 366 | } |
367 | 367 | elseif ($action == 'FICHINTER_DELETE') |
368 | 368 | { |
369 | 369 | // Load translation files required by the page |
370 | - $langs->loadLangs(array("agenda","other","interventions")); |
|
370 | + $langs->loadLangs(array("agenda", "other", "interventions")); |
|
371 | 371 | |
372 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref); |
|
373 | - $object->actionmsg=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref); |
|
372 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref); |
|
373 | + $object->actionmsg = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref); |
|
374 | 374 | |
375 | - $object->sendtoid=0; |
|
376 | - $object->fk_element=0; |
|
377 | - $object->elementtype=''; |
|
375 | + $object->sendtoid = 0; |
|
376 | + $object->fk_element = 0; |
|
377 | + $object->elementtype = ''; |
|
378 | 378 | } |
379 | 379 | elseif ($action == 'SHIPPING_VALIDATE') |
380 | 380 | { |
381 | 381 | // Load translation files required by the page |
382 | - $langs->loadLangs(array("agenda","other","sendings")); |
|
382 | + $langs->loadLangs(array("agenda", "other", "sendings")); |
|
383 | 383 | |
384 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",($object->newref?$object->newref:$object->ref)); |
|
384 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref)); |
|
385 | 385 | if (empty($object->actionmsg)) |
386 | 386 | { |
387 | - $object->actionmsg=$langs->transnoentities("ShippingValidated",($object->newref?$object->newref:$object->ref)); |
|
387 | + $object->actionmsg = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref)); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | // Parameters $object->sendtoid defined by caller |
@@ -393,12 +393,12 @@ discard block |
||
393 | 393 | elseif ($action == 'SHIPPING_SENTBYMAIL') |
394 | 394 | { |
395 | 395 | // Load translation files required by the page |
396 | - $langs->loadLangs(array("agenda","other","sendings")); |
|
396 | + $langs->loadLangs(array("agenda", "other", "sendings")); |
|
397 | 397 | |
398 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref); |
|
398 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingSentByEMail", $object->ref); |
|
399 | 399 | if (empty($object->actionmsg)) |
400 | 400 | { |
401 | - $object->actionmsg=$langs->transnoentities("ShippingSentByEMail",$object->ref); |
|
401 | + $object->actionmsg = $langs->transnoentities("ShippingSentByEMail", $object->ref); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | // Parameters $object->sendtoid defined by caller |
@@ -409,10 +409,10 @@ discard block |
||
409 | 409 | $langs->load("other"); |
410 | 410 | $langs->load("receptions"); |
411 | 411 | |
412 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionValidated",($object->newref?$object->newref:$object->ref)); |
|
412 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref)); |
|
413 | 413 | if (empty($object->actionmsg)) |
414 | 414 | { |
415 | - $object->actionmsg=$langs->transnoentities("ReceptionValidated",($object->newref?$object->newref:$object->ref)); |
|
415 | + $object->actionmsg = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref)); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | // Parameters $object->sendtoid defined by caller |
@@ -424,10 +424,10 @@ discard block |
||
424 | 424 | $langs->load("other"); |
425 | 425 | $langs->load("receptions"); |
426 | 426 | |
427 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionSentByEMail",$object->ref); |
|
427 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionSentByEMail", $object->ref); |
|
428 | 428 | if (empty($object->actionmsg)) |
429 | 429 | { |
430 | - $object->actionmsg=$langs->transnoentities("ReceptionSentByEMail",$object->ref); |
|
430 | + $object->actionmsg = $langs->transnoentities("ReceptionSentByEMail", $object->ref); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | // Parameters $object->sendtoid defined by caller |
@@ -436,22 +436,22 @@ discard block |
||
436 | 436 | elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') |
437 | 437 | { |
438 | 438 | // Load translation files required by the page |
439 | - $langs->loadLangs(array("agenda","other","propal")); |
|
439 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
440 | 440 | |
441 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
442 | - $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
441 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
442 | + $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
443 | 443 | |
444 | - $object->sendtoid=0; |
|
444 | + $object->sendtoid = 0; |
|
445 | 445 | } |
446 | 446 | elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') |
447 | 447 | { |
448 | 448 | // Load translation files required by the page |
449 | - $langs->loadLangs(array("agenda","other","propal")); |
|
449 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
450 | 450 | |
451 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
|
451 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref); |
|
452 | 452 | if (empty($object->actionmsg)) |
453 | 453 | { |
454 | - $object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
|
454 | + $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | // Parameters $object->sendtoid defined by caller |
@@ -460,92 +460,92 @@ discard block |
||
460 | 460 | elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') |
461 | 461 | { |
462 | 462 | // Load translation files required by the page |
463 | - $langs->loadLangs(array("agenda","other","propal")); |
|
463 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
464 | 464 | |
465 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
|
466 | - $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
|
465 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref); |
|
466 | + $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref); |
|
467 | 467 | |
468 | - $object->sendtoid=0; |
|
468 | + $object->sendtoid = 0; |
|
469 | 469 | } |
470 | 470 | elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') |
471 | 471 | { |
472 | 472 | // Load translation files required by the page |
473 | - $langs->loadLangs(array("agenda","other","propal")); |
|
473 | + $langs->loadLangs(array("agenda", "other", "propal")); |
|
474 | 474 | |
475 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
|
476 | - $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
|
475 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref); |
|
476 | + $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref); |
|
477 | 477 | |
478 | - $object->sendtoid=0; |
|
478 | + $object->sendtoid = 0; |
|
479 | 479 | } |
480 | 480 | elseif ($action == 'ORDER_SUPPLIER_CREATE') |
481 | 481 | { |
482 | 482 | // Load translation files required by the page |
483 | - $langs->loadLangs(array("agenda","other","orders")); |
|
483 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
484 | 484 | |
485 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
486 | - $object->actionmsg=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
485 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
486 | + $object->actionmsg = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
487 | 487 | |
488 | - $object->sendtoid=0; |
|
488 | + $object->sendtoid = 0; |
|
489 | 489 | } |
490 | 490 | elseif ($action == 'ORDER_SUPPLIER_VALIDATE') |
491 | 491 | { |
492 | 492 | // Load translation files required by the page |
493 | - $langs->loadLangs(array("agenda","other","orders")); |
|
493 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
494 | 494 | |
495 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
496 | - $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
495 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
496 | + $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
497 | 497 | |
498 | - $object->sendtoid=0; |
|
498 | + $object->sendtoid = 0; |
|
499 | 499 | } |
500 | 500 | elseif ($action == 'ORDER_SUPPLIER_APPROVE') |
501 | 501 | { |
502 | 502 | // Load translation files required by the page |
503 | - $langs->loadLangs(array("agenda","other","orders")); |
|
503 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
504 | 504 | |
505 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); |
|
506 | - $object->actionmsg=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); |
|
505 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref); |
|
506 | + $object->actionmsg = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref); |
|
507 | 507 | |
508 | - $object->sendtoid=0; |
|
508 | + $object->sendtoid = 0; |
|
509 | 509 | } |
510 | 510 | elseif ($action == 'ORDER_SUPPLIER_REFUSE') |
511 | 511 | { |
512 | 512 | // Load translation files required by the page |
513 | - $langs->loadLangs(array("agenda","other","orders")); |
|
513 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
514 | 514 | |
515 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); |
|
516 | - $object->actionmsg=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); |
|
515 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); |
|
516 | + $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); |
|
517 | 517 | |
518 | - $object->sendtoid=0; |
|
518 | + $object->sendtoid = 0; |
|
519 | 519 | } |
520 | 520 | elseif ($action == 'ORDER_SUPPLIER_SUBMIT') |
521 | 521 | { |
522 | 522 | // Load translation files required by the page |
523 | - $langs->loadLangs(array("agenda","other","orders")); |
|
523 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
524 | 524 | |
525 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
526 | - $object->actionmsg=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
525 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
526 | + $object->actionmsg = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
527 | 527 | |
528 | - $object->sendtoid=0; |
|
528 | + $object->sendtoid = 0; |
|
529 | 529 | } |
530 | 530 | elseif ($action == 'ORDER_SUPPLIER_RECEIVE') |
531 | 531 | { |
532 | 532 | // Load translation files required by the page |
533 | - $langs->loadLangs(array("agenda","other","orders")); |
|
533 | + $langs->loadLangs(array("agenda", "other", "orders")); |
|
534 | 534 | |
535 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
536 | - $object->actionmsg=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
535 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
536 | + $object->actionmsg = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
537 | 537 | |
538 | - $object->sendtoid=0; |
|
538 | + $object->sendtoid = 0; |
|
539 | 539 | } |
540 | 540 | elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') |
541 | 541 | { |
542 | 542 | // Load translation files required by the page |
543 | - $langs->loadLangs(array("agenda","other","bills","orders")); |
|
543 | + $langs->loadLangs(array("agenda", "other", "bills", "orders")); |
|
544 | 544 | |
545 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); |
|
545 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref); |
|
546 | 546 | if (empty($object->actionmsg)) |
547 | 547 | { |
548 | - $object->actionmsg=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); |
|
548 | + $object->actionmsg = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | // Parameters $object->sendtoid defined by caller |
@@ -554,45 +554,45 @@ discard block |
||
554 | 554 | elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') |
555 | 555 | { |
556 | 556 | // Load translation files required by the page |
557 | - $langs->loadLangs(array("agenda","other","bills","orders")); |
|
557 | + $langs->loadLangs(array("agenda", "other", "bills", "orders")); |
|
558 | 558 | |
559 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref); |
|
559 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref); |
|
560 | 560 | if (empty($object->actionmsg)) |
561 | 561 | { |
562 | - $object->actionmsg=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref); |
|
562 | + $object->actionmsg = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref); |
|
563 | 563 | } |
564 | 564 | |
565 | - $object->sendtoid=0; |
|
565 | + $object->sendtoid = 0; |
|
566 | 566 | } |
567 | 567 | elseif ($action == 'BILL_SUPPLIER_VALIDATE') |
568 | 568 | { |
569 | 569 | // Load translation files required by the page |
570 | - $langs->loadLangs(array("agenda","other","bills")); |
|
570 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
571 | 571 | |
572 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
573 | - $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
572 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
573 | + $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
574 | 574 | |
575 | - $object->sendtoid=0; |
|
575 | + $object->sendtoid = 0; |
|
576 | 576 | } |
577 | 577 | elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') |
578 | 578 | { |
579 | 579 | // Load translation files required by the page |
580 | - $langs->loadLangs(array("agenda","other","bills")); |
|
580 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
581 | 581 | |
582 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
|
583 | - $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
|
582 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref); |
|
583 | + $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref); |
|
584 | 584 | |
585 | - $object->sendtoid=0; |
|
585 | + $object->sendtoid = 0; |
|
586 | 586 | } |
587 | 587 | elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') |
588 | 588 | { |
589 | 589 | // Load translation files required by the page |
590 | - $langs->loadLangs(array("agenda","other","bills","orders")); |
|
590 | + $langs->loadLangs(array("agenda", "other", "bills", "orders")); |
|
591 | 591 | |
592 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); |
|
592 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref); |
|
593 | 593 | if (empty($object->actionmsg)) |
594 | 594 | { |
595 | - $object->actionmsg=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); |
|
595 | + $object->actionmsg = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | // Parameters $object->sendtoid defined by caller |
@@ -601,201 +601,201 @@ discard block |
||
601 | 601 | elseif ($action == 'BILL_SUPPLIER_PAYED') |
602 | 602 | { |
603 | 603 | // Load translation files required by the page |
604 | - $langs->loadLangs(array("agenda","other","bills")); |
|
604 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
605 | 605 | |
606 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); |
|
607 | - $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); |
|
606 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref); |
|
607 | + $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref); |
|
608 | 608 | |
609 | - $object->sendtoid=0; |
|
609 | + $object->sendtoid = 0; |
|
610 | 610 | } |
611 | 611 | elseif ($action == 'BILL_SUPPLIER_CANCELED') |
612 | 612 | { |
613 | 613 | // Load translation files required by the page |
614 | - $langs->loadLangs(array("agenda","other","bills")); |
|
614 | + $langs->loadLangs(array("agenda", "other", "bills")); |
|
615 | 615 | |
616 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
|
617 | - $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
|
616 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref); |
|
617 | + $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref); |
|
618 | 618 | |
619 | - $object->sendtoid=0; |
|
619 | + $object->sendtoid = 0; |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | // Members |
623 | 623 | elseif ($action == 'MEMBER_VALIDATE') |
624 | 624 | { |
625 | 625 | // Load translation files required by the page |
626 | - $langs->loadLangs(array("agenda","other","members")); |
|
626 | + $langs->loadLangs(array("agenda", "other", "members")); |
|
627 | 627 | |
628 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs)); |
|
629 | - $object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs)); |
|
630 | - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
631 | - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
|
628 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs)); |
|
629 | + $object->actionmsg = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs)); |
|
630 | + $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
631 | + $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; |
|
632 | 632 | |
633 | - $object->sendtoid=0; |
|
633 | + $object->sendtoid = 0; |
|
634 | 634 | } |
635 | 635 | elseif ($action == 'MEMBER_MODIFY') |
636 | 636 | { |
637 | 637 | // Load translation files required by the page |
638 | - $langs->loadLangs(array("agenda","other","members")); |
|
638 | + $langs->loadLangs(array("agenda", "other", "members")); |
|
639 | 639 | |
640 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs)); |
|
641 | - $object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs)); |
|
642 | - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
643 | - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
|
640 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs)); |
|
641 | + $object->actionmsg = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs)); |
|
642 | + $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
643 | + $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; |
|
644 | 644 | |
645 | - $object->sendtoid=0; |
|
645 | + $object->sendtoid = 0; |
|
646 | 646 | } |
647 | 647 | elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') |
648 | 648 | { |
649 | 649 | // Load translation files required by the page |
650 | - $langs->loadLangs(array("agenda","other","members")); |
|
650 | + $langs->loadLangs(array("agenda", "other", "members")); |
|
651 | 651 | |
652 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
653 | - $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
654 | - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
655 | - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
|
656 | - $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; |
|
657 | - $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); |
|
652 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->ref, $object->getFullName($langs)); |
|
653 | + $object->actionmsg = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->ref, $object->getFullName($langs)); |
|
654 | + $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
655 | + $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; |
|
656 | + $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; |
|
657 | + $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day'); |
|
658 | 658 | |
659 | - $object->sendtoid=0; |
|
660 | - if ($object->fk_soc > 0) $object->socid=$object->fk_soc; |
|
659 | + $object->sendtoid = 0; |
|
660 | + if ($object->fk_soc > 0) $object->socid = $object->fk_soc; |
|
661 | 661 | } |
662 | 662 | elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') |
663 | 663 | { |
664 | 664 | // Load translation files required by the page |
665 | - $langs->loadLangs(array("agenda","other","members")); |
|
665 | + $langs->loadLangs(array("agenda", "other", "members")); |
|
666 | 666 | |
667 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
668 | - $object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
669 | - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
670 | - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
|
671 | - $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; |
|
672 | - $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); |
|
667 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->ref, $object->getFullName($langs)); |
|
668 | + $object->actionmsg = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->ref, $object->getFullName($langs)); |
|
669 | + $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
670 | + $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; |
|
671 | + $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; |
|
672 | + $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day'); |
|
673 | 673 | |
674 | - $object->sendtoid=0; |
|
675 | - if ($object->fk_soc > 0) $object->socid=$object->fk_soc; |
|
674 | + $object->sendtoid = 0; |
|
675 | + if ($object->fk_soc > 0) $object->socid = $object->fk_soc; |
|
676 | 676 | } |
677 | 677 | elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') |
678 | 678 | { |
679 | 679 | // Load translation files required by the page |
680 | - $langs->loadLangs(array("agenda","other","members")); |
|
680 | + $langs->loadLangs(array("agenda", "other", "members")); |
|
681 | 681 | |
682 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
683 | - $object->actionmsg=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
684 | - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
685 | - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
|
686 | - $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; |
|
687 | - $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); |
|
682 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs)); |
|
683 | + $object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs)); |
|
684 | + $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
685 | + $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; |
|
686 | + $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; |
|
687 | + $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day'); |
|
688 | 688 | |
689 | - $object->sendtoid=0; |
|
690 | - if ($object->fk_soc > 0) $object->socid=$object->fk_soc; |
|
689 | + $object->sendtoid = 0; |
|
690 | + if ($object->fk_soc > 0) $object->socid = $object->fk_soc; |
|
691 | 691 | } |
692 | 692 | elseif ($action == 'MEMBER_RESILIATE') |
693 | 693 | { |
694 | 694 | // Load translation files required by the page |
695 | - $langs->loadLangs(array("agenda","other","members")); |
|
695 | + $langs->loadLangs(array("agenda", "other", "members")); |
|
696 | 696 | |
697 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs)); |
|
698 | - $object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs)); |
|
699 | - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
700 | - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
|
697 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs)); |
|
698 | + $object->actionmsg = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs)); |
|
699 | + $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
700 | + $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; |
|
701 | 701 | |
702 | - $object->sendtoid=0; |
|
702 | + $object->sendtoid = 0; |
|
703 | 703 | } |
704 | 704 | elseif ($action == 'MEMBER_DELETE') |
705 | 705 | { |
706 | 706 | // Load translation files required by the page |
707 | - $langs->loadLangs(array("agenda","other","members")); |
|
707 | + $langs->loadLangs(array("agenda", "other", "members")); |
|
708 | 708 | |
709 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs)); |
|
710 | - $object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs)); |
|
711 | - $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
712 | - $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
|
709 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs)); |
|
710 | + $object->actionmsg = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs)); |
|
711 | + $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
|
712 | + $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; |
|
713 | 713 | |
714 | - $object->sendtoid=0; |
|
714 | + $object->sendtoid = 0; |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | // Projects |
718 | 718 | elseif ($action == 'PROJECT_CREATE') |
719 | 719 | { |
720 | 720 | // Load translation files required by the page |
721 | - $langs->loadLangs(array("agenda","other","projects")); |
|
721 | + $langs->loadLangs(array("agenda", "other", "projects")); |
|
722 | 722 | |
723 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); |
|
724 | - $object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); |
|
725 | - $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref; |
|
723 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref); |
|
724 | + $object->actionmsg = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref); |
|
725 | + $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref; |
|
726 | 726 | |
727 | - $object->sendtoid=0; |
|
727 | + $object->sendtoid = 0; |
|
728 | 728 | } |
729 | - elseif($action == 'PROJECT_VALIDATE') |
|
729 | + elseif ($action == 'PROJECT_VALIDATE') |
|
730 | 730 | { |
731 | 731 | // Load translation files required by the page |
732 | - $langs->loadLangs(array("agenda","other","projects")); |
|
732 | + $langs->loadLangs(array("agenda", "other", "projects")); |
|
733 | 733 | |
734 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref); |
|
735 | - $object->actionmsg=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref); |
|
736 | - $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref; |
|
734 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref); |
|
735 | + $object->actionmsg = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref); |
|
736 | + $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref; |
|
737 | 737 | |
738 | - $object->sendtoid=0; |
|
738 | + $object->sendtoid = 0; |
|
739 | 739 | } |
740 | - elseif($action == 'PROJECT_MODIFY') |
|
740 | + elseif ($action == 'PROJECT_MODIFY') |
|
741 | 741 | { |
742 | 742 | // Load translation files required by the page |
743 | - $langs->loadLangs(array("agenda","other","projects")); |
|
743 | + $langs->loadLangs(array("agenda", "other", "projects")); |
|
744 | 744 | |
745 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref); |
|
746 | - $object->actionmsg=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref); |
|
747 | - $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; |
|
745 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref); |
|
746 | + $object->actionmsg = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref); |
|
747 | + $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref; |
|
748 | 748 | |
749 | - $object->sendtoid=0; |
|
749 | + $object->sendtoid = 0; |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | // Project tasks |
753 | - elseif($action == 'TASK_CREATE') |
|
753 | + elseif ($action == 'TASK_CREATE') |
|
754 | 754 | { |
755 | 755 | // Load translation files required by the page |
756 | - $langs->loadLangs(array("agenda","other","projects")); |
|
756 | + $langs->loadLangs(array("agenda", "other", "projects")); |
|
757 | 757 | |
758 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref); |
|
759 | - $object->actionmsg=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref); |
|
760 | - $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; |
|
758 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref); |
|
759 | + $object->actionmsg = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref); |
|
760 | + $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref; |
|
761 | 761 | |
762 | - $object->sendtoid=0; |
|
762 | + $object->sendtoid = 0; |
|
763 | 763 | } |
764 | 764 | |
765 | - elseif($action == 'TASK_MODIFY') |
|
765 | + elseif ($action == 'TASK_MODIFY') |
|
766 | 766 | { |
767 | 767 | // Load translation files required by the page |
768 | - $langs->loadLangs(array("agenda","other","projects")); |
|
768 | + $langs->loadLangs(array("agenda", "other", "projects")); |
|
769 | 769 | |
770 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref); |
|
771 | - $object->actionmsg=$langs->transnoentities("TaskModifieddInDolibarr",$object->ref); |
|
772 | - $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; |
|
770 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskModifiedInDolibarr", $object->ref); |
|
771 | + $object->actionmsg = $langs->transnoentities("TaskModifieddInDolibarr", $object->ref); |
|
772 | + $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref; |
|
773 | 773 | |
774 | - $object->sendtoid=0; |
|
774 | + $object->sendtoid = 0; |
|
775 | 775 | } |
776 | 776 | |
777 | - elseif($action == 'TASK_DELETE') |
|
777 | + elseif ($action == 'TASK_DELETE') |
|
778 | 778 | { |
779 | 779 | // Load translation files required by the page |
780 | - $langs->loadLangs(array("agenda","other","projects")); |
|
780 | + $langs->loadLangs(array("agenda", "other", "projects")); |
|
781 | 781 | |
782 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); |
|
783 | - $object->actionmsg=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); |
|
784 | - $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; |
|
782 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref); |
|
783 | + $object->actionmsg = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref); |
|
784 | + $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref; |
|
785 | 785 | |
786 | - $object->sendtoid=0; |
|
786 | + $object->sendtoid = 0; |
|
787 | 787 | } |
788 | 788 | // TODO Merge all previous cases into this generic one |
789 | 789 | else // $action = TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ... |
790 | 790 | { |
791 | 791 | // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function) |
792 | 792 | // Load translation files required by the page |
793 | - $langs->loadLangs(array("agenda","other")); |
|
793 | + $langs->loadLangs(array("agenda", "other")); |
|
794 | 794 | |
795 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities($action."InDolibarr",$object->ref); |
|
796 | - if (empty($object->actionmsg)) $object->actionmsg=$langs->transnoentities($action."InDolibarr",$object->ref); |
|
795 | + if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", $object->ref); |
|
796 | + if (empty($object->actionmsg)) $object->actionmsg = $langs->transnoentities($action."InDolibarr", $object->ref); |
|
797 | 797 | |
798 | - $object->sendtoid=0; |
|
798 | + $object->sendtoid = 0; |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | $object->actionmsg = $langs->transnoentities("Author").': '.$user->login."\n".$object->actionmsg; |
@@ -803,21 +803,21 @@ discard block |
||
803 | 803 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
804 | 804 | |
805 | 805 | // Add entry in event table |
806 | - $now=dol_now(); |
|
806 | + $now = dol_now(); |
|
807 | 807 | |
808 | 808 | if (isset($_SESSION['listofnames-'.$object->trackid])) |
809 | 809 | { |
810 | - $attachs=$_SESSION['listofnames-'.$object->trackid]; |
|
811 | - if ($attachs && strpos($action,'SENTBYMAIL')) |
|
810 | + $attachs = $_SESSION['listofnames-'.$object->trackid]; |
|
811 | + if ($attachs && strpos($action, 'SENTBYMAIL')) |
|
812 | 812 | { |
813 | - $object->actionmsg=dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs); |
|
813 | + $object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs); |
|
814 | 814 | } |
815 | 815 | } |
816 | 816 | |
817 | 817 | require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
818 | 818 | require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
819 | - $contactforaction=new Contact($this->db); |
|
820 | - $societeforaction=new Societe($this->db); |
|
819 | + $contactforaction = new Contact($this->db); |
|
820 | + $societeforaction = new Societe($this->db); |
|
821 | 821 | // Set contactforaction if there is only 1 contact. |
822 | 822 | if (is_array($object->sendtoid)) |
823 | 823 | { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | if ($object->socid > 0) $societeforaction->fetch($object->socid); |
832 | 832 | elseif ($object->fk_soc > 0) $societeforaction->fetch($object->fk_soc); |
833 | 833 | |
834 | - $projectid = isset($object->fk_project)?$object->fk_project:0; |
|
834 | + $projectid = isset($object->fk_project) ? $object->fk_project : 0; |
|
835 | 835 | if ($object->element == 'project') $projectid = $object->id; |
836 | 836 | |
837 | 837 | $elementid = $object->id; |
@@ -846,22 +846,22 @@ discard block |
||
846 | 846 | // Insertion action |
847 | 847 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
848 | 848 | $actioncomm = new ActionComm($this->db); |
849 | - $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
849 | + $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
850 | 850 | $actioncomm->code = 'AC_'.$action; |
851 | 851 | $actioncomm->label = $object->actionmsg2; |
852 | - $actioncomm->note = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg) |
|
852 | + $actioncomm->note = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg) |
|
853 | 853 | $actioncomm->fk_project = $projectid; |
854 | 854 | $actioncomm->datep = $now; |
855 | 855 | $actioncomm->datef = $now; |
856 | 856 | $actioncomm->durationp = 0; |
857 | 857 | $actioncomm->punctual = 1; |
858 | - $actioncomm->percentage = -1; // Not applicable |
|
858 | + $actioncomm->percentage = -1; // Not applicable |
|
859 | 859 | $actioncomm->societe = $societeforaction; |
860 | 860 | $actioncomm->contact = $contactforaction; |
861 | 861 | $actioncomm->socid = $societeforaction->id; |
862 | 862 | $actioncomm->contactid = $contactforaction->id; |
863 | - $actioncomm->authorid = $user->id; // User saving action |
|
864 | - $actioncomm->userownerid = $user->id; // Owner of action |
|
863 | + $actioncomm->authorid = $user->id; // User saving action |
|
864 | + $actioncomm->userownerid = $user->id; // Owner of action |
|
865 | 865 | // Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label) |
866 | 866 | $actioncomm->email_msgid = $object->email_msgid; |
867 | 867 | $actioncomm->email_from = $object->email_from; |
@@ -874,28 +874,28 @@ discard block |
||
874 | 874 | |
875 | 875 | // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table |
876 | 876 | // for such objects because there is already a dedicated field into table llx_actioncomm. |
877 | - if (! in_array($elementtype, array('societe','contact','project'))) |
|
877 | + if (!in_array($elementtype, array('societe', 'contact', 'project'))) |
|
878 | 878 | { |
879 | 879 | $actioncomm->fk_element = $elementid; |
880 | 880 | $actioncomm->elementtype = $elementtype; |
881 | 881 | } |
882 | 882 | |
883 | - if (property_exists($object,'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles)>0) { |
|
884 | - $actioncomm->attachedfiles=$object->attachedfiles; |
|
883 | + if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) { |
|
884 | + $actioncomm->attachedfiles = $object->attachedfiles; |
|
885 | 885 | } |
886 | - if (property_exists($object,'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid)>0) { |
|
887 | - $actioncomm->userassigned=$object->sendtouserid; |
|
886 | + if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid) > 0) { |
|
887 | + $actioncomm->userassigned = $object->sendtouserid; |
|
888 | 888 | } |
889 | 889 | |
890 | - $ret=$actioncomm->create($user); // User creating action |
|
890 | + $ret = $actioncomm->create($user); // User creating action |
|
891 | 891 | |
892 | 892 | if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO) |
893 | 893 | { |
894 | - if (is_array($object->attachedfiles) && array_key_exists('paths',$object->attachedfiles) && count($object->attachedfiles['paths'])>0) { |
|
895 | - foreach($object->attachedfiles['paths'] as $key=>$filespath) { |
|
894 | + if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { |
|
895 | + foreach ($object->attachedfiles['paths'] as $key=>$filespath) { |
|
896 | 896 | $srcfile = $filespath; |
897 | - $destdir = $conf->agenda->dir_output . '/' . $ret; |
|
898 | - $destfile = $destdir . '/' . $object->attachedfiles['names'][$key]; |
|
897 | + $destdir = $conf->agenda->dir_output.'/'.$ret; |
|
898 | + $destfile = $destdir.'/'.$object->attachedfiles['names'][$key]; |
|
899 | 899 | if (dol_mkdir($destdir) >= 0) { |
900 | 900 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
901 | 901 | dol_copy($srcfile, $destfile); |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | } |
905 | 905 | } |
906 | 906 | |
907 | - unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. |
|
907 | + unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. |
|
908 | 908 | |
909 | 909 | if ($ret > 0) |
910 | 910 | { |
@@ -913,9 +913,9 @@ discard block |
||
913 | 913 | } |
914 | 914 | else |
915 | 915 | { |
916 | - $error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors); |
|
917 | - $this->error=$error; |
|
918 | - $this->errors=$actioncomm->errors; |
|
916 | + $error = "Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors); |
|
917 | + $this->error = $error; |
|
918 | + $this->errors = $actioncomm->errors; |
|
919 | 919 | |
920 | 920 | dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR); |
921 | 921 | return -1; |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
58 | 58 | { |
59 | - if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing |
|
59 | + if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing |
|
60 | 60 | |
61 | 61 | // Test if event/record is qualified |
62 | 62 | $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription', 'payment_various', 'cashcontrol'); |
63 | - if (! in_array($object->element, $listofqualifiedelement)) return 1; |
|
63 | + if (!in_array($object->element, $listofqualifiedelement)) return 1; |
|
64 | 64 | |
65 | 65 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
66 | 66 | |
67 | 67 | require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; |
68 | - $b=new BlockedLog($this->db); |
|
68 | + $b = new BlockedLog($this->db); |
|
69 | 69 | |
70 | 70 | // Tracked events |
71 | - if (! in_array($action, array_keys($b->trackedevents))) |
|
71 | + if (!in_array($action, array_keys($b->trackedevents))) |
|
72 | 72 | { |
73 | 73 | return 0; |
74 | 74 | } |
@@ -76,19 +76,19 @@ discard block |
||
76 | 76 | // Event/record is qualified |
77 | 77 | $qualified = 0; |
78 | 78 | $amounts = 0; |
79 | - if ($action==='BILL_VALIDATE' || $action==='BILL_DELETE' || $action === 'BILL_SENTBYMAIL' |
|
80 | - || $action==='BILL_SUPPLIER_VALIDATE' || $action==='BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL' |
|
81 | - || $action==='MEMBER_SUBSCRIPTION_CREATE' || $action==='MEMBER_SUBSCRIPTION_MODIFY' || $action==='MEMBER_SUBSCRIPTION_DELETE' |
|
82 | - || $action==='DON_VALIDATE' || $action==='DON_MODIFY' || $action==='DON_DELETE' |
|
83 | - || $action==='CASHCONTROL_VALIDATE' |
|
84 | - || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_DOWNLOAD') || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_PREVIEW') |
|
79 | + if ($action === 'BILL_VALIDATE' || $action === 'BILL_DELETE' || $action === 'BILL_SENTBYMAIL' |
|
80 | + || $action === 'BILL_SUPPLIER_VALIDATE' || $action === 'BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL' |
|
81 | + || $action === 'MEMBER_SUBSCRIPTION_CREATE' || $action === 'MEMBER_SUBSCRIPTION_MODIFY' || $action === 'MEMBER_SUBSCRIPTION_DELETE' |
|
82 | + || $action === 'DON_VALIDATE' || $action === 'DON_MODIFY' || $action === 'DON_DELETE' |
|
83 | + || $action === 'CASHCONTROL_VALIDATE' |
|
84 | + || (in_array($object->element, array('facture', 'suplier_invoice')) && $action === 'DOC_DOWNLOAD') || (in_array($object->element, array('facture', 'suplier_invoice')) && $action === 'DOC_PREVIEW') |
|
85 | 85 | ) |
86 | 86 | { |
87 | 87 | $qualified++; |
88 | 88 | |
89 | 89 | if (in_array($action, array( |
90 | - 'MEMBER_SUBSCRIPTION_CREATE','MEMBER_SUBSCRIPTION_MODIFY','MEMBER_SUBSCRIPTION_DELETE', |
|
91 | - 'DON_VALIDATE','DON_MODIFY','DON_DELETE'))) $amounts = (double) $object->amount; |
|
90 | + 'MEMBER_SUBSCRIPTION_CREATE', 'MEMBER_SUBSCRIPTION_MODIFY', 'MEMBER_SUBSCRIPTION_DELETE', |
|
91 | + 'DON_VALIDATE', 'DON_MODIFY', 'DON_DELETE'))) $amounts = (double) $object->amount; |
|
92 | 92 | elseif ($action == 'CASHCONTROL_VALIDATE') |
93 | 93 | { |
94 | 94 | $amounts = (double) $object->cash + (double) $object->cheque + (double) $object->card; |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | { |
107 | 107 | $qualified++; |
108 | 108 | $amounts = 0; |
109 | - if(!empty($object->amounts)) { |
|
110 | - foreach($object->amounts as $amount) { |
|
109 | + if (!empty($object->amounts)) { |
|
110 | + foreach ($object->amounts as $amount) { |
|
111 | 111 | $amounts += price2num($amount); |
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
115 | - elseif (strpos($action,'PAYMENT')!==false && ! in_array($action, array('PAYMENT_ADD_TO_BANK'))) |
|
115 | + elseif (strpos($action, 'PAYMENT') !== false && !in_array($action, array('PAYMENT_ADD_TO_BANK'))) |
|
116 | 116 | { |
117 | 117 | $qualified++; |
118 | 118 | $amounts = (double) $object->amount; |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | |
121 | 121 | // Another protection. |
122 | 122 | // May be used when event is DOC_DOWNLOAD or DOC_PREVIEW and element is not an invoice |
123 | - if (! $qualified) |
|
123 | + if (!$qualified) |
|
124 | 124 | { |
125 | 125 | return 0; // not implemented action log |
126 | 126 | } |
127 | 127 | |
128 | - $result = $b->setObjectData($object, $action, $amounts, $user); // Set field date_object, ref_object, fk_object, element, object_data |
|
128 | + $result = $b->setObjectData($object, $action, $amounts, $user); // Set field date_object, ref_object, fk_object, element, object_data |
|
129 | 129 | |
130 | 130 | if ($result < 0) |
131 | 131 | { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public $picto = 'email'; |
46 | 46 | |
47 | 47 | // @TODO Defined also into notify.class.php) |
48 | - public $listofmanagedevents=array( |
|
48 | + public $listofmanagedevents = array( |
|
49 | 49 | 'BILL_VALIDATE', |
50 | 50 | 'BILL_PAYED', |
51 | 51 | 'ORDER_VALIDATE', |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
78 | 78 | { |
79 | - if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing |
|
79 | + if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing |
|
80 | 80 | |
81 | - require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; |
|
81 | + require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; |
|
82 | 82 | $notify = new Notify($this->db); |
83 | 83 | |
84 | - if (! in_array($action, $notify->arrayofnotifsupported)) return 0; |
|
84 | + if (!in_array($action, $notify->arrayofnotifsupported)) return 0; |
|
85 | 85 | |
86 | 86 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
87 | 87 | |
@@ -100,42 +100,42 @@ discard block |
||
100 | 100 | { |
101 | 101 | global $conf; |
102 | 102 | |
103 | - $ret=array(); |
|
103 | + $ret = array(); |
|
104 | 104 | |
105 | 105 | $sql = "SELECT rowid, code, label, description, elementtype"; |
106 | - $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; |
|
107 | - $sql.= $this->db->order("rang, elementtype, code"); |
|
106 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; |
|
107 | + $sql .= $this->db->order("rang, elementtype, code"); |
|
108 | 108 | dol_syslog("getListOfManagedEvents Get list of notifications", LOG_DEBUG); |
109 | - $resql=$this->db->query($sql); |
|
109 | + $resql = $this->db->query($sql); |
|
110 | 110 | if ($resql) |
111 | 111 | { |
112 | - $num=$this->db->num_rows($resql); |
|
113 | - $i=0; |
|
112 | + $num = $this->db->num_rows($resql); |
|
113 | + $i = 0; |
|
114 | 114 | while ($i < $num) |
115 | 115 | { |
116 | - $obj=$this->db->fetch_object($resql); |
|
116 | + $obj = $this->db->fetch_object($resql); |
|
117 | 117 | |
118 | - $qualified=0; |
|
118 | + $qualified = 0; |
|
119 | 119 | // Check is this event is supported by notification module |
120 | - if (in_array($obj->code, $this->listofmanagedevents)) $qualified=1; |
|
120 | + if (in_array($obj->code, $this->listofmanagedevents)) $qualified = 1; |
|
121 | 121 | // Check if module for this event is active |
122 | 122 | if ($qualified) |
123 | 123 | { |
124 | 124 | //print 'xx'.$obj->code; |
125 | - $element=$obj->elementtype; |
|
125 | + $element = $obj->elementtype; |
|
126 | 126 | |
127 | 127 | // Exclude events if related module is disabled |
128 | - if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified=0; |
|
129 | - elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified=0; |
|
130 | - elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified=0; |
|
131 | - elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified=0; |
|
132 | - elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified=0; |
|
133 | - elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member','expensereport')) && empty($conf->$element->enabled)) $qualified=0; |
|
128 | + if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified = 0; |
|
129 | + elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified = 0; |
|
130 | + elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified = 0; |
|
131 | + elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified = 0; |
|
132 | + elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified = 0; |
|
133 | + elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expensereport')) && empty($conf->$element->enabled)) $qualified = 0; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | if ($qualified) |
137 | 137 | { |
138 | - $ret[]=array('rowid'=>$obj->rowid,'code'=>$obj->code,'label'=>$obj->label,'description'=>$obj->description,'elementtype'=>$obj->elementtype); |
|
138 | + $ret[] = array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'label'=>$obj->label, 'description'=>$obj->description, 'elementtype'=>$obj->elementtype); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | $i++; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | switch ($action) { |
113 | 113 | case 'TICKET_ASSIGNED': |
114 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
114 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
115 | 115 | |
116 | 116 | if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id) |
117 | 117 | { |
@@ -127,25 +127,25 @@ discard block |
||
127 | 127 | $mimetype = array(); |
128 | 128 | |
129 | 129 | // Send email to assigned user |
130 | - $subject = '[' . $conf->global->MAIN_INFO_SOCIETE_NOM . '] ' . $langs->transnoentities('TicketAssignedToYou'); |
|
131 | - $message = '<p>' . $langs->transnoentities('TicketAssignedEmailBody', $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname)) . "</p>"; |
|
132 | - $message .= '<ul><li>' . $langs->trans('Title') . ' : ' . $object->subject . '</li>'; |
|
133 | - $message .= '<li>' . $langs->trans('Type') . ' : ' . $object->type_label . '</li>'; |
|
134 | - $message .= '<li>' . $langs->trans('Category') . ' : ' . $object->category_label . '</li>'; |
|
135 | - $message .= '<li>' . $langs->trans('Severity') . ' : ' . $object->severity_label . '</li>'; |
|
130 | + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketAssignedToYou'); |
|
131 | + $message = '<p>'.$langs->transnoentities('TicketAssignedEmailBody', $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname))."</p>"; |
|
132 | + $message .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>'; |
|
133 | + $message .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>'; |
|
134 | + $message .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>'; |
|
135 | + $message .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>'; |
|
136 | 136 | // Extrafields |
137 | 137 | if (is_array($object->array_options) && count($object->array_options) > 0) { |
138 | 138 | foreach ($object->array_options as $key => $value) { |
139 | - $message .= '<li>' . $langs->trans($key) . ' : ' . $value . '</li>'; |
|
139 | + $message .= '<li>'.$langs->trans($key).' : '.$value.'</li>'; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | 143 | $message .= '</ul>'; |
144 | - $message .= '<p>' . $langs->trans('Message') . ' : <br>' . $object->message . '</p>'; |
|
145 | - $message .= '<p><a href="' . dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id . '">' . $langs->trans('SeeThisTicketIntomanagementInterface') . '</a></p>'; |
|
144 | + $message .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>'; |
|
145 | + $message .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>'; |
|
146 | 146 | |
147 | 147 | $sendto = $userstat->email; |
148 | - $from = dolGetFirstLastname($user->firstname, $user->lastname) . '<' . $user->email . '>'; |
|
148 | + $from = dolGetFirstLastname($user->firstname, $user->lastname).'<'.$user->email.'>'; |
|
149 | 149 | |
150 | 150 | $message = dol_nl2br($message); |
151 | 151 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; |
154 | 154 | $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; |
155 | 155 | } |
156 | - include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; |
|
156 | + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; |
|
157 | 157 | $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1); |
158 | 158 | if ($mailfile->error) { |
159 | 159 | setEventMessages($mailfile->error, $mailfile->errors, 'errors'); |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | break; |
177 | 177 | |
178 | 178 | case 'TICKET_CREATE': |
179 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
179 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
180 | 180 | |
181 | 181 | $langs->load('ticket'); |
182 | 182 | |
183 | - $object->fetch('', $object->track_id); // Should be useless |
|
183 | + $object->fetch('', $object->track_id); // Should be useless |
|
184 | 184 | |
185 | 185 | |
186 | 186 | // Send email to notification email |
@@ -198,27 +198,27 @@ discard block |
||
198 | 198 | |
199 | 199 | /* Send email to admin */ |
200 | 200 | $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin'); |
201 | - $message_admin= $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; |
|
202 | - $message_admin.='<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>'; |
|
203 | - $message_admin.='<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>'; |
|
204 | - $message_admin.='<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>'; |
|
205 | - $message_admin.='<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>'; |
|
206 | - $message_admin.='<li>'.$langs->trans('From').' : '.( $object->email_from ? $object->email_from : ( $object->fk_user_create > 0 ? $langs->trans('Internal') : '') ).'</li>'; |
|
201 | + $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; |
|
202 | + $message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>'; |
|
203 | + $message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>'; |
|
204 | + $message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>'; |
|
205 | + $message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>'; |
|
206 | + $message_admin .= '<li>'.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'</li>'; |
|
207 | 207 | // Extrafields |
208 | 208 | if (is_array($object->array_options) && count($object->array_options) > 0) { |
209 | 209 | foreach ($object->array_options as $key => $value) { |
210 | - $message_admin.='<li>'.$langs->trans($key).' : '.$value.'</li>'; |
|
210 | + $message_admin .= '<li>'.$langs->trans($key).' : '.$value.'</li>'; |
|
211 | 211 | } |
212 | 212 | } |
213 | - $message_admin.='</ul>'; |
|
213 | + $message_admin .= '</ul>'; |
|
214 | 214 | |
215 | 215 | if ($object->fk_soc > 0) { |
216 | 216 | $object->fetch_thirdparty(); |
217 | - $message_admin.='<p>'.$langs->trans('Company'). ' : '.$object->thirdparty->name.'</p>'; |
|
217 | + $message_admin .= '<p>'.$langs->trans('Company').' : '.$object->thirdparty->name.'</p>'; |
|
218 | 218 | } |
219 | 219 | |
220 | - $message_admin.='<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>'; |
|
221 | - $message_admin.='<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>'; |
|
220 | + $message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>'; |
|
221 | + $message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>'; |
|
222 | 222 | |
223 | 223 | $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; |
224 | 224 | $replyto = $from; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | if ($mailfile->error) { |
235 | 235 | dol_syslog($mailfile->error, LOG_DEBUG); |
236 | 236 | } else { |
237 | - $result=$mailfile->sendfile(); |
|
237 | + $result = $mailfile->sendfile(); |
|
238 | 238 | } |
239 | 239 | if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { |
240 | 240 | $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | $mimetype = array(); |
262 | 262 | |
263 | 263 | $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectCustomer'); |
264 | - $message_customer= $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id)."\n\n"; |
|
265 | - $message_customer.='<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>'; |
|
266 | - $message_customer.='<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>'; |
|
267 | - $message_customer.='<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>'; |
|
268 | - $message_customer.='<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>'; |
|
264 | + $message_customer = $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id)."\n\n"; |
|
265 | + $message_customer .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>'; |
|
266 | + $message_customer .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>'; |
|
267 | + $message_customer .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>'; |
|
268 | + $message_customer .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>'; |
|
269 | 269 | |
270 | 270 | // Extrafields |
271 | 271 | foreach ($this->attributes[$object->table_element]['label'] as $key => $value) |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | if (empty($enabled)) $qualified = false; |
286 | 286 | if (empty($perms)) $qualified = false; |
287 | 287 | |
288 | - if ($qualified) $message_customer.='<li>'.$langs->trans($key).' : '.$value.'</li>'; |
|
288 | + if ($qualified) $message_customer .= '<li>'.$langs->trans($key).' : '.$value.'</li>'; |
|
289 | 289 | } |
290 | 290 | |
291 | - $message_customer.='</ul>'; |
|
292 | - $message_customer.='<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>'; |
|
293 | - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE?$conf->global->TICKET_URL_PUBLIC_INTERFACE.'/':dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; |
|
294 | - $message_customer.='<p>' . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>'; |
|
295 | - $message_customer.='<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>'; |
|
291 | + $message_customer .= '</ul>'; |
|
292 | + $message_customer .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>'; |
|
293 | + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; |
|
294 | + $message_customer .= '<p>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>'; |
|
295 | + $message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>'; |
|
296 | 296 | |
297 | 297 | $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; |
298 | 298 | $replyto = $from; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | if ($mailfile->error) { |
309 | 309 | dol_syslog($mailfile->error, LOG_DEBUG); |
310 | 310 | } else { |
311 | - $result=$mailfile->sendfile(); |
|
311 | + $result = $mailfile->sendfile(); |
|
312 | 312 | } |
313 | 313 | if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { |
314 | 314 | $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; |
@@ -319,19 +319,19 @@ discard block |
||
319 | 319 | break; |
320 | 320 | |
321 | 321 | case 'TICKET_DELETE': |
322 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
322 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
323 | 323 | break; |
324 | 324 | |
325 | 325 | case 'TICKET_MODIFY': |
326 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
326 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
327 | 327 | break; |
328 | 328 | |
329 | 329 | case 'TICKET_MARK_READ': |
330 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
330 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
331 | 331 | break; |
332 | 332 | |
333 | 333 | case 'TICKET_CLOSE': |
334 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
334 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
335 | 335 | break; |
336 | 336 | } |
337 | 337 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
58 | 58 | { |
59 | - if (empty($conf->mailmanspip->enabled)) return 0; // Module not active, we do nothing |
|
59 | + if (empty($conf->mailmanspip->enabled)) return 0; // Module not active, we do nothing |
|
60 | 60 | |
61 | 61 | require_once DOL_DOCUMENT_ROOT."/mailmanspip/class/mailmanspip.class.php"; |
62 | 62 | require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | // We add subscription if we change category (new category may means more mailing-list to subscribe) |
69 | 69 | if (is_object($object->context['linkto']) && method_exists($object->context['linkto'], 'add_to_abo') && $object->context['linkto']->add_to_abo() < 0) |
70 | 70 | { |
71 | - $this->error=$object->context['linkto']->error; |
|
72 | - $this->errors=$object->context['linkto']->errors; |
|
73 | - $return=-1; |
|
71 | + $this->error = $object->context['linkto']->error; |
|
72 | + $this->errors = $object->context['linkto']->errors; |
|
73 | + $return = -1; |
|
74 | 74 | } |
75 | 75 | else |
76 | 76 | { |
77 | - $return=1; |
|
77 | + $return = 1; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | return $return; |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | // We remove subscription if we change category (lessw category may means less mailing-list to subscribe) |
87 | 87 | if (is_object($object->context['unlinkoff']) && method_exists($object->context['unlinkoff'], 'del_to_abo') && $object->context['unlinkoff']->del_to_abo() < 0) |
88 | 88 | { |
89 | - $this->error=$object->context['unlinkoff']->error; |
|
90 | - $this->errors=$object->context['unlinkoff']->errors; |
|
91 | - $return=-1; |
|
89 | + $this->error = $object->context['unlinkoff']->error; |
|
90 | + $this->errors = $object->context['unlinkoff']->errors; |
|
91 | + $return = -1; |
|
92 | 92 | } |
93 | 93 | else |
94 | 94 | { |
95 | - $return=1; |
|
95 | + $return = 1; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $return; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
105 | 105 | |
106 | - $return=0; |
|
106 | + $return = 0; |
|
107 | 107 | // Add user into some linked tools (mailman, spip, etc...) |
108 | 108 | if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) // TODO Do del/add also if type change |
109 | 109 | { |
@@ -111,25 +111,25 @@ discard block |
||
111 | 111 | { |
112 | 112 | if ($object->oldcopy->del_to_abo() < 0) |
113 | 113 | { |
114 | - if (! empty($object->oldcopy->error)) $this->error=$object->oldcopy->error; |
|
115 | - $this->errors=$object->oldcopy->errors; |
|
116 | - $return=-1; |
|
114 | + if (!empty($object->oldcopy->error)) $this->error = $object->oldcopy->error; |
|
115 | + $this->errors = $object->oldcopy->errors; |
|
116 | + $return = -1; |
|
117 | 117 | } |
118 | 118 | else |
119 | 119 | { |
120 | - $return=1; |
|
120 | + $return = 1; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | // We add subscription if new email or new type (new type may means more mailing-list to subscribe) |
124 | 124 | if ($object->add_to_abo() < 0) |
125 | 125 | { |
126 | - if (! empty($object->error)) $this->error=$object->error; |
|
127 | - $this->errors=$object->errors; |
|
128 | - $return=-1; |
|
126 | + if (!empty($object->error)) $this->error = $object->error; |
|
127 | + $this->errors = $object->errors; |
|
128 | + $return = -1; |
|
129 | 129 | } |
130 | 130 | else |
131 | 131 | { |
132 | - $return=1; |
|
132 | + $return = 1; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -139,17 +139,17 @@ discard block |
||
139 | 139 | { |
140 | 140 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
141 | 141 | |
142 | - $return=0; |
|
142 | + $return = 0; |
|
143 | 143 | // Remove from external tools (mailman, spip, etc...) |
144 | 144 | if ($object->del_to_abo() < 0) |
145 | 145 | { |
146 | - if (! empty($object->error)) $this->error=$object->error; |
|
147 | - $this->errors=$object->errors; |
|
148 | - $return=-1; |
|
146 | + if (!empty($object->error)) $this->error = $object->error; |
|
147 | + $this->errors = $object->errors; |
|
148 | + $return = -1; |
|
149 | 149 | } |
150 | 150 | else |
151 | 151 | { |
152 | - $return=1; |
|
152 | + $return = 1; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return $return; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | global $langs, $db, $conf; |
120 | 120 | |
121 | 121 | // Load translation files required by the page |
122 | - $langs->loadLangs(array("members","other","users","mails")); |
|
122 | + $langs->loadLangs(array("members", "other", "users", "mails")); |
|
123 | 123 | |
124 | 124 | require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; |
125 | 125 | $stripe = new Stripe($db); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $service = 'StripeTest'; |
132 | 132 | $servicestatus = 0; |
133 | - if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) |
|
133 | + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) |
|
134 | 134 | { |
135 | 135 | $service = 'StripeLive'; |
136 | 136 | $servicestatus = 1; |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | |
139 | 139 | // If customer is linked to Stripe, we update/delete Stripe too |
140 | 140 | if ($action == 'COMPANY_MODIFY') { |
141 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
141 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
142 | 142 | |
143 | - $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. |
|
143 | + $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. |
|
144 | 144 | |
145 | 145 | if ($object->client != 0) { |
146 | - $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); // This make a network request |
|
146 | + $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); // This make a network request |
|
147 | 147 | if ($customer) |
148 | 148 | { |
149 | 149 | $namecleaned = $object->name ? $object->name : null; |
@@ -155,22 +155,22 @@ discard block |
||
155 | 155 | $taxinfo["tax_id"] = $vatcleaned; |
156 | 156 | } |
157 | 157 | // We force data to "null" if not defined as expected by Stripe |
158 | - if (empty($vatcleaned)) $taxinfo=null; |
|
158 | + if (empty($vatcleaned)) $taxinfo = null; |
|
159 | 159 | |
160 | 160 | // Detect if we change a Stripe info (email, description, vat id) |
161 | 161 | $changerequested = 0; |
162 | - if (! empty($object->email) && $object->email != $customer->email) $changerequested++; |
|
162 | + if (!empty($object->email) && $object->email != $customer->email) $changerequested++; |
|
163 | 163 | if ($namecleaned != $customer->description) $changerequested++; |
164 | - if (! isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) $changerequested++; |
|
164 | + if (!isset($customer->tax_info['tax_id']) && !is_null($vatcleaned)) $changerequested++; |
|
165 | 165 | elseif (isset($customer->tax_info['tax_id']) && is_null($vatcleaned)) $changerequested++; |
166 | - elseif (isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) |
|
166 | + elseif (isset($customer->tax_info['tax_id']) && !is_null($vatcleaned)) |
|
167 | 167 | { |
168 | 168 | if ($vatcleaned != $customer->tax_info['tax_id']) $changerequested++; |
169 | 169 | } |
170 | 170 | |
171 | 171 | if ($changerequested) |
172 | 172 | { |
173 | - if (! empty($object->email)) $customer->email = $object->email; |
|
173 | + if (!empty($object->email)) $customer->email = $object->email; |
|
174 | 174 | $customer->description = $namecleaned; |
175 | 175 | if (empty($taxinfo)) $customer->tax_info = array('type'=>'vat', 'tax_id'=>null); |
176 | 176 | else $customer->tax_info = $taxinfo; |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | if ($action == 'COMPANY_DELETE') { |
184 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
184 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
185 | 185 | |
186 | - $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. |
|
186 | + $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. |
|
187 | 187 | |
188 | 188 | $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); |
189 | 189 | if ($customer) |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account"; |
195 | - $sql.= " WHERE site='stripe' AND fk_soc = " . $object->id; |
|
195 | + $sql .= " WHERE site='stripe' AND fk_soc = ".$object->id; |
|
196 | 196 | $this->db->query($sql); |
197 | 197 | } |
198 | 198 | |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | // For creation of credit card, we do not create in Stripe automatically |
203 | 203 | } |
204 | 204 | if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') { |
205 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
205 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
206 | 206 | |
207 | - if (! empty($object->stripe_card_ref)) |
|
207 | + if (!empty($object->stripe_card_ref)) |
|
208 | 208 | { |
209 | - $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. |
|
210 | - $stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this |
|
209 | + $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. |
|
210 | + $stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this |
|
211 | 211 | |
212 | 212 | if ($stripecu) |
213 | 213 | { |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | { |
223 | 223 | $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); |
224 | 224 | if ($card) { |
225 | - $card->metadata=array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])); |
|
225 | + $card->metadata = array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])); |
|
226 | 226 | try { |
227 | 227 | $card->save($dataforcard); |
228 | 228 | } |
229 | - catch(Exception $e) |
|
229 | + catch (Exception $e) |
|
230 | 230 | { |
231 | 231 | $ok = -1; |
232 | 232 | $this->error = $e->getMessages(); |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | } |
238 | 238 | } |
239 | 239 | if ($action == 'COMPANYPAYMENTMODE_DELETE' && $object->type == 'card') { |
240 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
240 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
241 | 241 | |
242 | - if (! empty($object->stripe_card_ref)) |
|
242 | + if (!empty($object->stripe_card_ref)) |
|
243 | 243 | { |
244 | - $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. |
|
245 | - $stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this |
|
244 | + $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. |
|
245 | + $stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this |
|
246 | 246 | |
247 | 247 | if ($stripecu) |
248 | 248 | { |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
61 | 61 | { |
62 | - if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing |
|
62 | + if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing |
|
63 | 63 | |
64 | 64 | // Proposals to order |
65 | 65 | if ($action == 'PROPAL_CLOSE_SIGNED') |
66 | 66 | { |
67 | 67 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
68 | - if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) |
|
68 | + if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) |
|
69 | 69 | { |
70 | 70 | include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
71 | 71 | $newobject = new Commande($this->db); |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | $newobject->context['origin'] = $object->element; |
75 | 75 | $newobject->context['origin_id'] = $object->id; |
76 | 76 | |
77 | - $ret=$newobject->createFromProposal($object, $user); |
|
78 | - if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; } |
|
77 | + $ret = $newobject->createFromProposal($object, $user); |
|
78 | + if ($ret < 0) { $this->error = $newobject->error; $this->errors[] = $newobject->error; } |
|
79 | 79 | return $ret; |
80 | 80 | } |
81 | 81 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if ($action == 'ORDER_CLOSE') |
85 | 85 | { |
86 | 86 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
87 | - if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) |
|
87 | + if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) |
|
88 | 88 | { |
89 | 89 | include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
90 | 90 | $newobject = new Facture($this->db); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | $newobject->context['origin'] = $object->element; |
94 | 94 | $newobject->context['origin_id'] = $object->id; |
95 | 95 | |
96 | - $ret=$newobject->createFromOrder($object, $user); |
|
97 | - if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; } |
|
96 | + $ret = $newobject->createFromOrder($object, $user); |
|
97 | + if ($ret < 0) { $this->error = $newobject->error; $this->errors[] = $newobject->error; } |
|
98 | 98 | return $ret; |
99 | 99 | } |
100 | 100 | } |
@@ -102,23 +102,23 @@ discard block |
||
102 | 102 | // Order classify billed proposal |
103 | 103 | if ($action == 'ORDER_CLASSIFY_BILLED') |
104 | 104 | { |
105 | - dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); |
|
106 | - if (! empty($conf->propal->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL)) |
|
105 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
106 | + if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL)) |
|
107 | 107 | { |
108 | - $object->fetchObjectLinked('','propal',$object->id,$object->element); |
|
109 | - if (! empty($object->linkedObjects)) |
|
108 | + $object->fetchObjectLinked('', 'propal', $object->id, $object->element); |
|
109 | + if (!empty($object->linkedObjects)) |
|
110 | 110 | { |
111 | - $totalonlinkedelements=0; |
|
112 | - foreach($object->linkedObjects['propal'] as $element) |
|
111 | + $totalonlinkedelements = 0; |
|
112 | + foreach ($object->linkedObjects['propal'] as $element) |
|
113 | 113 | { |
114 | 114 | if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; |
115 | 115 | } |
116 | - dol_syslog( "Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); |
|
117 | - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) |
|
116 | + dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); |
|
117 | + if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS))) |
|
118 | 118 | { |
119 | - foreach($object->linkedObjects['propal'] as $element) |
|
119 | + foreach ($object->linkedObjects['propal'] as $element) |
|
120 | 120 | { |
121 | - $ret=$element->classifyBilled($user); |
|
121 | + $ret = $element->classifyBilled($user); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
@@ -129,25 +129,25 @@ discard block |
||
129 | 129 | // classify billed order & billed propososal |
130 | 130 | if ($action == 'BILL_VALIDATE') |
131 | 131 | { |
132 | - dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); |
|
132 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
133 | 133 | |
134 | 134 | // First classify billed the order to allow the proposal classify process |
135 | - if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) |
|
135 | + if (!empty($conf->commande->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) |
|
136 | 136 | { |
137 | - $object->fetchObjectLinked('','commande',$object->id,$object->element); |
|
138 | - if (! empty($object->linkedObjects)) |
|
137 | + $object->fetchObjectLinked('', 'commande', $object->id, $object->element); |
|
138 | + if (!empty($object->linkedObjects)) |
|
139 | 139 | { |
140 | - $totalonlinkedelements=0; |
|
141 | - foreach($object->linkedObjects['commande'] as $element) |
|
140 | + $totalonlinkedelements = 0; |
|
141 | + foreach ($object->linkedObjects['commande'] as $element) |
|
142 | 142 | { |
143 | 143 | if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht; |
144 | 144 | } |
145 | - dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); |
|
146 | - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) |
|
145 | + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); |
|
146 | + if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS))) |
|
147 | 147 | { |
148 | - foreach($object->linkedObjects['commande'] as $element) |
|
148 | + foreach ($object->linkedObjects['commande'] as $element) |
|
149 | 149 | { |
150 | - $ret=$element->classifyBilled($user); |
|
150 | + $ret = $element->classifyBilled($user); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
@@ -155,22 +155,22 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | // Second classify billed the proposal. |
158 | - if (! empty($conf->propal->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL)) |
|
158 | + if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL)) |
|
159 | 159 | { |
160 | - $object->fetchObjectLinked('','propal',$object->id,$object->element); |
|
161 | - if (! empty($object->linkedObjects)) |
|
160 | + $object->fetchObjectLinked('', 'propal', $object->id, $object->element); |
|
161 | + if (!empty($object->linkedObjects)) |
|
162 | 162 | { |
163 | - $totalonlinkedelements=0; |
|
164 | - foreach($object->linkedObjects['propal'] as $element) |
|
163 | + $totalonlinkedelements = 0; |
|
164 | + foreach ($object->linkedObjects['propal'] as $element) |
|
165 | 165 | { |
166 | 166 | if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; |
167 | 167 | } |
168 | - dol_syslog( "Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); |
|
169 | - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) |
|
168 | + dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); |
|
169 | + if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS))) |
|
170 | 170 | { |
171 | - foreach($object->linkedObjects['propal'] as $element) |
|
171 | + foreach ($object->linkedObjects['propal'] as $element) |
|
172 | 172 | { |
173 | - $ret=$element->classifyBilled($user); |
|
173 | + $ret = $element->classifyBilled($user); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | } |
@@ -181,25 +181,25 @@ discard block |
||
181 | 181 | // classify billed order & billed propososal |
182 | 182 | if ($action == 'BILL_SUPPLIER_VALIDATE') |
183 | 183 | { |
184 | - dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); |
|
184 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
185 | 185 | |
186 | 186 | // First classify billed the order to allow the proposal classify process |
187 | - if (! empty($conf->fournisseur->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) |
|
187 | + if (!empty($conf->fournisseur->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) |
|
188 | 188 | { |
189 | - $object->fetchObjectLinked('','order_supplier',$object->id,$object->element); |
|
190 | - if (! empty($object->linkedObjects)) |
|
189 | + $object->fetchObjectLinked('', 'order_supplier', $object->id, $object->element); |
|
190 | + if (!empty($object->linkedObjects)) |
|
191 | 191 | { |
192 | - $totalonlinkedelements=0; |
|
193 | - foreach($object->linkedObjects['order_supplier'] as $element) |
|
192 | + $totalonlinkedelements = 0; |
|
193 | + foreach ($object->linkedObjects['order_supplier'] as $element) |
|
194 | 194 | { |
195 | 195 | if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht; |
196 | 196 | } |
197 | - dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); |
|
198 | - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) |
|
197 | + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); |
|
198 | + if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS))) |
|
199 | 199 | { |
200 | - foreach($object->linkedObjects['order_supplier'] as $element) |
|
200 | + foreach ($object->linkedObjects['order_supplier'] as $element) |
|
201 | 201 | { |
202 | - $ret=$element->classifyBilled($user); |
|
202 | + $ret = $element->classifyBilled($user); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | } |
@@ -207,22 +207,22 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | // Second classify billed the proposal. |
210 | - if (! empty($conf->supplier_proposal->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) |
|
210 | + if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) |
|
211 | 211 | { |
212 | - $object->fetchObjectLinked('','supplier_proposal',$object->id,$object->element); |
|
213 | - if (! empty($object->linkedObjects)) |
|
212 | + $object->fetchObjectLinked('', 'supplier_proposal', $object->id, $object->element); |
|
213 | + if (!empty($object->linkedObjects)) |
|
214 | 214 | { |
215 | - $totalonlinkedelements=0; |
|
216 | - foreach($object->linkedObjects['supplier_proposal'] as $element) |
|
215 | + $totalonlinkedelements = 0; |
|
216 | + foreach ($object->linkedObjects['supplier_proposal'] as $element) |
|
217 | 217 | { |
218 | 218 | if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; |
219 | 219 | } |
220 | - dol_syslog( "Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); |
|
221 | - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) |
|
220 | + dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); |
|
221 | + if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS))) |
|
222 | 222 | { |
223 | - foreach($object->linkedObjects['supplier_proposal'] as $element) |
|
223 | + foreach ($object->linkedObjects['supplier_proposal'] as $element) |
|
224 | 224 | { |
225 | - $ret=$element->classifyBilled($user); |
|
225 | + $ret = $element->classifyBilled($user); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | } |
@@ -233,24 +233,24 @@ discard block |
||
233 | 233 | // Invoice classify billed order |
234 | 234 | if ($action == 'BILL_PAYED') |
235 | 235 | { |
236 | - dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); |
|
236 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
237 | 237 | |
238 | - if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) |
|
238 | + if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) |
|
239 | 239 | { |
240 | - $object->fetchObjectLinked('','commande',$object->id,$object->element); |
|
241 | - if (! empty($object->linkedObjects)) |
|
240 | + $object->fetchObjectLinked('', 'commande', $object->id, $object->element); |
|
241 | + if (!empty($object->linkedObjects)) |
|
242 | 242 | { |
243 | - $totalonlinkedelements=0; |
|
244 | - foreach($object->linkedObjects['commande'] as $element) |
|
243 | + $totalonlinkedelements = 0; |
|
244 | + foreach ($object->linkedObjects['commande'] as $element) |
|
245 | 245 | { |
246 | 246 | if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht; |
247 | 247 | } |
248 | - dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); |
|
249 | - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) |
|
248 | + dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); |
|
249 | + if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS))) |
|
250 | 250 | { |
251 | - foreach($object->linkedObjects['commande'] as $element) |
|
251 | + foreach ($object->linkedObjects['commande'] as $element) |
|
252 | 252 | { |
253 | - $ret=$element->classifyBilled($user); |
|
253 | + $ret = $element->classifyBilled($user); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
@@ -258,36 +258,36 @@ discard block |
||
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - if ($action=='SHIPPING_VALIDATE') |
|
261 | + if ($action == 'SHIPPING_VALIDATE') |
|
262 | 262 | { |
263 | - dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); |
|
263 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
264 | 264 | |
265 | - if (! empty($conf->commande->enabled) && ! empty($conf->expedition->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) |
|
265 | + if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) |
|
266 | 266 | { |
267 | - $qtyshipped=array(); |
|
268 | - $qtyordred=array(); |
|
267 | + $qtyshipped = array(); |
|
268 | + $qtyordred = array(); |
|
269 | 269 | require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
270 | 270 | |
271 | 271 | //find all shippement on order origin |
272 | 272 | $order = new Commande($this->db); |
273 | - $ret=$order->fetch($object->origin_id); |
|
274 | - if ($ret<0) { |
|
275 | - $this->error=$order->error; $this->errors=$order->errors; |
|
273 | + $ret = $order->fetch($object->origin_id); |
|
274 | + if ($ret < 0) { |
|
275 | + $this->error = $order->error; $this->errors = $order->errors; |
|
276 | 276 | return $ret; |
277 | 277 | } |
278 | - $ret=$order->fetchObjectLinked($order->id,'commande',null,'shipping'); |
|
279 | - if ($ret<0) { |
|
280 | - $this->error=$order->error; $this->errors=$order->errors; |
|
278 | + $ret = $order->fetchObjectLinked($order->id, 'commande', null, 'shipping'); |
|
279 | + if ($ret < 0) { |
|
280 | + $this->error = $order->error; $this->errors = $order->errors; |
|
281 | 281 | return $ret; |
282 | 282 | } |
283 | 283 | //Build array of quantity shipped by product for an order |
284 | - if (is_array($order->linkedObjects) && count($order->linkedObjects)>0) { |
|
285 | - foreach($order->linkedObjects as $type=>$shipping_array) { |
|
286 | - if ($type=='shipping' && is_array($shipping_array) && count($shipping_array)>0) { |
|
284 | + if (is_array($order->linkedObjects) && count($order->linkedObjects) > 0) { |
|
285 | + foreach ($order->linkedObjects as $type=>$shipping_array) { |
|
286 | + if ($type == 'shipping' && is_array($shipping_array) && count($shipping_array) > 0) { |
|
287 | 287 | foreach ($shipping_array as $shipping) { |
288 | - if (is_array($shipping->lines) && count($shipping->lines)>0) { |
|
289 | - foreach($shipping->lines as $shippingline) { |
|
290 | - $qtyshipped[$shippingline->fk_product]+=$shippingline->qty; |
|
288 | + if (is_array($shipping->lines) && count($shipping->lines) > 0) { |
|
289 | + foreach ($shipping->lines as $shippingline) { |
|
290 | + $qtyshipped[$shippingline->fk_product] += $shippingline->qty; |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | } |
@@ -296,20 +296,20 @@ discard block |
||
296 | 296 | } |
297 | 297 | |
298 | 298 | //Build array of quantity ordered by product |
299 | - if (is_array($order->lines) && count($order->lines)>0) { |
|
300 | - foreach($order->lines as $orderline) { |
|
301 | - $qtyordred[$orderline->fk_product]+=$orderline->qty; |
|
299 | + if (is_array($order->lines) && count($order->lines) > 0) { |
|
300 | + foreach ($order->lines as $orderline) { |
|
301 | + $qtyordred[$orderline->fk_product] += $orderline->qty; |
|
302 | 302 | } |
303 | 303 | } |
304 | 304 | //dol_syslog(var_export($qtyordred,true),LOG_DEBUG); |
305 | 305 | //dol_syslog(var_export($qtyshipped,true),LOG_DEBUG); |
306 | 306 | //Compare array |
307 | - $diff_array=array_diff_assoc($qtyordred,$qtyshipped); |
|
308 | - if (count($diff_array)==0) { |
|
307 | + $diff_array = array_diff_assoc($qtyordred, $qtyshipped); |
|
308 | + if (count($diff_array) == 0) { |
|
309 | 309 | //No diff => mean everythings is shipped |
310 | - $ret=$object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin); |
|
311 | - if ($ret<0) { |
|
312 | - $this->error=$object->error; $this->errors=$object->errors; |
|
310 | + $ret = $object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin); |
|
311 | + if ($ret < 0) { |
|
312 | + $this->error = $object->error; $this->errors = $object->errors; |
|
313 | 313 | return $ret; |
314 | 314 | } |
315 | 315 | } |
@@ -320,22 +320,22 @@ discard block |
||
320 | 320 | { |
321 | 321 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG); |
322 | 322 | |
323 | - if (! empty($conf->reception->enabled) && ! empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) |
|
323 | + if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) |
|
324 | 324 | { |
325 | - $object->fetchObjectLinked('','reception',$object->id,$object->element); |
|
326 | - if (! empty($object->linkedObjects)) |
|
325 | + $object->fetchObjectLinked('', 'reception', $object->id, $object->element); |
|
326 | + if (!empty($object->linkedObjects)) |
|
327 | 327 | { |
328 | - $totalonlinkedelements=0; |
|
329 | - foreach($object->linkedObjects['reception'] as $element) |
|
328 | + $totalonlinkedelements = 0; |
|
329 | + foreach ($object->linkedObjects['reception'] as $element) |
|
330 | 330 | { |
331 | 331 | if ($element->statut == Reception::STATUS_VALIDATED) $totalonlinkedelements += $element->total_ht; |
332 | 332 | } |
333 | 333 | dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); |
334 | 334 | if ($totalonlinkedelements == $object->total_ht) |
335 | 335 | { |
336 | - foreach($object->linkedObjects['reception'] as $element) |
|
336 | + foreach ($object->linkedObjects['reception'] as $element) |
|
337 | 337 | { |
338 | - $ret=$element->set_billed(); |
|
338 | + $ret = $element->set_billed(); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $arraycontext = array($arraycontext); |
75 | 75 | } |
76 | 76 | |
77 | - $this->contextarray = array_unique(array_merge($arraycontext, $this->contextarray)); // All contexts are concatenated |
|
77 | + $this->contextarray = array_unique(array_merge($arraycontext, $this->contextarray)); // All contexts are concatenated |
|
78 | 78 | |
79 | 79 | foreach (Globals::$conf->modules_parts['hooks'] as $module => $hooks) { // Loop on each module that brings hooks |
80 | 80 | if (empty(Globals::$conf->$module->enabled)) { |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | //dol_syslog(get_class($this).'::initHooks module='.$module.' arraycontext='.join(',',$arraycontext)); |
85 | 85 | foreach ($arraycontext as $context) { |
86 | 86 | if (is_array($hooks)) { |
87 | - $arrayhooks = $hooks; // New system |
|
87 | + $arrayhooks = $hooks; // New system |
|
88 | 88 | } else { |
89 | - $arrayhooks = explode(':', $hooks); // Old system (for backward compatibility) |
|
89 | + $arrayhooks = explode(':', $hooks); // Old system (for backward compatibility) |
|
90 | 90 | } |
91 | 91 | if (in_array($context, $arrayhooks) || in_array('all', $arrayhooks)) { // We instantiate action class only if initialized hook is handled by module |
92 | 92 | // Include actions class overwriting hooks |
93 | 93 | if (!is_object($this->hooks[$context][$module])) { // If set, class was already loaded |
94 | - $path = '/' . $module . '/class/'; |
|
95 | - $actionfile = 'actions_' . $module . '.class.php'; |
|
94 | + $path = '/'.$module.'/class/'; |
|
95 | + $actionfile = 'actions_'.$module.'.class.php'; |
|
96 | 96 | |
97 | - dol_syslog(get_class($this) . '::initHooks Loading hook class for context ' . $context . ": " . $actionfile, LOG_INFO); |
|
98 | - $resaction = dol_include_once($path . $actionfile); |
|
97 | + dol_syslog(get_class($this).'::initHooks Loading hook class for context '.$context.": ".$actionfile, LOG_INFO); |
|
98 | + $resaction = dol_include_once($path.$actionfile); |
|
99 | 99 | if ($resaction) { |
100 | - $controlclassname = 'Actions' . ucfirst($module); |
|
100 | + $controlclassname = 'Actions'.ucfirst($module); |
|
101 | 101 | $actionInstance = new $controlclassname($this->db); |
102 | 102 | $this->hooks[$context][$module] = $actionInstance; |
103 | 103 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $actionclassinstance->error = 0; |
221 | 221 | $actionclassinstance->errors = array(); |
222 | 222 | |
223 | - dol_syslog(get_class($this) . "::executeHooks Qualified hook found (hooktype=" . $hooktype . "). We call method " . $method . " of class " . get_class($actionclassinstance) . ", module=" . $module . ", action=" . $action . " context=" . $context, LOG_DEBUG); |
|
223 | + dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", action=".$action." context=".$context, LOG_DEBUG); |
|
224 | 224 | |
225 | 225 | // Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return; |
226 | 226 | $parameters['currentcontext'] = $context; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $error++; |
232 | 232 | $this->error = $actionclassinstance->error; |
233 | 233 | $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); |
234 | - dol_syslog("Error on hook module=" . $module . ", method " . $method . ", class " . get_class($actionclassinstance) . ", hooktype=" . $hooktype . (empty($this->error) ? '' : " " . $this->error) . (empty($this->errors) ? '' : " " . join(",", $this->errors)), LOG_ERR); |
|
234 | + dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $this->resPrint .= $actionclassinstance->resprints; |
255 | 255 | // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string |
256 | 256 | if (!is_array($resaction) && !is_numeric($resaction)) { |
257 | - dol_syslog('Error: Bug into hook ' . $method . ' of module class ' . get_class($actionclassinstance) . '. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR); |
|
257 | + dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR); |
|
258 | 258 | if (empty($actionclassinstance->resprints)) { |
259 | 259 | $this->resPrint .= $resaction; |
260 | 260 | $resaction = 0; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | if ($elementtype == 'contact') |
228 | 228 | $elementtype = 'socpeople'; |
229 | 229 | |
230 | - $table = $elementtype . '_extrafields'; |
|
230 | + $table = $elementtype.'_extrafields'; |
|
231 | 231 | if ($elementtype == 'categorie') |
232 | 232 | $table = 'categories_extrafields'; |
233 | 233 | |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | 'default' => $default_value |
273 | 273 | ); |
274 | 274 | |
275 | - $result = Config::$dbEngine->DDLAddField(MAIN_DB_PREFIX . $table, $attrname, $field_desc); |
|
275 | + $result = Config::$dbEngine->DDLAddField(MAIN_DB_PREFIX.$table, $attrname, $field_desc); |
|
276 | 276 | if ($result > 0) { |
277 | 277 | if ($unique) { |
278 | - $sql = "ALTER TABLE " . MAIN_DB_PREFIX . $table . " ADD UNIQUE INDEX uk_" . $table . "_" . $attrname . " (" . $attrname . ")"; |
|
278 | + $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")"; |
|
279 | 279 | $resql = Config::$dbEngine->query($sql, 1, 'dml'); |
280 | 280 | } |
281 | 281 | return 1; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $params = ''; |
345 | 345 | } |
346 | 346 | |
347 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "extrafields("; |
|
347 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; |
|
348 | 348 | $sql .= " name,"; |
349 | 349 | $sql .= " label,"; |
350 | 350 | $sql .= " type,"; |
@@ -367,30 +367,30 @@ discard block |
||
367 | 367 | $sql .= " enabled,"; |
368 | 368 | $sql .= " help"; |
369 | 369 | $sql .= " )"; |
370 | - $sql .= " VALUES('" . $attrname . "',"; |
|
371 | - $sql .= " '" . Config::$dbEngine->escape($label) . "',"; |
|
372 | - $sql .= " '" . Config::$dbEngine->escape($type) . "',"; |
|
373 | - $sql .= " " . $pos . ","; |
|
374 | - $sql .= " '" . Config::$dbEngine->escape($size) . "',"; |
|
375 | - $sql .= " " . ($entity === '' ? Globals::$conf->entity : $entity) . ","; |
|
376 | - $sql .= " '" . Config::$dbEngine->escape($elementtype) . "',"; |
|
377 | - $sql .= " " . $unique . ","; |
|
378 | - $sql .= " " . $required . ","; |
|
379 | - $sql .= " '" . Config::$dbEngine->escape($params) . "',"; |
|
380 | - $sql .= " " . $alwayseditable . ","; |
|
381 | - $sql .= " " . ($perms ? "'" . Config::$dbEngine->escape($perms) . "'" : "null") . ","; |
|
382 | - $sql .= " " . ($langfile ? "'" . Config::$dbEngine->escape($langfile) . "'" : "null") . ","; |
|
383 | - $sql .= " '" . Config::$dbEngine->escape($list) . "',"; |
|
384 | - $sql .= " " . ($default ? "'" . Config::$dbEngine->escape($default) . "'" : "null") . ","; |
|
385 | - $sql .= " " . ($computed ? "'" . Config::$dbEngine->escape($computed) . "'" : "null") . ","; |
|
386 | - $sql .= " " . (is_object(Globals::$user) ? Globals::$user->id : 0) . ","; |
|
387 | - $sql .= " " . (is_object(Globals::$user) ? Globals::$user->id : 0) . ","; |
|
388 | - $sql .= "'" . Config::$dbEngine->idate(dol_now()) . "',"; |
|
389 | - $sql .= " " . ($enabled ? "'" . Config::$dbEngine->escape($enabled) . "'" : "1") . ","; |
|
390 | - $sql .= " " . ($help ? "'" . Config::$dbEngine->escape($help) . "'" : "null"); |
|
370 | + $sql .= " VALUES('".$attrname."',"; |
|
371 | + $sql .= " '".Config::$dbEngine->escape($label)."',"; |
|
372 | + $sql .= " '".Config::$dbEngine->escape($type)."',"; |
|
373 | + $sql .= " ".$pos.","; |
|
374 | + $sql .= " '".Config::$dbEngine->escape($size)."',"; |
|
375 | + $sql .= " ".($entity === '' ? Globals::$conf->entity : $entity).","; |
|
376 | + $sql .= " '".Config::$dbEngine->escape($elementtype)."',"; |
|
377 | + $sql .= " ".$unique.","; |
|
378 | + $sql .= " ".$required.","; |
|
379 | + $sql .= " '".Config::$dbEngine->escape($params)."',"; |
|
380 | + $sql .= " ".$alwayseditable.","; |
|
381 | + $sql .= " ".($perms ? "'".Config::$dbEngine->escape($perms)."'" : "null").","; |
|
382 | + $sql .= " ".($langfile ? "'".Config::$dbEngine->escape($langfile)."'" : "null").","; |
|
383 | + $sql .= " '".Config::$dbEngine->escape($list)."',"; |
|
384 | + $sql .= " ".($default ? "'".Config::$dbEngine->escape($default)."'" : "null").","; |
|
385 | + $sql .= " ".($computed ? "'".Config::$dbEngine->escape($computed)."'" : "null").","; |
|
386 | + $sql .= " ".(is_object(Globals::$user) ? Globals::$user->id : 0).","; |
|
387 | + $sql .= " ".(is_object(Globals::$user) ? Globals::$user->id : 0).","; |
|
388 | + $sql .= "'".Config::$dbEngine->idate(dol_now())."',"; |
|
389 | + $sql .= " ".($enabled ? "'".Config::$dbEngine->escape($enabled)."'" : "1").","; |
|
390 | + $sql .= " ".($help ? "'".Config::$dbEngine->escape($help)."'" : "null"); |
|
391 | 391 | $sql .= ')'; |
392 | 392 | |
393 | - DolUtils::dol_syslog(get_class($this) . "::create_label", LOG_DEBUG); |
|
393 | + DolUtils::dol_syslog(get_class($this)."::create_label", LOG_DEBUG); |
|
394 | 394 | if (Config::$dbEngine->query($sql)) { |
395 | 395 | return 1; |
396 | 396 | } else { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | if ($elementtype == 'contact') |
416 | 416 | $elementtype = 'socpeople'; |
417 | 417 | |
418 | - $table = $elementtype . '_extrafields'; |
|
418 | + $table = $elementtype.'_extrafields'; |
|
419 | 419 | if ($elementtype == 'categorie') |
420 | 420 | $table = 'categories_extrafields'; |
421 | 421 | |
@@ -430,15 +430,15 @@ discard block |
||
430 | 430 | |
431 | 431 | if (!$error) { |
432 | 432 | $sql = "SELECT COUNT(rowid) as nb"; |
433 | - $sql .= " FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
434 | - $sql .= " WHERE elementtype = '" . $elementtype . "'"; |
|
435 | - $sql .= " AND name = '" . $attrname . "'"; |
|
433 | + $sql .= " FROM ".MAIN_DB_PREFIX."extrafields"; |
|
434 | + $sql .= " WHERE elementtype = '".$elementtype."'"; |
|
435 | + $sql .= " AND name = '".$attrname."'"; |
|
436 | 436 | //$sql.= " AND entity IN (0,".Globals::$conf->entity.")"; Do not test on entity here. We want to see if there is still on field remaning in other entities before deleting field in table |
437 | 437 | $resql = Config::$dbEngine->query($sql); |
438 | 438 | if ($resql) { |
439 | 439 | $obj = Config::$dbEngine->fetch_object($resql); |
440 | 440 | if ($obj->nb <= 0) { |
441 | - $result = Config::$dbEngine->DDLDropField(MAIN_DB_PREFIX . $table, $attrname); // This also drop the unique key |
|
441 | + $result = Config::$dbEngine->DDLDropField(MAIN_DB_PREFIX.$table, $attrname); // This also drop the unique key |
|
442 | 442 | if ($result < 0) { |
443 | 443 | $this->error = Config::$dbEngine->lasterror(); |
444 | 444 | $error++; |
@@ -472,12 +472,12 @@ discard block |
||
472 | 472 | $elementtype = 'socpeople'; |
473 | 473 | |
474 | 474 | if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname)) { |
475 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
476 | - $sql .= " WHERE name = '" . $attrname . "'"; |
|
477 | - $sql .= " AND entity IN (0," . Globals::$conf->entity . ')'; |
|
478 | - $sql .= " AND elementtype = '" . $elementtype . "'"; |
|
475 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; |
|
476 | + $sql .= " WHERE name = '".$attrname."'"; |
|
477 | + $sql .= " AND entity IN (0,".Globals::$conf->entity.')'; |
|
478 | + $sql .= " AND elementtype = '".$elementtype."'"; |
|
479 | 479 | |
480 | - DolUtils::dol_syslog(get_class($this) . "::delete_label", LOG_DEBUG); |
|
480 | + DolUtils::dol_syslog(get_class($this)."::delete_label", LOG_DEBUG); |
|
481 | 481 | $resql = Config::$dbEngine->query($sql); |
482 | 482 | if ($resql) { |
483 | 483 | return 1; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | if ($elementtype == 'contact') |
522 | 522 | $elementtype = 'socpeople'; |
523 | 523 | |
524 | - $table = $elementtype . '_extrafields'; |
|
524 | + $table = $elementtype.'_extrafields'; |
|
525 | 525 | if ($elementtype == 'categorie') |
526 | 526 | $table = 'categories_extrafields'; |
527 | 527 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | $field_desc = array('type' => $typedb, 'value' => $lengthdb, 'null' => ($required ? 'NOT NULL' : 'NULL'), 'default' => $default); |
560 | 560 | |
561 | 561 | if ($type != 'separate') { // No table update when separate type |
562 | - $result = Config::$dbEngine->DDLUpdateField(MAIN_DB_PREFIX . $table, $attrname, $field_desc); |
|
562 | + $result = Config::$dbEngine->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc); |
|
563 | 563 | } |
564 | 564 | if ($result > 0 || $type == 'separate') { |
565 | 565 | if ($label) { |
@@ -568,11 +568,11 @@ discard block |
||
568 | 568 | if ($result > 0) { |
569 | 569 | $sql = ''; |
570 | 570 | if ($unique) { |
571 | - $sql = "ALTER TABLE " . MAIN_DB_PREFIX . $table . " ADD UNIQUE INDEX uk_" . $table . "_" . $attrname . " (" . $attrname . ")"; |
|
571 | + $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")"; |
|
572 | 572 | } else { |
573 | - $sql = "ALTER TABLE " . MAIN_DB_PREFIX . $table . " DROP INDEX uk_" . $table . "_" . $attrname; |
|
573 | + $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname; |
|
574 | 574 | } |
575 | - DolUtils::dol_syslog(get_class($this) . '::update', LOG_DEBUG); |
|
575 | + DolUtils::dol_syslog(get_class($this).'::update', LOG_DEBUG); |
|
576 | 576 | $resql = Config::$dbEngine->query($sql, 1, 'dml'); |
577 | 577 | return 1; |
578 | 578 | } else { |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | { |
618 | 618 | // phpcs:enable |
619 | 619 | // global $conf, $user; |
620 | - DolUtils::dol_syslog(get_class($this) . "::update_label " . $attrname . ", " . $label . ", " . $type . ", " . $size . ", " . $elementtype . ", " . $unique . ", " . $required . ", " . $pos . ", " . $alwayseditable . ", " . $perms . ", " . $list . ", " . $default . ", " . $computed . ", " . $entity . ", " . $langfile . ", " . $enabled . ", " . $totalizable); |
|
620 | + DolUtils::dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable); |
|
621 | 621 | |
622 | 622 | // Clean parameters |
623 | 623 | if ($elementtype == 'thirdparty') |
@@ -652,21 +652,21 @@ discard block |
||
652 | 652 | |
653 | 653 | if ($entity === '' || $entity != '0') { |
654 | 654 | // We dont want on all entities, we delete all and current |
655 | - $sql_del = "DELETE FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
656 | - $sql_del .= " WHERE name = '" . $attrname . "'"; |
|
657 | - $sql_del .= " AND entity IN (0, " . ($entity === '' ? Globals::$conf->entity : $entity) . ")"; |
|
658 | - $sql_del .= " AND elementtype = '" . $elementtype . "'"; |
|
655 | + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; |
|
656 | + $sql_del .= " WHERE name = '".$attrname."'"; |
|
657 | + $sql_del .= " AND entity IN (0, ".($entity === '' ? Globals::$conf->entity : $entity).")"; |
|
658 | + $sql_del .= " AND elementtype = '".$elementtype."'"; |
|
659 | 659 | } else { |
660 | 660 | // We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity) |
661 | - $sql_del = "DELETE FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
662 | - $sql_del .= " WHERE name = '" . $attrname . "'"; |
|
661 | + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; |
|
662 | + $sql_del .= " WHERE name = '".$attrname."'"; |
|
663 | 663 | $sql_del .= " AND entity = 0"; |
664 | - $sql_del .= " AND elementtype = '" . $elementtype . "'"; |
|
664 | + $sql_del .= " AND elementtype = '".$elementtype."'"; |
|
665 | 665 | } |
666 | 666 | $resql1 = Config::$dbEngine->query($sql_del); |
667 | 667 | |
668 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "extrafields("; |
|
669 | - $sql .= " name,"; // This is code |
|
668 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; |
|
669 | + $sql .= " name,"; // This is code |
|
670 | 670 | $sql .= " entity,"; |
671 | 671 | $sql .= " label,"; |
672 | 672 | $sql .= " type,"; |
@@ -689,28 +689,28 @@ discard block |
||
689 | 689 | $sql .= " enabled,"; |
690 | 690 | $sql .= " help"; |
691 | 691 | $sql .= ") VALUES ("; |
692 | - $sql .= "'" . $attrname . "',"; |
|
693 | - $sql .= " " . ($entity === '' ? Globals::$conf->entity : $entity) . ","; |
|
694 | - $sql .= " '" . Config::$dbEngine->escape($label) . "',"; |
|
695 | - $sql .= " '" . Config::$dbEngine->escape($type) . "',"; |
|
696 | - $sql .= " '" . Config::$dbEngine->escape($size) . "',"; |
|
697 | - $sql .= " '" . Config::$dbEngine->escape($elementtype) . "',"; |
|
698 | - $sql .= " " . $unique . ","; |
|
699 | - $sql .= " " . $required . ","; |
|
700 | - $sql .= " " . ($perms ? "'" . Config::$dbEngine->escape($perms) . "'" : "null") . ","; |
|
701 | - $sql .= " " . ($langfile ? "'" . Config::$dbEngine->escape($langfile) . "'" : "null") . ","; |
|
702 | - $sql .= " " . $pos . ","; |
|
703 | - $sql .= " '" . Config::$dbEngine->escape($alwayseditable) . "',"; |
|
704 | - $sql .= " '" . Config::$dbEngine->escape($params) . "',"; |
|
705 | - $sql .= " '" . Config::$dbEngine->escape($list) . "', "; |
|
706 | - $sql .= " " . $totalizable . ","; |
|
707 | - $sql .= " " . (($default != '') ? "'" . Config::$dbEngine->escape($default) . "'" : "null") . ","; |
|
708 | - $sql .= " " . ($computed ? "'" . Config::$dbEngine->escape($computed) . "'" : "null") . ","; |
|
709 | - $sql .= " " . Globals::$user->id . ","; |
|
710 | - $sql .= " " . Globals::$user->id . ","; |
|
711 | - $sql .= "'" . Config::$dbEngine->idate(dol_now()) . "',"; |
|
712 | - $sql .= "'" . Config::$dbEngine->escape($enabled) . "',"; |
|
713 | - $sql .= " " . ($help ? "'" . Config::$dbEngine->escape($help) . "'" : "null"); |
|
692 | + $sql .= "'".$attrname."',"; |
|
693 | + $sql .= " ".($entity === '' ? Globals::$conf->entity : $entity).","; |
|
694 | + $sql .= " '".Config::$dbEngine->escape($label)."',"; |
|
695 | + $sql .= " '".Config::$dbEngine->escape($type)."',"; |
|
696 | + $sql .= " '".Config::$dbEngine->escape($size)."',"; |
|
697 | + $sql .= " '".Config::$dbEngine->escape($elementtype)."',"; |
|
698 | + $sql .= " ".$unique.","; |
|
699 | + $sql .= " ".$required.","; |
|
700 | + $sql .= " ".($perms ? "'".Config::$dbEngine->escape($perms)."'" : "null").","; |
|
701 | + $sql .= " ".($langfile ? "'".Config::$dbEngine->escape($langfile)."'" : "null").","; |
|
702 | + $sql .= " ".$pos.","; |
|
703 | + $sql .= " '".Config::$dbEngine->escape($alwayseditable)."',"; |
|
704 | + $sql .= " '".Config::$dbEngine->escape($params)."',"; |
|
705 | + $sql .= " '".Config::$dbEngine->escape($list)."', "; |
|
706 | + $sql .= " ".$totalizable.","; |
|
707 | + $sql .= " ".(($default != '') ? "'".Config::$dbEngine->escape($default)."'" : "null").","; |
|
708 | + $sql .= " ".($computed ? "'".Config::$dbEngine->escape($computed)."'" : "null").","; |
|
709 | + $sql .= " ".Globals::$user->id.","; |
|
710 | + $sql .= " ".Globals::$user->id.","; |
|
711 | + $sql .= "'".Config::$dbEngine->idate(dol_now())."',"; |
|
712 | + $sql .= "'".Config::$dbEngine->escape($enabled)."',"; |
|
713 | + $sql .= " ".($help ? "'".Config::$dbEngine->escape($help)."'" : "null"); |
|
714 | 714 | $sql .= ")"; |
715 | 715 | |
716 | 716 | $resql2 = Config::$dbEngine->query($sql); |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | // TODO Remove completely loading of label. This should be done by presentation. |
762 | 762 | $labelmulticompany = array(); |
763 | 763 | if (!empty(Globals::$conf->multicompany->enabled)) { |
764 | - $sql_entity_name = 'SELECT rowid, label FROM ' . MAIN_DB_PREFIX . 'entity WHERE rowid in (0,' . Globals::$conf->entity . ')'; |
|
764 | + $sql_entity_name = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid in (0,'.Globals::$conf->entity.')'; |
|
765 | 765 | $resql_entity_name = Config::$dbEngine->query($sql_entity_name); |
766 | 766 | if ($resql_entity_name) { |
767 | 767 | while ($obj = Config::$dbEngine->fetch_object($resql_entity_name)) { |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | } |
772 | 772 | |
773 | 773 | // We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management. |
774 | - DolUtils::dol_syslog("fetch_name_optionals_label elementtype=" . $elementtype); |
|
774 | + DolUtils::dol_syslog("fetch_name_optionals_label elementtype=".$elementtype); |
|
775 | 775 | |
776 | 776 | $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help"; |
777 | - $sql .= " FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
778 | - $sql .= " WHERE entity IN (0," . Globals::$conf->entity . ")"; |
|
777 | + $sql .= " FROM ".MAIN_DB_PREFIX."extrafields"; |
|
778 | + $sql .= " WHERE entity IN (0,".Globals::$conf->entity.")"; |
|
779 | 779 | if ($elementtype) |
780 | - $sql .= " AND elementtype = '" . $elementtype . "'"; // Filed with object->table_element |
|
780 | + $sql .= " AND elementtype = '".$elementtype."'"; // Filed with object->table_element |
|
781 | 781 | $sql .= " ORDER BY pos"; |
782 | 782 | |
783 | 783 | $resql = Config::$dbEngine->select($sql); |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $this->attribute_list[$tab->name] = $tab->list; |
810 | 810 | $this->attribute_totalizable[$tab->name] = $tab->totalizable; |
811 | 811 | $this->attribute_entityid[$tab->name] = $tab->entity; |
812 | - $this->attribute_entitylabel[$tab->name] = (empty($labelmulticompany[$tab->entity]) ? 'Entity' . $tab->entity : $labelmulticompany[$tab->entity]); |
|
812 | + $this->attribute_entitylabel[$tab->name] = (empty($labelmulticompany[$tab->entity]) ? 'Entity'.$tab->entity : $labelmulticompany[$tab->entity]); |
|
813 | 813 | |
814 | 814 | // New usage |
815 | 815 | $this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type; |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | $this->attributes[$tab->elementtype]['list'][$tab->name] = $tab->list; |
829 | 829 | $this->attributes[$tab->elementtype]['totalizable'][$tab->name] = $tab->totalizable; |
830 | 830 | $this->attributes[$tab->elementtype]['entityid'][$tab->name] = $tab->entity; |
831 | - $this->attributes[$tab->elementtype]['entitylabel'][$tab->name] = (empty($labelmulticompany[$tab->entity]) ? 'Entity' . $tab->entity : $labelmulticompany[$tab->entity]); |
|
831 | + $this->attributes[$tab->elementtype]['entitylabel'][$tab->name] = (empty($labelmulticompany[$tab->entity]) ? 'Entity'.$tab->entity : $labelmulticompany[$tab->entity]); |
|
832 | 832 | $this->attributes[$tab->elementtype]['enabled'][$tab->name] = $tab->enabled; |
833 | 833 | $this->attributes[$tab->elementtype]['help'][$tab->name] = $tab->help; |
834 | 834 | } |
@@ -861,13 +861,13 @@ discard block |
||
861 | 861 | // global $conf, $langs, $form; |
862 | 862 | |
863 | 863 | if (!is_object($form)) { |
864 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; |
|
864 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; |
|
865 | 865 | $form = new Form(Config::$dbEngine); |
866 | 866 | } |
867 | 867 | |
868 | 868 | $out = ''; |
869 | 869 | |
870 | - $keyprefix = $keyprefix . 'options_'; // Because we work on extrafields |
|
870 | + $keyprefix = $keyprefix.'options_'; // Because we work on extrafields |
|
871 | 871 | |
872 | 872 | if (!empty($extrafieldsobjectkey)) { |
873 | 873 | $label = $this->attributes[$extrafieldsobjectkey]['label'][$key]; |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); |
884 | 884 | $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; |
885 | 885 | $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; |
886 | - $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
886 | + $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
887 | 887 | } else { // Old usage |
888 | 888 | $label = $this->attribute_label[$key]; |
889 | 889 | $type = $this->attribute_type[$key]; |
@@ -897,12 +897,12 @@ discard block |
||
897 | 897 | $langfile = $this->attribute_langfile[$key]; |
898 | 898 | $list = $this->attribute_list[$key]; |
899 | 899 | $totalizable = $this->attribute_totalizable[$key]; |
900 | - $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
900 | + $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
901 | 901 | } |
902 | 902 | |
903 | 903 | if ($computed) { |
904 | 904 | if (!preg_match('/^search_/', $keyprefix)) |
905 | - return '<span class="opacitymedium">' . Globals::$langs->trans("AutomaticallyCalculated") . '</span>'; |
|
905 | + return '<span class="opacitymedium">'.Globals::$langs->trans("AutomaticallyCalculated").'</span>'; |
|
906 | 906 | else |
907 | 907 | return ''; |
908 | 908 | } |
@@ -942,31 +942,31 @@ discard block |
||
942 | 942 | $value = '-1'; |
943 | 943 | |
944 | 944 | // TODO Must also support $moreparam |
945 | - $out = $form->selectDate($value, $keyprefix . $key . $keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); |
|
945 | + $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); |
|
946 | 946 | } |
947 | 947 | elseif (in_array($type, array('int', 'integer'))) { |
948 | 948 | $tmp = explode(',', $size); |
949 | 949 | $newsize = $tmp[0]; |
950 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" maxlength="' . $newsize . '" value="' . dol_escape_htmltag($value) . '"' . ($moreparam ? $moreparam : '') . '>'; |
|
950 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').'>'; |
|
951 | 951 | } elseif (preg_match('/varchar/', $type)) { |
952 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" maxlength="' . $size . '" value="' . dol_escape_htmltag($value) . '"' . ($moreparam ? $moreparam : '') . '>'; |
|
952 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').'>'; |
|
953 | 953 | } elseif (in_array($type, array('mail', 'phone', 'url'))) { |
954 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
954 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>'; |
|
955 | 955 | } elseif ($type == 'text') { |
956 | 956 | if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field |
957 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
958 | - $doleditor = new DolEditor($keyprefix . $key . $keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); |
|
957 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
958 | + $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); |
|
959 | 959 | $out = $doleditor->Create(1); |
960 | 960 | } else { |
961 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
961 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>'; |
|
962 | 962 | } |
963 | 963 | } elseif ($type == 'html') { |
964 | 964 | if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field |
965 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
966 | - $doleditor = new DolEditor($keyprefix . $key . $keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty(Globals::$conf->fckeditor->enabled) && Globals::$conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); |
|
965 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
966 | + $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty(Globals::$conf->fckeditor->enabled) && Globals::$conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); |
|
967 | 967 | $out = $doleditor->Create(1); |
968 | 968 | } else { |
969 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
969 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>'; |
|
970 | 970 | } |
971 | 971 | } elseif ($type == 'boolean') { |
972 | 972 | $checked = ''; |
@@ -975,33 +975,33 @@ discard block |
||
975 | 975 | } else { |
976 | 976 | $checked = ' value="1" '; |
977 | 977 | } |
978 | - $out = '<input type="checkbox" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . $checked . ' ' . ($moreparam ? $moreparam : '') . '>'; |
|
978 | + $out = '<input type="checkbox" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>'; |
|
979 | 979 | } elseif ($type == 'price') { |
980 | 980 | if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. |
981 | 981 | $value = price($value); |
982 | 982 | } |
983 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . $value . '" ' . ($moreparam ? $moreparam : '') . '> ' . Globals::$langs->getCurrencySymbol(Globals::$conf->currency); |
|
983 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> '.Globals::$langs->getCurrencySymbol(Globals::$conf->currency); |
|
984 | 984 | } elseif ($type == 'double') { |
985 | 985 | if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. |
986 | 986 | $value = price($value); |
987 | 987 | } |
988 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . $value . '" ' . ($moreparam ? $moreparam : '') . '> '; |
|
988 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> '; |
|
989 | 989 | } elseif ($type == 'select') { |
990 | 990 | $out = ''; |
991 | 991 | if (!empty(Globals::$conf->use_javascript_ajax) && !empty(Globals::$conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) { |
992 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
993 | - $out .= ajax_combobox($keyprefix . $key . $keysuffix, array(), 0); |
|
992 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
993 | + $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); |
|
994 | 994 | } |
995 | 995 | |
996 | - $out .= '<select class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
996 | + $out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>'; |
|
997 | 997 | $out .= '<option value="0"> </option>'; |
998 | 998 | foreach ($param['options'] as $key => $val) { |
999 | 999 | if ((string) $key == '') |
1000 | 1000 | continue; |
1001 | 1001 | list($val, $parent) = explode('|', $val); |
1002 | - $out .= '<option value="' . $key . '"'; |
|
1002 | + $out .= '<option value="'.$key.'"'; |
|
1003 | 1003 | $out .= (((string) $value == (string) $key) ? ' selected' : ''); |
1004 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
1004 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
1005 | 1005 | $out .= '>'; |
1006 | 1006 | if ($langfile && $val) |
1007 | 1007 | $out .= Globals::$langs->trans($val); |
@@ -1014,11 +1014,11 @@ discard block |
||
1014 | 1014 | elseif ($type == 'sellist') { |
1015 | 1015 | $out = ''; |
1016 | 1016 | if (!empty(Globals::$conf->use_javascript_ajax) && !empty(Globals::$conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) { |
1017 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1018 | - $out .= ajax_combobox($keyprefix . $key . $keysuffix, array(), 0); |
|
1017 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1018 | + $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | - $out .= '<select class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
1021 | + $out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>'; |
|
1022 | 1022 | if (is_array($param['options'])) { |
1023 | 1023 | $param_list = array_keys($param['options']); |
1024 | 1024 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -1029,19 +1029,19 @@ discard block |
||
1029 | 1029 | // 2 : key fields name (if differ of rowid) |
1030 | 1030 | // 3 : key field parent (for dependent lists) |
1031 | 1031 | // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value |
1032 | - $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid'); |
|
1032 | + $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); |
|
1033 | 1033 | |
1034 | 1034 | |
1035 | 1035 | if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) { |
1036 | 1036 | if (strpos($InfoFieldList[4], 'extra.') !== false) { |
1037 | - $keyList = 'main.' . $InfoFieldList[2] . ' as rowid'; |
|
1037 | + $keyList = 'main.'.$InfoFieldList[2].' as rowid'; |
|
1038 | 1038 | } else { |
1039 | - $keyList = $InfoFieldList[2] . ' as rowid'; |
|
1039 | + $keyList = $InfoFieldList[2].' as rowid'; |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { |
1043 | 1043 | list($parentName, $parentField) = explode('|', $InfoFieldList[3]); |
1044 | - $keyList .= ', ' . $parentField; |
|
1044 | + $keyList .= ', '.$parentField; |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | $fields_label = explode('|', $InfoFieldList[1]); |
@@ -1051,8 +1051,8 @@ discard block |
||
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | $sqlwhere = ''; |
1054 | - $sql = 'SELECT ' . $keyList; |
|
1055 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; |
|
1054 | + $sql = 'SELECT '.$keyList; |
|
1055 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; |
|
1056 | 1056 | if (!empty($InfoFieldList[4])) { |
1057 | 1057 | // can use curent entity filter |
1058 | 1058 | if (strpos($InfoFieldList[4], '$ENTITY$') !== false) { |
@@ -1071,24 +1071,24 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | //We have to join on extrafield table |
1073 | 1073 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
1074 | - $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; |
|
1075 | - $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4]; |
|
1074 | + $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra'; |
|
1075 | + $sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4]; |
|
1076 | 1076 | } else { |
1077 | - $sqlwhere .= ' WHERE ' . $InfoFieldList[4]; |
|
1077 | + $sqlwhere .= ' WHERE '.$InfoFieldList[4]; |
|
1078 | 1078 | } |
1079 | 1079 | } else { |
1080 | 1080 | $sqlwhere .= ' WHERE 1=1'; |
1081 | 1081 | } |
1082 | 1082 | // Some tables may have field, some other not. For the moment we disable it. |
1083 | 1083 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
1084 | - $sqlwhere .= ' AND entity = ' . Globals::$conf->entity; |
|
1084 | + $sqlwhere .= ' AND entity = '.Globals::$conf->entity; |
|
1085 | 1085 | } |
1086 | 1086 | $sql .= $sqlwhere; |
1087 | 1087 | //print $sql; |
1088 | 1088 | |
1089 | - $sql .= ' ORDER BY ' . implode(', ', $fields_label); |
|
1089 | + $sql .= ' ORDER BY '.implode(', ', $fields_label); |
|
1090 | 1090 | |
1091 | - DolUtils::dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
1091 | + DolUtils::dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
1092 | 1092 | $resql = Config::$dbEngine->query($sql); |
1093 | 1093 | if ($resql) { |
1094 | 1094 | $out .= '<option value="0"> </option>'; |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | if (is_array($fields_label)) { |
1105 | 1105 | $notrans = true; |
1106 | 1106 | foreach ($fields_label as $field_toshow) { |
1107 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
1107 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
1108 | 1108 | } |
1109 | 1109 | } else { |
1110 | 1110 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -1115,12 +1115,12 @@ discard block |
||
1115 | 1115 | foreach ($fields_label as $field_toshow) { |
1116 | 1116 | $translabel = Globals::$langs->trans($obj->$field_toshow); |
1117 | 1117 | if ($translabel != $obj->$field_toshow) { |
1118 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
1118 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
1119 | 1119 | } else { |
1120 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
1120 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
1123 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
1124 | 1124 | } else { |
1125 | 1125 | if (!$notrans) { |
1126 | 1126 | $translabel = Globals::$langs->trans($obj->{$InfoFieldList[1]}); |
@@ -1133,38 +1133,38 @@ discard block |
||
1133 | 1133 | if (empty($labeltoshow)) |
1134 | 1134 | $labeltoshow = '(not defined)'; |
1135 | 1135 | if ($value == $obj->rowid) { |
1136 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
1136 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | if (!empty($InfoFieldList[3]) && $parentField) { |
1140 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
1140 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
1143 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
1144 | 1144 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
1145 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
1146 | - $out .= '>' . $labeltoshow . '</option>'; |
|
1145 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
1146 | + $out .= '>'.$labeltoshow.'</option>'; |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | $i++; |
1150 | 1150 | } |
1151 | 1151 | Config::$dbEngine->free($resql); |
1152 | 1152 | } else { |
1153 | - print 'Error in request ' . $sql . ' ' . Config::$dbEngine->lasterror() . '. Check setup of extra parameters.<br>'; |
|
1153 | + print 'Error in request '.$sql.' '.Config::$dbEngine->lasterror().'. Check setup of extra parameters.<br>'; |
|
1154 | 1154 | } |
1155 | 1155 | } |
1156 | 1156 | $out .= '</select>'; |
1157 | 1157 | } elseif ($type == 'checkbox') { |
1158 | 1158 | $value_arr = explode(',', $value); |
1159 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, '', 0, '100%'); |
|
1159 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, '', 0, '100%'); |
|
1160 | 1160 | } elseif ($type == 'radio') { |
1161 | 1161 | $out = ''; |
1162 | 1162 | foreach ($param['options'] as $keyopt => $val) { |
1163 | - $out .= '<input class="flat ' . $morecss . '" type="radio" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . ($moreparam ? $moreparam : ''); |
|
1164 | - $out .= ' value="' . $keyopt . '"'; |
|
1165 | - $out .= ' id="' . $keyprefix . $key . $keysuffix . '_' . $keyopt . '"'; |
|
1163 | + $out .= '<input class="flat '.$morecss.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : ''); |
|
1164 | + $out .= ' value="'.$keyopt.'"'; |
|
1165 | + $out .= ' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"'; |
|
1166 | 1166 | $out .= ($value == $keyopt ? 'checked' : ''); |
1167 | - $out .= '/><label for="' . $keyprefix . $key . $keysuffix . '_' . $keyopt . '">' . $val . '</label><br>'; |
|
1167 | + $out .= '/><label for="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>'; |
|
1168 | 1168 | } |
1169 | 1169 | } elseif ($type == 'chkbxlst') { |
1170 | 1170 | if (is_array($value)) { |
@@ -1183,17 +1183,17 @@ discard block |
||
1183 | 1183 | // 2 : key fields name (if differ of rowid) |
1184 | 1184 | // 3 : key field parent (for dependent lists) |
1185 | 1185 | // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value |
1186 | - $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid'); |
|
1186 | + $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); |
|
1187 | 1187 | |
1188 | 1188 | if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { |
1189 | - list ( $parentName, $parentField ) = explode('|', $InfoFieldList[3]); |
|
1190 | - $keyList .= ', ' . $parentField; |
|
1189 | + list ($parentName, $parentField) = explode('|', $InfoFieldList[3]); |
|
1190 | + $keyList .= ', '.$parentField; |
|
1191 | 1191 | } |
1192 | 1192 | if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) { |
1193 | 1193 | if (strpos($InfoFieldList[4], 'extra.') !== false) { |
1194 | - $keyList = 'main.' . $InfoFieldList[2] . ' as rowid'; |
|
1194 | + $keyList = 'main.'.$InfoFieldList[2].' as rowid'; |
|
1195 | 1195 | } else { |
1196 | - $keyList = $InfoFieldList[2] . ' as rowid'; |
|
1196 | + $keyList = $InfoFieldList[2].' as rowid'; |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1204,8 +1204,8 @@ discard block |
||
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | $sqlwhere = ''; |
1207 | - $sql = 'SELECT ' . $keyList; |
|
1208 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; |
|
1207 | + $sql = 'SELECT '.$keyList; |
|
1208 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; |
|
1209 | 1209 | if (!empty($InfoFieldList[4])) { |
1210 | 1210 | |
1211 | 1211 | // can use SELECT request |
@@ -1229,11 +1229,11 @@ discard block |
||
1229 | 1229 | // Init des compteurs |
1230 | 1230 | $nbPregRepl = $nbPregSel = 0; |
1231 | 1231 | // On retire toutes les parenthèses sans = avant |
1232 | - $InfoFieldList[4] = preg_replace('#([^=])(\([^)^(]*(' . $word . ')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl); |
|
1232 | + $InfoFieldList[4] = preg_replace('#([^=])(\([^)^(]*('.$word.')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl); |
|
1233 | 1233 | // On retire les espaces autour des = et parenthèses |
1234 | 1234 | $InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]); |
1235 | 1235 | // On retire toutes les parenthèses avec = avant |
1236 | - $InfoFieldList[4] = preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*(' . $word . ')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel); |
|
1236 | + $InfoFieldList[4] = preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*('.$word.')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel); |
|
1237 | 1237 | // On retire les espaces autour des = et parenthèses |
1238 | 1238 | $InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]); |
1239 | 1239 | |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | // Si l'on a un AND ou un OR, avant ou après |
1245 | - preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); |
|
1245 | + preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); |
|
1246 | 1246 | while (!empty($matchCondition[0])) { |
1247 | 1247 | // If the two sides differ but are not empty |
1248 | 1248 | if (!empty($matchCondition[1]) && !empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3]) { |
@@ -1250,10 +1250,10 @@ discard block |
||
1250 | 1250 | $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); |
1251 | 1251 | } else { |
1252 | 1252 | if (!empty($matchCondition[1])) { |
1253 | - $boolCond = (( $matchCondition[1] == "AND" ) ? ' AND 1 ' : ' OR 0 '); |
|
1254 | - $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]); |
|
1253 | + $boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 '); |
|
1254 | + $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond.$matchCondition[3], $InfoFieldList[4]); |
|
1255 | 1255 | } else if (!empty($matchCondition[3])) { |
1256 | - $boolCond = (( $matchCondition[3] == "AND" ) ? ' 1 AND ' : ' 0 OR'); |
|
1256 | + $boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR'); |
|
1257 | 1257 | $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]); |
1258 | 1258 | } else { |
1259 | 1259 | $InfoFieldList[4] = 1; |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | // Si l'on a un AND ou un OR, avant ou après |
1264 | - preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); |
|
1264 | + preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); |
|
1265 | 1265 | } |
1266 | 1266 | } else { |
1267 | 1267 | $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); |
@@ -1269,23 +1269,23 @@ discard block |
||
1269 | 1269 | |
1270 | 1270 | // We have to join on extrafield table |
1271 | 1271 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
1272 | - $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; |
|
1273 | - $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4]; |
|
1272 | + $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra'; |
|
1273 | + $sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4]; |
|
1274 | 1274 | } else { |
1275 | - $sqlwhere .= ' WHERE ' . $InfoFieldList[4]; |
|
1275 | + $sqlwhere .= ' WHERE '.$InfoFieldList[4]; |
|
1276 | 1276 | } |
1277 | 1277 | } else { |
1278 | 1278 | $sqlwhere .= ' WHERE 1=1'; |
1279 | 1279 | } |
1280 | 1280 | // Some tables may have field, some other not. For the moment we disable it. |
1281 | 1281 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
1282 | - $sqlwhere .= ' AND entity = ' . Globals::$conf->entity; |
|
1282 | + $sqlwhere .= ' AND entity = '.Globals::$conf->entity; |
|
1283 | 1283 | } |
1284 | 1284 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
1285 | 1285 | // print $sql; |
1286 | 1286 | |
1287 | 1287 | $sql .= $sqlwhere; |
1288 | - DolUtils::dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
1288 | + DolUtils::dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
1289 | 1289 | $resql = Config::$dbEngine->query($sql); |
1290 | 1290 | if ($resql) { |
1291 | 1291 | $num = Config::$dbEngine->num_rows($resql); |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | if (is_array($fields_label)) { |
1304 | 1304 | $notrans = true; |
1305 | 1305 | foreach ($fields_label as $field_toshow) { |
1306 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
1306 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
1307 | 1307 | } |
1308 | 1308 | } else { |
1309 | 1309 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -1314,9 +1314,9 @@ discard block |
||
1314 | 1314 | foreach ($fields_label as $field_toshow) { |
1315 | 1315 | $translabel = Globals::$langs->trans($obj->$field_toshow); |
1316 | 1316 | if ($translabel != $obj->$field_toshow) { |
1317 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
1317 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
1318 | 1318 | } else { |
1319 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
1319 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
1320 | 1320 | } |
1321 | 1321 | } |
1322 | 1322 | |
@@ -1338,32 +1338,32 @@ discard block |
||
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | if (!empty($InfoFieldList[3]) && $parentField) { |
1341 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
1341 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | $data[$obj->rowid] = $labeltoshow; |
1345 | 1345 | } |
1346 | 1346 | |
1347 | - $i ++; |
|
1347 | + $i++; |
|
1348 | 1348 | } |
1349 | 1349 | Config::$dbEngine->free($resql); |
1350 | 1350 | |
1351 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); |
|
1351 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); |
|
1352 | 1352 | } else { |
1353 | - print 'Error in request ' . $sql . ' ' . Config::$dbEngine->lasterror() . '. Check setup of extra parameters.<br>'; |
|
1353 | + print 'Error in request '.$sql.' '.Config::$dbEngine->lasterror().'. Check setup of extra parameters.<br>'; |
|
1354 | 1354 | } |
1355 | 1355 | } |
1356 | 1356 | } elseif ($type == 'link') { |
1357 | - $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' |
|
1357 | + $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' |
|
1358 | 1358 | $showempty = (($required && $default != '') ? 0 : 1); |
1359 | - $out = $form->selectForForms($param_list[0], $keyprefix . $key . $keysuffix, $value, $showempty); |
|
1359 | + $out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty); |
|
1360 | 1360 | } elseif ($type == 'password') { |
1361 | 1361 | // If prefix is 'search_', field is used as a filter, we use a common text field. |
1362 | 1362 | $out = '<input style="display:none" type="text" name="fakeusernameremembered">'; // Hidden field to reduce impact of evil Google Chrome autopopulate bug. |
1363 | - $out .= '<input autocomplete="new-password" type="' . ($keyprefix == 'search_' ? 'text' : 'password') . '" class="flat ' . $morecss . '" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . $value . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
1363 | + $out .= '<input autocomplete="new-password" type="'.($keyprefix == 'search_' ? 'text' : 'password').'" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'>'; |
|
1364 | 1364 | } |
1365 | 1365 | if (!empty($hidden)) { |
1366 | - $out = '<input type="hidden" value="' . $value . '" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '"/>'; |
|
1366 | + $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
|
1367 | 1367 | } |
1368 | 1368 | /* Add comments |
1369 | 1369 | if ($type == 'date') $out.=' (YYYY-MM-DD)'; |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key]; |
1399 | 1399 | $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); |
1400 | 1400 | $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; |
1401 | - $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
1401 | + $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
1402 | 1402 | } else { // Old usage |
1403 | 1403 | $label = $this->attribute_label[$key]; |
1404 | 1404 | $type = $this->attribute_type[$key]; |
@@ -1412,11 +1412,11 @@ discard block |
||
1412 | 1412 | $langfile = $this->attribute_langfile[$key]; |
1413 | 1413 | $list = dol_eval($this->attribute_list[$key], 1); |
1414 | 1414 | $help = ''; // Not supported with old syntax |
1415 | - $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
1415 | + $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | if ($hidden) |
1419 | - return ''; // This is a protection. If field is hidden, we should just not call this method. |
|
1419 | + return ''; // This is a protection. If field is hidden, we should just not call this method. |
|
1420 | 1420 | |
1421 | 1421 | |
1422 | 1422 | |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | if (!empty($value)) { |
1448 | 1448 | $checked = ' checked '; |
1449 | 1449 | } |
1450 | - $value = '<input type="checkbox" ' . $checked . ' ' . ($moreparam ? $moreparam : '') . ' readonly disabled>'; |
|
1450 | + $value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>'; |
|
1451 | 1451 | } elseif ($type == 'mail') { |
1452 | 1452 | $value = dol_print_email($value, 0, 0, 0, 64, 1, 1); |
1453 | 1453 | } elseif ($type == 'url') { |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | |
1472 | 1472 | if (count($InfoFieldList) >= 3) { |
1473 | 1473 | $selectkey = $InfoFieldList[2]; |
1474 | - $keyList = $InfoFieldList[2] . ' as rowid'; |
|
1474 | + $keyList = $InfoFieldList[2].' as rowid'; |
|
1475 | 1475 | } |
1476 | 1476 | |
1477 | 1477 | $fields_label = explode('|', $InfoFieldList[1]); |
@@ -1480,22 +1480,22 @@ discard block |
||
1480 | 1480 | $keyList .= implode(', ', $fields_label); |
1481 | 1481 | } |
1482 | 1482 | |
1483 | - $sql = 'SELECT ' . $keyList; |
|
1484 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; |
|
1483 | + $sql = 'SELECT '.$keyList; |
|
1484 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; |
|
1485 | 1485 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
1486 | 1486 | $sql .= ' as main'; |
1487 | 1487 | } |
1488 | 1488 | if ($selectkey == 'rowid' && empty($value)) { |
1489 | - $sql .= " WHERE " . $selectkey . "=0"; |
|
1489 | + $sql .= " WHERE ".$selectkey."=0"; |
|
1490 | 1490 | } elseif ($selectkey == 'rowid') { |
1491 | - $sql .= " WHERE " . $selectkey . "=" . Config::$dbEngine->escape($value); |
|
1491 | + $sql .= " WHERE ".$selectkey."=".Config::$dbEngine->escape($value); |
|
1492 | 1492 | } else { |
1493 | - $sql .= " WHERE " . $selectkey . "='" . Config::$dbEngine->escape($value) . "'"; |
|
1493 | + $sql .= " WHERE ".$selectkey."='".Config::$dbEngine->escape($value)."'"; |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | //$sql.= ' AND entity = '.Globals::$conf->entity; |
1497 | 1497 | |
1498 | - DolUtils::dol_syslog(get_class($this) . ':showOutputField:$type=sellist', LOG_DEBUG); |
|
1498 | + DolUtils::dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG); |
|
1499 | 1499 | $resql = Config::$dbEngine->query($sql); |
1500 | 1500 | if ($resql) { |
1501 | 1501 | $value = ''; // value was used, so now we reste it to use it to build final output |
@@ -1512,9 +1512,9 @@ discard block |
||
1512 | 1512 | $translabel = Globals::$langs->trans($obj->$field_toshow); |
1513 | 1513 | } |
1514 | 1514 | if ($translabel != $field_toshow) { |
1515 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
1515 | + $value .= dol_trunc($translabel, 18).' '; |
|
1516 | 1516 | } else { |
1517 | - $value .= $obj->$field_toshow . ' '; |
|
1517 | + $value .= $obj->$field_toshow.' '; |
|
1518 | 1518 | } |
1519 | 1519 | } |
1520 | 1520 | } else { |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | } |
1530 | 1530 | } |
1531 | 1531 | } else |
1532 | - DolUtils::dol_syslog(get_class($this) . '::showOutputField error ' . Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1532 | + DolUtils::dol_syslog(get_class($this).'::showOutputField error '.Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1533 | 1533 | } |
1534 | 1534 | elseif ($type == 'radio') { |
1535 | 1535 | $value = $param['options'][$value]; |
@@ -1539,10 +1539,10 @@ discard block |
||
1539 | 1539 | $toprint = array(); |
1540 | 1540 | if (is_array($value_arr)) { |
1541 | 1541 | foreach ($value_arr as $keyval => $valueval) { |
1542 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . $param['options'][$valueval] . '</li>'; |
|
1542 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$param['options'][$valueval].'</li>'; |
|
1543 | 1543 | } |
1544 | 1544 | } |
1545 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
1545 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
1546 | 1546 | } elseif ($type == 'chkbxlst') { |
1547 | 1547 | $value_arr = explode(',', $value); |
1548 | 1548 | |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | |
1555 | 1555 | if (count($InfoFieldList) >= 3) { |
1556 | 1556 | $selectkey = $InfoFieldList[2]; |
1557 | - $keyList = $InfoFieldList[2] . ' as rowid'; |
|
1557 | + $keyList = $InfoFieldList[2].' as rowid'; |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | $fields_label = explode('|', $InfoFieldList[1]); |
@@ -1563,15 +1563,15 @@ discard block |
||
1563 | 1563 | $keyList .= implode(', ', $fields_label); |
1564 | 1564 | } |
1565 | 1565 | |
1566 | - $sql = 'SELECT ' . $keyList; |
|
1567 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; |
|
1566 | + $sql = 'SELECT '.$keyList; |
|
1567 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; |
|
1568 | 1568 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
1569 | 1569 | $sql .= ' as main'; |
1570 | 1570 | } |
1571 | 1571 | // $sql.= " WHERE ".$selectkey."='".Config::$dbEngine->escape($value)."'"; |
1572 | 1572 | // $sql.= ' AND entity = '.Globals::$conf->entity; |
1573 | 1573 | |
1574 | - DolUtils::dol_syslog(get_class($this) . ':showOutputField:$type=chkbxlst', LOG_DEBUG); |
|
1574 | + DolUtils::dol_syslog(get_class($this).':showOutputField:$type=chkbxlst', LOG_DEBUG); |
|
1575 | 1575 | $resql = Config::$dbEngine->query($sql); |
1576 | 1576 | if ($resql) { |
1577 | 1577 | $value = ''; // value was used, so now we reste it to use it to build final output |
@@ -1588,9 +1588,9 @@ discard block |
||
1588 | 1588 | $translabel = Globals::$langs->trans($obj->$field_toshow); |
1589 | 1589 | } |
1590 | 1590 | if ($translabel != $field_toshow) { |
1591 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . dol_trunc($translabel, 18) . '</li>'; |
|
1591 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.dol_trunc($translabel, 18).'</li>'; |
|
1592 | 1592 | } else { |
1593 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . $obj->$field_toshow . '</li>'; |
|
1593 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$obj->$field_toshow.'</li>'; |
|
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | } else { |
@@ -1599,23 +1599,23 @@ discard block |
||
1599 | 1599 | $translabel = Globals::$langs->trans($obj->{$InfoFieldList[1]}); |
1600 | 1600 | } |
1601 | 1601 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
1602 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . dol_trunc($translabel, 18) . '</li>'; |
|
1602 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.dol_trunc($translabel, 18).'</li>'; |
|
1603 | 1603 | } else { |
1604 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
1604 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
1605 | 1605 | } |
1606 | 1606 | } |
1607 | 1607 | } |
1608 | 1608 | } |
1609 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
1609 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
1610 | 1610 | } else { |
1611 | - DolUtils::dol_syslog(get_class($this) . '::showOutputField error ' . Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1611 | + DolUtils::dol_syslog(get_class($this).'::showOutputField error '.Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1612 | 1612 | } |
1613 | 1613 | } elseif ($type == 'link') { |
1614 | 1614 | $out = ''; |
1615 | 1615 | |
1616 | 1616 | // Only if something to display (perf) |
1617 | 1617 | if ($value) { // If we have -1 here, pb is into sert, not into ouptu |
1618 | - $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' |
|
1618 | + $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' |
|
1619 | 1619 | |
1620 | 1620 | $InfoFieldList = explode(":", $param_list[0]); |
1621 | 1621 | $classname = $InfoFieldList[0]; |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | { |
1701 | 1701 | // global $langs; |
1702 | 1702 | |
1703 | - $out = '<tr class="trextrafieldseparator trextrafieldseparator' . $key . '"><td colspan="2"><strong>'; |
|
1703 | + $out = '<tr class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="2"><strong>'; |
|
1704 | 1704 | $out .= Globals::$langs->trans($this->attributes[$object->table_element]['label'][$key]); |
1705 | 1705 | $out .= '</strong></td></tr>'; |
1706 | 1706 | return $out; |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | |
1749 | 1749 | if ($this->attributes[$object->table_element]['required'][$key]) { // Value is required |
1750 | 1750 | // Check if empty without using GETPOST, value can be alpha, int, array, etc... |
1751 | - if ((!is_array($_POST["options_" . $key]) && empty($_POST["options_" . $key]) && $_POST["options_" . $key] != '0') || (is_array($_POST["options_" . $key]) && empty($_POST["options_" . $key]))) { |
|
1751 | + if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { |
|
1752 | 1752 | //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; |
1753 | 1753 | $nofillrequired++; |
1754 | 1754 | $error_field_required[] = Globals::$langs->transnoentitiesnoconv($value); |
@@ -1758,31 +1758,31 @@ discard block |
||
1758 | 1758 | if (in_array($key_type, array('date'))) { |
1759 | 1759 | // Clean parameters |
1760 | 1760 | // TODO GMT date in memory must be GMT so we should add gm=true in parameters |
1761 | - $value_key = dol_mktime(0, 0, 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]); |
|
1761 | + $value_key = dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); |
|
1762 | 1762 | } elseif (in_array($key_type, array('datetime'))) { |
1763 | 1763 | // Clean parameters |
1764 | 1764 | // TODO GMT date in memory must be GMT so we should add gm=true in parameters |
1765 | - $value_key = dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]); |
|
1765 | + $value_key = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); |
|
1766 | 1766 | } else if (in_array($key_type, array('checkbox', 'chkbxlst'))) { |
1767 | - $value_arr = GETPOST("options_" . $key, 'array'); // check if an array |
|
1767 | + $value_arr = GETPOST("options_".$key, 'array'); // check if an array |
|
1768 | 1768 | if (!empty($value_arr)) { |
1769 | 1769 | $value_key = implode($value_arr, ','); |
1770 | 1770 | } else { |
1771 | 1771 | $value_key = ''; |
1772 | 1772 | } |
1773 | 1773 | } else if (in_array($key_type, array('price', 'double'))) { |
1774 | - $value_arr = GETPOST("options_" . $key, 'alpha'); |
|
1774 | + $value_arr = GETPOST("options_".$key, 'alpha'); |
|
1775 | 1775 | $value_key = price2num($value_arr); |
1776 | 1776 | } else { |
1777 | - $value_key = GETPOST("options_" . $key); |
|
1777 | + $value_key = GETPOST("options_".$key); |
|
1778 | 1778 | } |
1779 | 1779 | |
1780 | - $object->array_options["options_" . $key] = $value_key; |
|
1780 | + $object->array_options["options_".$key] = $value_key; |
|
1781 | 1781 | } |
1782 | 1782 | |
1783 | 1783 | if ($nofillrequired) { |
1784 | 1784 | Globals::$langs->load('errors'); |
1785 | - setEventMessages(Globals::$langs->trans('ErrorFieldsRequired') . ' : ' . implode(', ', $error_field_required), null, 'errors'); |
|
1785 | + setEventMessages(Globals::$langs->trans('ErrorFieldsRequired').' : '.implode(', ', $error_field_required), null, 'errors'); |
|
1786 | 1786 | return -1; |
1787 | 1787 | } else { |
1788 | 1788 | return 1; |
@@ -1822,20 +1822,20 @@ discard block |
||
1822 | 1822 | |
1823 | 1823 | if (in_array($key_type, array('date', 'datetime'))) { |
1824 | 1824 | // Clean parameters |
1825 | - $value_key = dol_mktime($_POST[$keysuffix . "options_" . $key . $keyprefix . "hour"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "min"], 0, $_POST[$keysuffix . "options_" . $key . $keyprefix . "month"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "day"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "year"]); |
|
1825 | + $value_key = dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]); |
|
1826 | 1826 | } else if (in_array($key_type, array('checkbox', 'chkbxlst'))) { |
1827 | - $value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix); |
|
1827 | + $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); |
|
1828 | 1828 | // Make sure we get an array even if there's only one checkbox |
1829 | 1829 | $value_arr = (array) $value_arr; |
1830 | 1830 | $value_key = implode(',', $value_arr); |
1831 | 1831 | } else if (in_array($key_type, array('price', 'double'))) { |
1832 | - $value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix); |
|
1832 | + $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); |
|
1833 | 1833 | $value_key = price2num($value_arr); |
1834 | 1834 | } else { |
1835 | - $value_key = GETPOST($keysuffix . "options_" . $key . $keyprefix); |
|
1835 | + $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); |
|
1836 | 1836 | } |
1837 | 1837 | |
1838 | - $array_options[$keysuffix . "options_" . $key] = $value_key; // No keyprefix here. keyprefix is used only for read. |
|
1838 | + $array_options[$keysuffix."options_".$key] = $value_key; // No keyprefix here. keyprefix is used only for read. |
|
1839 | 1839 | } |
1840 | 1840 | |
1841 | 1841 | return $array_options; |