81 if (!isModEnabled(
'agenda')) {
86 if (preg_match(
'/^ACTION_/', $action)) {
90 $key =
'MAIN_AGENDA_ACTIONAUTO_'.$action;
99 $langs->load(
"agenda");
101 if (empty($object->actiontypecode)) {
102 $object->actiontypecode =
'AC_OTH_AUTO';
106 if ($action ==
'COMPANY_CREATE') {
108 $langs->loadLangs(array(
"agenda",
"other",
"companies"));
110 if (empty($object->actionmsg2)) {
111 if (empty($object->context[
'actionmsg2'])) {
112 $object->actionmsg2 = $langs->transnoentities(
"NewCompanyToDolibarr", $object->name);
114 $object->actionmsg2 = $object->context[
'actionmsg2'];
117 if (empty($object->actionmsg)) {
118 $object->actionmsg = $langs->transnoentities(
"NewCompanyToDolibarr", $object->name);
121 $object->sendtoid = 0;
122 $object->socid = $object->id;
123 } elseif ($action ==
'COMPANY_MODIFY') {
125 $langs->loadLangs(array(
"agenda",
"other",
"companies"));
127 if (empty($object->actionmsg2)) {
128 if (empty($object->context[
'actionmsg2'])) {
129 $object->actionmsg2 = $langs->transnoentities(
"COMPANY_MODIFYInDolibarr", $object->name);
131 $object->actionmsg2 = $object->context[
'actionmsg2'];
134 if (empty($object->actionmsg)) {
135 $object->actionmsg = $langs->transnoentities(
"COMPANY_MODIFYInDolibarr", $object->name);
139 if (!empty($object->context[
'mergefromname'])) {
140 $object->actionmsg =
dol_concatdesc($object->actionmsg, $langs->trans(
"DataFromWasMerged", $object->context[
'mergefromname'].
' (id='.$object->context[
'mergefromname'].
')'));
143 $object->sendtoid = 0;
144 $object->socid = $object->id;
145 } elseif ($action ==
'COMPANY_SENTBYMAIL') {
147 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
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);
153 $object->actionmsg2 = $object->context[
'actionmsg2'];
159 } elseif ($action ==
'CONTACT_CREATE') {
161 $langs->loadLangs(array(
"agenda",
"other",
"companies"));
163 if (empty($object->actionmsg2)) {
164 if (empty($object->context[
'actionmsg2'])) {
165 $object->actionmsg2 = $langs->transnoentities(
"CONTACT_CREATEInDolibarr", $object->getFullName($langs));
167 $object->actionmsg2 = $object->context[
'actionmsg2'];
170 if (empty($object->actionmsg)) {
171 $object->actionmsg = $langs->transnoentities(
"CONTACT_CREATEInDolibarr", $object->getFullName($langs));
174 $object->sendtoid = array($object->id => $object->id);
175 $object->socid = $object->socid;
176 } elseif ($action ==
'CONTACT_MODIFY') {
178 $langs->loadLangs(array(
"agenda",
"other",
"companies"));
180 if (empty($object->actionmsg2)) {
181 if (empty($object->context[
'actionmsg2'])) {
182 $object->actionmsg2 = $langs->transnoentities(
"CONTACT_MODIFYInDolibarr", $object->name);
184 $object->actionmsg2 = $object->context[
'actionmsg2'];
187 if (empty($object->actionmsg)) {
188 $object->actionmsg = $langs->transnoentities(
"CONTACT_MODIFYInDolibarr", $object->name);
191 $object->sendtoid = array($object->id => $object->id);
192 $object->socid = $object->socid;
193 } elseif ($action ==
'CONTRACT_VALIDATE') {
195 $langs->loadLangs(array(
"agenda",
"other",
"contracts"));
197 if (empty($object->actionmsg2)) {
198 if (empty($object->context[
'actionmsg2'])) {
199 $object->actionmsg2 = $langs->transnoentities(
"ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
201 $object->actionmsg2 = $object->context[
'actionmsg2'];
204 if (empty($object->actionmsg)) {
205 $object->actionmsg = $langs->transnoentities(
"ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
208 $object->sendtoid = 0;
209 } elseif ($action ==
'CONTRACT_SENTBYMAIL') {
211 $langs->loadLangs(array(
"agenda",
"other",
"contracts"));
213 if (empty($object->actionmsg2)) {
214 if (empty($object->context[
'actionmsg2'])) {
215 $object->actionmsg2 = $langs->transnoentities(
"ContractSentByEMail", $object->ref);
217 $object->actionmsg2 = $object->context[
'actionmsg2'];
220 if (empty($object->actionmsg)) {
221 $object->actionmsg = $langs->transnoentities(
"ContractSentByEMail", $object->ref);
226 } elseif ($action ==
'PROPAL_VALIDATE') {
228 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
230 if (empty($object->actionmsg2)) {
231 if (empty($object->context[
'actionmsg2'])) {
232 $object->actionmsg2 = $langs->transnoentities(
"PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
234 $object->actionmsg2 = $object->context[
'actionmsg2'];
237 if (empty($object->actionmsg)) {
238 $object->actionmsg = $langs->transnoentities(
"PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
241 $object->sendtoid = 0;
242 } elseif ($action ==
'PROPAL_MODIFY') {
244 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
246 if (empty($object->actionmsg2)) {
247 if (empty($object->context[
'actionmsg2'])) {
248 $object->actionmsg2 = $langs->transnoentities(
"PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref));
250 $object->actionmsg2 = $object->context[
'actionmsg2'];
253 if (empty($object->actionmsg)) {
254 $object->actionmsg = $langs->transnoentities(
"PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref));
257 $object->sendtoid = 0;
258 } elseif ($action ==
'PROPAL_SENTBYMAIL') {
260 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
262 if (empty($object->actionmsg2)) {
263 if (empty($object->context[
'actionmsg2'])) {
264 $object->actionmsg2 = $langs->transnoentities(
"ProposalSentByEMail", $object->ref);
266 $object->actionmsg2 = $object->context[
'actionmsg2'];
269 if (empty($object->actionmsg)) {
270 $object->actionmsg = $langs->transnoentities(
"ProposalSentByEMail", $object->ref);
275 } elseif ($action ==
'PROPAL_CLOSE_SIGNED') {
277 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
279 if (empty($object->actionmsg2)) {
280 if (empty($object->context[
'actionmsg2'])) {
281 $object->actionmsg2 = $langs->transnoentities(
"PropalClosedSignedInDolibarr", $object->ref);
283 $object->actionmsg2 = $object->context[
'actionmsg2'];
286 if (empty($object->actionmsg)) {
287 $object->actionmsg = $langs->transnoentities(
"PropalClosedSignedInDolibarr", $object->ref);
290 $object->sendtoid = 0;
291 } elseif ($action ==
'PROPAL_CLASSIFY_BILLED') {
293 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
295 if (empty($object->actionmsg2)) {
296 if (empty($object->context[
'actionmsg2'])) {
297 $object->actionmsg2 = $langs->transnoentities(
"PropalClassifiedBilledInDolibarr", $object->ref);
299 $object->actionmsg2 = $object->context[
'actionmsg2'];
302 if (empty($object->actionmsg)) {
303 $object->actionmsg = $langs->transnoentities(
"PropalClassifiedBilledInDolibarr", $object->ref);
306 $object->sendtoid = 0;
307 } elseif ($action ==
'PROPAL_CLOSE_REFUSED') {
309 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
311 if (empty($object->actionmsg2)) {
312 if (empty($object->context[
'actionmsg2'])) {
313 $object->actionmsg2 = $langs->transnoentities(
"PropalClosedRefusedInDolibarr", $object->ref);
315 $object->actionmsg2 = $object->context[
'actionmsg2'];
318 if (empty($object->actionmsg)) {
319 $object->actionmsg = $langs->transnoentities(
"PropalClosedRefusedInDolibarr", $object->ref);
322 $object->sendtoid = 0;
323 } elseif ($action ==
'ORDER_VALIDATE') {
325 $langs->loadLangs(array(
"agenda",
"orders"));
327 if (empty($object->actionmsg2)) {
328 if (empty($object->context[
'actionmsg2'])) {
329 $object->actionmsg2 = $langs->transnoentities(
"OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
331 $object->actionmsg2 = $object->context[
'actionmsg2'];
334 if (empty($object->actionmsg)) {
335 $object->actionmsg = $langs->transnoentities(
"OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
338 $object->sendtoid = 0;
339 } elseif ($action ==
'ORDER_CLOSE') {
341 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
343 if (empty($object->actionmsg2)) {
344 if (empty($object->context[
'actionmsg2'])) {
345 $object->actionmsg2 = $langs->transnoentities(
"OrderDeliveredInDolibarr", $object->ref);
347 $object->actionmsg2 = $object->context[
'actionmsg2'];
350 if (empty($object->actionmsg)) {
351 $object->actionmsg = $langs->transnoentities(
"OrderDeliveredInDolibarr", $object->ref);
354 $object->sendtoid = 0;
355 } elseif ($action ==
'ORDER_CLASSIFY_BILLED') {
357 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
359 if (empty($object->actionmsg2)) {
360 if (empty($object->context[
'actionmsg2'])) {
361 $object->actionmsg2 = $langs->transnoentities(
"OrderBilledInDolibarr", $object->ref);
363 $object->actionmsg2 = $object->context[
'actionmsg2'];
366 if (empty($object->actionmsg)) {
367 $object->actionmsg = $langs->transnoentities(
"OrderBilledInDolibarr", $object->ref);
370 $object->sendtoid = 0;
371 } elseif ($action ==
'ORDER_CANCEL') {
373 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
375 if (empty($object->actionmsg2)) {
376 if (empty($object->context[
'actionmsg2'])) {
377 $object->actionmsg2 = $langs->transnoentities(
"OrderCanceledInDolibarr", $object->ref);
379 $object->actionmsg2 = $object->context[
'actionmsg2'];
382 if (empty($object->actionmsg)) {
383 $object->actionmsg = $langs->transnoentities(
"OrderCanceledInDolibarr", $object->ref);
386 $object->sendtoid = 0;
387 } elseif ($action ==
'ORDER_SENTBYMAIL') {
389 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
391 if (empty($object->actionmsg2)) {
392 if (empty($object->context[
'actionmsg2'])) {
393 $object->actionmsg2 = $langs->transnoentities(
"OrderSentByEMail", $object->ref);
395 $object->actionmsg2 = $object->context[
'actionmsg2'];
398 if (empty($object->actionmsg)) {
399 $object->actionmsg = $langs->transnoentities(
"OrderSentByEMail", $object->ref);
404 } elseif ($action ==
'BILL_VALIDATE') {
406 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
408 if (empty($object->actionmsg2)) {
409 if (empty($object->context[
'actionmsg2'])) {
410 $object->actionmsg2 = $langs->transnoentities(
"InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
412 $object->actionmsg2 = $object->context[
'actionmsg2'];
415 if (empty($object->actionmsg)) {
416 $object->actionmsg = $langs->transnoentities(
"InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
419 $object->sendtoid = 0;
420 } elseif ($action ==
'BILL_UNVALIDATE') {
422 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
424 if (empty($object->actionmsg2)) {
425 if (empty($object->context[
'actionmsg2'])) {
426 $object->actionmsg2 = $langs->transnoentities(
"InvoiceBackToDraftInDolibarr", $object->ref);
428 $object->actionmsg2 = $object->context[
'actionmsg2'];
431 if (empty($object->actionmsg)) {
432 $object->actionmsg = $langs->transnoentities(
"InvoiceBackToDraftInDolibarr", $object->ref);
435 $object->sendtoid = 0;
436 } elseif ($action ==
'BILL_SENTBYMAIL') {
438 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
440 if (empty($object->actionmsg2)) {
441 if (empty($object->context[
'actionmsg2'])) {
442 $object->actionmsg2 = $langs->transnoentities(
"InvoiceSentByEMail", $object->ref);
444 $object->actionmsg2 = $object->context[
'actionmsg2'];
447 if (empty($object->actionmsg)) {
448 $object->actionmsg = $langs->transnoentities(
"InvoiceSentByEMail", $object->ref);
453 } elseif ($action ==
'BILL_PAYED') {
455 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
458 if (empty($object->actionmsg2)) {
459 if (empty($object->context[
'actionmsg2'])) {
460 $object->actionmsg2 = $langs->transnoentities(
"InvoicePaidInDolibarr", $object->ref);
462 $object->actionmsg2 = $object->context[
'actionmsg2'];
465 if (empty($object->actionmsg)) {
466 $object->actionmsg = $langs->transnoentities(
"InvoicePaidInDolibarr", $object->ref);
469 $object->sendtoid = 0;
470 } elseif ($action ==
'BILL_CANCEL') {
472 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
474 if (empty($object->actionmsg2)) {
475 if (empty($object->context[
'actionmsg2'])) {
476 $object->actionmsg2 = $langs->transnoentities(
"InvoiceCanceledInDolibarr", $object->ref);
478 $object->actionmsg2 = $object->context[
'actionmsg2'];
481 if (empty($object->actionmsg)) {
482 $object->actionmsg = $langs->transnoentities(
"InvoiceCanceledInDolibarr", $object->ref);
485 $object->sendtoid = 0;
486 } elseif ($action ==
'FICHINTER_CREATE') {
488 $langs->loadLangs(array(
"agenda",
"other",
"interventions"));
490 if (empty($object->actionmsg2)) {
491 if (empty($object->context[
'actionmsg2'])) {
492 $object->actionmsg2 = $langs->transnoentities(
"InterventionCreatedInDolibarr", $object->ref);
494 $object->actionmsg2 = $object->context[
'actionmsg2'];
497 if (empty($object->actionmsg)) {
498 $object->actionmsg = $langs->transnoentities(
"InterventionCreatedInDolibarr", $object->ref);
501 $object->sendtoid = 0;
502 $object->fk_element = 0;
503 $object->elementtype =
'';
504 } elseif ($action ==
'FICHINTER_VALIDATE') {
506 $langs->loadLangs(array(
"agenda",
"other",
"interventions"));
508 if (empty($object->actionmsg2)) {
509 if (empty($object->context[
'actionmsg2'])) {
510 $object->actionmsg2 = $langs->transnoentities(
"InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
512 $object->actionmsg2 = $object->context[
'actionmsg2'];
515 if (empty($object->actionmsg)) {
516 $object->actionmsg = $langs->transnoentities(
"InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
519 $object->sendtoid = 0;
520 $object->fk_element = 0;
521 $object->elementtype =
'';
522 } elseif ($action ==
'FICHINTER_MODIFY') {
524 $langs->loadLangs(array(
"agenda",
"other",
"interventions"));
526 if (empty($object->actionmsg2)) {
527 if (empty($object->context[
'actionmsg2'])) {
528 $object->actionmsg2 = $langs->transnoentities(
"InterventionModifiedInDolibarr", $object->ref);
530 $object->actionmsg2 = $object->context[
'actionmsg2'];
533 if (empty($object->actionmsg)) {
534 $object->actionmsg = $langs->transnoentities(
"InterventionModifiedInDolibarr", $object->ref);
537 $object->sendtoid = 0;
538 $object->fk_element = 0;
539 $object->elementtype =
'';
540 } elseif ($action ==
'FICHINTER_SENTBYMAIL') {
542 $langs->loadLangs(array(
"agenda",
"other",
"interventions"));
544 if (empty($object->actionmsg2)) {
545 if (empty($object->context[
'actionmsg2'])) {
546 $object->actionmsg2 = $langs->transnoentities(
"InterventionSentByEMail", $object->ref);
548 $object->actionmsg2 = $object->context[
'actionmsg2'];
551 if (empty($object->actionmsg)) {
552 $object->actionmsg = $langs->transnoentities(
"InterventionSentByEMail", $object->ref);
557 } elseif ($action ==
'FICHINTER_CLASSIFY_BILLED') {
559 $langs->loadLangs(array(
"agenda",
"other",
"interventions"));
561 if (empty($object->actionmsg2)) {
562 if (empty($object->context[
'actionmsg2'])) {
563 $object->actionmsg2 = $langs->transnoentities(
"InterventionClassifiedBilledInDolibarr", $object->ref);
565 $object->actionmsg2 = $object->context[
'actionmsg2'];
568 if (empty($object->actionmsg)) {
569 $object->actionmsg = $langs->transnoentities(
"InterventionClassifiedBilledInDolibarr", $object->ref);
572 $object->sendtoid = 0;
573 } elseif ($action ==
'FICHINTER_CLASSIFY_UNBILLED') {
575 $langs->loadLangs(array(
"agenda",
"other",
"interventions"));
577 if (empty($object->actionmsg2)) {
578 if (empty($object->context[
'actionmsg2'])) {
579 $object->actionmsg2 = $langs->transnoentities(
"InterventionClassifiedUnbilledInDolibarr", $object->ref);
581 $object->actionmsg2 = $object->context[
'actionmsg2'];
584 if (empty($object->actionmsg)) {
585 $object->actionmsg = $langs->transnoentities(
"InterventionClassifiedUnbilledInDolibarr", $object->ref);
588 $object->sendtoid = 0;
589 } elseif ($action ==
'FICHINTER_CLOSE') {
591 $langs->loadLangs(array(
"agenda",
"other",
"interventions"));
593 if (empty($object->actionmsg2)) {
594 if (empty($object->context[
'actionmsg2'])) {
595 $object->actionmsg2 = $langs->transnoentities(
"InterventionClosedInDolibarr", $object->ref);
597 $object->actionmsg2 = $object->context[
'actionmsg2'];
600 if (empty($object->actionmsg)) {
601 $object->actionmsg = $langs->transnoentities(
"InterventionClosedInDolibarr", $object->ref);
604 $object->sendtoid = 0;
605 $object->fk_element = 0;
606 $object->elementtype =
'';
607 } elseif ($action ==
'FICHINTER_DELETE') {
609 $langs->loadLangs(array(
"agenda",
"other",
"interventions"));
611 if (empty($object->actionmsg2)) {
612 if (empty($object->context[
'actionmsg2'])) {
613 $object->actionmsg2 = $langs->transnoentities(
"InterventionDeletedInDolibarr", $object->ref);
615 $object->actionmsg2 = $object->context[
'actionmsg2'];
618 if (empty($object->actionmsg)) {
619 $object->actionmsg = $langs->transnoentities(
"InterventionDeletedInDolibarr", $object->ref);
622 $object->sendtoid = 0;
623 $object->fk_element = 0;
624 $object->elementtype =
'';
625 } elseif ($action ==
'SHIPPING_VALIDATE') {
627 $langs->loadLangs(array(
"agenda",
"other",
"sendings"));
629 if (empty($object->actionmsg2)) {
630 if (empty($object->context[
'actionmsg2'])) {
631 $object->actionmsg2 = $langs->transnoentities(
"ShippingValidated", ($object->newref ? $object->newref : $object->ref));
633 $object->actionmsg2 = $object->context[
'actionmsg2'];
636 if (empty($object->actionmsg)) {
637 $object->actionmsg = $langs->transnoentities(
"ShippingValidated", ($object->newref ? $object->newref : $object->ref));
642 } elseif ($action ==
'SHIPPING_SENTBYMAIL') {
644 $langs->loadLangs(array(
"agenda",
"other",
"sendings"));
646 if (empty($object->actionmsg2)) {
647 if (empty($object->context[
'actionmsg2'])) {
648 $object->actionmsg2 = $langs->transnoentities(
"ShippingSentByEMail", $object->ref);
650 $object->actionmsg2 = $object->context[
'actionmsg2'];
653 if (empty($object->actionmsg)) {
654 $object->actionmsg = $langs->transnoentities(
"ShippingSentByEMail", $object->ref);
659 } elseif ($action ==
'RECEPTION_VALIDATE') {
660 $langs->load(
"agenda");
661 $langs->load(
"other");
662 $langs->load(
"receptions");
664 if (empty($object->actionmsg2)) {
665 if (empty($object->context[
'actionmsg2'])) {
666 $object->actionmsg2 = $langs->transnoentities(
"ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
668 $object->actionmsg2 = $object->context[
'actionmsg2'];
671 if (empty($object->actionmsg)) {
672 $object->actionmsg = $langs->transnoentities(
"ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
677 } elseif ($action ==
'RECEPTION_SENTBYMAIL') {
678 $langs->load(
"agenda");
679 $langs->load(
"other");
680 $langs->load(
"receptions");
682 if (empty($object->actionmsg2)) {
683 if (empty($object->context[
'actionmsg2'])) {
684 $object->actionmsg2 = $langs->transnoentities(
"ReceptionSentByEMail", $object->ref);
686 $object->actionmsg2 = $object->context[
'actionmsg2'];
689 if (empty($object->actionmsg)) {
690 $object->actionmsg = $langs->transnoentities(
"ReceptionSentByEMail", $object->ref);
695 } elseif ($action ==
'PROPOSAL_SUPPLIER_VALIDATE') {
697 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
699 if (empty($object->actionmsg2)) {
700 if (empty($object->context[
'actionmsg2'])) {
701 $object->actionmsg2 = $langs->transnoentities(
"PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
703 $object->actionmsg2 = $object->context[
'actionmsg2'];
706 if (empty($object->actionmsg)) {
707 $object->actionmsg = $langs->transnoentities(
"PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
710 $object->sendtoid = 0;
711 } elseif ($action ==
'PROPOSAL_SUPPLIER_SENTBYMAIL') {
713 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
715 if (empty($object->actionmsg2)) {
716 if (empty($object->context[
'actionmsg2'])) {
717 $object->actionmsg2 = $langs->transnoentities(
"ProposalSentByEMail", $object->ref);
719 $object->actionmsg2 = $object->context[
'actionmsg2'];
722 if (empty($object->actionmsg)) {
723 $object->actionmsg = $langs->transnoentities(
"ProposalSentByEMail", $object->ref);
728 } elseif ($action ==
'PROPOSAL_SUPPLIER_CLOSE_SIGNED') {
730 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
732 if (empty($object->actionmsg2)) {
733 if (empty($object->context[
'actionmsg2'])) {
734 $object->actionmsg2 = $langs->transnoentities(
"PropalClosedSignedInDolibarr", $object->ref);
736 $object->actionmsg2 = $object->context[
'actionmsg2'];
739 if (empty($object->actionmsg)) {
740 $object->actionmsg = $langs->transnoentities(
"PropalClosedSignedInDolibarr", $object->ref);
743 $object->sendtoid = 0;
744 } elseif ($action ==
'PROPOSAL_SUPPLIER_CLOSE_REFUSED') {
746 $langs->loadLangs(array(
"agenda",
"other",
"propal"));
748 if (empty($object->actionmsg2)) {
749 if (empty($object->context[
'actionmsg2'])) {
750 $object->actionmsg2 = $langs->transnoentities(
"PropalClosedRefusedInDolibarr", $object->ref);
752 $object->actionmsg2 = $object->context[
'actionmsg2'];
755 if (empty($object->actionmsg)) {
756 $object->actionmsg = $langs->transnoentities(
"PropalClosedRefusedInDolibarr", $object->ref);
759 $object->sendtoid = 0;
760 } elseif ($action ==
'ORDER_SUPPLIER_CREATE') {
762 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
764 if (empty($object->actionmsg2)) {
765 if (empty($object->context[
'actionmsg2'])) {
766 $object->actionmsg2 = $langs->transnoentities(
"OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
768 $object->actionmsg2 = $object->context[
'actionmsg2'];
771 if (empty($object->actionmsg)) {
772 $object->actionmsg = $langs->transnoentities(
"OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
775 $object->sendtoid = 0;
776 } elseif ($action ==
'ORDER_SUPPLIER_VALIDATE') {
778 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
780 if (empty($object->actionmsg2)) {
781 if (empty($object->context[
'actionmsg2'])) {
782 $object->actionmsg2 = $langs->transnoentities(
"OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
784 $object->actionmsg2 = $object->context[
'actionmsg2'];
787 if (empty($object->actionmsg)) {
788 $object->actionmsg = $langs->transnoentities(
"OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
791 $object->sendtoid = 0;
792 } elseif ($action ==
'ORDER_SUPPLIER_APPROVE') {
794 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
796 if (empty($object->actionmsg2)) {
797 if (empty($object->context[
'actionmsg2'])) {
798 $object->actionmsg2 = $langs->transnoentities(
"OrderApprovedInDolibarr", $object->ref);
800 $object->actionmsg2 = $object->context[
'actionmsg2'];
803 if (empty($object->actionmsg)) {
804 $object->actionmsg = $langs->transnoentities(
"OrderApprovedInDolibarr", $object->ref);
807 $object->sendtoid = 0;
808 } elseif ($action ==
'ORDER_SUPPLIER_REFUSE') {
810 $langs->loadLangs(array(
"agenda",
"other",
"orders",
"main"));
812 if (empty($object->actionmsg2)) {
813 if (empty($object->context[
'actionmsg2'])) {
814 $object->actionmsg2 = $langs->transnoentities(
"OrderRefusedInDolibarr", $object->ref);
816 $object->actionmsg2 = $object->context[
'actionmsg2'];
819 if (empty($object->actionmsg)) {
820 $object->actionmsg = $langs->transnoentities(
"OrderRefusedInDolibarr", $object->ref);
823 if (!empty($object->refuse_note)) {
824 $object->actionmsg .=
'<br>';
825 $object->actionmsg .= $langs->trans(
"Reason") .
': '.$object->refuse_note;
828 $object->sendtoid = 0;
829 } elseif ($action ==
'ORDER_SUPPLIER_CANCEL') {
831 $langs->loadLangs(array(
"agenda",
"other",
"orders",
"main"));
833 if (empty($object->actionmsg2)) {
834 if (empty($object->context[
'actionmsg2'])) {
835 $object->actionmsg2 = $langs->transnoentities(
"OrderCanceledInDolibarr", $object->ref);
837 $object->actionmsg2 = $object->context[
'actionmsg2'];
840 if (empty($object->actionmsg)) {
841 $object->actionmsg = $langs->transnoentities(
"OrderCanceledInDolibarr", $object->ref);
844 if (!empty($object->cancel_note)) {
845 $object->actionmsg .=
'<br>';
846 $object->actionmsg .= $langs->trans(
"Reason") .
': '.$object->cancel_note;
849 $object->sendtoid = 0;
850 } elseif ($action ==
'ORDER_SUPPLIER_SUBMIT') {
852 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
854 if (empty($object->actionmsg2)) {
855 if (empty($object->context[
'actionmsg2'])) {
856 $object->actionmsg2 = $langs->transnoentities(
"SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
858 $object->actionmsg2 = $object->context[
'actionmsg2'];
861 if (empty($object->actionmsg)) {
862 $object->actionmsg = $langs->transnoentities(
"SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
865 if (!empty($object->context[
'comments'])) {
866 $object->actionmsg .=
'<br>';
867 $object->actionmsg .= $langs->trans(
"Comment") .
': '.$object->context[
'comments'];
870 $object->sendtoid = 0;
871 } elseif ($action ==
'ORDER_SUPPLIER_RECEIVE') {
873 $langs->loadLangs(array(
"agenda",
"other",
"orders"));
875 if (empty($object->actionmsg2)) {
876 if (empty($object->context[
'actionmsg2'])) {
877 $object->actionmsg2 = $langs->transnoentities(
"SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
879 $object->actionmsg2 = $object->context[
'actionmsg2'];
882 if (empty($object->actionmsg)) {
883 $object->actionmsg = $langs->transnoentities(
"SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
886 $object->sendtoid = 0;
887 } elseif ($action ==
'ORDER_SUPPLIER_SENTBYMAIL') {
889 $langs->loadLangs(array(
"agenda",
"other",
"bills",
"orders"));
891 if (empty($object->actionmsg2)) {
892 if (empty($object->context[
'actionmsg2'])) {
893 $object->actionmsg2 = $langs->transnoentities(
"SupplierOrderSentByEMail", $object->ref);
895 $object->actionmsg2 = $object->context[
'actionmsg2'];
898 if (empty($object->actionmsg)) {
899 $object->actionmsg = $langs->transnoentities(
"SupplierOrderSentByEMail", $object->ref);
904 } elseif ($action ==
'ORDER_SUPPLIER_CLASSIFY_BILLED') {
906 $langs->loadLangs(array(
"agenda",
"other",
"bills",
"orders"));
908 if (empty($object->actionmsg2)) {
909 if (empty($object->context[
'actionmsg2'])) {
910 $object->actionmsg2 = $langs->transnoentities(
"SupplierOrderClassifiedBilled", $object->ref);
912 $object->actionmsg2 = $object->context[
'actionmsg2'];
915 if (empty($object->actionmsg)) {
916 $object->actionmsg = $langs->transnoentities(
"SupplierOrderClassifiedBilled", $object->ref);
919 $object->sendtoid = 0;
920 } elseif ($action ==
'BILL_SUPPLIER_VALIDATE') {
922 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
924 if (empty($object->actionmsg2)) {
925 if (empty($object->context[
'actionmsg2'])) {
926 $object->actionmsg2 = $langs->transnoentities(
"InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
928 $object->actionmsg2 = $object->context[
'actionmsg2'];
931 if (empty($object->actionmsg)) {
932 $object->actionmsg = $langs->transnoentities(
"InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
935 $object->sendtoid = 0;
936 } elseif ($action ==
'BILL_SUPPLIER_UNVALIDATE') {
938 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
940 if (empty($object->actionmsg2)) {
941 if (empty($object->context[
'actionmsg2'])) {
942 $object->actionmsg2 = $langs->transnoentities(
"InvoiceBackToDraftInDolibarr", $object->ref);
944 $object->actionmsg2 = $object->context[
'actionmsg2'];
947 if (empty($object->actionmsg)) {
948 $object->actionmsg = $langs->transnoentities(
"InvoiceBackToDraftInDolibarr", $object->ref);
951 $object->sendtoid = 0;
952 } elseif ($action ==
'BILL_SUPPLIER_SENTBYMAIL') {
954 $langs->loadLangs(array(
"agenda",
"other",
"bills",
"orders"));
956 if (empty($object->actionmsg2)) {
957 if (empty($object->context[
'actionmsg2'])) {
958 $object->actionmsg2 = $langs->transnoentities(
"SupplierInvoiceSentByEMail", $object->ref);
960 $object->actionmsg2 = $object->context[
'actionmsg2'];
963 if (empty($object->actionmsg)) {
964 $object->actionmsg = $langs->transnoentities(
"SupplierInvoiceSentByEMail", $object->ref);
969 } elseif ($action ==
'BILL_SUPPLIER_PAYED') {
971 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
973 if (empty($object->actionmsg2)) {
974 if (empty($object->context[
'actionmsg2'])) {
975 $object->actionmsg2 = $langs->transnoentities(
"InvoicePaidInDolibarr", $object->ref);
977 $object->actionmsg2 = $object->context[
'actionmsg2'];
980 if (empty($object->actionmsg)) {
981 $object->actionmsg = $langs->transnoentities(
"InvoicePaidInDolibarr", $object->ref);
984 $object->sendtoid = 0;
985 } elseif ($action ==
'BILL_SUPPLIER_CANCELED') {
987 $langs->loadLangs(array(
"agenda",
"other",
"bills"));
989 if (empty($object->actionmsg2)) {
990 if (empty($object->context[
'actionmsg2'])) {
991 $object->actionmsg2 = $langs->transnoentities(
"InvoiceCanceledInDolibarr", $object->ref);
993 $object->actionmsg2 = $object->context[
'actionmsg2'];
996 if (empty($object->actionmsg)) {
997 $object->actionmsg = $langs->transnoentities(
"InvoiceCanceledInDolibarr", $object->ref);
1000 $object->sendtoid = 0;
1001 } elseif ($action ==
'MEMBER_VALIDATE') {
1004 $langs->loadLangs(array(
"agenda",
"other",
"members"));
1006 if (empty($object->actionmsg2)) {
1007 if (empty($object->context[
'actionmsg2'])) {
1008 $object->actionmsg2 = $langs->transnoentities(
"MemberValidatedInDolibarr", $object->getFullName($langs));
1010 $object->actionmsg2 = $object->context[
'actionmsg2'];
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;
1019 $object->sendtoid = 0;
1020 } elseif ($action ==
'MEMBER_MODIFY') {
1022 $langs->loadLangs(array(
"agenda",
"other",
"members"));
1024 if (empty($object->actionmsg2)) {
1025 if (empty($object->context[
'actionmsg2'])) {
1026 $object->actionmsg2 = $langs->transnoentities(
"MemberModifiedInDolibarr", $object->getFullName($langs));
1028 $object->actionmsg2 = $object->context[
'actionmsg2'];
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;
1037 $object->sendtoid = 0;
1038 } elseif ($action ==
'MEMBER_SUBSCRIPTION_CREATE') {
1040 $langs->loadLangs(array(
"agenda",
"other",
"members"));
1042 $member = (isset($object->context[
'member']) ? $object->context[
'member'] :
null);
1043 if (!is_object($member)) {
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';
1047 $member->fetch($object->fk_adherent);
1050 if (empty($object->actionmsg2)) {
1051 if (empty($object->context[
'actionmsg2'])) {
1052 $object->actionmsg2 = $langs->transnoentities(
"MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
1054 $object->actionmsg2 = $object->context[
'actionmsg2'];
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');
1065 $object->sendtoid = 0;
1066 if (isset($object->fk_soc) && $object->fk_soc > 0) {
1067 $object->socid = $object->fk_soc;
1069 } elseif ($action ==
'MEMBER_SUBSCRIPTION_MODIFY') {
1071 $langs->loadLangs(array(
"agenda",
"other",
"members"));
1073 $member = $object->context[
'member'];
1074 if (!is_object($member)) {
1075 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
1077 $member->fetch($object->fk_adherent);
1080 if (empty($object->actionmsg2)) {
1081 if (empty($object->context[
'actionmsg2'])) {
1082 $object->actionmsg2 = $langs->transnoentities(
"MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
1084 $object->actionmsg2 = $object->context[
'actionmsg2'];
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');
1095 $object->sendtoid = 0;
1096 if (isset($object->fk_soc) && $object->fk_soc > 0) {
1097 $object->socid = $object->fk_soc;
1099 } elseif ($action ==
'MEMBER_SUBSCRIPTION_DELETE') {
1101 $langs->loadLangs(array(
"agenda",
"other",
"members"));
1103 $member = $object->context[
'member'];
1104 if (!is_object($member)) {
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';
1108 $member->fetch($object->fk_adherent);
1111 if (empty($object->actionmsg2)) {
1112 if (empty($object->context[
'actionmsg2'])) {
1113 $object->actionmsg2 = $langs->transnoentities(
"MemberSubscriptionDeletedInDolibarr", $object->ref, $member->getFullName($langs));
1115 $object->actionmsg2 = $object->context[
'actionmsg2'];
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');
1126 $object->sendtoid = 0;
1127 if (isset($object->fk_soc) && $object->fk_soc > 0) {
1128 $object->socid = $object->fk_soc;
1130 } elseif ($action ==
'MEMBER_RESILIATE') {
1132 $langs->loadLangs(array(
"agenda",
"other",
"members"));
1134 if (empty($object->actionmsg2)) {
1135 if (empty($object->context[
'actionmsg2'])) {
1136 $object->actionmsg2 = $langs->transnoentities(
"MemberResiliatedInDolibarr", $object->getFullName($langs));
1138 $object->actionmsg2 = $object->context[
'actionmsg2'];
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;
1147 $object->sendtoid = 0;
1148 } elseif ($action ==
'MEMBER_DELETE') {
1150 $langs->loadLangs(array(
"agenda",
"other",
"members"));
1152 if (empty($object->actionmsg2)) {
1153 if (empty($object->context[
'actionmsg2'])) {
1154 $object->actionmsg2 = $langs->transnoentities(
"MemberDeletedInDolibarr", $object->getFullName($langs));
1156 $object->actionmsg2 = $object->context[
'actionmsg2'];
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;
1165 $object->sendtoid = 0;
1166 } elseif ($action ==
'MEMBER_EXCLUDE') {
1168 $langs->loadLangs(array(
"agenda",
"other",
"members"));
1170 if (empty($object->actionmsg2)) {
1171 if (empty($object->context[
'actionmsg2'])) {
1172 $object->actionmsg2 = $langs->transnoentities(
"MemberExcludedInDolibarr", $object->getFullName($langs));
1174 $object->actionmsg2 = $object->context[
'actionmsg2'];
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;
1183 $object->sendtoid = 0;
1184 } elseif ($action ==
'PROJECT_CREATE') {
1187 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1189 if (empty($object->actionmsg2)) {
1190 if (empty($object->context[
'actionmsg2'])) {
1191 $object->actionmsg2 = $langs->transnoentities(
"ProjectCreatedInDolibarr", $object->ref);
1193 $object->actionmsg2 = $object->context[
'actionmsg2'];
1196 if (empty($object->actionmsg)) {
1197 $object->actionmsg = $langs->transnoentities(
"ProjectCreatedInDolibarr", $object->ref);
1198 $object->actionmsg .=
"\n".$langs->transnoentities(
"Project").
': '.$object->ref;
1201 $object->sendtoid = 0;
1202 } elseif ($action ==
'PROJECT_VALIDATE') {
1204 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1206 if (empty($object->actionmsg2)) {
1207 if (empty($object->context[
'actionmsg2'])) {
1208 $object->actionmsg2 = $langs->transnoentities(
"ProjectValidatedInDolibarr", $object->ref);
1210 $object->actionmsg2 = $object->context[
'actionmsg2'];
1213 if (empty($object->actionmsg)) {
1214 $object->actionmsg = $langs->transnoentities(
"ProjectValidatedInDolibarr", $object->ref);
1215 $object->actionmsg .=
"\n".$langs->transnoentities(
"Project").
': '.$object->ref;
1218 $object->sendtoid = 0;
1219 } elseif ($action ==
'PROJECT_MODIFY') {
1221 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1223 if (empty($object->actionmsg2)) {
1224 if (empty($object->context[
'actionmsg2'])) {
1225 $object->actionmsg2 = $langs->transnoentities(
"ProjectModifiedInDolibarr", $object->ref);
1227 $object->actionmsg2 = $object->context[
'actionmsg2'];
1230 if (empty($object->actionmsg)) {
1231 $object->actionmsg = $langs->transnoentities(
"ProjectModifiedInDolibarr", $object->ref);
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;
1239 $object->sendtoid = 0;
1240 } elseif ($action ==
'PROJECT_SENTBYMAIL') {
1242 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1244 if (empty($object->actionmsg2)) {
1245 if (empty($object->context[
'actionmsg2'])) {
1246 $object->actionmsg2 = $langs->transnoentities(
"ProjectSentByEMail", $object->ref);
1248 $object->actionmsg2 = $object->context[
'actionmsg2'];
1251 if (empty($object->actionmsg)) {
1252 $object->actionmsg = $langs->transnoentities(
"ProjectSentByEMail", $object->ref);
1257 } elseif ($action ==
'PROJECT_DELETE') {
1259 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1261 if (empty($object->actionmsg2)) {
1262 $object->actionmsg2 = $langs->transnoentities(
"ProjectDeletedInDolibarr", $object->ref);
1264 $object->actionmsg = $langs->transnoentities(
"ProjectDeletedInDolibarr", $object->ref);
1266 $object->sendtoid = 0;
1267 } elseif ($action ==
'PROJECT_CLOSE') {
1269 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1271 if (empty($object->actionmsg2)) {
1272 if (empty($object->context[
'actionmsg2'])) {
1273 $object->actionmsg2 = $langs->transnoentities(
"ProjectClosedInDolibarr", $object->ref);
1275 $object->actionmsg2 = $object->context[
'actionmsg2'];
1278 if (empty($object->actionmsg)) {
1279 $object->actionmsg = $langs->transnoentities(
"ProjectClosedInDolibarr", $object->ref);
1282 $object->sendtoid = 0;
1283 } elseif ($action ==
'TASK_CREATE') {
1286 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1288 if (empty($object->actionmsg2)) {
1289 if (empty($object->context[
'actionmsg2'])) {
1290 $object->actionmsg2 = $langs->transnoentities(
"TaskCreatedInDolibarr", $object->ref);
1292 $object->actionmsg2 = $object->context[
'actionmsg2'];
1295 if (empty($object->actionmsg)) {
1296 $object->actionmsg = $langs->transnoentities(
"TaskCreatedInDolibarr", $object->ref);
1297 $object->actionmsg .=
"\n".$langs->transnoentities(
"Task").
': '.$object->ref;
1300 $object->sendtoid = 0;
1301 } elseif ($action ==
'TASK_MODIFY') {
1303 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1305 if (empty($object->actionmsg2)) {
1306 if (empty($object->context[
'actionmsg2'])) {
1307 $object->actionmsg2 = $langs->transnoentities(
"TaskModifiedInDolibarr", $object->ref);
1309 $object->actionmsg2 = $object->context[
'actionmsg2'];
1312 if (empty($object->actionmsg)) {
1313 $object->actionmsg = $langs->transnoentities(
"TaskModifieddInDolibarr", $object->ref);
1314 $object->actionmsg .=
"\n".$langs->transnoentities(
"Task").
': '.$object->ref;
1317 $object->sendtoid = 0;
1318 } elseif ($action ==
'TASK_DELETE') {
1320 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1322 if (empty($object->actionmsg2)) {
1323 if (empty($object->context[
'actionmsg2'])) {
1324 $object->actionmsg2 = $langs->transnoentities(
"TaskDeletedInDolibarr", $object->ref);
1326 $object->actionmsg2 = $object->context[
'actionmsg2'];
1329 if (empty($object->actionmsg)) {
1330 $object->actionmsg = $langs->transnoentities(
"TaskDeletedInDolibarr", $object->ref);
1331 $object->actionmsg .=
"\n".$langs->transnoentities(
"Task").
': '.$object->ref;
1334 $object->sendtoid = 0;
1335 } elseif ($action ==
'TICKET_ASSIGNED') {
1337 $langs->loadLangs(array(
"agenda",
"other",
"projects"));
1339 if (empty($object->actionmsg2)) {
1340 if (empty($object->context[
'actionmsg2'])) {
1341 $object->actionmsg2 = $langs->transnoentities(
"TICKET_ASSIGNEDInDolibarr", $object->ref);
1343 $object->actionmsg2 = $object->context[
'actionmsg2'];
1346 if (empty($object->actionmsg)) {
1347 $object->actionmsg = $langs->transnoentities(
"TICKET_ASSIGNEDInDolibarr", $object->ref);
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);
1355 $object->actionmsg .=
"\n".$langs->transnoentities(
"OldUser").
': '.$langs->trans(
"None");
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);
1362 $object->actionmsg .=
"\n".$langs->transnoentities(
"NewUser").
': '.$langs->trans(
"None");
1365 $object->sendtoid = 0;
1372 if (!empty($object->context[
'actionmsg']) && empty($object->actionmsg)) {
1373 $object->actionmsg = $object->context[
'actionmsg'];
1375 if (!empty($object->context[
'actionmsg2']) && empty($object->actionmsg2)) {
1376 $object->actionmsg2 = $object->context[
'actionmsg2'];
1379 if (empty($object->actionmsg2)) {
1381 $langs->loadLangs(array(
"agenda",
"other"));
1382 if ($langs->transnoentities($action.
"InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)) != $action.
"InDolibarr") {
1383 $object->actionmsg2 = $langs->transnoentities($action.
"InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
1385 $tmp = explode(
'_', $action);
1386 $object->actionmsg2 = $langs->transnoentities($tmp[count($tmp) - 1].
"InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
1389 if (empty($object->actionmsg)) {
1391 $langs->loadLangs(array(
"agenda",
"other"));
1392 if ($langs->transnoentities($action.
"InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)) != $action.
"InDolibarr") {
1393 $object->actionmsg = $langs->transnoentities($action.
"InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
1395 $tmp = explode(
'_', $action);
1396 $object->actionmsg = $langs->transnoentities($tmp[count($tmp) - 1].
"InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
1398 if (isModEnabled(
'multicompany') && property_exists($object,
'entity') && $object->entity > 1) {
1399 $object->actionmsg .=
' ('.$langs->trans(
"Entity").
' '.$object->entity.
')';
1403 if (!isset($object->sendtoid) || !is_array($object->sendtoid)) {
1404 $object->sendtoid = 0;
1410 if (empty($object->trackid)) {
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;
1451 $object->trackid =
'';
1455 dol_syslog(
"Trigger '".$this->
name.
"' for action '".$action.
"' launched by ".__FILE__.
". id=".$object->id);
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);
1467 $societeforactionid = 0;
1468 $contactforactionid = 0;
1471 if (is_array($object->sendtoid)) {
1472 if (count($object->sendtoid) == 1) {
1473 $contactforactionid = reset($object->sendtoid);
1476 if ($object->sendtoid > 0) {
1477 $contactforactionid = $object->sendtoid;
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;
1489 $projectid = isset($object->fk_project) ? $object->fk_project : 0;
1490 if ($object->element ==
'project') {
1491 $projectid = $object->id;
1494 $elementid = $object->id;
1495 $elementtype = $object->element;
1496 $elementmodule = (empty($object->module) ?
'' : $object->module);
1497 if ($object->element ==
'subscription') {
1498 $elementid = $object->fk_adherent;
1499 $elementtype =
'member';
1504 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
1506 $actioncomm->type_code = $object->actiontypecode;
1507 $actioncomm->code =
'AC_'.$action;
1508 $actioncomm->label = $object->actionmsg2;
1509 $actioncomm->note_private = $object->actionmsg;
1510 $actioncomm->fk_project = $projectid;
1511 $actioncomm->datep = $now;
1512 $actioncomm->datef = $now;
1513 $actioncomm->durationp = 0;
1514 $actioncomm->percentage = -1;
1515 $actioncomm->socid = $societeforactionid;
1516 $actioncomm->contact_id = $contactforactionid;
1517 $actioncomm->authorid = $user->id;
1518 $actioncomm->userownerid = $user->id;
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;
1533 if (!in_array($elementtype, array(
'societe',
'contact',
'project'))) {
1534 $actioncomm->fk_element = $elementid;
1535 $actioncomm->elementtype = $elementtype.($elementmodule ?
'@'.$elementmodule :
'');
1538 if (property_exists($object,
'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) {
1539 $actioncomm->attachedfiles = $object->attachedfiles;
1541 if (property_exists($object,
'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid) > 0) {
1542 $actioncomm->userassigned = $object->sendtouserid;
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;
1550 $ret = $actioncomm->create($user);
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];
1559 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1567 unset($object->context[
'actionmsg']);
1568 unset($object->context[
'actionmsg2']);
1569 unset($object->actionmsg);
1570 unset($object->actionmsg2);
1571 unset($object->actiontypecode);
1574 $_SESSION[
'LAST_ACTION_CREATED'] = $ret;
1577 $this->error =
"Failed to insert event : ".$actioncomm->error.
" ".join(
',', $actioncomm->errors);
1578 $this->errors = $actioncomm->errors;
1580 dol_syslog(
"interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);