@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills")); |
52 | 52 | |
53 | 53 | // Get Parameters |
54 | -$action = GETPOST('action', 'aZ09'); |
|
54 | +$action = GETPOST('action', 'aZ09'); |
|
55 | 55 | $massaction = GETPOST('massaction', 'alpha'); |
56 | -$confirm = GETPOST('confirm', 'alpha'); |
|
56 | +$confirm = GETPOST('confirm', 'alpha'); |
|
57 | 57 | $cancel = GETPOST('cancel', 'alpha'); |
58 | -$toselect = GETPOST('toselect', 'array'); |
|
58 | +$toselect = GETPOST('toselect', 'array'); |
|
59 | 59 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search |
60 | 60 | $optioncss = GETPOST('optioncss', 'alpha'); |
61 | 61 | $mode = GETPOST('mode', 'aZ09'); |
62 | 62 | if (empty($mode) && preg_match('/show_/', $action)) { |
63 | - $mode = $action; // For backward compatibility |
|
63 | + $mode = $action; // For backward compatibility |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $disabledefaultvalues = GETPOSTINT('disabledefaultvalues'); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | if (isModEnabled('category') && $user->hasRight('agenda', 'myactions', 'create')) { |
421 | 421 | $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); |
422 | 422 | } |
423 | -if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) { |
|
423 | +if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) { |
|
424 | 424 | $arrayofmassactions = array(); |
425 | 425 | } |
426 | 426 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | if (($filtert != '-1' && $filtert != '-2') || $usergroup > 0) { |
466 | 466 | // TODO Replace with a AND EXISTS |
467 | 467 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'"; |
468 | - if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
468 | + if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
469 | 469 | $sql .= " AND (ar.fk_element IN (".$db->sanitize($filtert).") OR (ar.fk_element IS NULL AND a.fk_user_action = ".((int) $filtert)."))"; // The OR is for backward compatibility |
470 | 470 | } elseif ($filtert == '-3') { |
471 | 471 | $sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")"; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
481 | 481 | $sql .= $hookmanager->resPrint; |
482 | 482 | |
483 | -$sql .= " WHERE a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
483 | +$sql .= " WHERE a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
484 | 484 | // Condition on actioncode |
485 | 485 | if (!empty($actioncode)) { |
486 | 486 | if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | * @param string $value |
511 | 511 | * @return bool |
512 | 512 | */ |
513 | - function ($value) { |
|
513 | + function($value) { |
|
514 | 514 | return ((string) $value !== '-1'); |
515 | 515 | } |
516 | 516 | ); |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | $event_owner_style = ''; |
1010 | 1010 | // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) |
1011 | 1011 | if ($obj->fk_user_action > 0 && $cache_user_list[$obj->fk_user_action]->color != '') { |
1012 | - $event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;'; |
|
1012 | + $event_owner_style .= 'border-left: #'.$cache_user_list[$obj->fk_user_action]->color.' 5px solid;'; |
|
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | // get event style for start and end date |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | $event_start_date_css = $event_end_date_css = $event_more_class; |
1046 | 1046 | |
1047 | - print '<tr class="oddeven' . ($event_more_class != '' ? ' '.$event_more_class : '') . '">'; |
|
1047 | + print '<tr class="oddeven'.($event_more_class != '' ? ' '.$event_more_class : '').'">'; |
|
1048 | 1048 | // Action column |
1049 | 1049 | if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
1050 | 1050 | print '<td class="nowrap center">'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | |
52 | 52 | $MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5); |
53 | -$DELAYFORCACHE = 300; // 300 seconds |
|
53 | +$DELAYFORCACHE = 300; // 300 seconds |
|
54 | 54 | |
55 | 55 | $disabledefaultvalues = GETPOSTINT('disabledefaultvalues'); |
56 | 56 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $socid = ''; |
87 | 87 | } |
88 | 88 | |
89 | -$canedit = 1; // can read events of others |
|
89 | +$canedit = 1; // can read events of others |
|
90 | 90 | if (!$user->hasRight('agenda', 'myactions', 'read')) { |
91 | 91 | accessforbidden(); |
92 | 92 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $sql .= " ON bc.rowid = ba.fk_bookcal_calendar"; |
554 | 554 | $sql .= " WHERE bc.status = 1"; |
555 | 555 | $sql .= " AND ba.status = 1"; |
556 | - $sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
556 | + $sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
557 | 557 | if (!empty($filtert) && $filtert != '-1' && $filtert != '-2') { |
558 | 558 | $sql .= " AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).")"; |
559 | 559 | } |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | // Holiday calendar |
595 | 595 | if ($user->hasRight("holiday", "read")) { |
596 | 596 | $s .= ' |
597 | - <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday ? ' checked' : '') . '> |
|
597 | + <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday ? ' checked' : '').'> |
|
598 | 598 | <label for="check_holiday" class="labelcalendar"> |
599 | - <span class="check_holiday_text">' . $langs->trans("Holidays") . '</span> |
|
599 | + <span class="check_holiday_text">' . $langs->trans("Holidays").'</span> |
|
600 | 600 | </label> |
601 | 601 | </div>'; |
602 | 602 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | // External calendars |
605 | 605 | if (count($showextcals) > 0) { |
606 | 606 | foreach ($showextcals as $val) { |
607 | - $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
607 | + $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
608 | 608 | |
609 | 609 | $s .= '<script type="text/javascript">'."\n"; |
610 | 610 | $s .= 'jQuery(document).ready(function () {'."\n"; |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | $s .= "\n".'<!-- End div to calendars selectors -->'."\n"; |
650 | 650 | } else { // If javascript off |
651 | 651 | $newparam = $param; // newparam is for birthday links |
652 | - $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.($showbirthday ? '1' : '0'), $newparam); // Always false @phpstan-ignore-line |
|
652 | + $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.($showbirthday ? '1' : '0'), $newparam); // Always false @phpstan-ignore-line |
|
653 | 653 | if (!preg_match('/showbirthday=/i', $newparam)) { |
654 | 654 | $newparam .= '&showbirthday=1'; |
655 | 655 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | // TODO Replace with a AND EXISTS |
699 | 699 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar"; |
700 | 700 | $sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'"; |
701 | - if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
701 | + if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
702 | 702 | $sql .= " AND ar.fk_element IN (".$db->sanitize($filtert).")"; |
703 | 703 | } elseif ($filtert == '-3') { |
704 | 704 | $sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")"; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | } |
710 | 710 | |
711 | 711 | $sql .= " WHERE a.fk_action = ca.id"; |
712 | -$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
712 | +$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
713 | 713 | |
714 | 714 | // Condition on actioncode |
715 | 715 | if (!empty($actioncode)) { |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | // event->datep and event->datef must be GMT date. |
876 | 876 | if ($event->fulldayevent) { |
877 | 877 | $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); |
878 | - $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
878 | + $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
879 | 879 | $event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver'); |
880 | 880 | } else { |
881 | 881 | // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) |
@@ -951,8 +951,8 @@ discard block |
||
951 | 951 | // Loop on each day covered by action to prepare an index to show on calendar |
952 | 952 | $loop = true; |
953 | 953 | $j = 0; |
954 | - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
955 | - $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
954 | + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
955 | + $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
956 | 956 | /* |
957 | 957 | print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>'; |
958 | 958 | print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>'; |
@@ -1154,9 +1154,9 @@ discard block |
||
1154 | 1154 | } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) { |
1155 | 1155 | $newevent->label .= ' ('.$langs->trans("Afternoon").')'; |
1156 | 1156 | } |
1157 | - $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. |
|
1157 | + $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. |
|
1158 | 1158 | } else { |
1159 | - $eventarray[$daykey][] = $event; // We can use the event unchanged |
|
1159 | + $eventarray[$daykey][] = $event; // We can use the event unchanged |
|
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | $daykey += 60 * 60 * 24; |
@@ -1904,8 +1904,8 @@ discard block |
||
1904 | 1904 | // We are in a particular day for $username, now we scan all events |
1905 | 1905 | foreach ($eventarray as $daykey => $notused) { |
1906 | 1906 | $annee = (int) dol_print_date($daykey, '%Y', 'tzuserrel'); |
1907 | - $mois = (int) dol_print_date($daykey, '%m', 'tzuserrel'); |
|
1908 | - $jour = (int) dol_print_date($daykey, '%d', 'tzuserrel'); |
|
1907 | + $mois = (int) dol_print_date($daykey, '%m', 'tzuserrel'); |
|
1908 | + $jour = (int) dol_print_date($daykey, '%d', 'tzuserrel'); |
|
1909 | 1909 | //var_dump("daykey=$daykey day=$day jour=$jour, month=$month mois=$mois, year=$year annee=$annee ".dol_print_date($daykey, 'dayhour', 'gmt')); |
1910 | 1910 | //var_dump($notused); |
1911 | 1911 |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | */ |
51 | 51 | |
52 | 52 | $MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5); |
53 | -$DELAYFORCACHE = 300; // 300 seconds |
|
53 | +$DELAYFORCACHE = 300; // 300 seconds |
|
54 | 54 | |
55 | 55 | $action = GETPOST('action', 'aZ09'); |
56 | 56 | $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
57 | 57 | $mode = GETPOST('mode', 'aZ09'); |
58 | 58 | if (empty($mode) && preg_match('/show_/', $action)) { |
59 | - $mode = $action; // For backward compatibility |
|
59 | + $mode = $action; // For backward compatibility |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $disabledefaultvalues = GETPOSTINT('disabledefaultvalues'); |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS')); |
147 | 147 | } |
148 | 148 | |
149 | -$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app |
|
150 | -$defaultview = getDolUserString('AGENDA_DEFAULT_VIEW', $defaultview); // default for user |
|
149 | +$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app |
|
150 | +$defaultview = getDolUserString('AGENDA_DEFAULT_VIEW', $defaultview); // default for user |
|
151 | 151 | if (empty($mode) && !GETPOSTISSET('mode')) { |
152 | 152 | $mode = $defaultview; |
153 | 153 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | |
562 | 562 | $viewmode .= '</div>'; |
563 | 563 | |
564 | -$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools |
|
564 | +$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools |
|
565 | 565 | |
566 | 566 | |
567 | 567 | $newparam = ''; |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $sql .= " ON bc.rowid = ba.fk_bookcal_calendar"; |
597 | 597 | $sql .= " WHERE bc.status = 1"; |
598 | 598 | $sql .= " AND ba.status = 1"; |
599 | - $sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
599 | + $sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
600 | 600 | if (!empty($filtert) && $filtert != '-1') { |
601 | 601 | $sql .= " AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).")"; |
602 | 602 | } |
@@ -652,9 +652,9 @@ discard block |
||
652 | 652 | if ($user->hasRight("holiday", "read")) { |
653 | 653 | $s .= ' |
654 | 654 | <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday |
655 | - ? ' checked' : '') . '> |
|
655 | + ? ' checked' : '').'> |
|
656 | 656 | <label for="check_holiday" class="labelcalendar"> |
657 | - <span class="check_holiday_text">' . $langs->trans("Holidays") . '</span> |
|
657 | + <span class="check_holiday_text">' . $langs->trans("Holidays").'</span> |
|
658 | 658 | </label> |
659 | 659 | </div>'; |
660 | 660 | } |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | $s .= '</script>'."\n"; |
681 | 681 | |
682 | 682 | foreach ($showextcals as $val) { |
683 | - $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
683 | + $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
684 | 684 | |
685 | 685 | if (!empty($val['default']) || GETPOSTINT('check_ext'.$htmlname)) { |
686 | 686 | $default = "checked"; |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | if (($filtert != '-1' && $filtert != '-2') || $usergroup > 0) { |
771 | 771 | // TODO Replace with a AND EXISTS |
772 | 772 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'"; |
773 | - if ($filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
773 | + if ($filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
774 | 774 | $sql .= " AND (ar.fk_element IN (".$db->sanitize($filtert).") OR (ar.fk_element IS NULL AND a.fk_user_action = ".((int) $filtert)."))"; // The OR is for backward compatibility |
775 | 775 | } elseif ($filtert == '-3') { |
776 | 776 | $sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")"; |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | $sql .= $hookmanager->resPrint; |
792 | 792 | |
793 | 793 | $sql .= " WHERE a.fk_action = ca.id"; |
794 | -$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
794 | +$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
795 | 795 | // Condition on actioncode |
796 | 796 | if (!empty($actioncode)) { |
797 | 797 | if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | * @param string $value |
822 | 822 | * @return bool |
823 | 823 | */ |
824 | - function ($value) { |
|
824 | + function($value) { |
|
825 | 825 | return ((string) $value !== '-1'); |
826 | 826 | } |
827 | 827 | ); |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | // event->datep and event->datef must be GMT date. |
945 | 945 | if ($event->fulldayevent) { |
946 | 946 | $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); |
947 | - $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
947 | + $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
948 | 948 | $event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver'); |
949 | 949 | } else { |
950 | 950 | // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | // Loop on each day covered by action to prepare an index to show on calendar |
1023 | 1023 | $loop = true; |
1024 | 1024 | $j = 0; |
1025 | - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
1026 | - $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
1025 | + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
1026 | + $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
1027 | 1027 | /* |
1028 | 1028 | print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>'; |
1029 | 1029 | print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>'; |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | $sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved) |
1151 | 1151 | if ($mode == 'show_day') { |
1152 | 1152 | // Request only leaves for the current selected day |
1153 | - $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time |
|
1153 | + $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time |
|
1154 | 1154 | } elseif ($mode == 'show_week') { |
1155 | 1155 | // Restrict on current month (we get more, but we will filter later) |
1156 | 1156 | $sql .= " AND x.date_debut < '".$db->idate(dol_get_last_day($year, $month))."'"; |
@@ -1234,9 +1234,9 @@ discard block |
||
1234 | 1234 | } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) { |
1235 | 1235 | $newevent->label .= ' ('.$langs->trans("Afternoon").')'; |
1236 | 1236 | } |
1237 | - $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. |
|
1237 | + $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. |
|
1238 | 1238 | } else { |
1239 | - $eventarray[$daykey][] = $event; // We can use the event unchanged |
|
1239 | + $eventarray[$daykey][] = $event; // We can use the event unchanged |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | $daykey += 60 * 60 * 24; |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | |
1726 | 1726 | for ($iter_day = 0; $iter_day < 7; $iter_day++) { |
1727 | 1727 | // Show days of the current week |
1728 | - $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server |
|
1728 | + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server |
|
1729 | 1729 | $tmpday = (int) dol_print_date($curtime, '%d', 'tzuserrel'); |
1730 | 1730 | $tmpmonth = (int) dol_print_date($curtime, '%m', 'tzuserrel'); |
1731 | 1731 | $tmpyear = (int) dol_print_date($curtime, '%Y', 'tzuserrel'); |
@@ -1960,9 +1960,9 @@ discard block |
||
1960 | 1960 | $tmpholiday = new Holiday($db); |
1961 | 1961 | |
1962 | 1962 | foreach ($eventarray as $daykey => $notused) { // daykey is the 'YYYYMMDD' to show according to user |
1963 | - $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1964 | - $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1965 | - $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1963 | + $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1964 | + $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1965 | + $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1966 | 1966 | |
1967 | 1967 | //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n"; |
1968 | 1968 | //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' day='.$day.' month='.$month.' year='.$year."<br>\n"; |
@@ -2232,7 +2232,7 @@ discard block |
||
2232 | 2232 | $event->label = $titletoshow; |
2233 | 2233 | // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user. |
2234 | 2234 | $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : ''); |
2235 | - $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...' |
|
2235 | + $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...' |
|
2236 | 2236 | $event->label = $savlabel; |
2237 | 2237 | } |
2238 | 2238 | |
@@ -2276,7 +2276,7 @@ discard block |
||
2276 | 2276 | $thirdparty = $cachethirdparties[$thirdparty_id]; |
2277 | 2277 | } |
2278 | 2278 | if (!empty($thirdparty->id)) { |
2279 | - $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large |
|
2279 | + $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large |
|
2280 | 2280 | } |
2281 | 2281 | } |
2282 | 2282 | if (!empty($contact_id) && $contact_id > 0) { |
@@ -2291,7 +2291,7 @@ discard block |
||
2291 | 2291 | $linerelatedto .= ' '; |
2292 | 2292 | } |
2293 | 2293 | if (!empty($contact->id)) { |
2294 | - $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large |
|
2294 | + $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large |
|
2295 | 2295 | } |
2296 | 2296 | } |
2297 | 2297 | if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT')) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | //if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id; |
63 | 63 | |
64 | 64 | // $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; |
65 | -$showbirthday = 0; // will be hidden here |
|
65 | +$showbirthday = 0; // will be hidden here |
|
66 | 66 | |
67 | 67 | // If not choice done on calendar owner, we filter on user. |
68 | 68 | if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $socid = ''; |
96 | 96 | } |
97 | 97 | |
98 | -$canedit = 1; // can read events of others |
|
98 | +$canedit = 1; // can read events of others |
|
99 | 99 | if (!$user->hasRight('agenda', 'myactions', 'read')) { |
100 | 100 | accessforbidden(); |
101 | 101 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | // TODO Replace with a AND EXISTS |
553 | 553 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar"; |
554 | 554 | $sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'"; |
555 | - if ($filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
555 | + if ($filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
556 | 556 | $sql .= " AND ar.fk_element IN (".$db->sanitize($filtert).")"; |
557 | 557 | } elseif ($filtert == -3) { |
558 | 558 | $sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")"; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | |
565 | 565 | $sql .= " WHERE a.fk_action = ca.id"; |
566 | -$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
566 | +$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
567 | 567 | |
568 | 568 | // Condition on actioncode |
569 | 569 | if (!empty($actioncode)) { |
@@ -1033,8 +1033,8 @@ discard block |
||
1033 | 1033 | // We are in a particular day for $username, now we scan all events |
1034 | 1034 | foreach ($eventarray as $daykey => $notused) { |
1035 | 1035 | $annee = dol_print_date($daykey, '%Y', 'tzuserrel'); |
1036 | - $mois = dol_print_date($daykey, '%m', 'tzuserrel'); |
|
1037 | - $jour = dol_print_date($daykey, '%d', 'tzuserrel'); |
|
1036 | + $mois = dol_print_date($daykey, '%m', 'tzuserrel'); |
|
1037 | + $jour = dol_print_date($daykey, '%d', 'tzuserrel'); |
|
1038 | 1038 | |
1039 | 1039 | if ($day == $jour && (int) $month == (int) $mois && $year == $annee) { // Is it the day we are looking for when calling function ? |
1040 | 1040 | // Scan all event for this date |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'const_anonymize' => 'DATAPOLICY_TIERS_CLIENT_ANONYMIZE_DELAY', |
75 | 75 | 'sql_template' => "SELECT s.rowid FROM ".$prefix."societe as s WHERE s.entity = __ENTITY__ AND s.client = ".Societe::CUSTOMER." AND s.fournisseur = 0 AND s.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
76 | 76 | 'class' => 'Societe', |
77 | - 'file' => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', |
|
77 | + 'file' => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', |
|
78 | 78 | 'anonymize_fields' => array('name' => 'MAKEANONYMOUS', 'name_alias' => 'MAKEANONYMOUS', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone' => '---', 'email' => '---', 'url' => '---', 'fax' => '---', 'siret' => '---', 'siren' => '---', 'ape' => '---', 'idprof4' => '---', 'idprof5' => '---', 'idprof6' => '---', 'tva_intra' => '---', 'capital' => 0, 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
79 | 79 | 'call_params' => array( |
80 | 80 | 'delete' => array('id', 'user'), // $object->delete($id, $user) |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'const_anonymize' => 'DATAPOLICY_TIERS_PROSPECT_ANONYMIZE_DELAY', |
90 | 90 | 'sql_template' => "SELECT s.rowid FROM ".$prefix."societe as s WHERE s.entity = __ENTITY__ AND s.client = ".Societe::PROSPECT." AND s.fournisseur = 0 AND s.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
91 | 91 | 'class' => 'Societe', |
92 | - 'file' => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', |
|
92 | + 'file' => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', |
|
93 | 93 | 'anonymize_fields' => array('name' => 'MAKEANONYMOUS', 'name_alias' => 'MAKEANONYMOUS', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone' => '---', 'email' => '---', 'url' => '---', 'fax' => '---', 'siret' => '---', 'siren' => '---', 'ape' => '---', 'idprof4' => '---', 'idprof5' => '---', 'idprof6' => '---', 'tva_intra' => '---', 'capital' => 0, 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
94 | 94 | 'call_params' => array( |
95 | 95 | 'delete' => array('id', 'user'), // $object->delete($id, $user) |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | 'const_anonymize' => 'DATAPOLICY_TIERS_PROSPECT_CLIENT_ANONYMIZE_DELAY', |
105 | 105 | 'sql_template' => "SELECT s.rowid FROM ".$prefix."societe as s WHERE s.entity = __ENTITY__ AND s.client = ".Societe::CUSTOMER_AND_PROSPECT." AND s.fournisseur = 0 AND s.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
106 | 106 | 'class' => 'Societe', |
107 | - 'file' => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', |
|
107 | + 'file' => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', |
|
108 | 108 | 'anonymize_fields' => array('name' => 'MAKEANONYMOUS', 'name_alias' => 'MAKEANONYMOUS', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone' => '---', 'email' => '---', 'url' => '---', 'fax' => '---', 'siret' => '---', 'siren' => '---', 'ape' => '---', 'idprof4' => '---', 'idprof5' => '---', 'idprof6' => '---', 'tva_intra' => '---', 'capital' => 0, 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
109 | 109 | 'call_params' => array( |
110 | 110 | 'delete' => array('id', 'user'), // $object->delete($id, $user) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | 'const_anonymize' => 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT_ANONYMIZE_DELAY', |
120 | 120 | 'sql_template' => "SELECT s.rowid FROM ".$prefix."societe as s WHERE s.entity = __ENTITY__ AND s.client = ".Societe::NO_CUSTOMER." AND s.fournisseur = 0 AND s.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
121 | 121 | 'class' => 'Societe', |
122 | - 'file' => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', |
|
122 | + 'file' => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', |
|
123 | 123 | 'anonymize_fields' => array('name' => 'MAKEANONYMOUS', 'name_alias' => 'MAKEANONYMOUS', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone' => '---', 'email' => '---', 'url' => '---', 'fax' => '---', 'siret' => '---', 'siren' => '---', 'ape' => '---', 'idprof4' => '---', 'idprof5' => '---', 'idprof6' => '---', 'tva_intra' => '---', 'capital' => 0, 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
124 | 124 | 'call_params' => array( |
125 | 125 | 'delete' => array('id', 'user'), // $object->delete($id, $user) |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'const_anonymize' => 'DATAPOLICY_TIERS_FOURNISSEUR_ANONYMIZE_DELAY', |
135 | 135 | 'sql_template' => "SELECT s.rowid FROM ".$prefix."societe as s WHERE s.entity = __ENTITY__ AND s.fournisseur = 1 AND s.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
136 | 136 | 'class' => 'Societe', |
137 | - 'file' => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', |
|
137 | + 'file' => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', |
|
138 | 138 | 'anonymize_fields' => array('name' => 'MAKEANONYMOUS', 'name_alias' => 'MAKEANONYMOUS', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone' => '---', 'email' => '---', 'url' => '---', 'fax' => '---', 'siret' => '---', 'siren' => '---', 'ape' => '---', 'idprof4' => '---', 'idprof5' => '---', 'idprof6' => '---', 'tva_intra' => '---', 'capital' => 0, 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
139 | 139 | 'call_params' => array( |
140 | 140 | 'delete' => array('id', 'user'), // $object->delete($id, $user) |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'const_anonymize' => 'DATAPOLICY_CONTACT_CLIENT_ANONYMIZE_DELAY', |
151 | 151 | 'sql_template' => "SELECT c.rowid FROM ".$prefix."socpeople as c INNER JOIN ".$prefix."societe as s ON s.rowid = c.fk_soc WHERE c.entity = __ENTITY__ AND c.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND s.client = ".Societe::CUSTOMER." AND s.fournisseur = 0 AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
152 | 152 | 'class' => 'Contact', |
153 | - 'file' => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', |
|
153 | + 'file' => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', |
|
154 | 154 | 'anonymize_fields' => array('lastname' => 'MAKEANONYMOUS', 'firstname' => 'MAKEANONYMOUS', 'poste' => '---', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone_pro' => '---', 'phone_perso' => '---', 'phone_mobile' => '---', 'email' => '---', 'photo' => '', 'url' => '---', 'fax' => '---', 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
155 | 155 | 'call_params' => array( |
156 | 156 | 'delete' => array('user'), // $object->delete($user) |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | 'const_anonymize' => 'DATAPOLICY_CONTACT_PROSPECT_ANONYMIZE_DELAY', |
166 | 166 | 'sql_template' => "SELECT c.rowid FROM ".$prefix."socpeople as c INNER JOIN ".$prefix."societe as s ON s.rowid = c.fk_soc WHERE c.entity = __ENTITY__ AND c.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND s.client = ".Societe::PROSPECT." AND s.fournisseur = 0 AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
167 | 167 | 'class' => 'Contact', |
168 | - 'file' => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', |
|
168 | + 'file' => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', |
|
169 | 169 | 'anonymize_fields' => array('lastname' => 'MAKEANONYMOUS', 'firstname' => 'MAKEANONYMOUS', 'poste' => '---', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone_pro' => '---', 'phone_perso' => '---', 'phone_mobile' => '---', 'email' => '---', 'photo' => '', 'url' => '---', 'fax' => '---', 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
170 | 170 | 'call_params' => array( |
171 | 171 | 'delete' => array('user'), // $object->delete($user) |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'const_anonymize' => 'DATAPOLICY_CONTACT_PROSPECT_CLIENT_ANONYMIZE_DELAY', |
181 | 181 | 'sql_template' => "SELECT c.rowid FROM ".$prefix."socpeople as c INNER JOIN ".$prefix."societe as s ON s.rowid = c.fk_soc WHERE c.entity = __ENTITY__ AND c.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND s.client = ".Societe::CUSTOMER_AND_PROSPECT." AND s.fournisseur = 0 AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
182 | 182 | 'class' => 'Contact', |
183 | - 'file' => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', |
|
183 | + 'file' => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', |
|
184 | 184 | 'anonymize_fields' => array('lastname' => 'MAKEANONYMOUS', 'firstname' => 'MAKEANONYMOUS', 'poste' => '---', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone_pro' => '---', 'phone_perso' => '---', 'phone_mobile' => '---', 'email' => '---', 'photo' => '', 'url' => '---', 'fax' => '---', 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
185 | 185 | 'call_params' => array( |
186 | 186 | 'delete' => array('user'), // $object->delete($user) |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'const_anonymize' => 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT_ANONYMIZE_DELAY', |
196 | 196 | 'sql_template' => "SELECT c.rowid FROM ".$prefix."socpeople as c INNER JOIN ".$prefix."societe as s ON s.rowid = c.fk_soc WHERE c.entity = __ENTITY__ AND c.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND s.client = ".Societe::NO_CUSTOMER." AND s.fournisseur = 0 AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
197 | 197 | 'class' => 'Contact', |
198 | - 'file' => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', |
|
198 | + 'file' => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', |
|
199 | 199 | 'anonymize_fields' => array('lastname' => 'MAKEANONYMOUS', 'firstname' => 'MAKEANONYMOUS', 'poste' => '---', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone_pro' => '---', 'phone_perso' => '---', 'phone_mobile' => '---', 'email' => '---', 'photo' => '', 'url' => '---', 'fax' => '---', 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
200 | 200 | 'call_params' => array( |
201 | 201 | 'delete' => array('user'), // $object->delete($user) |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | 'const_anonymize' => 'DATAPOLICY_CONTACT_FOURNISSEUR_ANONYMIZE_DELAY', |
211 | 211 | 'sql_template' => "SELECT c.rowid FROM ".$prefix."socpeople as c INNER JOIN ".$prefix."societe as s ON s.rowid = c.fk_soc WHERE c.entity = __ENTITY__ AND c.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND s.fournisseur = 1 AND NOT EXISTS (SELECT a.id FROM ".$prefix."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH)) AND NOT EXISTS (SELECT f.rowid FROM ".$prefix."facture as f WHERE f.fk_soc = s.rowid)", |
212 | 212 | 'class' => 'Contact', |
213 | - 'file' => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', |
|
213 | + 'file' => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', |
|
214 | 214 | 'anonymize_fields' => array('lastname' => 'MAKEANONYMOUS', 'firstname' => 'MAKEANONYMOUS', 'poste' => '---', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone_pro' => '---', 'phone_perso' => '---', 'phone_mobile' => '---', 'email' => '---', 'photo' => '', 'url' => '---', 'fax' => '---', 'socialnetworks' => [], 'geolat' => 0, 'geolong' => 0, 'ip' => '0.0.0.0'), |
215 | 215 | 'call_params' => array( |
216 | 216 | 'delete' => array('user'), // $object->delete($user) |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | 'const_anonymize' => 'DATAPOLICY_ADHERENT_ANONYMIZE_DELAY', |
227 | 227 | 'sql_template' => "SELECT a.rowid FROM ".$prefix."adherent as a WHERE a.entity = __ENTITY__ AND a.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND NOT EXISTS (SELECT ac.id FROM ".$prefix."actioncomm as ac WHERE ac.fk_element = a.rowid AND ac.elementtype = 'member' AND ac.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH))", |
228 | 228 | 'class' => 'Adherent', |
229 | - 'file' => DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php', |
|
229 | + 'file' => DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php', |
|
230 | 230 | 'anonymize_fields' => array('lastname' => 'MAKEANONYMOUS', 'firstname' => 'MAKEANONYMOUS', 'societe' => '---', 'address' => '---', 'town' => '---', 'zip' => '---', 'phone' => '---', 'phone_perso' => '---', 'phone_mobile' => '---', 'email' => '---', 'birth' => '1900-01-01', 'photo' => '', 'url' => '---', 'fax' => '---', 'socialnetworks' => [], 'ip' => '0.0.0.0'), |
231 | 231 | 'call_params' => array( |
232 | - 'delete' => array('user'), // $object->delete($user) |
|
232 | + 'delete' => array('user'), // $object->delete($user) |
|
233 | 233 | 'update' => array('user') // $object->update($user) |
234 | 234 | ) |
235 | 235 | ), |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | 'const_anonymize' => '', // Anonymization not applicable |
243 | 243 | 'sql_template' => "SELECT c.rowid FROM ".$prefix."recruitment_recruitmentcandidature as c WHERE c.entity = __ENTITY__ AND c.tms < DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH) AND NOT EXISTS (SELECT ac.id FROM ".$prefix."actioncomm as ac WHERE ac.elementtype = 'recruitmentcandidature@recruitment' AND ac.fk_element = c.rowid AND ac.tms > DATE_SUB(__NOW__, INTERVAL __DELAY__ MONTH))", |
244 | 244 | 'class' => 'RecruitmentCandidature', |
245 | - 'file' => DOL_DOCUMENT_ROOT . '/recruitment/class/recruitmentcandidature.class.php', |
|
245 | + 'file' => DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php', |
|
246 | 246 | 'anonymize_fields' => array(), |
247 | 247 | 'call_params' => array( |
248 | - 'delete' => array('user'), // $object->delete($user) |
|
248 | + 'delete' => array('user'), // $object->delete($user) |
|
249 | 249 | 'update' => array('user') // $object->update($user) |
250 | 250 | ) |
251 | 251 | ) |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | // Iterate through each defined policy to apply its rules. |
282 | 282 | foreach ($dataPolicies as $policy) { |
283 | 283 | // Instantiate object only once per class type for efficiency. |
284 | - if (! isset($objectInstances[$policy['class']])) { |
|
284 | + if (!isset($objectInstances[$policy['class']])) { |
|
285 | 285 | require_once $policy['file']; |
286 | 286 | $classtoinit = $policy['class']; |
287 | 287 | $objectInstances[$policy['class']] = new $classtoinit($this->db); |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | // Finalize the transaction based on the outcome of all operations. |
302 | - if (! $this->errorCount) { |
|
302 | + if (!$this->errorCount) { |
|
303 | 303 | $this->db->commit(); |
304 | - $this->output = $this->nbupdated . ' record(s) anonymized, ' . $this->nbdeleted . ' record(s) deleted.'; |
|
304 | + $this->output = $this->nbupdated.' record(s) anonymized, '.$this->nbdeleted.' record(s) deleted.'; |
|
305 | 305 | } else { |
306 | 306 | $this->db->rollback(); |
307 | 307 | $this->error = implode("\n", $this->errorMessages); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | private function _processPolicyAction($policy, $action, $object, &$processedIds, $conf, $user) |
326 | 326 | { |
327 | - $constName = $policy['const_' . $action] ?? null; |
|
327 | + $constName = $policy['const_'.$action] ?? null; |
|
328 | 328 | $delay = $constName ? getDolGlobalInt($constName) : 0; |
329 | 329 | |
330 | 330 | if ($delay <= 0) { |
@@ -335,25 +335,25 @@ discard block |
||
335 | 335 | $sqlPlaceholders = array( |
336 | 336 | '__ENTITY__' => (string) $conf->entity, |
337 | 337 | '__DELAY__' => (string) $delay, |
338 | - '__NOW__' => "'" . $this->db->idate(dol_now()) . "'" |
|
338 | + '__NOW__' => "'".$this->db->idate(dol_now())."'" |
|
339 | 339 | ); |
340 | 340 | $sql = str_replace(array_keys($sqlPlaceholders), array_values($sqlPlaceholders), $policy['sql_template']); |
341 | 341 | |
342 | 342 | $resql = $this->db->query($sql); |
343 | 343 | |
344 | - if (! $resql) { |
|
344 | + if (!$resql) { |
|
345 | 345 | $this->errorCount++; |
346 | - $this->errorMessages[] = 'Error executing ' . $action . ' query for policy ' . $constName . ': ' . $this->db->lasterror(); |
|
346 | + $this->errorMessages[] = 'Error executing '.$action.' query for policy '.$constName.': '.$this->db->lasterror(); |
|
347 | 347 | |
348 | 348 | return; |
349 | 349 | } |
350 | 350 | |
351 | 351 | // Define the handler method for the action |
352 | - $handlerMethod = '_handle' . ucfirst($action); |
|
352 | + $handlerMethod = '_handle'.ucfirst($action); |
|
353 | 353 | |
354 | 354 | // Process the records found by the query |
355 | 355 | while ($obj = $this->db->fetch_object($resql)) { |
356 | - if (in_array($obj->rowid, $processedIds) || ! method_exists($this, $handlerMethod)) { |
|
356 | + if (in_array($obj->rowid, $processedIds) || !method_exists($this, $handlerMethod)) { |
|
357 | 357 | continue; |
358 | 358 | } |
359 | 359 | /** @var CommonObject $object */ |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | foreach ($policy['anonymize_fields'] as $field => $val) { |
402 | 402 | if ($val == 'MAKEANONYMOUS') { |
403 | 403 | // For each field with rule "MAKEANONYMOUS, set the new value, keeping the ID. |
404 | - $object->$field = $field . '-anonymous-' . $object->id; |
|
404 | + $object->$field = $field.'-anonymous-'.$object->id; |
|
405 | 405 | } else { |
406 | 406 | // For others, force the value, but only if not already empty. |
407 | 407 | if (!empty($object->$field)) { |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | $paramConfig = $policy['call_params'][$method] ?? []; |
435 | 435 | |
436 | - return array_map(function (string $paramName) use ($availableArgs) { |
|
436 | + return array_map(function(string $paramName) use ($availableArgs) { |
|
437 | 437 | return $availableArgs[$paramName]; |
438 | 438 | }, $paramConfig); |
439 | 439 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | { |
451 | 451 | if ($result <= 0) { |
452 | 452 | $this->errorCount++; |
453 | - $this->errorMessages[] = 'Failed to ' . $action . ' record ID ' . $object->id . ' from class ' . get_class($object) . '. Error: ' . $object->errorsToString(); |
|
453 | + $this->errorMessages[] = 'Failed to '.$action.' record ID '.$object->id.' from class '.get_class($object).'. Error: '.$object->errorsToString(); |
|
454 | 454 | } else { |
455 | 455 | if ($action === 'delete') { |
456 | 456 | $this->nbdeleted++; |