dolibarr 19.0.3
interface_50_modAgenda_ActionsAuto.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
5 * Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
6 * Copyright (C) 2014 Marcos GarcĂ­a <marcosgdf@gmail.com>
7 * Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
8 * Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
9 * Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
10 * Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
32require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
33
34
39{
45 public function __construct($db)
46 {
47 $this->db = $db;
48
49 $this->name = preg_replace('/^Interface/i', '', get_class($this));
50 $this->family = "agenda";
51 $this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup.";
52 // 'development', 'experimental', 'dolibarr' or version
53 $this->version = self::VERSION_DOLIBARR;
54 $this->picto = 'action';
55 }
56
79 public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
80 {
81 if (!isModEnabled('agenda')) {
82 return 0; // Module not active, we do nothing
83 }
84
85 // Do not log events when trigger is for creating event (infinite loop)
86 if (preg_match('/^ACTION_/', $action)) {
87 return 0;
88 }
89
90 $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
91 //var_dump($action.' - '.$key.' - '.$conf->global->$key);exit;
92
93 // Do not log events not enabled for this action
94 // GUI allow to set this option only if entry exists into table llx_c_action_trigger
95 if (!getDolGlobalString($key)) {
96 return 0;
97 }
98
99 $langs->load("agenda");
100
101 if (empty($object->actiontypecode)) {
102 $object->actiontypecode = 'AC_OTH_AUTO';
103 }
104
105 // Actions
106 if ($action == 'COMPANY_CREATE') {
107 // Load translation files required by the page
108 $langs->loadLangs(array("agenda", "other", "companies"));
109
110 if (empty($object->actionmsg2)) {
111 if (empty($object->context['actionmsg2'])) {
112 $object->actionmsg2 = $langs->transnoentities("NewCompanyToDolibarr", $object->name);
113 } else {
114 $object->actionmsg2 = $object->context['actionmsg2'];
115 }
116 }
117 if (empty($object->actionmsg)) {
118 $object->actionmsg = $langs->transnoentities("NewCompanyToDolibarr", $object->name);
119 }
120
121 $object->sendtoid = 0;
122 $object->socid = $object->id;
123 } elseif ($action == 'COMPANY_MODIFY') {
124 // Load translation files required by the page
125 $langs->loadLangs(array("agenda", "other", "companies"));
126
127 if (empty($object->actionmsg2)) {
128 if (empty($object->context['actionmsg2'])) {
129 $object->actionmsg2 = $langs->transnoentities("COMPANY_MODIFYInDolibarr", $object->name);
130 } else {
131 $object->actionmsg2 = $object->context['actionmsg2'];
132 }
133 }
134 if (empty($object->actionmsg)) {
135 $object->actionmsg = $langs->transnoentities("COMPANY_MODIFYInDolibarr", $object->name);
136 }
137
138 // For merge event, we add a mention
139 if (!empty($object->context['mergefromname'])) {
140 $object->actionmsg = dol_concatdesc($object->actionmsg, $langs->trans("DataFromWasMerged", $object->context['mergefromname'].' (id='.$object->context['mergefromname'].')'));
141 }
142
143 $object->sendtoid = 0;
144 $object->socid = $object->id;
145 } elseif ($action == 'COMPANY_SENTBYMAIL') {
146 // Load translation files required by the page
147 $langs->loadLangs(array("agenda", "other", "orders"));
148
149 if (empty($object->actionmsg2)) {
150 if (empty($object->context['actionmsg2'])) {
151 dol_syslog('Trigger called with property actionmsg2 and context[actionmsg2] on object not defined', LOG_ERR);
152 } else {
153 $object->actionmsg2 = $object->context['actionmsg2'];
154 }
155 }
156
157 // Parameters $object->sendtoid defined by caller
158 //$object->sendtoid=0;
159 } elseif ($action == 'CONTACT_CREATE') {
160 // Load translation files required by the page
161 $langs->loadLangs(array("agenda", "other", "companies"));
162
163 if (empty($object->actionmsg2)) {
164 if (empty($object->context['actionmsg2'])) {
165 $object->actionmsg2 = $langs->transnoentities("CONTACT_CREATEInDolibarr", $object->getFullName($langs));
166 } else {
167 $object->actionmsg2 = $object->context['actionmsg2'];
168 }
169 }
170 if (empty($object->actionmsg)) {
171 $object->actionmsg = $langs->transnoentities("CONTACT_CREATEInDolibarr", $object->getFullName($langs));
172 }
173
174 $object->sendtoid = array($object->id => $object->id);
175 $object->socid = $object->socid;
176 } elseif ($action == 'CONTACT_MODIFY') {
177 // Load translation files required by the page
178 $langs->loadLangs(array("agenda", "other", "companies"));
179
180 if (empty($object->actionmsg2)) {
181 if (empty($object->context['actionmsg2'])) {
182 $object->actionmsg2 = $langs->transnoentities("CONTACT_MODIFYInDolibarr", $object->name);
183 } else {
184 $object->actionmsg2 = $object->context['actionmsg2'];
185 }
186 }
187 if (empty($object->actionmsg)) {
188 $object->actionmsg = $langs->transnoentities("CONTACT_MODIFYInDolibarr", $object->name);
189 }
190
191 $object->sendtoid = array($object->id => $object->id);
192 $object->socid = $object->socid;
193 } elseif ($action == 'CONTRACT_VALIDATE') {
194 // Load translation files required by the page
195 $langs->loadLangs(array("agenda", "other", "contracts"));
196
197 if (empty($object->actionmsg2)) {
198 if (empty($object->context['actionmsg2'])) {
199 $object->actionmsg2 = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
200 } else {
201 $object->actionmsg2 = $object->context['actionmsg2'];
202 }
203 }
204 if (empty($object->actionmsg)) {
205 $object->actionmsg = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
206 }
207
208 $object->sendtoid = 0;
209 } elseif ($action == 'CONTRACT_SENTBYMAIL') {
210 // Load translation files required by the page
211 $langs->loadLangs(array("agenda", "other", "contracts"));
212
213 if (empty($object->actionmsg2)) {
214 if (empty($object->context['actionmsg2'])) {
215 $object->actionmsg2 = $langs->transnoentities("ContractSentByEMail", $object->ref);
216 } else {
217 $object->actionmsg2 = $object->context['actionmsg2'];
218 }
219 }
220 if (empty($object->actionmsg)) {
221 $object->actionmsg = $langs->transnoentities("ContractSentByEMail", $object->ref);
222 }
223
224 // Parameters $object->sendtoid defined by caller
225 //$object->sendtoid=0;
226 } elseif ($action == 'PROPAL_VALIDATE') {
227 // Load translation files required by the page
228 $langs->loadLangs(array("agenda", "other", "propal"));
229
230 if (empty($object->actionmsg2)) {
231 if (empty($object->context['actionmsg2'])) {
232 $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
233 } else {
234 $object->actionmsg2 = $object->context['actionmsg2'];
235 }
236 }
237 if (empty($object->actionmsg)) {
238 $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
239 }
240
241 $object->sendtoid = 0;
242 } elseif ($action == 'PROPAL_MODIFY') {
243 // Load translation files required by the page
244 $langs->loadLangs(array("agenda", "other", "propal"));
245
246 if (empty($object->actionmsg2)) {
247 if (empty($object->context['actionmsg2'])) {
248 $object->actionmsg2 = $langs->transnoentities("PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref));
249 } else {
250 $object->actionmsg2 = $object->context['actionmsg2'];
251 }
252 }
253 if (empty($object->actionmsg)) {
254 $object->actionmsg = $langs->transnoentities("PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref));
255 }
256
257 $object->sendtoid = 0;
258 } elseif ($action == 'PROPAL_SENTBYMAIL') {
259 // Load translation files required by the page
260 $langs->loadLangs(array("agenda", "other", "propal"));
261
262 if (empty($object->actionmsg2)) {
263 if (empty($object->context['actionmsg2'])) {
264 $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
265 } else {
266 $object->actionmsg2 = $object->context['actionmsg2'];
267 }
268 }
269 if (empty($object->actionmsg)) {
270 $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
271 }
272
273 // Parameters $object->sendtoid defined by caller
274 //$object->sendtoid=0;
275 } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
276 // Load translation files required by the page
277 $langs->loadLangs(array("agenda", "other", "propal"));
278
279 if (empty($object->actionmsg2)) {
280 if (empty($object->context['actionmsg2'])) {
281 $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
282 } else {
283 $object->actionmsg2 = $object->context['actionmsg2'];
284 }
285 }
286 if (empty($object->actionmsg)) {
287 $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
288 }
289
290 $object->sendtoid = 0;
291 } elseif ($action == 'PROPAL_CLASSIFY_BILLED') {
292 // Load translation files required by the page
293 $langs->loadLangs(array("agenda", "other", "propal"));
294
295 if (empty($object->actionmsg2)) {
296 if (empty($object->context['actionmsg2'])) {
297 $object->actionmsg2 = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
298 } else {
299 $object->actionmsg2 = $object->context['actionmsg2'];
300 }
301 }
302 if (empty($object->actionmsg)) {
303 $object->actionmsg = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
304 }
305
306 $object->sendtoid = 0;
307 } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
308 // Load translation files required by the page
309 $langs->loadLangs(array("agenda", "other", "propal"));
310
311 if (empty($object->actionmsg2)) {
312 if (empty($object->context['actionmsg2'])) {
313 $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
314 } else {
315 $object->actionmsg2 = $object->context['actionmsg2'];
316 }
317 }
318 if (empty($object->actionmsg)) {
319 $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
320 }
321
322 $object->sendtoid = 0;
323 } elseif ($action == 'ORDER_VALIDATE') {
324 // Load translation files required by the page
325 $langs->loadLangs(array("agenda", "orders"));
326
327 if (empty($object->actionmsg2)) {
328 if (empty($object->context['actionmsg2'])) {
329 $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
330 } else {
331 $object->actionmsg2 = $object->context['actionmsg2'];
332 }
333 }
334 if (empty($object->actionmsg)) {
335 $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
336 }
337
338 $object->sendtoid = 0;
339 } elseif ($action == 'ORDER_CLOSE') {
340 // Load translation files required by the page
341 $langs->loadLangs(array("agenda", "other", "orders"));
342
343 if (empty($object->actionmsg2)) {
344 if (empty($object->context['actionmsg2'])) {
345 $object->actionmsg2 = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
346 } else {
347 $object->actionmsg2 = $object->context['actionmsg2'];
348 }
349 }
350 if (empty($object->actionmsg)) {
351 $object->actionmsg = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
352 }
353
354 $object->sendtoid = 0;
355 } elseif ($action == 'ORDER_CLASSIFY_BILLED') {
356 // Load translation files required by the page
357 $langs->loadLangs(array("agenda", "other", "orders"));
358
359 if (empty($object->actionmsg2)) {
360 if (empty($object->context['actionmsg2'])) {
361 $object->actionmsg2 = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
362 } else {
363 $object->actionmsg2 = $object->context['actionmsg2'];
364 }
365 }
366 if (empty($object->actionmsg)) {
367 $object->actionmsg = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
368 }
369
370 $object->sendtoid = 0;
371 } elseif ($action == 'ORDER_CANCEL') {
372 // Load translation files required by the page
373 $langs->loadLangs(array("agenda", "other", "orders"));
374
375 if (empty($object->actionmsg2)) {
376 if (empty($object->context['actionmsg2'])) {
377 $object->actionmsg2 = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
378 } else {
379 $object->actionmsg2 = $object->context['actionmsg2'];
380 }
381 }
382 if (empty($object->actionmsg)) {
383 $object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
384 }
385
386 $object->sendtoid = 0;
387 } elseif ($action == 'ORDER_SENTBYMAIL') {
388 // Load translation files required by the page
389 $langs->loadLangs(array("agenda", "other", "orders"));
390
391 if (empty($object->actionmsg2)) {
392 if (empty($object->context['actionmsg2'])) {
393 $object->actionmsg2 = $langs->transnoentities("OrderSentByEMail", $object->ref);
394 } else {
395 $object->actionmsg2 = $object->context['actionmsg2'];
396 }
397 }
398 if (empty($object->actionmsg)) {
399 $object->actionmsg = $langs->transnoentities("OrderSentByEMail", $object->ref);
400 }
401
402 // Parameters $object->sendtoid defined by caller
403 //$object->sendtoid=0;
404 } elseif ($action == 'BILL_VALIDATE') {
405 // Load translation files required by the page
406 $langs->loadLangs(array("agenda", "other", "bills"));
407
408 if (empty($object->actionmsg2)) {
409 if (empty($object->context['actionmsg2'])) {
410 $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
411 } else {
412 $object->actionmsg2 = $object->context['actionmsg2'];
413 }
414 }
415 if (empty($object->actionmsg)) {
416 $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
417 }
418
419 $object->sendtoid = 0;
420 } elseif ($action == 'BILL_UNVALIDATE') {
421 // Load translation files required by the page
422 $langs->loadLangs(array("agenda", "other", "bills"));
423
424 if (empty($object->actionmsg2)) {
425 if (empty($object->context['actionmsg2'])) {
426 $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
427 } else {
428 $object->actionmsg2 = $object->context['actionmsg2'];
429 }
430 }
431 if (empty($object->actionmsg)) {
432 $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
433 }
434
435 $object->sendtoid = 0;
436 } elseif ($action == 'BILL_SENTBYMAIL') {
437 // Load translation files required by the page
438 $langs->loadLangs(array("agenda", "other", "bills"));
439
440 if (empty($object->actionmsg2)) {
441 if (empty($object->context['actionmsg2'])) {
442 $object->actionmsg2 = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
443 } else {
444 $object->actionmsg2 = $object->context['actionmsg2'];
445 }
446 }
447 if (empty($object->actionmsg)) {
448 $object->actionmsg = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
449 }
450
451 // Parameters $object->sendtoid defined by caller
452 //$object->sendtoid=0;
453 } elseif ($action == 'BILL_PAYED') {
454 // Load translation files required by the page
455 $langs->loadLangs(array("agenda", "other", "bills"));
456
457 // Values for this action can't be defined by caller.
458 if (empty($object->actionmsg2)) {
459 if (empty($object->context['actionmsg2'])) {
460 $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
461 } else {
462 $object->actionmsg2 = $object->context['actionmsg2'];
463 }
464 }
465 if (empty($object->actionmsg)) {
466 $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
467 }
468
469 $object->sendtoid = 0;
470 } elseif ($action == 'BILL_CANCEL') {
471 // Load translation files required by the page
472 $langs->loadLangs(array("agenda", "other", "bills"));
473
474 if (empty($object->actionmsg2)) {
475 if (empty($object->context['actionmsg2'])) {
476 $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
477 } else {
478 $object->actionmsg2 = $object->context['actionmsg2'];
479 }
480 }
481 if (empty($object->actionmsg)) {
482 $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
483 }
484
485 $object->sendtoid = 0;
486 } elseif ($action == 'FICHINTER_CREATE') {
487 // Load translation files required by the page
488 $langs->loadLangs(array("agenda", "other", "interventions"));
489
490 if (empty($object->actionmsg2)) {
491 if (empty($object->context['actionmsg2'])) {
492 $object->actionmsg2 = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
493 } else {
494 $object->actionmsg2 = $object->context['actionmsg2'];
495 }
496 }
497 if (empty($object->actionmsg)) {
498 $object->actionmsg = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
499 }
500
501 $object->sendtoid = 0;
502 $object->fk_element = 0;
503 $object->elementtype = '';
504 } elseif ($action == 'FICHINTER_VALIDATE') {
505 // Load translation files required by the page
506 $langs->loadLangs(array("agenda", "other", "interventions"));
507
508 if (empty($object->actionmsg2)) {
509 if (empty($object->context['actionmsg2'])) {
510 $object->actionmsg2 = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
511 } else {
512 $object->actionmsg2 = $object->context['actionmsg2'];
513 }
514 }
515 if (empty($object->actionmsg)) {
516 $object->actionmsg = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
517 }
518
519 $object->sendtoid = 0;
520 $object->fk_element = 0;
521 $object->elementtype = '';
522 } elseif ($action == 'FICHINTER_MODIFY') {
523 // Load translation files required by the page
524 $langs->loadLangs(array("agenda", "other", "interventions"));
525
526 if (empty($object->actionmsg2)) {
527 if (empty($object->context['actionmsg2'])) {
528 $object->actionmsg2 = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
529 } else {
530 $object->actionmsg2 = $object->context['actionmsg2'];
531 }
532 }
533 if (empty($object->actionmsg)) {
534 $object->actionmsg = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
535 }
536
537 $object->sendtoid = 0;
538 $object->fk_element = 0;
539 $object->elementtype = '';
540 } elseif ($action == 'FICHINTER_SENTBYMAIL') {
541 // Load translation files required by the page
542 $langs->loadLangs(array("agenda", "other", "interventions"));
543
544 if (empty($object->actionmsg2)) {
545 if (empty($object->context['actionmsg2'])) {
546 $object->actionmsg2 = $langs->transnoentities("InterventionSentByEMail", $object->ref);
547 } else {
548 $object->actionmsg2 = $object->context['actionmsg2'];
549 }
550 }
551 if (empty($object->actionmsg)) {
552 $object->actionmsg = $langs->transnoentities("InterventionSentByEMail", $object->ref);
553 }
554
555 // Parameters $object->sendtoid defined by caller
556 //$object->sendtoid=0;
557 } elseif ($action == 'FICHINTER_CLASSIFY_BILLED') {
558 // Load translation files required by the page
559 $langs->loadLangs(array("agenda", "other", "interventions"));
560
561 if (empty($object->actionmsg2)) {
562 if (empty($object->context['actionmsg2'])) {
563 $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
564 } else {
565 $object->actionmsg2 = $object->context['actionmsg2'];
566 }
567 }
568 if (empty($object->actionmsg)) {
569 $object->actionmsg = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
570 }
571
572 $object->sendtoid = 0;
573 } elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') {
574 // Load translation files required by the page
575 $langs->loadLangs(array("agenda", "other", "interventions"));
576
577 if (empty($object->actionmsg2)) {
578 if (empty($object->context['actionmsg2'])) {
579 $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
580 } else {
581 $object->actionmsg2 = $object->context['actionmsg2'];
582 }
583 }
584 if (empty($object->actionmsg)) {
585 $object->actionmsg = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
586 }
587
588 $object->sendtoid = 0;
589 } elseif ($action == 'FICHINTER_CLOSE') {
590 // Load translation files required by the page
591 $langs->loadLangs(array("agenda", "other", "interventions"));
592
593 if (empty($object->actionmsg2)) {
594 if (empty($object->context['actionmsg2'])) {
595 $object->actionmsg2 = $langs->transnoentities("InterventionClosedInDolibarr", $object->ref);
596 } else {
597 $object->actionmsg2 = $object->context['actionmsg2'];
598 }
599 }
600 if (empty($object->actionmsg)) {
601 $object->actionmsg = $langs->transnoentities("InterventionClosedInDolibarr", $object->ref);
602 }
603
604 $object->sendtoid = 0;
605 $object->fk_element = 0;
606 $object->elementtype = '';
607 } elseif ($action == 'FICHINTER_DELETE') {
608 // Load translation files required by the page
609 $langs->loadLangs(array("agenda", "other", "interventions"));
610
611 if (empty($object->actionmsg2)) {
612 if (empty($object->context['actionmsg2'])) {
613 $object->actionmsg2 = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
614 } else {
615 $object->actionmsg2 = $object->context['actionmsg2'];
616 }
617 }
618 if (empty($object->actionmsg)) {
619 $object->actionmsg = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
620 }
621
622 $object->sendtoid = 0;
623 $object->fk_element = 0;
624 $object->elementtype = '';
625 } elseif ($action == 'SHIPPING_VALIDATE') {
626 // Load translation files required by the page
627 $langs->loadLangs(array("agenda", "other", "sendings"));
628
629 if (empty($object->actionmsg2)) {
630 if (empty($object->context['actionmsg2'])) {
631 $object->actionmsg2 = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
632 } else {
633 $object->actionmsg2 = $object->context['actionmsg2'];
634 }
635 }
636 if (empty($object->actionmsg)) {
637 $object->actionmsg = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
638 }
639
640 // Parameters $object->sendtoid defined by caller
641 //$object->sendtoid=0;
642 } elseif ($action == 'SHIPPING_SENTBYMAIL') {
643 // Load translation files required by the page
644 $langs->loadLangs(array("agenda", "other", "sendings"));
645
646 if (empty($object->actionmsg2)) {
647 if (empty($object->context['actionmsg2'])) {
648 $object->actionmsg2 = $langs->transnoentities("ShippingSentByEMail", $object->ref);
649 } else {
650 $object->actionmsg2 = $object->context['actionmsg2'];
651 }
652 }
653 if (empty($object->actionmsg)) {
654 $object->actionmsg = $langs->transnoentities("ShippingSentByEMail", $object->ref);
655 }
656
657 // Parameters $object->sendtoid defined by caller
658 //$object->sendtoid=0;
659 } elseif ($action == 'RECEPTION_VALIDATE') {
660 $langs->load("agenda");
661 $langs->load("other");
662 $langs->load("receptions");
663
664 if (empty($object->actionmsg2)) {
665 if (empty($object->context['actionmsg2'])) {
666 $object->actionmsg2 = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
667 } else {
668 $object->actionmsg2 = $object->context['actionmsg2'];
669 }
670 }
671 if (empty($object->actionmsg)) {
672 $object->actionmsg = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
673 }
674
675 // Parameters $object->sendtoid defined by caller
676 //$object->sendtoid=0;
677 } elseif ($action == 'RECEPTION_SENTBYMAIL') {
678 $langs->load("agenda");
679 $langs->load("other");
680 $langs->load("receptions");
681
682 if (empty($object->actionmsg2)) {
683 if (empty($object->context['actionmsg2'])) {
684 $object->actionmsg2 = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
685 } else {
686 $object->actionmsg2 = $object->context['actionmsg2'];
687 }
688 }
689 if (empty($object->actionmsg)) {
690 $object->actionmsg = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
691 }
692
693 // Parameters $object->sendtoid defined by caller
694 //$object->sendtoid=0;
695 } elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') {
696 // Load translation files required by the page
697 $langs->loadLangs(array("agenda", "other", "propal"));
698
699 if (empty($object->actionmsg2)) {
700 if (empty($object->context['actionmsg2'])) {
701 $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
702 } else {
703 $object->actionmsg2 = $object->context['actionmsg2'];
704 }
705 }
706 if (empty($object->actionmsg)) {
707 $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
708 }
709
710 $object->sendtoid = 0;
711 } elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') {
712 // Load translation files required by the page
713 $langs->loadLangs(array("agenda", "other", "propal"));
714
715 if (empty($object->actionmsg2)) {
716 if (empty($object->context['actionmsg2'])) {
717 $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
718 } else {
719 $object->actionmsg2 = $object->context['actionmsg2'];
720 }
721 }
722 if (empty($object->actionmsg)) {
723 $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
724 }
725
726 // Parameters $object->sendtoid defined by caller
727 //$object->sendtoid=0;
728 } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') {
729 // Load translation files required by the page
730 $langs->loadLangs(array("agenda", "other", "propal"));
731
732 if (empty($object->actionmsg2)) {
733 if (empty($object->context['actionmsg2'])) {
734 $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
735 } else {
736 $object->actionmsg2 = $object->context['actionmsg2'];
737 }
738 }
739 if (empty($object->actionmsg)) {
740 $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
741 }
742
743 $object->sendtoid = 0;
744 } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') {
745 // Load translation files required by the page
746 $langs->loadLangs(array("agenda", "other", "propal"));
747
748 if (empty($object->actionmsg2)) {
749 if (empty($object->context['actionmsg2'])) {
750 $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
751 } else {
752 $object->actionmsg2 = $object->context['actionmsg2'];
753 }
754 }
755 if (empty($object->actionmsg)) {
756 $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
757 }
758
759 $object->sendtoid = 0;
760 } elseif ($action == 'ORDER_SUPPLIER_CREATE') {
761 // Load translation files required by the page
762 $langs->loadLangs(array("agenda", "other", "orders"));
763
764 if (empty($object->actionmsg2)) {
765 if (empty($object->context['actionmsg2'])) {
766 $object->actionmsg2 = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
767 } else {
768 $object->actionmsg2 = $object->context['actionmsg2'];
769 }
770 }
771 if (empty($object->actionmsg)) {
772 $object->actionmsg = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
773 }
774
775 $object->sendtoid = 0;
776 } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
777 // Load translation files required by the page
778 $langs->loadLangs(array("agenda", "other", "orders"));
779
780 if (empty($object->actionmsg2)) {
781 if (empty($object->context['actionmsg2'])) {
782 $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
783 } else {
784 $object->actionmsg2 = $object->context['actionmsg2'];
785 }
786 }
787 if (empty($object->actionmsg)) {
788 $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
789 }
790
791 $object->sendtoid = 0;
792 } elseif ($action == 'ORDER_SUPPLIER_APPROVE') {
793 // Load translation files required by the page
794 $langs->loadLangs(array("agenda", "other", "orders"));
795
796 if (empty($object->actionmsg2)) {
797 if (empty($object->context['actionmsg2'])) {
798 $object->actionmsg2 = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
799 } else {
800 $object->actionmsg2 = $object->context['actionmsg2'];
801 }
802 }
803 if (empty($object->actionmsg)) {
804 $object->actionmsg = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
805 }
806
807 $object->sendtoid = 0;
808 } elseif ($action == 'ORDER_SUPPLIER_REFUSE') {
809 // Load translation files required by the page
810 $langs->loadLangs(array("agenda", "other", "orders", "main"));
811
812 if (empty($object->actionmsg2)) {
813 if (empty($object->context['actionmsg2'])) {
814 $object->actionmsg2 = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
815 } else {
816 $object->actionmsg2 = $object->context['actionmsg2'];
817 }
818 }
819 if (empty($object->actionmsg)) {
820 $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
821 }
822
823 if (!empty($object->refuse_note)) {
824 $object->actionmsg .= '<br>';
825 $object->actionmsg .= $langs->trans("Reason") . ': '.$object->refuse_note;
826 }
827
828 $object->sendtoid = 0;
829 } elseif ($action == 'ORDER_SUPPLIER_CANCEL') {
830 // Load translation files required by the page
831 $langs->loadLangs(array("agenda", "other", "orders", "main"));
832
833 if (empty($object->actionmsg2)) {
834 if (empty($object->context['actionmsg2'])) {
835 $object->actionmsg2 = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
836 } else {
837 $object->actionmsg2 = $object->context['actionmsg2'];
838 }
839 }
840 if (empty($object->actionmsg)) {
841 $object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
842 }
843
844 if (!empty($object->cancel_note)) {
845 $object->actionmsg .= '<br>';
846 $object->actionmsg .= $langs->trans("Reason") . ': '.$object->cancel_note;
847 }
848
849 $object->sendtoid = 0;
850 } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') {
851 // Load translation files required by the page
852 $langs->loadLangs(array("agenda", "other", "orders"));
853
854 if (empty($object->actionmsg2)) {
855 if (empty($object->context['actionmsg2'])) {
856 $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
857 } else {
858 $object->actionmsg2 = $object->context['actionmsg2'];
859 }
860 }
861 if (empty($object->actionmsg)) {
862 $object->actionmsg = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
863 }
864
865 if (!empty($object->context['comments'])) {
866 $object->actionmsg .= '<br>';
867 $object->actionmsg .= $langs->trans("Comment") . ': '.$object->context['comments'];
868 }
869
870 $object->sendtoid = 0;
871 } elseif ($action == 'ORDER_SUPPLIER_RECEIVE') {
872 // Load translation files required by the page
873 $langs->loadLangs(array("agenda", "other", "orders"));
874
875 if (empty($object->actionmsg2)) {
876 if (empty($object->context['actionmsg2'])) {
877 $object->actionmsg2 = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
878 } else {
879 $object->actionmsg2 = $object->context['actionmsg2'];
880 }
881 }
882 if (empty($object->actionmsg)) {
883 $object->actionmsg = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
884 }
885
886 $object->sendtoid = 0;
887 } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
888 // Load translation files required by the page
889 $langs->loadLangs(array("agenda", "other", "bills", "orders"));
890
891 if (empty($object->actionmsg2)) {
892 if (empty($object->context['actionmsg2'])) {
893 $object->actionmsg2 = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
894 } else {
895 $object->actionmsg2 = $object->context['actionmsg2'];
896 }
897 }
898 if (empty($object->actionmsg)) {
899 $object->actionmsg = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
900 }
901
902 // Parameters $object->sendtoid defined by caller
903 //$object->sendtoid=0;
904 } elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') {
905 // Load translation files required by the page
906 $langs->loadLangs(array("agenda", "other", "bills", "orders"));
907
908 if (empty($object->actionmsg2)) {
909 if (empty($object->context['actionmsg2'])) {
910 $object->actionmsg2 = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
911 } else {
912 $object->actionmsg2 = $object->context['actionmsg2'];
913 }
914 }
915 if (empty($object->actionmsg)) {
916 $object->actionmsg = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
917 }
918
919 $object->sendtoid = 0;
920 } elseif ($action == 'BILL_SUPPLIER_VALIDATE') {
921 // Load translation files required by the page
922 $langs->loadLangs(array("agenda", "other", "bills"));
923
924 if (empty($object->actionmsg2)) {
925 if (empty($object->context['actionmsg2'])) {
926 $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
927 } else {
928 $object->actionmsg2 = $object->context['actionmsg2'];
929 }
930 }
931 if (empty($object->actionmsg)) {
932 $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
933 }
934
935 $object->sendtoid = 0;
936 } elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') {
937 // Load translation files required by the page
938 $langs->loadLangs(array("agenda", "other", "bills"));
939
940 if (empty($object->actionmsg2)) {
941 if (empty($object->context['actionmsg2'])) {
942 $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
943 } else {
944 $object->actionmsg2 = $object->context['actionmsg2'];
945 }
946 }
947 if (empty($object->actionmsg)) {
948 $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
949 }
950
951 $object->sendtoid = 0;
952 } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') {
953 // Load translation files required by the page
954 $langs->loadLangs(array("agenda", "other", "bills", "orders"));
955
956 if (empty($object->actionmsg2)) {
957 if (empty($object->context['actionmsg2'])) {
958 $object->actionmsg2 = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
959 } else {
960 $object->actionmsg2 = $object->context['actionmsg2'];
961 }
962 }
963 if (empty($object->actionmsg)) {
964 $object->actionmsg = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
965 }
966
967 // Parameters $object->sendtoid defined by caller
968 //$object->sendtoid=0;
969 } elseif ($action == 'BILL_SUPPLIER_PAYED') {
970 // Load translation files required by the page
971 $langs->loadLangs(array("agenda", "other", "bills"));
972
973 if (empty($object->actionmsg2)) {
974 if (empty($object->context['actionmsg2'])) {
975 $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
976 } else {
977 $object->actionmsg2 = $object->context['actionmsg2'];
978 }
979 }
980 if (empty($object->actionmsg)) {
981 $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
982 }
983
984 $object->sendtoid = 0;
985 } elseif ($action == 'BILL_SUPPLIER_CANCELED') {
986 // Load translation files required by the page
987 $langs->loadLangs(array("agenda", "other", "bills"));
988
989 if (empty($object->actionmsg2)) {
990 if (empty($object->context['actionmsg2'])) {
991 $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
992 } else {
993 $object->actionmsg2 = $object->context['actionmsg2'];
994 }
995 }
996 if (empty($object->actionmsg)) {
997 $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
998 }
999
1000 $object->sendtoid = 0;
1001 } elseif ($action == 'MEMBER_VALIDATE') {
1002 // Members
1003 // Load translation files required by the page
1004 $langs->loadLangs(array("agenda", "other", "members"));
1005
1006 if (empty($object->actionmsg2)) {
1007 if (empty($object->context['actionmsg2'])) {
1008 $object->actionmsg2 = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
1009 } else {
1010 $object->actionmsg2 = $object->context['actionmsg2'];
1011 }
1012 }
1013 if (empty($object->actionmsg)) {
1014 $object->actionmsg = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
1015 $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
1016 $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
1017 }
1018
1019 $object->sendtoid = 0;
1020 } elseif ($action == 'MEMBER_MODIFY') {
1021 // Load translation files required by the page
1022 $langs->loadLangs(array("agenda", "other", "members"));
1023
1024 if (empty($object->actionmsg2)) {
1025 if (empty($object->context['actionmsg2'])) {
1026 $object->actionmsg2 = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
1027 } else {
1028 $object->actionmsg2 = $object->context['actionmsg2'];
1029 }
1030 }
1031 if (empty($object->actionmsg)) {
1032 $object->actionmsg = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
1033 $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
1034 $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
1035 }
1036
1037 $object->sendtoid = 0;
1038 } elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') {
1039 // Load translation files required by the page
1040 $langs->loadLangs(array("agenda", "other", "members"));
1041
1042 $member = (isset($object->context['member']) ? $object->context['member'] : null);
1043 if (!is_object($member)) { // This should not happen
1044 dol_syslog("Execute a trigger MEMBER_SUBSCRIPTION_CREATE with context key 'member' not an object");
1045 include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
1046 $member = new Adherent($this->db);
1047 $member->fetch($object->fk_adherent);
1048 }
1049
1050 if (empty($object->actionmsg2)) {
1051 if (empty($object->context['actionmsg2'])) {
1052 $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
1053 } else {
1054 $object->actionmsg2 = $object->context['actionmsg2'];
1055 }
1056 }
1057 if (empty($object->actionmsg)) {
1058 $object->actionmsg = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
1059 $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
1060 $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->fk_type;
1061 $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->amount;
1062 $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
1063 }
1064
1065 $object->sendtoid = 0;
1066 if (isset($object->fk_soc) && $object->fk_soc > 0) {
1067 $object->socid = $object->fk_soc;
1068 }
1069 } elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') {
1070 // Load translation files required by the page
1071 $langs->loadLangs(array("agenda", "other", "members"));
1072
1073 $member = $object->context['member'];
1074 if (!is_object($member)) { // This should not happen
1075 include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
1076 $member = new Adherent($this->db);
1077 $member->fetch($object->fk_adherent);
1078 }
1079
1080 if (empty($object->actionmsg2)) {
1081 if (empty($object->context['actionmsg2'])) {
1082 $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
1083 } else {
1084 $object->actionmsg2 = $object->context['actionmsg2'];
1085 }
1086 }
1087 if (empty($object->actionmsg)) {
1088 $object->actionmsg = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
1089 $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
1090 $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->fk_type;
1091 $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->amount;
1092 $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
1093 }
1094
1095 $object->sendtoid = 0;
1096 if (isset($object->fk_soc) && $object->fk_soc > 0) {
1097 $object->socid = $object->fk_soc;
1098 }
1099 } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') {
1100 // Load translation files required by the page
1101 $langs->loadLangs(array("agenda", "other", "members"));
1102
1103 $member = $object->context['member'];
1104 if (!is_object($member)) { // This should not happen but it happen when deleting a subscription from adherents/subscription/card.php
1105 dol_syslog("Execute a trigger MEMBER_SUBSCRIPTION_CREATE with context key 'member' not an object");
1106 include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
1107 $member = new Adherent($this->db);
1108 $member->fetch($object->fk_adherent);
1109 }
1110
1111 if (empty($object->actionmsg2)) {
1112 if (empty($object->context['actionmsg2'])) {
1113 $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $member->getFullName($langs));
1114 } else {
1115 $object->actionmsg2 = $object->context['actionmsg2'];
1116 }
1117 }
1118 if (empty($object->actionmsg)) {
1119 $object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $member->getFullName($langs));
1120 $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
1121 $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->fk_type;
1122 $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->amount;
1123 $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
1124 }
1125
1126 $object->sendtoid = 0;
1127 if (isset($object->fk_soc) && $object->fk_soc > 0) {
1128 $object->socid = $object->fk_soc;
1129 }
1130 } elseif ($action == 'MEMBER_RESILIATE') {
1131 // Load translation files required by the page
1132 $langs->loadLangs(array("agenda", "other", "members"));
1133
1134 if (empty($object->actionmsg2)) {
1135 if (empty($object->context['actionmsg2'])) {
1136 $object->actionmsg2 = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
1137 } else {
1138 $object->actionmsg2 = $object->context['actionmsg2'];
1139 }
1140 }
1141 if (empty($object->actionmsg)) {
1142 $object->actionmsg = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
1143 $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
1144 $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
1145 }
1146
1147 $object->sendtoid = 0;
1148 } elseif ($action == 'MEMBER_DELETE') {
1149 // Load translation files required by the page
1150 $langs->loadLangs(array("agenda", "other", "members"));
1151
1152 if (empty($object->actionmsg2)) {
1153 if (empty($object->context['actionmsg2'])) {
1154 $object->actionmsg2 = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
1155 } else {
1156 $object->actionmsg2 = $object->context['actionmsg2'];
1157 }
1158 }
1159 if (empty($object->actionmsg)) {
1160 $object->actionmsg = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
1161 $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
1162 $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
1163 }
1164
1165 $object->sendtoid = 0;
1166 } elseif ($action == 'MEMBER_EXCLUDE') {
1167 // Load translation files required by the page
1168 $langs->loadLangs(array("agenda", "other", "members"));
1169
1170 if (empty($object->actionmsg2)) {
1171 if (empty($object->context['actionmsg2'])) {
1172 $object->actionmsg2 = $langs->transnoentities("MemberExcludedInDolibarr", $object->getFullName($langs));
1173 } else {
1174 $object->actionmsg2 = $object->context['actionmsg2'];
1175 }
1176 }
1177 if (empty($object->actionmsg)) {
1178 $object->actionmsg = $langs->transnoentities("MemberExcludedInDolibarr", $object->getFullName($langs));
1179 $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
1180 $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
1181 }
1182
1183 $object->sendtoid = 0;
1184 } elseif ($action == 'PROJECT_CREATE') {
1185 // Projects
1186 // Load translation files required by the page
1187 $langs->loadLangs(array("agenda", "other", "projects"));
1188
1189 if (empty($object->actionmsg2)) {
1190 if (empty($object->context['actionmsg2'])) {
1191 $object->actionmsg2 = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
1192 } else {
1193 $object->actionmsg2 = $object->context['actionmsg2'];
1194 }
1195 }
1196 if (empty($object->actionmsg)) {
1197 $object->actionmsg = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
1198 $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
1199 }
1200
1201 $object->sendtoid = 0;
1202 } elseif ($action == 'PROJECT_VALIDATE') {
1203 // Load translation files required by the page
1204 $langs->loadLangs(array("agenda", "other", "projects"));
1205
1206 if (empty($object->actionmsg2)) {
1207 if (empty($object->context['actionmsg2'])) {
1208 $object->actionmsg2 = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
1209 } else {
1210 $object->actionmsg2 = $object->context['actionmsg2'];
1211 }
1212 }
1213 if (empty($object->actionmsg)) {
1214 $object->actionmsg = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
1215 $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
1216 }
1217
1218 $object->sendtoid = 0;
1219 } elseif ($action == 'PROJECT_MODIFY') {
1220 // Load translation files required by the page
1221 $langs->loadLangs(array("agenda", "other", "projects"));
1222
1223 if (empty($object->actionmsg2)) {
1224 if (empty($object->context['actionmsg2'])) {
1225 $object->actionmsg2 = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
1226 } else {
1227 $object->actionmsg2 = $object->context['actionmsg2'];
1228 }
1229 }
1230 if (empty($object->actionmsg)) {
1231 $object->actionmsg = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
1232 }
1233
1234 //$object->actionmsg .= "\n".$langs->transnoentities("Task").': ???';
1235 if (!empty($object->usage_opportunity) && is_object($object->oldcopy) && $object->opp_status != $object->oldcopy->opp_status) {
1236 $object->actionmsg .= "\n".$langs->transnoentitiesnoconv("OpportunityStatus").': '.$object->oldcopy->opp_status.' -> '.$object->opp_status;
1237 }
1238
1239 $object->sendtoid = 0;
1240 } elseif ($action == 'PROJECT_SENTBYMAIL') {
1241 // Load translation files required by the page
1242 $langs->loadLangs(array("agenda", "other", "projects"));
1243
1244 if (empty($object->actionmsg2)) {
1245 if (empty($object->context['actionmsg2'])) {
1246 $object->actionmsg2 = $langs->transnoentities("ProjectSentByEMail", $object->ref);
1247 } else {
1248 $object->actionmsg2 = $object->context['actionmsg2'];
1249 }
1250 }
1251 if (empty($object->actionmsg)) {
1252 $object->actionmsg = $langs->transnoentities("ProjectSentByEMail", $object->ref);
1253 }
1254
1255 // Parameters $object->sendtoid defined by caller
1256 //$object->sendtoid=0;
1257 } elseif ($action == 'PROJECT_DELETE') {
1258 // Load translation files required by the page
1259 $langs->loadLangs(array("agenda", "other", "projects"));
1260
1261 if (empty($object->actionmsg2)) {
1262 $object->actionmsg2 = $langs->transnoentities("ProjectDeletedInDolibarr", $object->ref);
1263 }
1264 $object->actionmsg = $langs->transnoentities("ProjectDeletedInDolibarr", $object->ref);
1265
1266 $object->sendtoid = 0;
1267 } elseif ($action == 'PROJECT_CLOSE') {
1268 // Load translation files required by the page
1269 $langs->loadLangs(array("agenda", "other", "projects"));
1270
1271 if (empty($object->actionmsg2)) {
1272 if (empty($object->context['actionmsg2'])) {
1273 $object->actionmsg2 = $langs->transnoentities("ProjectClosedInDolibarr", $object->ref);
1274 } else {
1275 $object->actionmsg2 = $object->context['actionmsg2'];
1276 }
1277 }
1278 if (empty($object->actionmsg)) {
1279 $object->actionmsg = $langs->transnoentities("ProjectClosedInDolibarr", $object->ref);
1280 }
1281
1282 $object->sendtoid = 0;
1283 } elseif ($action == 'TASK_CREATE') {
1284 // Project tasks
1285 // Load translation files required by the page
1286 $langs->loadLangs(array("agenda", "other", "projects"));
1287
1288 if (empty($object->actionmsg2)) {
1289 if (empty($object->context['actionmsg2'])) {
1290 $object->actionmsg2 = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
1291 } else {
1292 $object->actionmsg2 = $object->context['actionmsg2'];
1293 }
1294 }
1295 if (empty($object->actionmsg)) {
1296 $object->actionmsg = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
1297 $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
1298 }
1299
1300 $object->sendtoid = 0;
1301 } elseif ($action == 'TASK_MODIFY') {
1302 // Load translation files required by the page
1303 $langs->loadLangs(array("agenda", "other", "projects"));
1304
1305 if (empty($object->actionmsg2)) {
1306 if (empty($object->context['actionmsg2'])) {
1307 $object->actionmsg2 = $langs->transnoentities("TaskModifiedInDolibarr", $object->ref);
1308 } else {
1309 $object->actionmsg2 = $object->context['actionmsg2'];
1310 }
1311 }
1312 if (empty($object->actionmsg)) {
1313 $object->actionmsg = $langs->transnoentities("TaskModifieddInDolibarr", $object->ref);
1314 $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
1315 }
1316
1317 $object->sendtoid = 0;
1318 } elseif ($action == 'TASK_DELETE') {
1319 // Load translation files required by the page
1320 $langs->loadLangs(array("agenda", "other", "projects"));
1321
1322 if (empty($object->actionmsg2)) {
1323 if (empty($object->context['actionmsg2'])) {
1324 $object->actionmsg2 = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
1325 } else {
1326 $object->actionmsg2 = $object->context['actionmsg2'];
1327 }
1328 }
1329 if (empty($object->actionmsg)) {
1330 $object->actionmsg = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
1331 $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
1332 }
1333
1334 $object->sendtoid = 0;
1335 } elseif ($action == 'TICKET_ASSIGNED') {
1336 // Load translation files required by the page
1337 $langs->loadLangs(array("agenda", "other", "projects"));
1338
1339 if (empty($object->actionmsg2)) {
1340 if (empty($object->context['actionmsg2'])) {
1341 $object->actionmsg2 = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
1342 } else {
1343 $object->actionmsg2 = $object->context['actionmsg2'];
1344 }
1345 }
1346 if (empty($object->actionmsg)) {
1347 $object->actionmsg = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
1348 }
1349
1350 if ($object->oldcopy->fk_user_assign > 0) {
1351 $tmpuser = new User($this->db);
1352 $tmpuser->fetch($object->oldcopy->fk_user_assign);
1353 $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs);
1354 } else {
1355 $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$langs->trans("None");
1356 }
1357 if ($object->fk_user_assign > 0) {
1358 $tmpuser = new User($this->db);
1359 $tmpuser->fetch($object->fk_user_assign);
1360 $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$tmpuser->getFullName($langs);
1361 } else {
1362 $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$langs->trans("None");
1363 }
1364
1365 $object->sendtoid = 0;
1366 } else {
1367 // TODO Merge all previous cases into this generic one
1368 // $action = PASSWORD, BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ...
1369 // Can also be a value defined by an external module like SENTBYSMS, COMPANY_SENTBYSMS, MEMBER_SENTBYSMS, ...
1370 // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function).
1371 // Note that these key can be set in agenda setup, only if defined into llx_c_action_trigger
1372 if (!empty($object->context['actionmsg']) && empty($object->actionmsg)) { // For description
1373 $object->actionmsg = $object->context['actionmsg'];
1374 }
1375 if (!empty($object->context['actionmsg2']) && empty($object->actionmsg2)) { // For label
1376 $object->actionmsg2 = $object->context['actionmsg2'];
1377 }
1378
1379 if (empty($object->actionmsg2)) {
1380 // Load translation files required by the page
1381 $langs->loadLangs(array("agenda", "other"));
1382 if ($langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)) != $action."InDolibarr") { // specific translation key
1383 $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
1384 } else { // generic translation key
1385 $tmp = explode('_', $action);
1386 $object->actionmsg2 = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
1387 }
1388 }
1389 if (empty($object->actionmsg)) {
1390 // Load translation files required by the page
1391 $langs->loadLangs(array("agenda", "other"));
1392 if ($langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)) != $action."InDolibarr") { // specific translation key
1393 $object->actionmsg = $langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
1394 } else { // generic translation key
1395 $tmp = explode('_', $action);
1396 $object->actionmsg = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
1397 }
1398 if (isModEnabled('multicompany') && property_exists($object, 'entity') && $object->entity > 1) {
1399 $object->actionmsg .= ' ('.$langs->trans("Entity").' '.$object->entity.')';
1400 }
1401 }
1402
1403 if (!isset($object->sendtoid) || !is_array($object->sendtoid)) {
1404 $object->sendtoid = 0;
1405 }
1406 }
1407
1408 // If trackid is not defined, we set it.
1409 // Note that it should be set by caller. This is for compatibility purpose only.
1410 if (empty($object->trackid)) {
1411 // See also similar list into emailcollector.class.php
1412 if (preg_match('/^COMPANY_/', $action)) {
1413 $object->trackid = 'thi'.$object->id;
1414 } elseif (preg_match('/^CONTACT_/', $action)) {
1415 $object->trackid = 'ctc'.$object->id;
1416 } elseif (preg_match('/^CONTRACT_/', $action)) {
1417 $object->trackid = 'con'.$object->id;
1418 } elseif (preg_match('/^PROPAL_/', $action)) {
1419 $object->trackid = 'pro'.$object->id;
1420 } elseif (preg_match('/^ORDER_/', $action)) {
1421 $object->trackid = 'ord'.$object->id;
1422 } elseif (preg_match('/^BILL_/', $action)) {
1423 $object->trackid = 'inv'.$object->id;
1424 } elseif (preg_match('/^FICHINTER_/', $action)) {
1425 $object->trackid = 'int'.$object->id;
1426 } elseif (preg_match('/^SHIPPING_/', $action)) {
1427 $object->trackid = 'shi'.$object->id;
1428 } elseif (preg_match('/^RECEPTION_/', $action)) {
1429 $object->trackid = 'rec'.$object->id;
1430 } elseif (preg_match('/^PROPOSAL_SUPPLIER/', $action)) {
1431 $object->trackid = 'spr'.$object->id;
1432 } elseif (preg_match('/^ORDER_SUPPLIER_/', $action)) {
1433 $object->trackid = 'sor'.$object->id;
1434 } elseif (preg_match('/^BILL_SUPPLIER_/', $action)) {
1435 $object->trackid = 'sin'.$object->id;
1436 } elseif (preg_match('/^MEMBER_SUBSCRIPTION_/', $action)) {
1437 $object->trackid = 'sub'.$object->id;
1438 } elseif (preg_match('/^MEMBER_/', $action)) {
1439 $object->trackid = 'mem'.$object->id;
1440 } elseif (preg_match('/^PARTNERSHIP_/', $action)) {
1441 $object->trackid = 'pship'.$object->id;
1442 } elseif (preg_match('/^PROJECT_/', $action)) {
1443 $object->trackid = 'proj'.$object->id;
1444 } elseif (preg_match('/^TASK_/', $action)) {
1445 $object->trackid = 'tas'.$object->id;
1446 } elseif (preg_match('/^TICKET_/', $action)) {
1447 $object->trackid = 'tic'.$object->id;
1448 } elseif (preg_match('/^USER_/', $action)) {
1449 $object->trackid = 'use'.$object->id;
1450 } else {
1451 $object->trackid = '';
1452 }
1453 }
1454
1455 dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id);
1456
1457 // Add entry in event table
1458 $now = dol_now();
1459
1460 if (isset($_SESSION['listofnames-'.$object->trackid])) {
1461 $attachs = $_SESSION['listofnames-'.$object->trackid];
1462 if ($attachs && strpos($action, 'SENTBYMAIL')) {
1463 $object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
1464 }
1465 }
1466
1467 $societeforactionid = 0;
1468 $contactforactionid = 0;
1469
1470 // Set $contactforactionid
1471 if (is_array($object->sendtoid)) {
1472 if (count($object->sendtoid) == 1) {
1473 $contactforactionid = reset($object->sendtoid);
1474 }
1475 } else {
1476 if ($object->sendtoid > 0) {
1477 $contactforactionid = $object->sendtoid;
1478 }
1479 }
1480 // Set $societeforactionid
1481 if (isset($object->socid) && $object->socid > 0) {
1482 $societeforactionid = $object->socid;
1483 } elseif (isset($object->fk_soc) && $object->fk_soc > 0) {
1484 $societeforactionid = $object->fk_soc;
1485 } elseif (isset($object->thirdparty) && isset($object->thirdparty->id) && $object->thirdparty->id > 0) {
1486 $societeforactionid = $object->thirdparty->id;
1487 }
1488
1489 $projectid = isset($object->fk_project) ? $object->fk_project : 0;
1490 if ($object->element == 'project') {
1491 $projectid = $object->id;
1492 }
1493
1494 $elementid = $object->id; // id of object
1495 $elementtype = $object->element;
1496 $elementmodule = (empty($object->module) ? '' : $object->module);
1497 if ($object->element == 'subscription') {
1498 $elementid = $object->fk_adherent;
1499 $elementtype = 'member';
1500 }
1501 //var_dump($societeforaction);var_dump($contactforaction);var_dump($elementid);var_dump($elementtype);exit;
1502
1503 // Insertion action
1504 require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
1505 $actioncomm = new ActionComm($this->db);
1506 $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
1507 $actioncomm->code = 'AC_'.$action;
1508 $actioncomm->label = $object->actionmsg2; // Label of event
1509 $actioncomm->note_private = $object->actionmsg; // Description
1510 $actioncomm->fk_project = $projectid;
1511 $actioncomm->datep = $now;
1512 $actioncomm->datef = $now;
1513 $actioncomm->durationp = 0;
1514 $actioncomm->percentage = -1; // Not applicable
1515 $actioncomm->socid = $societeforactionid;
1516 $actioncomm->contact_id = $contactforactionid; // deprecated, now managed by setting $actioncomm->socpeopleassigned later
1517 $actioncomm->authorid = $user->id; // User saving action
1518 $actioncomm->userownerid = $user->id; // Owner of action
1519 // Fields defined when action is an email (content should be into object->actionmsg to be added into event note, subject should be into object->actionms2 to be added into event label)
1520 if (!property_exists($object, 'email_fields_no_propagate_in_actioncomm') || empty($object->email_fields_no_propagate_in_actioncomm)) {
1521 $actioncomm->email_msgid = empty($object->email_msgid) ? null : $object->email_msgid;
1522 $actioncomm->email_from = empty($object->email_from) ? null : $object->email_from;
1523 $actioncomm->email_sender = empty($object->email_sender) ? null : $object->email_sender;
1524 $actioncomm->email_to = empty($object->email_to) ? null : $object->email_to;
1525 $actioncomm->email_tocc = empty($object->email_tocc) ? null : $object->email_tocc;
1526 $actioncomm->email_tobcc = empty($object->email_tobcc) ? null : $object->email_tobcc;
1527 $actioncomm->email_subject = empty($object->email_subject) ? null : $object->email_subject;
1528 $actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to;
1529 }
1530
1531 // Object linked (if link is for thirdparty, contact or project, it is a recording error. We should not have links in link table
1532 // for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources.
1533 if (!in_array($elementtype, array('societe', 'contact', 'project'))) {
1534 $actioncomm->fk_element = $elementid;
1535 $actioncomm->elementtype = $elementtype.($elementmodule ? '@'.$elementmodule : '');
1536 }
1537
1538 if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) {
1539 $actioncomm->attachedfiles = $object->attachedfiles;
1540 }
1541 if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid) > 0) {
1542 $actioncomm->userassigned = $object->sendtouserid;
1543 }
1544 if (property_exists($object, 'sendtoid') && is_array($object->sendtoid) && count($object->sendtoid) > 0) {
1545 foreach ($object->sendtoid as $val) {
1546 $actioncomm->socpeopleassigned[$val] = $val;
1547 }
1548 }
1549
1550 $ret = $actioncomm->create($user); // User creating action
1551
1552 if ($ret > 0 && getDolGlobalString('MAIN_COPY_FILE_IN_EVENT_AUTO')) {
1553 if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) {
1554 foreach ($object->attachedfiles['paths'] as $key => $filespath) {
1555 $srcfile = $filespath;
1556 $destdir = $conf->agenda->dir_output.'/'.$ret;
1557 $destfile = $destdir.'/'.$object->attachedfiles['names'][$key];
1558 if (dol_mkdir($destdir) >= 0) {
1559 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
1560 dol_copy($srcfile, $destfile);
1561 }
1562 }
1563 }
1564 }
1565
1566 // Reset value set by caller
1567 unset($object->context['actionmsg']);
1568 unset($object->context['actionmsg2']);
1569 unset($object->actionmsg);
1570 unset($object->actionmsg2);
1571 unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
1572
1573 if ($ret > 0) {
1574 $_SESSION['LAST_ACTION_CREATED'] = $ret;
1575 return 1;
1576 } else {
1577 $this->error = "Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
1578 $this->errors = $actioncomm->errors;
1579
1580 dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
1581 return -1;
1582 }
1583 }
1584}
Class to manage agenda events (actions)
Class to manage members of a foundation.
Class to stock current configuration.
Class that all the triggers must extend.
Class of triggered functions for agenda module.
runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
Function called when a Dolibarrr business event is done.
Class to manage translations.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:124