@@ -88,19 +88,19 @@ discard block |
||
88 | 88 | $yearref = dol_print_date($gmtnow, '%Y'); |
89 | 89 | $monthref = dol_print_date($gmtnow, '%m'); |
90 | 90 | $dayref = dol_print_date($gmtnow, '%d'); |
91 | - if ($refgmtdate == 'now') |
|
92 | - $newrefgmtdate = $yearref . '-' . $monthref . '-' . $dayref; |
|
93 | - elseif ($refgmtdate == 'summer') |
|
94 | - $newrefgmtdate = $yearref . '-08-01'; |
|
95 | - else |
|
96 | - $newrefgmtdate = $yearref . '-01-01'; |
|
91 | + if ($refgmtdate == 'now') { |
|
92 | + $newrefgmtdate = $yearref . '-' . $monthref . '-' . $dayref; |
|
93 | + } elseif ($refgmtdate == 'summer') { |
|
94 | + $newrefgmtdate = $yearref . '-08-01'; |
|
95 | + } else { |
|
96 | + $newrefgmtdate = $yearref . '-01-01'; |
|
97 | + } |
|
97 | 98 | $newrefgmtdate .= 'T00:00:00+00:00'; |
98 | 99 | $localtz = new DateTimeZone(getServerTimeZoneString()); |
99 | 100 | $localdt = new DateTime($newrefgmtdate, $localtz); |
100 | 101 | $tmp = -1 * $localtz->getOffset($localdt); |
101 | 102 | //print $refgmtdate.'='.$tmp; |
102 | - } |
|
103 | - else { |
|
103 | + } else { |
|
104 | 104 | $tmp = 0; |
105 | 105 | dol_print_error('', 'PHP version must be 5.3+'); |
106 | 106 | } |
@@ -120,12 +120,15 @@ discard block |
||
120 | 120 | { |
121 | 121 | global $conf; |
122 | 122 | |
123 | - if ($duration_value == 0) |
|
124 | - return $time; |
|
125 | - if ($duration_unit == 'h') |
|
126 | - return $time + (3600 * $duration_value); |
|
127 | - if ($duration_unit == 'w') |
|
128 | - return $time + (3600 * 24 * 7 * $duration_value); |
|
123 | + if ($duration_value == 0) { |
|
124 | + return $time; |
|
125 | + } |
|
126 | + if ($duration_unit == 'h') { |
|
127 | + return $time + (3600 * $duration_value); |
|
128 | + } |
|
129 | + if ($duration_unit == 'w') { |
|
130 | + return $time + (3600 * 24 * 7 * $duration_value); |
|
131 | + } |
|
129 | 132 | |
130 | 133 | $deltastring = 'P'; |
131 | 134 | |
@@ -148,15 +151,17 @@ discard block |
||
148 | 151 | } |
149 | 152 | |
150 | 153 | $date = new DateTime(); |
151 | - if (!empty($conf->global->MAIN_DATE_IN_MEMORY_ARE_GMT)) |
|
152 | - $date->setTimezone(new DateTimeZone('UTC')); |
|
154 | + if (!empty($conf->global->MAIN_DATE_IN_MEMORY_ARE_GMT)) { |
|
155 | + $date->setTimezone(new DateTimeZone('UTC')); |
|
156 | + } |
|
153 | 157 | $date->setTimestamp($time); |
154 | 158 | $interval = new DateInterval($deltastring); |
155 | 159 | |
156 | - if ($sub) |
|
157 | - $date->sub($interval); |
|
158 | - else |
|
159 | - $date->add($interval); |
|
160 | + if ($sub) { |
|
161 | + $date->sub($interval); |
|
162 | + } else { |
|
163 | + $date->add($interval); |
|
164 | + } |
|
160 | 165 | |
161 | 166 | return $date->getTimestamp(); |
162 | 167 | } |
@@ -200,14 +205,20 @@ discard block |
||
200 | 205 | { |
201 | 206 | global $langs; |
202 | 207 | |
203 | - if (empty($lengthOfDay)) |
|
204 | - $lengthOfDay = 86400; // 1 day = 24 hours |
|
205 | - if (empty($lengthOfWeek)) |
|
206 | - $lengthOfWeek = 7; // 1 week = 7 days |
|
208 | + if (empty($lengthOfDay)) { |
|
209 | + $lengthOfDay = 86400; |
|
210 | + } |
|
211 | + // 1 day = 24 hours |
|
212 | + if (empty($lengthOfWeek)) { |
|
213 | + $lengthOfWeek = 7; |
|
214 | + } |
|
215 | + // 1 week = 7 days |
|
207 | 216 | |
208 | 217 | if ($format == 'all' || $format == 'allwithouthour' || $format == 'allhour' || $format == 'allhourmin') { |
209 | - if ((int) $iSecond === 0) |
|
210 | - return '0'; // This is to avoid having 0 return a 12:00 AM for en_US |
|
218 | + if ((int) $iSecond === 0) { |
|
219 | + return '0'; |
|
220 | + } |
|
221 | + // This is to avoid having 0 return a 12:00 AM for en_US |
|
211 | 222 | |
212 | 223 | $sTime = ''; |
213 | 224 | $sDay = 0; |
@@ -219,8 +230,9 @@ discard block |
||
219 | 230 | $iSecond -= $lengthOfDay; |
220 | 231 | } |
221 | 232 | $dayTranslate = $langs->trans("Day"); |
222 | - if ($iSecond >= ($lengthOfDay * 2)) |
|
223 | - $dayTranslate = $langs->trans("Days"); |
|
233 | + if ($iSecond >= ($lengthOfDay * 2)) { |
|
234 | + $dayTranslate = $langs->trans("Days"); |
|
235 | + } |
|
224 | 236 | } |
225 | 237 | |
226 | 238 | if ($lengthOfWeek < 7) { |
@@ -229,16 +241,18 @@ discard block |
||
229 | 241 | $sWeek = (int) (($sDay - $sDay % $lengthOfWeek ) / $lengthOfWeek); |
230 | 242 | $sDay = $sDay % $lengthOfWeek; |
231 | 243 | $weekTranslate = $langs->trans("DurationWeek"); |
232 | - if ($sWeek >= 2) |
|
233 | - $weekTranslate = $langs->trans("DurationWeeks"); |
|
244 | + if ($sWeek >= 2) { |
|
245 | + $weekTranslate = $langs->trans("DurationWeeks"); |
|
246 | + } |
|
234 | 247 | $sTime .= $sWeek . ' ' . $weekTranslate . ' '; |
235 | 248 | } |
236 | 249 | } |
237 | 250 | } |
238 | 251 | if ($sDay > 0) { |
239 | 252 | $dayTranslate = $langs->trans("Day"); |
240 | - if ($sDay > 1) |
|
241 | - $dayTranslate = $langs->trans("Days"); |
|
253 | + if ($sDay > 1) { |
|
254 | + $dayTranslate = $langs->trans("Days"); |
|
255 | + } |
|
242 | 256 | $sTime .= $sDay . ' ' . $dayTranslate . ' '; |
243 | 257 | } |
244 | 258 | |
@@ -294,8 +308,9 @@ discard block |
||
294 | 308 | } else if ($year_date > 0 && !empty($day_date)) { |
295 | 309 | $sqldate .= " AND " . $datefield . " BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month_date, $day_date, $year_date)); |
296 | 310 | $sqldate .= "' AND '" . $db->idate(dol_mktime(23, 59, 59, $month_date, $day_date, $year_date)) . "'"; |
297 | - } else |
|
298 | - $sqldate .= " AND date_format( " . $datefield . ", '%m') = '" . $db->escape($month_date) . "'"; |
|
311 | + } else { |
|
312 | + $sqldate .= " AND date_format( " . $datefield . ", '%m') = '" . $db->escape($month_date) . "'"; |
|
313 | + } |
|
299 | 314 | } else if ($year_date > 0) { |
300 | 315 | $sqldate .= " AND " . $datefield . " BETWEEN '" . $db->idate(dol_get_first_day($year_date, 1, false)); |
301 | 316 | $sqldate .= "' AND '" . $db->idate(dol_get_last_day($year_date, 12, false)) . "'"; |
@@ -334,13 +349,14 @@ discard block |
||
334 | 349 | $shour = $reg[4]; |
335 | 350 | $smin = $reg[5]; |
336 | 351 | $ssec = $reg[6]; |
337 | - if ($syear < 50) |
|
338 | - $syear += 1900; |
|
339 | - if ($syear >= 50 && $syear < 100) |
|
340 | - $syear += 2000; |
|
352 | + if ($syear < 50) { |
|
353 | + $syear += 1900; |
|
354 | + } |
|
355 | + if ($syear >= 50 && $syear < 100) { |
|
356 | + $syear += 2000; |
|
357 | + } |
|
341 | 358 | $string = sprintf("%04d%02d%02d%02d%02d%02d", $syear, $smonth, $sday, $shour, $smin, $ssec); |
342 | - } |
|
343 | - else if ( |
|
359 | + } else if ( |
|
344 | 360 | preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$/i', $string, $reg) // Convert date with format YYYY-MM-DDTHH:MM:SSZ (RFC3339) |
345 | 361 | || preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/i', $string, $reg) // Convert date with format YYYY-MM-DD HH:MM:SS |
346 | 362 | || preg_match('/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z$/i', $string, $reg) // Convert date with format YYYYMMDDTHHMMSSZ |
@@ -474,8 +490,9 @@ discard block |
||
474 | 490 | */ |
475 | 491 | function dol_get_first_day($year, $month = 1, $gm = false) |
476 | 492 | { |
477 | - if ($year > 9999) |
|
478 | - return ''; |
|
493 | + if ($year > 9999) { |
|
494 | + return ''; |
|
495 | + } |
|
479 | 496 | return dol_mktime(0, 0, 0, $month, 1, $year, $gm); |
480 | 497 | } |
481 | 498 | |
@@ -488,8 +505,9 @@ discard block |
||
488 | 505 | */ |
489 | 506 | function dol_get_last_day($year, $month = 12, $gm = false) |
490 | 507 | { |
491 | - if ($year > 9999) |
|
492 | - return ''; |
|
508 | + if ($year > 9999) { |
|
509 | + return ''; |
|
510 | + } |
|
493 | 511 | if ($month == 12) { |
494 | 512 | $month = 1; |
495 | 513 | $year += 1; |
@@ -525,8 +543,9 @@ discard block |
||
525 | 543 | $tmparray = dol_getdate($date, true); // detail of current day |
526 | 544 | //Calculate days = offset from current day |
527 | 545 | $days = $start_week - $tmparray['wday']; |
528 | - if ($days >= 1) |
|
529 | - $days = 7 - $days; |
|
546 | + if ($days >= 1) { |
|
547 | + $days = 7 - $days; |
|
548 | + } |
|
530 | 549 | $days = abs($days); |
531 | 550 | $seconds = $days * 24 * 60 * 60; |
532 | 551 | //print 'start_week='.$start_week.' tmparray[wday]='.$tmparray['wday'].' day offset='.$days.' seconds offset='.$seconds.'<br>'; |
@@ -590,8 +609,9 @@ discard block |
||
590 | 609 | $nbFerie = 0; |
591 | 610 | |
592 | 611 | // Check to ensure we use correct parameters |
593 | - if ((($timestampEnd - $timestampStart) % 86400) != 0) |
|
594 | - return 'ErrorDates must use same hours and must be GMT dates'; |
|
612 | + if ((($timestampEnd - $timestampStart) % 86400) != 0) { |
|
613 | + return 'ErrorDates must use same hours and must be GMT dates'; |
|
614 | + } |
|
595 | 615 | |
596 | 616 | $i = 0; |
597 | 617 | while (( ($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd) ) && ($i < 50000)) { // Loop end when equals (Test on i is a security loop to avoid infinite loop) |
@@ -610,12 +630,13 @@ discard block |
||
610 | 630 | foreach ($arrayofdaystring as $daystring) { |
611 | 631 | $tmp = explode('-', $daystring); |
612 | 632 | if ($tmp[2]) { |
613 | - if ($tmp[0] == $annee && $tmp[1] == $mois && $tmp[2] == $jour) |
|
614 | - $ferie = true; |
|
615 | - } |
|
616 | - else { |
|
617 | - if ($tmp[0] == $mois && $tmp[1] == $jour) |
|
618 | - $ferie = true; |
|
633 | + if ($tmp[0] == $annee && $tmp[1] == $mois && $tmp[2] == $jour) { |
|
634 | + $ferie = true; |
|
635 | + } |
|
636 | + } else { |
|
637 | + if ($tmp[0] == $mois && $tmp[1] == $jour) { |
|
638 | + $ferie = true; |
|
639 | + } |
|
619 | 640 | } |
620 | 641 | } |
621 | 642 | } |
@@ -624,22 +645,38 @@ discard block |
||
624 | 645 | $countryfound = 1; |
625 | 646 | |
626 | 647 | // Definition of fixed working days |
627 | - if ($jour == 1 && $mois == 1) |
|
628 | - $ferie = true; // 1er january |
|
629 | - if ($jour == 1 && $mois == 5) |
|
630 | - $ferie = true; // 1er may |
|
631 | - if ($jour == 8 && $mois == 5) |
|
632 | - $ferie = true; // 5 may |
|
633 | - if ($jour == 14 && $mois == 7) |
|
634 | - $ferie = true; // 14 july |
|
635 | - if ($jour == 15 && $mois == 8) |
|
636 | - $ferie = true; // 15 august |
|
637 | - if ($jour == 1 && $mois == 11) |
|
638 | - $ferie = true; // 1 november |
|
639 | - if ($jour == 11 && $mois == 11) |
|
640 | - $ferie = true; // 11 november |
|
641 | - if ($jour == 25 && $mois == 12) |
|
642 | - $ferie = true; // 25 december |
|
648 | + if ($jour == 1 && $mois == 1) { |
|
649 | + $ferie = true; |
|
650 | + } |
|
651 | + // 1er january |
|
652 | + if ($jour == 1 && $mois == 5) { |
|
653 | + $ferie = true; |
|
654 | + } |
|
655 | + // 1er may |
|
656 | + if ($jour == 8 && $mois == 5) { |
|
657 | + $ferie = true; |
|
658 | + } |
|
659 | + // 5 may |
|
660 | + if ($jour == 14 && $mois == 7) { |
|
661 | + $ferie = true; |
|
662 | + } |
|
663 | + // 14 july |
|
664 | + if ($jour == 15 && $mois == 8) { |
|
665 | + $ferie = true; |
|
666 | + } |
|
667 | + // 15 august |
|
668 | + if ($jour == 1 && $mois == 11) { |
|
669 | + $ferie = true; |
|
670 | + } |
|
671 | + // 1 november |
|
672 | + if ($jour == 11 && $mois == 11) { |
|
673 | + $ferie = true; |
|
674 | + } |
|
675 | + // 11 november |
|
676 | + if ($jour == 25 && $mois == 12) { |
|
677 | + $ferie = true; |
|
678 | + } |
|
679 | + // 25 december |
|
643 | 680 | |
644 | 681 | |
645 | 682 | |
@@ -647,8 +684,9 @@ discard block |
||
647 | 684 | $date_paques = easter_date($annee); |
648 | 685 | $jour_paques = date("d", $date_paques); |
649 | 686 | $mois_paques = date("m", $date_paques); |
650 | - if ($jour_paques == $jour && $mois_paques == $mois) |
|
651 | - $ferie = true; |
|
687 | + if ($jour_paques == $jour && $mois_paques == $mois) { |
|
688 | + $ferie = true; |
|
689 | + } |
|
652 | 690 | // Pâques |
653 | 691 | // Calculation for the monday of easter date |
654 | 692 | $date_lundi_paques = mktime( |
@@ -656,8 +694,9 @@ discard block |
||
656 | 694 | ); |
657 | 695 | $jour_lundi_ascension = date("d", $date_lundi_paques); |
658 | 696 | $mois_lundi_ascension = date("m", $date_lundi_paques); |
659 | - if ($jour_lundi_ascension == $jour && $mois_lundi_ascension == $mois) |
|
660 | - $ferie = true; |
|
697 | + if ($jour_lundi_ascension == $jour && $mois_lundi_ascension == $mois) { |
|
698 | + $ferie = true; |
|
699 | + } |
|
661 | 700 | // Lundi de Pâques |
662 | 701 | // Calcul du jour de l'ascension (38 days after easter day) |
663 | 702 | $date_ascension = mktime( |
@@ -665,8 +704,9 @@ discard block |
||
665 | 704 | ); |
666 | 705 | $jour_ascension = date("d", $date_ascension); |
667 | 706 | $mois_ascension = date("m", $date_ascension); |
668 | - if ($jour_ascension == $jour && $mois_ascension == $mois) |
|
669 | - $ferie = true; |
|
707 | + if ($jour_ascension == $jour && $mois_ascension == $mois) { |
|
708 | + $ferie = true; |
|
709 | + } |
|
670 | 710 | // Ascension |
671 | 711 | // Calculation of "Pentecote" (11 days after easter day) |
672 | 712 | $date_pentecote = mktime( |
@@ -674,8 +714,9 @@ discard block |
||
674 | 714 | ); |
675 | 715 | $jour_pentecote = date("d", $date_pentecote); |
676 | 716 | $mois_pentecote = date("m", $date_pentecote); |
677 | - if ($jour_pentecote == $jour && $mois_pentecote == $mois) |
|
678 | - $ferie = true; |
|
717 | + if ($jour_pentecote == $jour && $mois_pentecote == $mois) { |
|
718 | + $ferie = true; |
|
719 | + } |
|
679 | 720 | // "Pentecote" |
680 | 721 | } |
681 | 722 | |
@@ -685,26 +726,46 @@ discard block |
||
685 | 726 | $countryfound = 1; |
686 | 727 | |
687 | 728 | // Definition des dates feriees fixes |
688 | - if ($jour == 1 && $mois == 1) |
|
689 | - $ferie = true; // Capodanno |
|
690 | - if ($jour == 6 && $mois == 1) |
|
691 | - $ferie = true; // Epifania |
|
692 | - if ($jour == 25 && $mois == 4) |
|
693 | - $ferie = true; // Anniversario Liberazione |
|
694 | - if ($jour == 1 && $mois == 5) |
|
695 | - $ferie = true; // Festa del Lavoro |
|
696 | - if ($jour == 2 && $mois == 6) |
|
697 | - $ferie = true; // Festa della Repubblica |
|
698 | - if ($jour == 15 && $mois == 8) |
|
699 | - $ferie = true; // Ferragosto |
|
700 | - if ($jour == 1 && $mois == 11) |
|
701 | - $ferie = true; // Tutti i Santi |
|
702 | - if ($jour == 8 && $mois == 12) |
|
703 | - $ferie = true; // Immacolata Concezione |
|
704 | - if ($jour == 25 && $mois == 12) |
|
705 | - $ferie = true; // 25 decembre |
|
706 | - if ($jour == 26 && $mois == 12) |
|
707 | - $ferie = true; // Santo Stefano |
|
729 | + if ($jour == 1 && $mois == 1) { |
|
730 | + $ferie = true; |
|
731 | + } |
|
732 | + // Capodanno |
|
733 | + if ($jour == 6 && $mois == 1) { |
|
734 | + $ferie = true; |
|
735 | + } |
|
736 | + // Epifania |
|
737 | + if ($jour == 25 && $mois == 4) { |
|
738 | + $ferie = true; |
|
739 | + } |
|
740 | + // Anniversario Liberazione |
|
741 | + if ($jour == 1 && $mois == 5) { |
|
742 | + $ferie = true; |
|
743 | + } |
|
744 | + // Festa del Lavoro |
|
745 | + if ($jour == 2 && $mois == 6) { |
|
746 | + $ferie = true; |
|
747 | + } |
|
748 | + // Festa della Repubblica |
|
749 | + if ($jour == 15 && $mois == 8) { |
|
750 | + $ferie = true; |
|
751 | + } |
|
752 | + // Ferragosto |
|
753 | + if ($jour == 1 && $mois == 11) { |
|
754 | + $ferie = true; |
|
755 | + } |
|
756 | + // Tutti i Santi |
|
757 | + if ($jour == 8 && $mois == 12) { |
|
758 | + $ferie = true; |
|
759 | + } |
|
760 | + // Immacolata Concezione |
|
761 | + if ($jour == 25 && $mois == 12) { |
|
762 | + $ferie = true; |
|
763 | + } |
|
764 | + // 25 decembre |
|
765 | + if ($jour == 26 && $mois == 12) { |
|
766 | + $ferie = true; |
|
767 | + } |
|
768 | + // Santo Stefano |
|
708 | 769 | |
709 | 770 | |
710 | 771 | |
@@ -712,50 +773,81 @@ discard block |
||
712 | 773 | $date_paques = easter_date($annee); |
713 | 774 | $jour_paques = date("d", $date_paques); |
714 | 775 | $mois_paques = date("m", $date_paques); |
715 | - if ($jour_paques == $jour && $mois_paques == $mois) |
|
716 | - $ferie = true; |
|
776 | + if ($jour_paques == $jour && $mois_paques == $mois) { |
|
777 | + $ferie = true; |
|
778 | + } |
|
717 | 779 | // Paques |
718 | 780 | } |
719 | 781 | |
720 | 782 | if ($countrycode == 'IN') { |
721 | 783 | $countryfound = 1; |
722 | 784 | |
723 | - if ($jour == 1 && $mois == 1) |
|
724 | - $ferie = true; // New Year's Day |
|
725 | - if ($jour == 26 && $mois == 1) |
|
726 | - $ferie = true; // Republic Day |
|
727 | - if ($jour == 1 && $mois == 5) |
|
728 | - $ferie = true; // May Day |
|
729 | - if ($jour == 15 && $mois == 8) |
|
730 | - $ferie = true; // Independence Day |
|
731 | - if ($jour == 2 && $mois == 10) |
|
732 | - $ferie = true; // Gandhi Jayanti |
|
733 | - if ($jour == 25 && $mois == 12) |
|
734 | - $ferie = true; // Christmas |
|
785 | + if ($jour == 1 && $mois == 1) { |
|
786 | + $ferie = true; |
|
787 | + } |
|
788 | + // New Year's Day |
|
789 | + if ($jour == 26 && $mois == 1) { |
|
790 | + $ferie = true; |
|
791 | + } |
|
792 | + // Republic Day |
|
793 | + if ($jour == 1 && $mois == 5) { |
|
794 | + $ferie = true; |
|
795 | + } |
|
796 | + // May Day |
|
797 | + if ($jour == 15 && $mois == 8) { |
|
798 | + $ferie = true; |
|
799 | + } |
|
800 | + // Independence Day |
|
801 | + if ($jour == 2 && $mois == 10) { |
|
802 | + $ferie = true; |
|
803 | + } |
|
804 | + // Gandhi Jayanti |
|
805 | + if ($jour == 25 && $mois == 12) { |
|
806 | + $ferie = true; |
|
807 | + } |
|
808 | + // Christmas |
|
735 | 809 | } |
736 | 810 | |
737 | 811 | if ($countrycode == 'ES') { |
738 | 812 | $countryfound = 1; |
739 | 813 | |
740 | 814 | // Definition des dates feriees fixes |
741 | - if ($jour == 1 && $mois == 1) |
|
742 | - $ferie = true; // Año nuevo |
|
743 | - if ($jour == 6 && $mois == 1) |
|
744 | - $ferie = true; // Día Reyes |
|
745 | - if ($jour == 1 && $mois == 5) |
|
746 | - $ferie = true; // 1 Mayo |
|
747 | - if ($jour == 15 && $mois == 8) |
|
748 | - $ferie = true; // 15 Agosto |
|
749 | - if ($jour == 12 && $mois == 10) |
|
750 | - $ferie = true; // Día Hispanidad |
|
751 | - if ($jour == 1 && $mois == 11) |
|
752 | - $ferie = true; // 1 noviembre |
|
753 | - if ($jour == 6 && $mois == 12) |
|
754 | - $ferie = true; // Constitución |
|
755 | - if ($jour == 8 && $mois == 12) |
|
756 | - $ferie = true; // Inmaculada |
|
757 | - if ($jour == 25 && $mois == 12) |
|
758 | - $ferie = true; // 25 diciembre |
|
815 | + if ($jour == 1 && $mois == 1) { |
|
816 | + $ferie = true; |
|
817 | + } |
|
818 | + // Año nuevo |
|
819 | + if ($jour == 6 && $mois == 1) { |
|
820 | + $ferie = true; |
|
821 | + } |
|
822 | + // Día Reyes |
|
823 | + if ($jour == 1 && $mois == 5) { |
|
824 | + $ferie = true; |
|
825 | + } |
|
826 | + // 1 Mayo |
|
827 | + if ($jour == 15 && $mois == 8) { |
|
828 | + $ferie = true; |
|
829 | + } |
|
830 | + // 15 Agosto |
|
831 | + if ($jour == 12 && $mois == 10) { |
|
832 | + $ferie = true; |
|
833 | + } |
|
834 | + // Día Hispanidad |
|
835 | + if ($jour == 1 && $mois == 11) { |
|
836 | + $ferie = true; |
|
837 | + } |
|
838 | + // 1 noviembre |
|
839 | + if ($jour == 6 && $mois == 12) { |
|
840 | + $ferie = true; |
|
841 | + } |
|
842 | + // Constitución |
|
843 | + if ($jour == 8 && $mois == 12) { |
|
844 | + $ferie = true; |
|
845 | + } |
|
846 | + // Inmaculada |
|
847 | + if ($jour == 25 && $mois == 12) { |
|
848 | + $ferie = true; |
|
849 | + } |
|
850 | + // 25 diciembre |
|
759 | 851 | |
760 | 852 | |
761 | 853 | |
@@ -763,8 +855,9 @@ discard block |
||
763 | 855 | $date_paques = easter_date($annee); |
764 | 856 | $jour_paques = date("d", $date_paques); |
765 | 857 | $mois_paques = date("m", $date_paques); |
766 | - if ($jour_paques == $jour && $mois_paques == $mois) |
|
767 | - $ferie = true; |
|
858 | + if ($jour_paques == $jour && $mois_paques == $mois) { |
|
859 | + $ferie = true; |
|
860 | + } |
|
768 | 861 | // Paques |
769 | 862 | // Viernes Santo |
770 | 863 | $date_viernes = mktime( |
@@ -772,8 +865,9 @@ discard block |
||
772 | 865 | ); |
773 | 866 | $jour_viernes = date("d", $date_viernes); |
774 | 867 | $mois_viernes = date("m", $date_viernes); |
775 | - if ($jour_viernes == $jour && $mois_viernes == $mois) |
|
776 | - $ferie = true; |
|
868 | + if ($jour_viernes == $jour && $mois_viernes == $mois) { |
|
869 | + $ferie = true; |
|
870 | + } |
|
777 | 871 | //Viernes Santo |
778 | 872 | } |
779 | 873 | |
@@ -781,28 +875,50 @@ discard block |
||
781 | 875 | $countryfound = 1; |
782 | 876 | |
783 | 877 | // Definition des dates feriees fixes |
784 | - if ($jour == 1 && $mois == 1) |
|
785 | - $ferie = true; // Neujahr |
|
786 | - if ($jour == 6 && $mois == 1) |
|
787 | - $ferie = true; // Hl. 3 Koenige |
|
788 | - if ($jour == 1 && $mois == 5) |
|
789 | - $ferie = true; // 1. Mai |
|
790 | - if ($jour == 15 && $mois == 8) |
|
791 | - $ferie = true; // Mariae Himmelfahrt |
|
792 | - if ($jour == 26 && $mois == 10) |
|
793 | - $ferie = true; // 26. Oktober |
|
794 | - if ($jour == 1 && $mois == 11) |
|
795 | - $ferie = true; // Allerheiligen |
|
796 | - if ($jour == 8 && $mois == 12) |
|
797 | - $ferie = true; // Mariae Empfaengnis |
|
798 | - if ($jour == 24 && $mois == 12) |
|
799 | - $ferie = true; // Heilig abend |
|
800 | - if ($jour == 25 && $mois == 12) |
|
801 | - $ferie = true; // Christtag |
|
802 | - if ($jour == 26 && $mois == 12) |
|
803 | - $ferie = true; // Stefanietag |
|
804 | - if ($jour == 31 && $mois == 12) |
|
805 | - $ferie = true; // Silvester |
|
878 | + if ($jour == 1 && $mois == 1) { |
|
879 | + $ferie = true; |
|
880 | + } |
|
881 | + // Neujahr |
|
882 | + if ($jour == 6 && $mois == 1) { |
|
883 | + $ferie = true; |
|
884 | + } |
|
885 | + // Hl. 3 Koenige |
|
886 | + if ($jour == 1 && $mois == 5) { |
|
887 | + $ferie = true; |
|
888 | + } |
|
889 | + // 1. Mai |
|
890 | + if ($jour == 15 && $mois == 8) { |
|
891 | + $ferie = true; |
|
892 | + } |
|
893 | + // Mariae Himmelfahrt |
|
894 | + if ($jour == 26 && $mois == 10) { |
|
895 | + $ferie = true; |
|
896 | + } |
|
897 | + // 26. Oktober |
|
898 | + if ($jour == 1 && $mois == 11) { |
|
899 | + $ferie = true; |
|
900 | + } |
|
901 | + // Allerheiligen |
|
902 | + if ($jour == 8 && $mois == 12) { |
|
903 | + $ferie = true; |
|
904 | + } |
|
905 | + // Mariae Empfaengnis |
|
906 | + if ($jour == 24 && $mois == 12) { |
|
907 | + $ferie = true; |
|
908 | + } |
|
909 | + // Heilig abend |
|
910 | + if ($jour == 25 && $mois == 12) { |
|
911 | + $ferie = true; |
|
912 | + } |
|
913 | + // Christtag |
|
914 | + if ($jour == 26 && $mois == 12) { |
|
915 | + $ferie = true; |
|
916 | + } |
|
917 | + // Stefanietag |
|
918 | + if ($jour == 31 && $mois == 12) { |
|
919 | + $ferie = true; |
|
920 | + } |
|
921 | + // Silvester |
|
806 | 922 | |
807 | 923 | |
808 | 924 | |
@@ -810,8 +926,9 @@ discard block |
||
810 | 926 | $date_paques = easter_date($annee); |
811 | 927 | $jour_paques = date("d", $date_paques); |
812 | 928 | $mois_paques = date("m", $date_paques); |
813 | - if ($jour_paques == $jour && $mois_paques == $mois) |
|
814 | - $ferie = true; |
|
929 | + if ($jour_paques == $jour && $mois_paques == $mois) { |
|
930 | + $ferie = true; |
|
931 | + } |
|
815 | 932 | // Easter sunday |
816 | 933 | // Monday after easter |
817 | 934 | $date_eastermonday = mktime( |
@@ -819,8 +936,9 @@ discard block |
||
819 | 936 | ); |
820 | 937 | $jour_eastermonday = date("d", $date_eastermonday); |
821 | 938 | $mois_eastermonday = date("m", $date_eastermonday); |
822 | - if ($jour_eastermonday == $jour && $mois_eastermonday == $mois) |
|
823 | - $ferie = true; |
|
939 | + if ($jour_eastermonday == $jour && $mois_eastermonday == $mois) { |
|
940 | + $ferie = true; |
|
941 | + } |
|
824 | 942 | // Easter monday |
825 | 943 | // Christi Himmelfahrt (39 days after easter sunday) |
826 | 944 | $date_ch = mktime( |
@@ -828,8 +946,9 @@ discard block |
||
828 | 946 | ); |
829 | 947 | $jour_ch = date("d", $date_ch); |
830 | 948 | $mois_ch = date("m", $date_ch); |
831 | - if ($jour_ch == $jour && $mois_ch == $mois) |
|
832 | - $ferie = true; |
|
949 | + if ($jour_ch == $jour && $mois_ch == $mois) { |
|
950 | + $ferie = true; |
|
951 | + } |
|
833 | 952 | // Christi Himmelfahrt |
834 | 953 | // Pfingsten (50 days after easter sunday) |
835 | 954 | $date_pentecote = mktime( |
@@ -837,8 +956,9 @@ discard block |
||
837 | 956 | ); |
838 | 957 | $jour_pentecote = date("d", $date_pentecote); |
839 | 958 | $mois_pentecote = date("m", $date_pentecote); |
840 | - if ($jour_pentecote == $jour && $mois_pentecote == $mois) |
|
841 | - $ferie = true; |
|
959 | + if ($jour_pentecote == $jour && $mois_pentecote == $mois) { |
|
960 | + $ferie = true; |
|
961 | + } |
|
842 | 962 | // Pfingsten |
843 | 963 | // Fronleichnam (60 days after easter sunday) |
844 | 964 | $date_fronleichnam = mktime( |
@@ -846,8 +966,9 @@ discard block |
||
846 | 966 | ); |
847 | 967 | $jour_fronleichnam = date("d", $date_fronleichnam); |
848 | 968 | $mois_fronleichnam = date("m", $date_fronleichnam); |
849 | - if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) |
|
850 | - $ferie = true; |
|
969 | + if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) { |
|
970 | + $ferie = true; |
|
971 | + } |
|
851 | 972 | // Fronleichnam |
852 | 973 | } |
853 | 974 | |
@@ -855,14 +976,16 @@ discard block |
||
855 | 976 | if ($includesaturdayandsunday) { |
856 | 977 | $jour_julien = unixtojd($timestampStart); |
857 | 978 | $jour_semaine = jddayofweek($jour_julien, 0); |
858 | - if ($jour_semaine == 0 || $jour_semaine == 6) |
|
859 | - $ferie = true; |
|
979 | + if ($jour_semaine == 0 || $jour_semaine == 6) { |
|
980 | + $ferie = true; |
|
981 | + } |
|
860 | 982 | //Saturday (6) and Sunday (0) |
861 | 983 | } |
862 | 984 | |
863 | 985 | // On incremente compteur |
864 | - if ($ferie) |
|
865 | - $nbFerie++; |
|
986 | + if ($ferie) { |
|
987 | + $nbFerie++; |
|
988 | + } |
|
866 | 989 | |
867 | 990 | // Increase number of days (on go up into loop) |
868 | 991 | $timestampStart = dol_time_plus_duree($timestampStart, 1, 'd'); |
@@ -914,16 +1037,19 @@ discard block |
||
914 | 1037 | { |
915 | 1038 | global $langs, $mysoc; |
916 | 1039 | |
917 | - if (empty($country_code)) |
|
918 | - $country_code = $mysoc->country_code; |
|
1040 | + if (empty($country_code)) { |
|
1041 | + $country_code = $mysoc->country_code; |
|
1042 | + } |
|
919 | 1043 | |
920 | 1044 | dol_syslog('num_open_day timestampStart=' . $timestampStart . ' timestampEnd=' . $timestampEnd . ' bit=' . $lastday . ' country_code=' . $country_code); |
921 | 1045 | |
922 | 1046 | // Check parameters |
923 | - if (!is_int($timestampStart) && !is_float($timestampStart)) |
|
924 | - return 'ErrorBadParameter_num_open_day'; |
|
925 | - if (!is_int($timestampEnd) && !is_float($timestampEnd)) |
|
926 | - return 'ErrorBadParameter_num_open_day'; |
|
1047 | + if (!is_int($timestampStart) && !is_float($timestampStart)) { |
|
1048 | + return 'ErrorBadParameter_num_open_day'; |
|
1049 | + } |
|
1050 | + if (!is_int($timestampEnd) && !is_float($timestampEnd)) { |
|
1051 | + return 'ErrorBadParameter_num_open_day'; |
|
1052 | + } |
|
927 | 1053 | |
928 | 1054 | //print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday; |
929 | 1055 | if ($timestampStart < $timestampEnd) { |
@@ -931,17 +1057,17 @@ discard block |
||
931 | 1057 | $numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday); |
932 | 1058 | $nbOpenDay = $numdays - $numholidays; |
933 | 1059 | $nbOpenDay .= " " . $langs->trans("Days"); |
934 | - if ($inhour == 1 && $nbOpenDay <= 3) |
|
935 | - $nbOpenDay = $nbOpenDay * 24 . $langs->trans("HourShort"); |
|
1060 | + if ($inhour == 1 && $nbOpenDay <= 3) { |
|
1061 | + $nbOpenDay = $nbOpenDay * 24 . $langs->trans("HourShort"); |
|
1062 | + } |
|
936 | 1063 | return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); |
937 | - } |
|
938 | - elseif ($timestampStart == $timestampEnd) { |
|
1064 | + } elseif ($timestampStart == $timestampEnd) { |
|
939 | 1065 | $nbOpenDay = $lastday; |
940 | - if ($inhour == 1) |
|
941 | - $nbOpenDay = $nbOpenDay * 24 . $langs->trans("HourShort"); |
|
1066 | + if ($inhour == 1) { |
|
1067 | + $nbOpenDay = $nbOpenDay * 24 . $langs->trans("HourShort"); |
|
1068 | + } |
|
942 | 1069 | return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); |
943 | - } |
|
944 | - else { |
|
1070 | + } else { |
|
945 | 1071 | return $langs->trans("Error"); |
946 | 1072 | } |
947 | 1073 | } |
@@ -58,8 +58,14 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
60 | 60 | { |
61 | - if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing |
|
62 | - if (defined('DISABLE_LDAP_SYNCHRO')) return 0; // If constant defined, we do nothing |
|
61 | + if (empty($conf->ldap->enabled)) { |
|
62 | + return 0; |
|
63 | + } |
|
64 | + // Module not active, we do nothing |
|
65 | + if (defined('DISABLE_LDAP_SYNCHRO')) { |
|
66 | + return 0; |
|
67 | + } |
|
68 | + // If constant defined, we do nothing |
|
63 | 69 | |
64 | 70 | if (! function_exists('ldap_connect')) |
65 | 71 | { |
@@ -89,10 +95,11 @@ discard block |
||
89 | 95 | $result=$ldap->add($dn,$info,$user); |
90 | 96 | } |
91 | 97 | |
92 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
98 | + if ($result < 0) { |
|
99 | + $this->error="ErrorLDAP ".$ldap->error; |
|
100 | + } |
|
93 | 101 | } |
94 | - } |
|
95 | - elseif ($action == 'USER_MODIFY') |
|
102 | + } elseif ($action == 'USER_MODIFY') |
|
96 | 103 | { |
97 | 104 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
98 | 105 | if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
@@ -128,10 +135,11 @@ discard block |
||
128 | 135 | $result=$ldap->update($dn,$info,$user,$olddn,$newrdn,$newparent); |
129 | 136 | } |
130 | 137 | |
131 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
138 | + if ($result < 0) { |
|
139 | + $this->error="ErrorLDAP ".$ldap->error; |
|
140 | + } |
|
132 | 141 | } |
133 | - } |
|
134 | - elseif ($action == 'USER_NEW_PASSWORD') |
|
142 | + } elseif ($action == 'USER_NEW_PASSWORD') |
|
135 | 143 | { |
136 | 144 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
137 | 145 | if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
@@ -165,14 +173,14 @@ discard block |
||
165 | 173 | $result=$ldap->update($dn,$info,$user,$olddn); |
166 | 174 | } |
167 | 175 | |
168 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
176 | + if ($result < 0) { |
|
177 | + $this->error="ErrorLDAP ".$ldap->error; |
|
178 | + } |
|
169 | 179 | } |
170 | - } |
|
171 | - elseif ($action == 'USER_ENABLEDISABLE') |
|
180 | + } elseif ($action == 'USER_ENABLEDISABLE') |
|
172 | 181 | { |
173 | 182 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
174 | - } |
|
175 | - elseif ($action == 'USER_DELETE') |
|
183 | + } elseif ($action == 'USER_DELETE') |
|
176 | 184 | { |
177 | 185 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
178 | 186 | if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
@@ -188,10 +196,11 @@ discard block |
||
188 | 196 | $result=$ldap->delete($dn); |
189 | 197 | } |
190 | 198 | |
191 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
199 | + if ($result < 0) { |
|
200 | + $this->error="ErrorLDAP ".$ldap->error; |
|
201 | + } |
|
192 | 202 | } |
193 | - } |
|
194 | - elseif ($action == 'USER_SETINGROUP') |
|
203 | + } elseif ($action == 'USER_SETINGROUP') |
|
195 | 204 | { |
196 | 205 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
197 | 206 | if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
@@ -226,10 +235,11 @@ discard block |
||
226 | 235 | } |
227 | 236 | } |
228 | 237 | |
229 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
238 | + if ($result < 0) { |
|
239 | + $this->error="ErrorLDAP ".$ldap->error; |
|
240 | + } |
|
230 | 241 | } |
231 | - } |
|
232 | - elseif ($action == 'USER_REMOVEFROMGROUP') |
|
242 | + } elseif ($action == 'USER_REMOVEFROMGROUP') |
|
233 | 243 | { |
234 | 244 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
235 | 245 | if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
@@ -264,7 +274,9 @@ discard block |
||
264 | 274 | } |
265 | 275 | } |
266 | 276 | |
267 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
277 | + if ($result < 0) { |
|
278 | + $this->error="ErrorLDAP ".$ldap->error; |
|
279 | + } |
|
268 | 280 | } |
269 | 281 | } |
270 | 282 | |
@@ -290,10 +302,11 @@ discard block |
||
290 | 302 | $result=$ldap->add($dn,$info,$user); |
291 | 303 | } |
292 | 304 | |
293 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
305 | + if ($result < 0) { |
|
306 | + $this->error="ErrorLDAP ".$ldap->error; |
|
307 | + } |
|
294 | 308 | } |
295 | - } |
|
296 | - elseif ($action == 'GROUP_MODIFY') |
|
309 | + } elseif ($action == 'GROUP_MODIFY') |
|
297 | 310 | { |
298 | 311 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
299 | 312 | if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
@@ -327,10 +340,11 @@ discard block |
||
327 | 340 | $result=$ldap->update($dn,$info,$user,$olddn); |
328 | 341 | } |
329 | 342 | |
330 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
343 | + if ($result < 0) { |
|
344 | + $this->error="ErrorLDAP ".$ldap->error; |
|
345 | + } |
|
331 | 346 | } |
332 | - } |
|
333 | - elseif ($action == 'GROUP_DELETE') |
|
347 | + } elseif ($action == 'GROUP_DELETE') |
|
334 | 348 | { |
335 | 349 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
336 | 350 | if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
@@ -346,7 +360,9 @@ discard block |
||
346 | 360 | $result=$ldap->delete($dn); |
347 | 361 | } |
348 | 362 | |
349 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
363 | + if ($result < 0) { |
|
364 | + $this->error="ErrorLDAP ".$ldap->error; |
|
365 | + } |
|
350 | 366 | } |
351 | 367 | } |
352 | 368 | |
@@ -367,10 +383,11 @@ discard block |
||
367 | 383 | $result=$ldap->add($dn,$info,$user); |
368 | 384 | } |
369 | 385 | |
370 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
386 | + if ($result < 0) { |
|
387 | + $this->error="ErrorLDAP ".$ldap->error; |
|
388 | + } |
|
371 | 389 | } |
372 | - } |
|
373 | - elseif ($action == 'CONTACT_MODIFY') |
|
390 | + } elseif ($action == 'CONTACT_MODIFY') |
|
374 | 391 | { |
375 | 392 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
376 | 393 | if (! empty($conf->global->LDAP_CONTACT_ACTIVE)) |
@@ -404,10 +421,11 @@ discard block |
||
404 | 421 | $result=$ldap->update($dn,$info,$user,$olddn); |
405 | 422 | } |
406 | 423 | |
407 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
424 | + if ($result < 0) { |
|
425 | + $this->error="ErrorLDAP ".$ldap->error; |
|
426 | + } |
|
408 | 427 | } |
409 | - } |
|
410 | - elseif ($action == 'CONTACT_DELETE') |
|
428 | + } elseif ($action == 'CONTACT_DELETE') |
|
411 | 429 | { |
412 | 430 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
413 | 431 | if (! empty($conf->global->LDAP_CONTACT_ACTIVE)) |
@@ -423,7 +441,9 @@ discard block |
||
423 | 441 | $result=$ldap->delete($dn); |
424 | 442 | } |
425 | 443 | |
426 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
444 | + if ($result < 0) { |
|
445 | + $this->error="ErrorLDAP ".$ldap->error; |
|
446 | + } |
|
427 | 447 | } |
428 | 448 | } |
429 | 449 | |
@@ -472,10 +492,11 @@ discard block |
||
472 | 492 | } |
473 | 493 | } |
474 | 494 | |
475 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
495 | + if ($result < 0) { |
|
496 | + $this->error="ErrorLDAP ".$ldap->error; |
|
497 | + } |
|
476 | 498 | } |
477 | - } |
|
478 | - elseif ($action == 'MEMBER_VALIDATE') |
|
499 | + } elseif ($action == 'MEMBER_VALIDATE') |
|
479 | 500 | { |
480 | 501 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
481 | 502 | if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
@@ -495,11 +516,12 @@ discard block |
||
495 | 516 | $result=$ldap->update($dn,$info,$user,$olddn); |
496 | 517 | } |
497 | 518 | |
498 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
519 | + if ($result < 0) { |
|
520 | + $this->error="ErrorLDAP ".$ldap->error; |
|
521 | + } |
|
499 | 522 | } |
500 | 523 | } |
501 | - } |
|
502 | - elseif ($action == 'MEMBER_SUBSCRIPTION') |
|
524 | + } elseif ($action == 'MEMBER_SUBSCRIPTION') |
|
503 | 525 | { |
504 | 526 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
505 | 527 | if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
@@ -523,11 +545,12 @@ discard block |
||
523 | 545 | $result=$ldap->update($dn,$info,$user,$olddn); |
524 | 546 | } |
525 | 547 | |
526 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
548 | + if ($result < 0) { |
|
549 | + $this->error="ErrorLDAP ".$ldap->error; |
|
550 | + } |
|
527 | 551 | } |
528 | 552 | } |
529 | - } |
|
530 | - elseif ($action == 'MEMBER_MODIFY') |
|
553 | + } elseif ($action == 'MEMBER_MODIFY') |
|
531 | 554 | { |
532 | 555 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
533 | 556 | if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
@@ -618,10 +641,11 @@ discard block |
||
618 | 641 | } |
619 | 642 | } |
620 | 643 | |
621 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
644 | + if ($result < 0) { |
|
645 | + $this->error="ErrorLDAP ".$ldap->error; |
|
646 | + } |
|
622 | 647 | } |
623 | - } |
|
624 | - elseif ($action == 'MEMBER_NEW_PASSWORD') |
|
648 | + } elseif ($action == 'MEMBER_NEW_PASSWORD') |
|
625 | 649 | { |
626 | 650 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
627 | 651 | if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
@@ -641,11 +665,12 @@ discard block |
||
641 | 665 | $result=$ldap->update($dn,$info,$user,$olddn); |
642 | 666 | } |
643 | 667 | |
644 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
668 | + if ($result < 0) { |
|
669 | + $this->error="ErrorLDAP ".$ldap->error; |
|
670 | + } |
|
645 | 671 | } |
646 | 672 | } |
647 | - } |
|
648 | - elseif ($action == 'MEMBER_RESILIATE') |
|
673 | + } elseif ($action == 'MEMBER_RESILIATE') |
|
649 | 674 | { |
650 | 675 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
651 | 676 | if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
@@ -665,11 +690,12 @@ discard block |
||
665 | 690 | $result=$ldap->update($dn,$info,$user,$olddn); |
666 | 691 | } |
667 | 692 | |
668 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
693 | + if ($result < 0) { |
|
694 | + $this->error="ErrorLDAP ".$ldap->error; |
|
695 | + } |
|
669 | 696 | } |
670 | 697 | } |
671 | - } |
|
672 | - elseif ($action == 'MEMBER_DELETE') |
|
698 | + } elseif ($action == 'MEMBER_DELETE') |
|
673 | 699 | { |
674 | 700 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
675 | 701 | if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
@@ -716,7 +742,9 @@ discard block |
||
716 | 742 | } |
717 | 743 | } |
718 | 744 | |
719 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
745 | + if ($result < 0) { |
|
746 | + $this->error="ErrorLDAP ".$ldap->error; |
|
747 | + } |
|
720 | 748 | } |
721 | 749 | } |
722 | 750 | |
@@ -742,10 +770,11 @@ discard block |
||
742 | 770 | $result=$ldap->add($dn,$info,$user); |
743 | 771 | } |
744 | 772 | |
745 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
773 | + if ($result < 0) { |
|
774 | + $this->error="ErrorLDAP ".$ldap->error; |
|
775 | + } |
|
746 | 776 | } |
747 | - } |
|
748 | - elseif ($action == 'MEMBER_TYPE_MODIFY') |
|
777 | + } elseif ($action == 'MEMBER_TYPE_MODIFY') |
|
749 | 778 | { |
750 | 779 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
751 | 780 | if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
@@ -783,10 +812,11 @@ discard block |
||
783 | 812 | $result=$ldap->update($dn,$info,$user,$olddn); |
784 | 813 | } |
785 | 814 | |
786 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
815 | + if ($result < 0) { |
|
816 | + $this->error="ErrorLDAP ".$ldap->error; |
|
817 | + } |
|
787 | 818 | } |
788 | - } |
|
789 | - elseif ($action == 'MEMBER_TYPE_DELETE') |
|
819 | + } elseif ($action == 'MEMBER_TYPE_DELETE') |
|
790 | 820 | { |
791 | 821 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
792 | 822 | if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
@@ -802,7 +832,9 @@ discard block |
||
802 | 832 | $result=$ldap->delete($dn); |
803 | 833 | } |
804 | 834 | |
805 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
835 | + if ($result < 0) { |
|
836 | + $this->error="ErrorLDAP ".$ldap->error; |
|
837 | + } |
|
806 | 838 | } |
807 | 839 | } |
808 | 840 |
@@ -59,13 +59,22 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
61 | 61 | { |
62 | - if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features) |
|
62 | + if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) { |
|
63 | + return 0; |
|
64 | + } |
|
65 | + // Log events is disabled (hidden features) |
|
63 | 66 | |
64 | 67 | $key='MAIN_LOGEVENTS_'.$action; |
65 | 68 | //dol_syslog("xxxxxxxxxxx".$key); |
66 | - if (empty($conf->global->$key)) return 0; // Log events not enabled for this action |
|
69 | + if (empty($conf->global->$key)) { |
|
70 | + return 0; |
|
71 | + } |
|
72 | + // Log events not enabled for this action |
|
67 | 73 | |
68 | - if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form) |
|
74 | + if (empty($conf->entity)) { |
|
75 | + $conf->entity = $entity; |
|
76 | + } |
|
77 | + // forcing of the entity if it's not defined (ex: in login form) |
|
69 | 78 | |
70 | 79 | $date = dol_now(); |
71 | 80 | |
@@ -106,8 +115,7 @@ discard block |
||
106 | 115 | // Initialisation donnees (date,duree,texte,desc) |
107 | 116 | $text=$langs->transnoentities("NewUserCreated",$object->login); |
108 | 117 | $desc=$langs->transnoentities("NewUserCreated",$object->login); |
109 | - } |
|
110 | - elseif ($action == 'USER_MODIFY') |
|
118 | + } elseif ($action == 'USER_MODIFY') |
|
111 | 119 | { |
112 | 120 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
113 | 121 | $langs->load("users"); |
@@ -115,8 +123,7 @@ discard block |
||
115 | 123 | // Initialisation donnees (date,duree,texte,desc) |
116 | 124 | $text=$langs->transnoentities("EventUserModified",$object->login); |
117 | 125 | $desc=$langs->transnoentities("EventUserModified",$object->login); |
118 | - } |
|
119 | - elseif ($action == 'USER_NEW_PASSWORD') |
|
126 | + } elseif ($action == 'USER_NEW_PASSWORD') |
|
120 | 127 | { |
121 | 128 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
122 | 129 | $langs->load("users"); |
@@ -124,8 +131,7 @@ discard block |
||
124 | 131 | // Initialisation donnees (date,duree,texte,desc) |
125 | 132 | $text=$langs->transnoentities("NewUserPassword",$object->login); |
126 | 133 | $desc=$langs->transnoentities("NewUserPassword",$object->login); |
127 | - } |
|
128 | - elseif ($action == 'USER_ENABLEDISABLE') |
|
134 | + } elseif ($action == 'USER_ENABLEDISABLE') |
|
129 | 135 | { |
130 | 136 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
131 | 137 | $langs->load("users"); |
@@ -140,8 +146,7 @@ discard block |
||
140 | 146 | $text=$langs->transnoentities("UserDisabled",$object->login); |
141 | 147 | $desc=$langs->transnoentities("UserDisabled",$object->login); |
142 | 148 | } |
143 | - } |
|
144 | - elseif ($action == 'USER_DELETE') |
|
149 | + } elseif ($action == 'USER_DELETE') |
|
145 | 150 | { |
146 | 151 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
147 | 152 | $langs->load("users"); |
@@ -158,16 +163,14 @@ discard block |
||
158 | 163 | // Initialisation donnees (date,duree,texte,desc) |
159 | 164 | $text=$langs->transnoentities("NewGroupCreated",$object->name); |
160 | 165 | $desc=$langs->transnoentities("NewGroupCreated",$object->name); |
161 | - } |
|
162 | - elseif ($action == 'GROUP_MODIFY') |
|
166 | + } elseif ($action == 'GROUP_MODIFY') |
|
163 | 167 | { |
164 | 168 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
165 | 169 | $langs->load("users"); |
166 | 170 | // Initialisation donnees (date,duree,texte,desc) |
167 | 171 | $text=$langs->transnoentities("GroupModified",$object->name); |
168 | 172 | $desc=$langs->transnoentities("GroupModified",$object->name); |
169 | - } |
|
170 | - elseif ($action == 'GROUP_DELETE') |
|
173 | + } elseif ($action == 'GROUP_DELETE') |
|
171 | 174 | { |
172 | 175 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
173 | 176 | $langs->load("users"); |
@@ -186,7 +189,9 @@ discard block |
||
186 | 189 | */ |
187 | 190 | |
188 | 191 | // Add more information into desc from the context property |
189 | - if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit']; |
|
192 | + if (! empty($desc) && ! empty($object->context['audit'])) { |
|
193 | + $desc.=' - '.$object->context['audit']; |
|
194 | + } |
|
190 | 195 | |
191 | 196 | // Add entry in event table |
192 | 197 | include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; |
@@ -202,8 +207,7 @@ discard block |
||
202 | 207 | if ($result > 0) |
203 | 208 | { |
204 | 209 | return 1; |
205 | - } |
|
206 | - else |
|
210 | + } else |
|
207 | 211 | { |
208 | 212 | $error ="Failed to insert security event: ".$event->error; |
209 | 213 | $this->error=$error; |
@@ -71,7 +71,10 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
73 | 73 | { |
74 | - if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing |
|
74 | + if (empty($conf->agenda->enabled)) { |
|
75 | + return 0; |
|
76 | + } |
|
77 | + // Module not active, we do nothing |
|
75 | 78 | |
76 | 79 | $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; |
77 | 80 | |
@@ -82,7 +85,9 @@ discard block |
||
82 | 85 | |
83 | 86 | $langs->load("agenda"); |
84 | 87 | |
85 | - if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO'; |
|
88 | + if (empty($object->actiontypecode)) { |
|
89 | + $object->actiontypecode='AC_OTH_AUTO'; |
|
90 | + } |
|
86 | 91 | |
87 | 92 | // Actions |
88 | 93 | if ($action == 'COMPANY_CREATE') |
@@ -90,39 +95,46 @@ discard block |
||
90 | 95 | // Load translation files required by the page |
91 | 96 | $langs->loadLangs(array("agenda","other","companies")); |
92 | 97 | |
93 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->name); |
|
98 | + if (empty($object->actionmsg2)) { |
|
99 | + $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->name); |
|
100 | + } |
|
94 | 101 | $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->name); |
95 | - if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")"; |
|
102 | + if (! empty($object->prefix)) { |
|
103 | + $object->actionmsg.=" (".$object->prefix.")"; |
|
104 | + } |
|
96 | 105 | |
97 | 106 | $object->sendtoid=0; |
98 | 107 | $object->socid=$object->id; |
99 | - } |
|
100 | - elseif ($action == 'COMPANY_SENTBYMAIL') |
|
108 | + } elseif ($action == 'COMPANY_SENTBYMAIL') |
|
101 | 109 | { |
102 | 110 | // Load translation files required by the page |
103 | 111 | $langs->loadLangs(array("agenda","other","orders")); |
104 | 112 | |
105 | - if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR); |
|
113 | + if (empty($object->actionmsg2)) { |
|
114 | + dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR); |
|
115 | + } |
|
106 | 116 | |
107 | 117 | // Parameters $object->sendtoid defined by caller |
108 | 118 | //$object->sendtoid=0; |
109 | - } |
|
110 | - elseif ($action == 'CONTRACT_VALIDATE') |
|
119 | + } elseif ($action == 'CONTRACT_VALIDATE') |
|
111 | 120 | { |
112 | 121 | // Load translation files required by the page |
113 | 122 | $langs->loadLangs(array("agenda","other","contracts")); |
114 | 123 | |
115 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
124 | + if (empty($object->actionmsg2)) { |
|
125 | + $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
126 | + } |
|
116 | 127 | $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
117 | 128 | |
118 | 129 | $object->sendtoid=0; |
119 | - } |
|
120 | - elseif ($action == 'CONTRACT_SENTBYMAIL') |
|
130 | + } elseif ($action == 'CONTRACT_SENTBYMAIL') |
|
121 | 131 | { |
122 | 132 | // Load translation files required by the page |
123 | 133 | $langs->loadLangs(array("agenda","other","contracts")); |
124 | 134 | |
125 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail",$object->ref); |
|
135 | + if (empty($object->actionmsg2)) { |
|
136 | + $object->actionmsg2=$langs->transnoentities("ContractSentByEMail",$object->ref); |
|
137 | + } |
|
126 | 138 | if (empty($object->actionmsg)) |
127 | 139 | { |
128 | 140 | $object->actionmsg=$langs->transnoentities("ContractSentByEMail",$object->ref); |
@@ -130,23 +142,25 @@ discard block |
||
130 | 142 | |
131 | 143 | // Parameters $object->sendtoid defined by caller |
132 | 144 | //$object->sendtoid=0; |
133 | - } |
|
134 | - elseif ($action == 'PROPAL_VALIDATE') |
|
145 | + } elseif ($action == 'PROPAL_VALIDATE') |
|
135 | 146 | { |
136 | 147 | // Load translation files required by the page |
137 | 148 | $langs->loadLangs(array("agenda","other","propal")); |
138 | 149 | |
139 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
150 | + if (empty($object->actionmsg2)) { |
|
151 | + $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
152 | + } |
|
140 | 153 | $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
141 | 154 | |
142 | 155 | $object->sendtoid=0; |
143 | - } |
|
144 | - elseif ($action == 'PROPAL_SENTBYMAIL') |
|
156 | + } elseif ($action == 'PROPAL_SENTBYMAIL') |
|
145 | 157 | { |
146 | 158 | // Load translation files required by the page |
147 | 159 | $langs->loadLangs(array("agenda","other","propal")); |
148 | 160 | |
149 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
|
161 | + if (empty($object->actionmsg2)) { |
|
162 | + $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
|
163 | + } |
|
150 | 164 | if (empty($object->actionmsg)) |
151 | 165 | { |
152 | 166 | $object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
@@ -154,83 +168,91 @@ discard block |
||
154 | 168 | |
155 | 169 | // Parameters $object->sendtoid defined by caller |
156 | 170 | //$object->sendtoid=0; |
157 | - } |
|
158 | - elseif ($action == 'PROPAL_CLOSE_SIGNED') |
|
171 | + } elseif ($action == 'PROPAL_CLOSE_SIGNED') |
|
159 | 172 | { |
160 | 173 | // Load translation files required by the page |
161 | 174 | $langs->loadLangs(array("agenda","other","propal")); |
162 | 175 | |
163 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
|
176 | + if (empty($object->actionmsg2)) { |
|
177 | + $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
|
178 | + } |
|
164 | 179 | $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
165 | 180 | |
166 | 181 | $object->sendtoid=0; |
167 | - } |
|
168 | - elseif ($action == 'PROPAL_CLASSIFY_BILLED') |
|
182 | + } elseif ($action == 'PROPAL_CLASSIFY_BILLED') |
|
169 | 183 | { |
170 | 184 | // Load translation files required by the page |
171 | 185 | $langs->loadLangs(array("agenda","other","propal")); |
172 | 186 | |
173 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref); |
|
187 | + if (empty($object->actionmsg2)) { |
|
188 | + $object->actionmsg2=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref); |
|
189 | + } |
|
174 | 190 | $object->actionmsg=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref); |
175 | 191 | |
176 | 192 | $object->sendtoid=0; |
177 | - } |
|
178 | - elseif ($action == 'PROPAL_CLOSE_REFUSED') |
|
193 | + } elseif ($action == 'PROPAL_CLOSE_REFUSED') |
|
179 | 194 | { |
180 | 195 | // Load translation files required by the page |
181 | 196 | $langs->loadLangs(array("agenda","other","propal")); |
182 | 197 | |
183 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
|
198 | + if (empty($object->actionmsg2)) { |
|
199 | + $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
|
200 | + } |
|
184 | 201 | $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
185 | 202 | |
186 | 203 | $object->sendtoid=0; |
187 | - } |
|
188 | - elseif ($action == 'ORDER_VALIDATE') |
|
204 | + } elseif ($action == 'ORDER_VALIDATE') |
|
189 | 205 | { |
190 | 206 | // Load translation files required by the page |
191 | 207 | $langs->loadLangs(array("agenda","orders")); |
192 | 208 | |
193 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
209 | + if (empty($object->actionmsg2)) { |
|
210 | + $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
211 | + } |
|
194 | 212 | $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
195 | 213 | |
196 | 214 | $object->sendtoid=0; |
197 | - } |
|
198 | - elseif ($action == 'ORDER_CLOSE') |
|
215 | + } elseif ($action == 'ORDER_CLOSE') |
|
199 | 216 | { |
200 | 217 | // Load translation files required by the page |
201 | 218 | $langs->loadLangs(array("agenda","other","orders")); |
202 | 219 | |
203 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref); |
|
220 | + if (empty($object->actionmsg2)) { |
|
221 | + $object->actionmsg2=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref); |
|
222 | + } |
|
204 | 223 | $object->actionmsg=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref); |
205 | 224 | |
206 | 225 | $object->sendtoid=0; |
207 | - } |
|
208 | - elseif ($action == 'ORDER_CLASSIFY_BILLED') |
|
226 | + } elseif ($action == 'ORDER_CLASSIFY_BILLED') |
|
209 | 227 | { |
210 | 228 | // Load translation files required by the page |
211 | 229 | $langs->loadLangs(array("agenda","other","orders")); |
212 | 230 | |
213 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderBilledInDolibarr",$object->ref); |
|
231 | + if (empty($object->actionmsg2)) { |
|
232 | + $object->actionmsg2=$langs->transnoentities("OrderBilledInDolibarr",$object->ref); |
|
233 | + } |
|
214 | 234 | $object->actionmsg=$langs->transnoentities("OrderBilledInDolibarr",$object->ref); |
215 | 235 | |
216 | 236 | $object->sendtoid=0; |
217 | - } |
|
218 | - elseif ($action == 'ORDER_CANCEL') |
|
237 | + } elseif ($action == 'ORDER_CANCEL') |
|
219 | 238 | { |
220 | 239 | // Load translation files required by the page |
221 | 240 | $langs->loadLangs(array("agenda","other","orders")); |
222 | 241 | |
223 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref); |
|
242 | + if (empty($object->actionmsg2)) { |
|
243 | + $object->actionmsg2=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref); |
|
244 | + } |
|
224 | 245 | $object->actionmsg=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref); |
225 | 246 | |
226 | 247 | $object->sendtoid=0; |
227 | - } |
|
228 | - elseif ($action == 'ORDER_SENTBYMAIL') |
|
248 | + } elseif ($action == 'ORDER_SENTBYMAIL') |
|
229 | 249 | { |
230 | 250 | // Load translation files required by the page |
231 | 251 | $langs->loadLangs(array("agenda","other","orders")); |
232 | 252 | |
233 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref); |
|
253 | + if (empty($object->actionmsg2)) { |
|
254 | + $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref); |
|
255 | + } |
|
234 | 256 | if (empty($object->actionmsg)) |
235 | 257 | { |
236 | 258 | $object->actionmsg=$langs->transnoentities("OrderSentByEMail",$object->ref); |
@@ -238,33 +260,36 @@ discard block |
||
238 | 260 | |
239 | 261 | // Parameters $object->sendtoid defined by caller |
240 | 262 | //$object->sendtoid=0; |
241 | - } |
|
242 | - elseif ($action == 'BILL_VALIDATE') |
|
263 | + } elseif ($action == 'BILL_VALIDATE') |
|
243 | 264 | { |
244 | 265 | // Load translation files required by the page |
245 | 266 | $langs->loadLangs(array("agenda","other","bills")); |
246 | 267 | |
247 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
268 | + if (empty($object->actionmsg2)) { |
|
269 | + $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
270 | + } |
|
248 | 271 | $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
249 | 272 | |
250 | 273 | $object->sendtoid=0; |
251 | - } |
|
252 | - elseif ($action == 'BILL_UNVALIDATE') |
|
274 | + } elseif ($action == 'BILL_UNVALIDATE') |
|
253 | 275 | { |
254 | 276 | // Load translation files required by the page |
255 | 277 | $langs->loadLangs(array("agenda","other","bills")); |
256 | 278 | |
257 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
|
279 | + if (empty($object->actionmsg2)) { |
|
280 | + $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
|
281 | + } |
|
258 | 282 | $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
259 | 283 | |
260 | 284 | $object->sendtoid=0; |
261 | - } |
|
262 | - elseif ($action == 'BILL_SENTBYMAIL') |
|
285 | + } elseif ($action == 'BILL_SENTBYMAIL') |
|
263 | 286 | { |
264 | 287 | // Load translation files required by the page |
265 | 288 | $langs->loadLangs(array("agenda","other","bills")); |
266 | 289 | |
267 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref); |
|
290 | + if (empty($object->actionmsg2)) { |
|
291 | + $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref); |
|
292 | + } |
|
268 | 293 | if (empty($object->actionmsg)) |
269 | 294 | { |
270 | 295 | $object->actionmsg=$langs->transnoentities("InvoiceSentByEMail",$object->ref); |
@@ -272,8 +297,7 @@ discard block |
||
272 | 297 | |
273 | 298 | // Parameters $object->sendtoid defined by caller |
274 | 299 | //$object->sendtoid=0; |
275 | - } |
|
276 | - elseif ($action == 'BILL_PAYED') |
|
300 | + } elseif ($action == 'BILL_PAYED') |
|
277 | 301 | { |
278 | 302 | // Load translation files required by the page |
279 | 303 | $langs->loadLangs(array("agenda","other","bills")); |
@@ -283,59 +307,64 @@ discard block |
||
283 | 307 | $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); |
284 | 308 | |
285 | 309 | $object->sendtoid=0; |
286 | - } |
|
287 | - elseif ($action == 'BILL_CANCEL') |
|
310 | + } elseif ($action == 'BILL_CANCEL') |
|
288 | 311 | { |
289 | 312 | // Load translation files required by the page |
290 | 313 | $langs->loadLangs(array("agenda","other","bills")); |
291 | 314 | |
292 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
|
315 | + if (empty($object->actionmsg2)) { |
|
316 | + $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
|
317 | + } |
|
293 | 318 | $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
294 | 319 | |
295 | 320 | $object->sendtoid=0; |
296 | - } |
|
297 | - elseif ($action == 'FICHINTER_CREATE') |
|
321 | + } elseif ($action == 'FICHINTER_CREATE') |
|
298 | 322 | { |
299 | 323 | // Load translation files required by the page |
300 | 324 | $langs->loadLangs(array("agenda","other","interventions")); |
301 | 325 | |
302 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref); |
|
326 | + if (empty($object->actionmsg2)) { |
|
327 | + $object->actionmsg2=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref); |
|
328 | + } |
|
303 | 329 | $object->actionmsg=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref); |
304 | 330 | |
305 | 331 | $object->sendtoid=0; |
306 | 332 | $object->fk_element=0; |
307 | 333 | $object->elementtype=''; |
308 | - } |
|
309 | - elseif ($action == 'FICHINTER_VALIDATE') |
|
334 | + } elseif ($action == 'FICHINTER_VALIDATE') |
|
310 | 335 | { |
311 | 336 | // Load translation files required by the page |
312 | 337 | $langs->loadLangs(array("agenda","other","interventions")); |
313 | 338 | |
314 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
339 | + if (empty($object->actionmsg2)) { |
|
340 | + $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
341 | + } |
|
315 | 342 | $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
316 | 343 | |
317 | 344 | $object->sendtoid=0; |
318 | 345 | $object->fk_element=0; |
319 | 346 | $object->elementtype=''; |
320 | - } |
|
321 | - elseif ($action == 'FICHINTER_MODIFY') |
|
347 | + } elseif ($action == 'FICHINTER_MODIFY') |
|
322 | 348 | { |
323 | 349 | // Load translation files required by the page |
324 | 350 | $langs->loadLangs(array("agenda","other","interventions")); |
325 | 351 | |
326 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref); |
|
352 | + if (empty($object->actionmsg2)) { |
|
353 | + $object->actionmsg2=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref); |
|
354 | + } |
|
327 | 355 | $object->actionmsg=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref); |
328 | 356 | |
329 | 357 | $object->sendtoid=0; |
330 | 358 | $object->fk_element=0; |
331 | 359 | $object->elementtype=''; |
332 | - } |
|
333 | - elseif ($action == 'FICHINTER_SENTBYMAIL') |
|
360 | + } elseif ($action == 'FICHINTER_SENTBYMAIL') |
|
334 | 361 | { |
335 | 362 | // Load translation files required by the page |
336 | 363 | $langs->loadLangs(array("agenda","other","interventions")); |
337 | 364 | |
338 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); |
|
365 | + if (empty($object->actionmsg2)) { |
|
366 | + $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); |
|
367 | + } |
|
339 | 368 | if (empty($object->actionmsg)) |
340 | 369 | { |
341 | 370 | $object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref); |
@@ -343,45 +372,49 @@ discard block |
||
343 | 372 | |
344 | 373 | // Parameters $object->sendtoid defined by caller |
345 | 374 | //$object->sendtoid=0; |
346 | - } |
|
347 | - elseif ($action == 'FICHINTER_CLASSIFY_BILLED') |
|
375 | + } elseif ($action == 'FICHINTER_CLASSIFY_BILLED') |
|
348 | 376 | { |
349 | 377 | // Load translation files required by the page |
350 | 378 | $langs->loadLangs(array("agenda","other","interventions")); |
351 | 379 | |
352 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref); |
|
380 | + if (empty($object->actionmsg2)) { |
|
381 | + $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref); |
|
382 | + } |
|
353 | 383 | $object->actionmsg=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref); |
354 | 384 | |
355 | 385 | $object->sendtoid=0; |
356 | - } |
|
357 | - elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') |
|
386 | + } elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') |
|
358 | 387 | { |
359 | 388 | // Load translation files required by the page |
360 | 389 | $langs->loadLangs(array("agenda","other","interventions")); |
361 | 390 | |
362 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref); |
|
391 | + if (empty($object->actionmsg2)) { |
|
392 | + $object->actionmsg2=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref); |
|
393 | + } |
|
363 | 394 | $object->actionmsg=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref); |
364 | 395 | |
365 | 396 | $object->sendtoid=0; |
366 | - } |
|
367 | - elseif ($action == 'FICHINTER_DELETE') |
|
397 | + } elseif ($action == 'FICHINTER_DELETE') |
|
368 | 398 | { |
369 | 399 | // Load translation files required by the page |
370 | 400 | $langs->loadLangs(array("agenda","other","interventions")); |
371 | 401 | |
372 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref); |
|
402 | + if (empty($object->actionmsg2)) { |
|
403 | + $object->actionmsg2=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref); |
|
404 | + } |
|
373 | 405 | $object->actionmsg=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref); |
374 | 406 | |
375 | 407 | $object->sendtoid=0; |
376 | 408 | $object->fk_element=0; |
377 | 409 | $object->elementtype=''; |
378 | - } |
|
379 | - elseif ($action == 'SHIPPING_VALIDATE') |
|
410 | + } elseif ($action == 'SHIPPING_VALIDATE') |
|
380 | 411 | { |
381 | 412 | // Load translation files required by the page |
382 | 413 | $langs->loadLangs(array("agenda","other","sendings")); |
383 | 414 | |
384 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",($object->newref?$object->newref:$object->ref)); |
|
415 | + if (empty($object->actionmsg2)) { |
|
416 | + $object->actionmsg2=$langs->transnoentities("ShippingValidated",($object->newref?$object->newref:$object->ref)); |
|
417 | + } |
|
385 | 418 | if (empty($object->actionmsg)) |
386 | 419 | { |
387 | 420 | $object->actionmsg=$langs->transnoentities("ShippingValidated",($object->newref?$object->newref:$object->ref)); |
@@ -389,13 +422,14 @@ discard block |
||
389 | 422 | |
390 | 423 | // Parameters $object->sendtoid defined by caller |
391 | 424 | //$object->sendtoid=0; |
392 | - } |
|
393 | - elseif ($action == 'SHIPPING_SENTBYMAIL') |
|
425 | + } elseif ($action == 'SHIPPING_SENTBYMAIL') |
|
394 | 426 | { |
395 | 427 | // Load translation files required by the page |
396 | 428 | $langs->loadLangs(array("agenda","other","sendings")); |
397 | 429 | |
398 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref); |
|
430 | + if (empty($object->actionmsg2)) { |
|
431 | + $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref); |
|
432 | + } |
|
399 | 433 | if (empty($object->actionmsg)) |
400 | 434 | { |
401 | 435 | $object->actionmsg=$langs->transnoentities("ShippingSentByEMail",$object->ref); |
@@ -409,7 +443,9 @@ discard block |
||
409 | 443 | $langs->load("other"); |
410 | 444 | $langs->load("receptions"); |
411 | 445 | |
412 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionValidated",($object->newref?$object->newref:$object->ref)); |
|
446 | + if (empty($object->actionmsg2)) { |
|
447 | + $object->actionmsg2=$langs->transnoentities("ReceptionValidated",($object->newref?$object->newref:$object->ref)); |
|
448 | + } |
|
413 | 449 | if (empty($object->actionmsg)) |
414 | 450 | { |
415 | 451 | $object->actionmsg=$langs->transnoentities("ReceptionValidated",($object->newref?$object->newref:$object->ref)); |
@@ -417,14 +453,15 @@ discard block |
||
417 | 453 | |
418 | 454 | // Parameters $object->sendtoid defined by caller |
419 | 455 | //$object->sendtoid=0; |
420 | - } |
|
421 | - elseif ($action == 'RECEPTION_SENTBYMAIL') |
|
456 | + } elseif ($action == 'RECEPTION_SENTBYMAIL') |
|
422 | 457 | { |
423 | 458 | $langs->load("agenda"); |
424 | 459 | $langs->load("other"); |
425 | 460 | $langs->load("receptions"); |
426 | 461 | |
427 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionSentByEMail",$object->ref); |
|
462 | + if (empty($object->actionmsg2)) { |
|
463 | + $object->actionmsg2=$langs->transnoentities("ReceptionSentByEMail",$object->ref); |
|
464 | + } |
|
428 | 465 | if (empty($object->actionmsg)) |
429 | 466 | { |
430 | 467 | $object->actionmsg=$langs->transnoentities("ReceptionSentByEMail",$object->ref); |
@@ -432,23 +469,25 @@ discard block |
||
432 | 469 | |
433 | 470 | // Parameters $object->sendtoid defined by caller |
434 | 471 | //$object->sendtoid=0; |
435 | - } |
|
436 | - elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') |
|
472 | + } elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') |
|
437 | 473 | { |
438 | 474 | // Load translation files required by the page |
439 | 475 | $langs->loadLangs(array("agenda","other","propal")); |
440 | 476 | |
441 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
477 | + if (empty($object->actionmsg2)) { |
|
478 | + $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
479 | + } |
|
442 | 480 | $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
443 | 481 | |
444 | 482 | $object->sendtoid=0; |
445 | - } |
|
446 | - elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') |
|
483 | + } elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') |
|
447 | 484 | { |
448 | 485 | // Load translation files required by the page |
449 | 486 | $langs->loadLangs(array("agenda","other","propal")); |
450 | 487 | |
451 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
|
488 | + if (empty($object->actionmsg2)) { |
|
489 | + $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
|
490 | + } |
|
452 | 491 | if (empty($object->actionmsg)) |
453 | 492 | { |
454 | 493 | $object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref); |
@@ -456,93 +495,102 @@ discard block |
||
456 | 495 | |
457 | 496 | // Parameters $object->sendtoid defined by caller |
458 | 497 | //$object->sendtoid=0; |
459 | - } |
|
460 | - elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') |
|
498 | + } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') |
|
461 | 499 | { |
462 | 500 | // Load translation files required by the page |
463 | 501 | $langs->loadLangs(array("agenda","other","propal")); |
464 | 502 | |
465 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
|
503 | + if (empty($object->actionmsg2)) { |
|
504 | + $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
|
505 | + } |
|
466 | 506 | $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); |
467 | 507 | |
468 | 508 | $object->sendtoid=0; |
469 | - } |
|
470 | - elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') |
|
509 | + } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') |
|
471 | 510 | { |
472 | 511 | // Load translation files required by the page |
473 | 512 | $langs->loadLangs(array("agenda","other","propal")); |
474 | 513 | |
475 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
|
514 | + if (empty($object->actionmsg2)) { |
|
515 | + $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
|
516 | + } |
|
476 | 517 | $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); |
477 | 518 | |
478 | 519 | $object->sendtoid=0; |
479 | - } |
|
480 | - elseif ($action == 'ORDER_SUPPLIER_CREATE') |
|
520 | + } elseif ($action == 'ORDER_SUPPLIER_CREATE') |
|
481 | 521 | { |
482 | 522 | // Load translation files required by the page |
483 | 523 | $langs->loadLangs(array("agenda","other","orders")); |
484 | 524 | |
485 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
525 | + if (empty($object->actionmsg2)) { |
|
526 | + $object->actionmsg2=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
527 | + } |
|
486 | 528 | $object->actionmsg=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
487 | 529 | |
488 | 530 | $object->sendtoid=0; |
489 | - } |
|
490 | - elseif ($action == 'ORDER_SUPPLIER_VALIDATE') |
|
531 | + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') |
|
491 | 532 | { |
492 | 533 | // Load translation files required by the page |
493 | 534 | $langs->loadLangs(array("agenda","other","orders")); |
494 | 535 | |
495 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
536 | + if (empty($object->actionmsg2)) { |
|
537 | + $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
538 | + } |
|
496 | 539 | $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
497 | 540 | |
498 | 541 | $object->sendtoid=0; |
499 | - } |
|
500 | - elseif ($action == 'ORDER_SUPPLIER_APPROVE') |
|
542 | + } elseif ($action == 'ORDER_SUPPLIER_APPROVE') |
|
501 | 543 | { |
502 | 544 | // Load translation files required by the page |
503 | 545 | $langs->loadLangs(array("agenda","other","orders")); |
504 | 546 | |
505 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); |
|
547 | + if (empty($object->actionmsg2)) { |
|
548 | + $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); |
|
549 | + } |
|
506 | 550 | $object->actionmsg=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); |
507 | 551 | |
508 | 552 | $object->sendtoid=0; |
509 | - } |
|
510 | - elseif ($action == 'ORDER_SUPPLIER_REFUSE') |
|
553 | + } elseif ($action == 'ORDER_SUPPLIER_REFUSE') |
|
511 | 554 | { |
512 | 555 | // Load translation files required by the page |
513 | 556 | $langs->loadLangs(array("agenda","other","orders")); |
514 | 557 | |
515 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); |
|
558 | + if (empty($object->actionmsg2)) { |
|
559 | + $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); |
|
560 | + } |
|
516 | 561 | $object->actionmsg=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); |
517 | 562 | |
518 | 563 | $object->sendtoid=0; |
519 | - } |
|
520 | - elseif ($action == 'ORDER_SUPPLIER_SUBMIT') |
|
564 | + } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') |
|
521 | 565 | { |
522 | 566 | // Load translation files required by the page |
523 | 567 | $langs->loadLangs(array("agenda","other","orders")); |
524 | 568 | |
525 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
569 | + if (empty($object->actionmsg2)) { |
|
570 | + $object->actionmsg2=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
571 | + } |
|
526 | 572 | $object->actionmsg=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref)); |
527 | 573 | |
528 | 574 | $object->sendtoid=0; |
529 | - } |
|
530 | - elseif ($action == 'ORDER_SUPPLIER_RECEIVE') |
|
575 | + } elseif ($action == 'ORDER_SUPPLIER_RECEIVE') |
|
531 | 576 | { |
532 | 577 | // Load translation files required by the page |
533 | 578 | $langs->loadLangs(array("agenda","other","orders")); |
534 | 579 | |
535 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
580 | + if (empty($object->actionmsg2)) { |
|
581 | + $object->actionmsg2=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
582 | + } |
|
536 | 583 | $object->actionmsg=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref)); |
537 | 584 | |
538 | 585 | $object->sendtoid=0; |
539 | - } |
|
540 | - elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') |
|
586 | + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') |
|
541 | 587 | { |
542 | 588 | // Load translation files required by the page |
543 | 589 | $langs->loadLangs(array("agenda","other","bills","orders")); |
544 | 590 | |
545 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); |
|
591 | + if (empty($object->actionmsg2)) { |
|
592 | + $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); |
|
593 | + } |
|
546 | 594 | if (empty($object->actionmsg)) |
547 | 595 | { |
548 | 596 | $object->actionmsg=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); |
@@ -550,46 +598,50 @@ discard block |
||
550 | 598 | |
551 | 599 | // Parameters $object->sendtoid defined by caller |
552 | 600 | //$object->sendtoid=0; |
553 | - } |
|
554 | - elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') |
|
601 | + } elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') |
|
555 | 602 | { |
556 | 603 | // Load translation files required by the page |
557 | 604 | $langs->loadLangs(array("agenda","other","bills","orders")); |
558 | 605 | |
559 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref); |
|
606 | + if (empty($object->actionmsg2)) { |
|
607 | + $object->actionmsg2=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref); |
|
608 | + } |
|
560 | 609 | if (empty($object->actionmsg)) |
561 | 610 | { |
562 | 611 | $object->actionmsg=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref); |
563 | 612 | } |
564 | 613 | |
565 | 614 | $object->sendtoid=0; |
566 | - } |
|
567 | - elseif ($action == 'BILL_SUPPLIER_VALIDATE') |
|
615 | + } elseif ($action == 'BILL_SUPPLIER_VALIDATE') |
|
568 | 616 | { |
569 | 617 | // Load translation files required by the page |
570 | 618 | $langs->loadLangs(array("agenda","other","bills")); |
571 | 619 | |
572 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
620 | + if (empty($object->actionmsg2)) { |
|
621 | + $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
|
622 | + } |
|
573 | 623 | $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); |
574 | 624 | |
575 | 625 | $object->sendtoid=0; |
576 | - } |
|
577 | - elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') |
|
626 | + } elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') |
|
578 | 627 | { |
579 | 628 | // Load translation files required by the page |
580 | 629 | $langs->loadLangs(array("agenda","other","bills")); |
581 | 630 | |
582 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
|
631 | + if (empty($object->actionmsg2)) { |
|
632 | + $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
|
633 | + } |
|
583 | 634 | $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); |
584 | 635 | |
585 | 636 | $object->sendtoid=0; |
586 | - } |
|
587 | - elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') |
|
637 | + } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') |
|
588 | 638 | { |
589 | 639 | // Load translation files required by the page |
590 | 640 | $langs->loadLangs(array("agenda","other","bills","orders")); |
591 | 641 | |
592 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); |
|
642 | + if (empty($object->actionmsg2)) { |
|
643 | + $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); |
|
644 | + } |
|
593 | 645 | if (empty($object->actionmsg)) |
594 | 646 | { |
595 | 647 | $object->actionmsg=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); |
@@ -597,23 +649,25 @@ discard block |
||
597 | 649 | |
598 | 650 | // Parameters $object->sendtoid defined by caller |
599 | 651 | //$object->sendtoid=0; |
600 | - } |
|
601 | - elseif ($action == 'BILL_SUPPLIER_PAYED') |
|
652 | + } elseif ($action == 'BILL_SUPPLIER_PAYED') |
|
602 | 653 | { |
603 | 654 | // Load translation files required by the page |
604 | 655 | $langs->loadLangs(array("agenda","other","bills")); |
605 | 656 | |
606 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); |
|
657 | + if (empty($object->actionmsg2)) { |
|
658 | + $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); |
|
659 | + } |
|
607 | 660 | $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); |
608 | 661 | |
609 | 662 | $object->sendtoid=0; |
610 | - } |
|
611 | - elseif ($action == 'BILL_SUPPLIER_CANCELED') |
|
663 | + } elseif ($action == 'BILL_SUPPLIER_CANCELED') |
|
612 | 664 | { |
613 | 665 | // Load translation files required by the page |
614 | 666 | $langs->loadLangs(array("agenda","other","bills")); |
615 | 667 | |
616 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
|
668 | + if (empty($object->actionmsg2)) { |
|
669 | + $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
|
670 | + } |
|
617 | 671 | $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); |
618 | 672 | |
619 | 673 | $object->sendtoid=0; |
@@ -625,31 +679,35 @@ discard block |
||
625 | 679 | // Load translation files required by the page |
626 | 680 | $langs->loadLangs(array("agenda","other","members")); |
627 | 681 | |
628 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs)); |
|
682 | + if (empty($object->actionmsg2)) { |
|
683 | + $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs)); |
|
684 | + } |
|
629 | 685 | $object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs)); |
630 | 686 | $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
631 | 687 | $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
632 | 688 | |
633 | 689 | $object->sendtoid=0; |
634 | - } |
|
635 | - elseif ($action == 'MEMBER_MODIFY') |
|
690 | + } elseif ($action == 'MEMBER_MODIFY') |
|
636 | 691 | { |
637 | 692 | // Load translation files required by the page |
638 | 693 | $langs->loadLangs(array("agenda","other","members")); |
639 | 694 | |
640 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs)); |
|
695 | + if (empty($object->actionmsg2)) { |
|
696 | + $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs)); |
|
697 | + } |
|
641 | 698 | $object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs)); |
642 | 699 | $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
643 | 700 | $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
644 | 701 | |
645 | 702 | $object->sendtoid=0; |
646 | - } |
|
647 | - elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') |
|
703 | + } elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') |
|
648 | 704 | { |
649 | 705 | // Load translation files required by the page |
650 | 706 | $langs->loadLangs(array("agenda","other","members")); |
651 | 707 | |
652 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
708 | + if (empty($object->actionmsg2)) { |
|
709 | + $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
710 | + } |
|
653 | 711 | $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs)); |
654 | 712 | $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
655 | 713 | $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
@@ -657,14 +715,17 @@ discard block |
||
657 | 715 | $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); |
658 | 716 | |
659 | 717 | $object->sendtoid=0; |
660 | - if ($object->fk_soc > 0) $object->socid=$object->fk_soc; |
|
661 | - } |
|
662 | - elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') |
|
718 | + if ($object->fk_soc > 0) { |
|
719 | + $object->socid=$object->fk_soc; |
|
720 | + } |
|
721 | + } elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') |
|
663 | 722 | { |
664 | 723 | // Load translation files required by the page |
665 | 724 | $langs->loadLangs(array("agenda","other","members")); |
666 | 725 | |
667 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
726 | + if (empty($object->actionmsg2)) { |
|
727 | + $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
728 | + } |
|
668 | 729 | $object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs)); |
669 | 730 | $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
670 | 731 | $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
@@ -672,14 +733,17 @@ discard block |
||
672 | 733 | $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); |
673 | 734 | |
674 | 735 | $object->sendtoid=0; |
675 | - if ($object->fk_soc > 0) $object->socid=$object->fk_soc; |
|
676 | - } |
|
677 | - elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') |
|
736 | + if ($object->fk_soc > 0) { |
|
737 | + $object->socid=$object->fk_soc; |
|
738 | + } |
|
739 | + } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') |
|
678 | 740 | { |
679 | 741 | // Load translation files required by the page |
680 | 742 | $langs->loadLangs(array("agenda","other","members")); |
681 | 743 | |
682 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
744 | + if (empty($object->actionmsg2)) { |
|
745 | + $object->actionmsg2=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs)); |
|
746 | + } |
|
683 | 747 | $object->actionmsg=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs)); |
684 | 748 | $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
685 | 749 | $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
@@ -687,26 +751,30 @@ discard block |
||
687 | 751 | $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); |
688 | 752 | |
689 | 753 | $object->sendtoid=0; |
690 | - if ($object->fk_soc > 0) $object->socid=$object->fk_soc; |
|
691 | - } |
|
692 | - elseif ($action == 'MEMBER_RESILIATE') |
|
754 | + if ($object->fk_soc > 0) { |
|
755 | + $object->socid=$object->fk_soc; |
|
756 | + } |
|
757 | + } elseif ($action == 'MEMBER_RESILIATE') |
|
693 | 758 | { |
694 | 759 | // Load translation files required by the page |
695 | 760 | $langs->loadLangs(array("agenda","other","members")); |
696 | 761 | |
697 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs)); |
|
762 | + if (empty($object->actionmsg2)) { |
|
763 | + $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs)); |
|
764 | + } |
|
698 | 765 | $object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs)); |
699 | 766 | $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
700 | 767 | $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
701 | 768 | |
702 | 769 | $object->sendtoid=0; |
703 | - } |
|
704 | - elseif ($action == 'MEMBER_DELETE') |
|
770 | + } elseif ($action == 'MEMBER_DELETE') |
|
705 | 771 | { |
706 | 772 | // Load translation files required by the page |
707 | 773 | $langs->loadLangs(array("agenda","other","members")); |
708 | 774 | |
709 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs)); |
|
775 | + if (empty($object->actionmsg2)) { |
|
776 | + $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs)); |
|
777 | + } |
|
710 | 778 | $object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs)); |
711 | 779 | $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); |
712 | 780 | $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; |
@@ -720,29 +788,33 @@ discard block |
||
720 | 788 | // Load translation files required by the page |
721 | 789 | $langs->loadLangs(array("agenda","other","projects")); |
722 | 790 | |
723 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); |
|
791 | + if (empty($object->actionmsg2)) { |
|
792 | + $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); |
|
793 | + } |
|
724 | 794 | $object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); |
725 | 795 | $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref; |
726 | 796 | |
727 | 797 | $object->sendtoid=0; |
728 | - } |
|
729 | - elseif($action == 'PROJECT_VALIDATE') |
|
798 | + } elseif($action == 'PROJECT_VALIDATE') |
|
730 | 799 | { |
731 | 800 | // Load translation files required by the page |
732 | 801 | $langs->loadLangs(array("agenda","other","projects")); |
733 | 802 | |
734 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref); |
|
803 | + if (empty($object->actionmsg2)) { |
|
804 | + $object->actionmsg2=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref); |
|
805 | + } |
|
735 | 806 | $object->actionmsg=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref); |
736 | 807 | $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref; |
737 | 808 | |
738 | 809 | $object->sendtoid=0; |
739 | - } |
|
740 | - elseif($action == 'PROJECT_MODIFY') |
|
810 | + } elseif($action == 'PROJECT_MODIFY') |
|
741 | 811 | { |
742 | 812 | // Load translation files required by the page |
743 | 813 | $langs->loadLangs(array("agenda","other","projects")); |
744 | 814 | |
745 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref); |
|
815 | + if (empty($object->actionmsg2)) { |
|
816 | + $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref); |
|
817 | + } |
|
746 | 818 | $object->actionmsg=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref); |
747 | 819 | $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; |
748 | 820 | |
@@ -755,31 +827,33 @@ discard block |
||
755 | 827 | // Load translation files required by the page |
756 | 828 | $langs->loadLangs(array("agenda","other","projects")); |
757 | 829 | |
758 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref); |
|
830 | + if (empty($object->actionmsg2)) { |
|
831 | + $object->actionmsg2=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref); |
|
832 | + } |
|
759 | 833 | $object->actionmsg=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref); |
760 | 834 | $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; |
761 | 835 | |
762 | 836 | $object->sendtoid=0; |
763 | - } |
|
764 | - |
|
765 | - elseif($action == 'TASK_MODIFY') |
|
837 | + } elseif($action == 'TASK_MODIFY') |
|
766 | 838 | { |
767 | 839 | // Load translation files required by the page |
768 | 840 | $langs->loadLangs(array("agenda","other","projects")); |
769 | 841 | |
770 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref); |
|
842 | + if (empty($object->actionmsg2)) { |
|
843 | + $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref); |
|
844 | + } |
|
771 | 845 | $object->actionmsg=$langs->transnoentities("TaskModifieddInDolibarr",$object->ref); |
772 | 846 | $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; |
773 | 847 | |
774 | 848 | $object->sendtoid=0; |
775 | - } |
|
776 | - |
|
777 | - elseif($action == 'TASK_DELETE') |
|
849 | + } elseif($action == 'TASK_DELETE') |
|
778 | 850 | { |
779 | 851 | // Load translation files required by the page |
780 | 852 | $langs->loadLangs(array("agenda","other","projects")); |
781 | 853 | |
782 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); |
|
854 | + if (empty($object->actionmsg2)) { |
|
855 | + $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); |
|
856 | + } |
|
783 | 857 | $object->actionmsg=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); |
784 | 858 | $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref; |
785 | 859 | |
@@ -792,8 +866,12 @@ discard block |
||
792 | 866 | // Load translation files required by the page |
793 | 867 | $langs->loadLangs(array("agenda","other")); |
794 | 868 | |
795 | - if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities($action."InDolibarr",$object->ref); |
|
796 | - if (empty($object->actionmsg)) $object->actionmsg=$langs->transnoentities($action."InDolibarr",$object->ref); |
|
869 | + if (empty($object->actionmsg2)) { |
|
870 | + $object->actionmsg2=$langs->transnoentities($action."InDolibarr",$object->ref); |
|
871 | + } |
|
872 | + if (empty($object->actionmsg)) { |
|
873 | + $object->actionmsg=$langs->transnoentities($action."InDolibarr",$object->ref); |
|
874 | + } |
|
797 | 875 | |
798 | 876 | $object->sendtoid=0; |
799 | 877 | } |
@@ -821,18 +899,26 @@ discard block |
||
821 | 899 | // Set contactforaction if there is only 1 contact. |
822 | 900 | if (is_array($object->sendtoid)) |
823 | 901 | { |
824 | - if (count($object->sendtoid) == 1) $contactforaction->fetch(reset($object->sendtoid)); |
|
825 | - } |
|
826 | - else |
|
902 | + if (count($object->sendtoid) == 1) { |
|
903 | + $contactforaction->fetch(reset($object->sendtoid)); |
|
904 | + } |
|
905 | + } else |
|
827 | 906 | { |
828 | - if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid); |
|
907 | + if ($object->sendtoid > 0) { |
|
908 | + $contactforaction->fetch($object->sendtoid); |
|
909 | + } |
|
829 | 910 | } |
830 | 911 | // Set societeforaction. |
831 | - if ($object->socid > 0) $societeforaction->fetch($object->socid); |
|
832 | - elseif ($object->fk_soc > 0) $societeforaction->fetch($object->fk_soc); |
|
912 | + if ($object->socid > 0) { |
|
913 | + $societeforaction->fetch($object->socid); |
|
914 | + } elseif ($object->fk_soc > 0) { |
|
915 | + $societeforaction->fetch($object->fk_soc); |
|
916 | + } |
|
833 | 917 | |
834 | 918 | $projectid = isset($object->fk_project)?$object->fk_project:0; |
835 | - if ($object->element == 'project') $projectid = $object->id; |
|
919 | + if ($object->element == 'project') { |
|
920 | + $projectid = $object->id; |
|
921 | + } |
|
836 | 922 | |
837 | 923 | $elementid = $object->id; |
838 | 924 | $elementtype = $object->element; |
@@ -910,8 +996,7 @@ discard block |
||
910 | 996 | { |
911 | 997 | $_SESSION['LAST_ACTION_CREATED'] = $ret; |
912 | 998 | return 1; |
913 | - } |
|
914 | - else |
|
999 | + } else |
|
915 | 1000 | { |
916 | 1001 | $error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors); |
917 | 1002 | $this->error=$error; |
@@ -56,11 +56,16 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
58 | 58 | { |
59 | - if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing |
|
59 | + if (empty($conf->blockedlog->enabled)) { |
|
60 | + return 0; |
|
61 | + } |
|
62 | + // Module not active, we do nothing |
|
60 | 63 | |
61 | 64 | // Test if event/record is qualified |
62 | 65 | $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription', 'payment_various', 'cashcontrol'); |
63 | - if (! in_array($object->element, $listofqualifiedelement)) return 1; |
|
66 | + if (! in_array($object->element, $listofqualifiedelement)) { |
|
67 | + return 1; |
|
68 | + } |
|
64 | 69 | |
65 | 70 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
66 | 71 | |
@@ -88,12 +93,14 @@ discard block |
||
88 | 93 | |
89 | 94 | if (in_array($action, array( |
90 | 95 | 'MEMBER_SUBSCRIPTION_CREATE','MEMBER_SUBSCRIPTION_MODIFY','MEMBER_SUBSCRIPTION_DELETE', |
91 | - 'DON_VALIDATE','DON_MODIFY','DON_DELETE'))) $amounts = (double) $object->amount; |
|
92 | - elseif ($action == 'CASHCONTROL_VALIDATE') |
|
96 | + 'DON_VALIDATE','DON_MODIFY','DON_DELETE'))) { |
|
97 | + $amounts = (double) $object->amount; |
|
98 | + } elseif ($action == 'CASHCONTROL_VALIDATE') |
|
93 | 99 | { |
94 | 100 | $amounts = (double) $object->cash + (double) $object->cheque + (double) $object->card; |
95 | - } |
|
96 | - else $amounts = (double) $object->total_ttc; |
|
101 | + } else { |
|
102 | + $amounts = (double) $object->total_ttc; |
|
103 | + } |
|
97 | 104 | } |
98 | 105 | /*if ($action === 'BILL_PAYED' || $action==='BILL_UNPAYED' |
99 | 106 | || $action === 'BILL_SUPPLIER_PAYED' || $action === 'BILL_SUPPLIER_UNPAYED') |
@@ -111,8 +118,7 @@ discard block |
||
111 | 118 | $amounts += price2num($amount); |
112 | 119 | } |
113 | 120 | } |
114 | - } |
|
115 | - elseif (strpos($action,'PAYMENT')!==false && ! in_array($action, array('PAYMENT_ADD_TO_BANK'))) |
|
121 | + } elseif (strpos($action,'PAYMENT')!==false && ! in_array($action, array('PAYMENT_ADD_TO_BANK'))) |
|
116 | 122 | { |
117 | 123 | $qualified++; |
118 | 124 | $amounts = (double) $object->amount; |
@@ -141,8 +147,7 @@ discard block |
||
141 | 147 | $this->error = $b->error; |
142 | 148 | $this->errors = $b->errors; |
143 | 149 | return -1; |
144 | - } |
|
145 | - else |
|
150 | + } else |
|
146 | 151 | { |
147 | 152 | return 1; |
148 | 153 | } |
@@ -76,12 +76,17 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
78 | 78 | { |
79 | - if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing |
|
79 | + if (empty($conf->notification->enabled)) { |
|
80 | + return 0; |
|
81 | + } |
|
82 | + // Module not active, we do nothing |
|
80 | 83 | |
81 | 84 | require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; |
82 | 85 | $notify = new Notify($this->db); |
83 | 86 | |
84 | - if (! in_array($action, $notify->arrayofnotifsupported)) return 0; |
|
87 | + if (! in_array($action, $notify->arrayofnotifsupported)) { |
|
88 | + return 0; |
|
89 | + } |
|
85 | 90 | |
86 | 91 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
87 | 92 | |
@@ -117,7 +122,9 @@ discard block |
||
117 | 122 | |
118 | 123 | $qualified=0; |
119 | 124 | // Check is this event is supported by notification module |
120 | - if (in_array($obj->code, $this->listofmanagedevents)) $qualified=1; |
|
125 | + if (in_array($obj->code, $this->listofmanagedevents)) { |
|
126 | + $qualified=1; |
|
127 | + } |
|
121 | 128 | // Check if module for this event is active |
122 | 129 | if ($qualified) |
123 | 130 | { |
@@ -125,12 +132,19 @@ discard block |
||
125 | 132 | $element=$obj->elementtype; |
126 | 133 | |
127 | 134 | // Exclude events if related module is disabled |
128 | - if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified=0; |
|
129 | - elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified=0; |
|
130 | - elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified=0; |
|
131 | - elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified=0; |
|
132 | - elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified=0; |
|
133 | - elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member','expensereport')) && empty($conf->$element->enabled)) $qualified=0; |
|
135 | + if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) { |
|
136 | + $qualified=0; |
|
137 | + } elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) { |
|
138 | + $qualified=0; |
|
139 | + } elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) { |
|
140 | + $qualified=0; |
|
141 | + } elseif ($element == 'shipping' && empty($conf->expedition->enabled)) { |
|
142 | + $qualified=0; |
|
143 | + } elseif ($element == 'member' && empty($conf->adherent->enabled)) { |
|
144 | + $qualified=0; |
|
145 | + } elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member','expensereport')) && empty($conf->$element->enabled)) { |
|
146 | + $qualified=0; |
|
147 | + } |
|
134 | 148 | } |
135 | 149 | |
136 | 150 | if ($qualified) |
@@ -140,8 +154,9 @@ discard block |
||
140 | 154 | |
141 | 155 | $i++; |
142 | 156 | } |
143 | - } |
|
144 | - else dol_print_error($this->db); |
|
157 | + } else { |
|
158 | + dol_print_error($this->db); |
|
159 | + } |
|
145 | 160 | |
146 | 161 | return $ret; |
147 | 162 | } |
@@ -166,8 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | $ok = 1; |
169 | - } |
|
170 | - else |
|
169 | + } else |
|
171 | 170 | { |
172 | 171 | $this->error = $userstat->error; |
173 | 172 | $this->errors = $userstat->errors; |
@@ -282,10 +281,16 @@ discard block |
||
282 | 281 | } |
283 | 282 | |
284 | 283 | $qualified = true; |
285 | - if (empty($enabled)) $qualified = false; |
|
286 | - if (empty($perms)) $qualified = false; |
|
287 | - |
|
288 | - if ($qualified) $message_customer.='<li>'.$langs->trans($key).' : '.$value.'</li>'; |
|
284 | + if (empty($enabled)) { |
|
285 | + $qualified = false; |
|
286 | + } |
|
287 | + if (empty($perms)) { |
|
288 | + $qualified = false; |
|
289 | + } |
|
290 | + |
|
291 | + if ($qualified) { |
|
292 | + $message_customer.='<li>'.$langs->trans($key).' : '.$value.'</li>'; |
|
293 | + } |
|
289 | 294 | } |
290 | 295 | |
291 | 296 | $message_customer.='</ul>'; |
@@ -56,7 +56,10 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
58 | 58 | { |
59 | - if (empty($conf->mailmanspip->enabled)) return 0; // Module not active, we do nothing |
|
59 | + if (empty($conf->mailmanspip->enabled)) { |
|
60 | + return 0; |
|
61 | + } |
|
62 | + // Module not active, we do nothing |
|
60 | 63 | |
61 | 64 | require_once DOL_DOCUMENT_ROOT."/mailmanspip/class/mailmanspip.class.php"; |
62 | 65 | require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; |
@@ -71,15 +74,13 @@ discard block |
||
71 | 74 | $this->error=$object->context['linkto']->error; |
72 | 75 | $this->errors=$object->context['linkto']->errors; |
73 | 76 | $return=-1; |
74 | - } |
|
75 | - else |
|
77 | + } else |
|
76 | 78 | { |
77 | 79 | $return=1; |
78 | 80 | } |
79 | 81 | |
80 | 82 | return $return; |
81 | - } |
|
82 | - elseif ($action == 'CATEGORY_UNLINK') |
|
83 | + } elseif ($action == 'CATEGORY_UNLINK') |
|
83 | 84 | { |
84 | 85 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
85 | 86 | |
@@ -89,8 +90,7 @@ discard block |
||
89 | 90 | $this->error=$object->context['unlinkoff']->error; |
90 | 91 | $this->errors=$object->context['unlinkoff']->errors; |
91 | 92 | $return=-1; |
92 | - } |
|
93 | - else |
|
93 | + } else |
|
94 | 94 | { |
95 | 95 | $return=1; |
96 | 96 | } |
@@ -105,17 +105,18 @@ discard block |
||
105 | 105 | |
106 | 106 | $return=0; |
107 | 107 | // Add user into some linked tools (mailman, spip, etc...) |
108 | - if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) // TODO Do del/add also if type change |
|
108 | + if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) { |
|
109 | + // TODO Do del/add also if type change |
|
109 | 110 | { |
110 | 111 | if (is_object($object->oldcopy) && ($object->oldcopy->email != $object->email)) // If email has changed we delete mailman subscription for old email |
111 | 112 | { |
112 | 113 | if ($object->oldcopy->del_to_abo() < 0) |
113 | 114 | { |
114 | - if (! empty($object->oldcopy->error)) $this->error=$object->oldcopy->error; |
|
115 | + if (! empty($object->oldcopy->error)) $this->error=$object->oldcopy->error; |
|
116 | + } |
|
115 | 117 | $this->errors=$object->oldcopy->errors; |
116 | 118 | $return=-1; |
117 | - } |
|
118 | - else |
|
119 | + } else |
|
119 | 120 | { |
120 | 121 | $return=1; |
121 | 122 | } |
@@ -123,19 +124,19 @@ discard block |
||
123 | 124 | // We add subscription if new email or new type (new type may means more mailing-list to subscribe) |
124 | 125 | if ($object->add_to_abo() < 0) |
125 | 126 | { |
126 | - if (! empty($object->error)) $this->error=$object->error; |
|
127 | + if (! empty($object->error)) { |
|
128 | + $this->error=$object->error; |
|
129 | + } |
|
127 | 130 | $this->errors=$object->errors; |
128 | 131 | $return=-1; |
129 | - } |
|
130 | - else |
|
132 | + } else |
|
131 | 133 | { |
132 | 134 | $return=1; |
133 | 135 | } |
134 | 136 | } |
135 | 137 | |
136 | 138 | return $return; |
137 | - } |
|
138 | - elseif ($action == 'MEMBER_RESILIATE' || $action == 'MEMBER_DELETE') |
|
139 | + } elseif ($action == 'MEMBER_RESILIATE' || $action == 'MEMBER_DELETE') |
|
139 | 140 | { |
140 | 141 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
141 | 142 | |
@@ -143,11 +144,12 @@ discard block |
||
143 | 144 | // Remove from external tools (mailman, spip, etc...) |
144 | 145 | if ($object->del_to_abo() < 0) |
145 | 146 | { |
146 | - if (! empty($object->error)) $this->error=$object->error; |
|
147 | + if (! empty($object->error)) { |
|
148 | + $this->error=$object->error; |
|
149 | + } |
|
147 | 150 | $this->errors=$object->errors; |
148 | 151 | $return=-1; |
149 | - } |
|
150 | - else |
|
152 | + } else |
|
151 | 153 | { |
152 | 154 | $return=1; |
153 | 155 | } |
@@ -124,7 +124,9 @@ discard block |
||
124 | 124 | require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; |
125 | 125 | $stripe = new Stripe($db); |
126 | 126 | |
127 | - if (empty($conf->stripe->enabled)) return 0; |
|
127 | + if (empty($conf->stripe->enabled)) { |
|
128 | + return 0; |
|
129 | + } |
|
128 | 130 | |
129 | 131 | $ok = 1; |
130 | 132 | |
@@ -155,25 +157,40 @@ discard block |
||
155 | 157 | $taxinfo["tax_id"] = $vatcleaned; |
156 | 158 | } |
157 | 159 | // We force data to "null" if not defined as expected by Stripe |
158 | - if (empty($vatcleaned)) $taxinfo=null; |
|
160 | + if (empty($vatcleaned)) { |
|
161 | + $taxinfo=null; |
|
162 | + } |
|
159 | 163 | |
160 | 164 | // Detect if we change a Stripe info (email, description, vat id) |
161 | 165 | $changerequested = 0; |
162 | - if (! empty($object->email) && $object->email != $customer->email) $changerequested++; |
|
163 | - if ($namecleaned != $customer->description) $changerequested++; |
|
164 | - if (! isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) $changerequested++; |
|
165 | - elseif (isset($customer->tax_info['tax_id']) && is_null($vatcleaned)) $changerequested++; |
|
166 | - elseif (isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) |
|
166 | + if (! empty($object->email) && $object->email != $customer->email) { |
|
167 | + $changerequested++; |
|
168 | + } |
|
169 | + if ($namecleaned != $customer->description) { |
|
170 | + $changerequested++; |
|
171 | + } |
|
172 | + if (! isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) { |
|
173 | + $changerequested++; |
|
174 | + } elseif (isset($customer->tax_info['tax_id']) && is_null($vatcleaned)) { |
|
175 | + $changerequested++; |
|
176 | + } elseif (isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) |
|
167 | 177 | { |
168 | - if ($vatcleaned != $customer->tax_info['tax_id']) $changerequested++; |
|
178 | + if ($vatcleaned != $customer->tax_info['tax_id']) { |
|
179 | + $changerequested++; |
|
180 | + } |
|
169 | 181 | } |
170 | 182 | |
171 | 183 | if ($changerequested) |
172 | 184 | { |
173 | - if (! empty($object->email)) $customer->email = $object->email; |
|
185 | + if (! empty($object->email)) { |
|
186 | + $customer->email = $object->email; |
|
187 | + } |
|
174 | 188 | $customer->description = $namecleaned; |
175 | - if (empty($taxinfo)) $customer->tax_info = array('type'=>'vat', 'tax_id'=>null); |
|
176 | - else $customer->tax_info = $taxinfo; |
|
189 | + if (empty($taxinfo)) { |
|
190 | + $customer->tax_info = array('type'=>'vat', 'tax_id'=>null); |
|
191 | + } else { |
|
192 | + $customer->tax_info = $taxinfo; |
|
193 | + } |
|
177 | 194 | |
178 | 195 | $customer->save(); |
179 | 196 | } |
@@ -225,8 +242,7 @@ discard block |
||
225 | 242 | $card->metadata=array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])); |
226 | 243 | try { |
227 | 244 | $card->save($dataforcard); |
228 | - } |
|
229 | - catch(Exception $e) |
|
245 | + } catch(Exception $e) |
|
230 | 246 | { |
231 | 247 | $ok = -1; |
232 | 248 | $this->error = $e->getMessages(); |
@@ -257,8 +273,11 @@ discard block |
||
257 | 273 | { |
258 | 274 | $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); |
259 | 275 | if ($card) { |
260 | - if (method_exists($card, 'detach')) $card->detach(); |
|
261 | - else $card->delete(); |
|
276 | + if (method_exists($card, 'detach')) { |
|
277 | + $card->detach(); |
|
278 | + } else { |
|
279 | + $card->delete(); |
|
280 | + } |
|
262 | 281 | } |
263 | 282 | } |
264 | 283 | } |