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