|
@@ -82,7 +82,7 @@ discard block |
|
|
block discarded – undo |
82
|
82
|
$offsetunit = GETPOST('offsetunittype_duration', 'aZ09'); |
83
|
83
|
$remindertype = GETPOST('selectremindertype', 'aZ09'); |
84
|
84
|
$modelmail = GETPOSTINT('actioncommsendmodel_mail'); |
85
|
|
-$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed |
|
85
|
+$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed |
86
|
86
|
$private = GETPOST('private', 'alphanohtml'); |
87
|
87
|
if ($complete == 'na' || $complete == -2) { |
88
|
88
|
$complete = -1; |
|
@@ -563,7 +563,7 @@ discard block |
|
|
block discarded – undo |
563
|
563
|
if (is_array($listofresourceid) && count($listofresourceid)) { |
564
|
564
|
foreach ($listofresourceid as $resource_id => $val) { |
565
|
565
|
$resource_type = 'dolresource'; |
566
|
|
- $busy = 1;//GETPOSTINT('busy'); |
|
566
|
+ $busy = 1; //GETPOSTINT('busy'); |
567
|
567
|
|
568
|
568
|
// Resources association |
569
|
569
|
if (getDolGlobalString('RESOURCE_USED_IN_EVENT_CHECK')) { |
|
@@ -579,24 +579,24 @@ discard block |
|
|
block discarded – undo |
579
|
579
|
} |
580
|
580
|
|
581
|
581
|
$sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; |
582
|
|
- $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; |
583
|
|
- $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($resource_type) . "'"; |
584
|
|
- $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; |
585
|
|
- $sql .= " WHERE er.resource_id = " . ((int) $resource_id); |
|
582
|
+ $sql .= " FROM ".MAIN_DB_PREFIX."element_resources as er"; |
|
583
|
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."resource as r ON r.rowid = er.resource_id AND er.resource_type = '".$db->escape($resource_type)."'"; |
|
584
|
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as ac ON ac.id = er.element_id AND er.element_type = '".$db->escape($object->element)."'"; |
|
585
|
+ $sql .= " WHERE er.resource_id = ".((int) $resource_id); |
586
|
586
|
$sql .= " AND er.busy = 1"; |
587
|
587
|
$sql .= " AND ("; |
588
|
588
|
|
589
|
589
|
// event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end) |
590
|
|
- $sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))"; |
|
590
|
+ $sql .= " (ac.datep <= '".$db->idate($eventDateStart)."' AND (ac.datep2 IS NULL OR ac.datep2 >= '".$db->idate($eventDateStart)."'))"; |
591
|
591
|
// event date end between ac.datep and ac.datep2 |
592
|
592
|
if (!empty($eventDateEnd)) { |
593
|
|
- $sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))"; |
|
593
|
+ $sql .= " OR (ac.datep <= '".$db->idate($eventDateEnd)."' AND (ac.datep2 >= '".$db->idate($eventDateEnd)."'))"; |
594
|
594
|
} |
595
|
595
|
// event date start before ac.datep and event date end after ac.datep2 |
596
|
596
|
$sql .= " OR ("; |
597
|
|
- $sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'"; |
|
597
|
+ $sql .= "ac.datep >= '".$db->idate($eventDateStart)."'"; |
598
|
598
|
if (!empty($eventDateEnd)) { |
599
|
|
- $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')"; |
|
599
|
+ $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($eventDateEnd)."')"; |
600
|
600
|
} |
601
|
601
|
$sql .= ")"; |
602
|
602
|
|
|
@@ -610,9 +610,9 @@ discard block |
|
|
block discarded – undo |
610
|
610
|
if ($db->num_rows($resql) > 0) { |
611
|
611
|
// Resource already in use |
612
|
612
|
$error++; |
613
|
|
- $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; |
|
613
|
+ $object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : '; |
614
|
614
|
while ($obj = $db->fetch_object($resql)) { |
615
|
|
- $object->error .= '<br> - ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); |
|
615
|
+ $object->error .= '<br> - '.$langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label.' ['.$obj->ac_id.']'); |
616
|
616
|
} |
617
|
617
|
$object->errors[] = $object->error; |
618
|
618
|
|
|
@@ -723,12 +723,12 @@ discard block |
|
|
block discarded – undo |
723
|
723
|
if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) { |
724
|
724
|
$firstdatearray = dol_get_first_day_week(GETPOSTINT("apday"), GETPOSTINT("apmonth"), GETPOSTINT("apyear")); |
725
|
725
|
$datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel'); |
726
|
|
- $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd');//We begin the week after |
|
726
|
+ $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd'); //We begin the week after |
727
|
727
|
$dayoffset = 7; |
728
|
728
|
$monthoffset = 0; |
729
|
729
|
} elseif ($selectedrecurrulefreq == 'MONTHLY' && !empty($selectedrecurrulebymonthday)) { |
730
|
730
|
$firstday = $selectedrecurrulebymonthday; |
731
|
|
- $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth");//We begin the week after |
|
731
|
+ $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth"); //We begin the week after |
732
|
732
|
$datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel'); |
733
|
733
|
$dayoffset = 0; |
734
|
734
|
$monthoffset = 1; |
|
@@ -832,9 +832,9 @@ discard block |
|
|
block discarded – undo |
832
|
832
|
|
833
|
833
|
// increment date for recurrent events |
834
|
834
|
$datep = dol_time_plus_duree($datep, $dayoffset, 'd'); |
835
|
|
- $datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
835
|
+ $datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
836
|
836
|
$datef = dol_time_plus_duree($datef, $dayoffset, 'd'); |
837
|
|
- $datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
837
|
+ $datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
838
|
838
|
} |
839
|
839
|
} |
840
|
840
|
if (!empty($backtopage) && !$error) { |
|
@@ -876,7 +876,7 @@ discard block |
|
|
block discarded – undo |
876
|
876
|
$object->fetch($id); |
877
|
877
|
$object->fetch_optionals(); |
878
|
878
|
$object->fetch_userassigned(); |
879
|
|
- $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
879
|
+ $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
880
|
880
|
|
881
|
881
|
// Clean parameters |
882
|
882
|
if ($fulldayevent) { |
|
@@ -1155,7 +1155,7 @@ discard block |
|
|
block discarded – undo |
1155
|
1155
|
$object->fetch($id); |
1156
|
1156
|
$object->fetch_optionals(); |
1157
|
1157
|
$object->fetch_userassigned(); |
1158
|
|
- $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1158
|
+ $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
1159
|
1159
|
|
1160
|
1160
|
if ($user->hasRight('agenda', 'myactions', 'delete') |
1161
|
1161
|
|| $user->hasRight('agenda', 'allactions', 'delete')) { |
|
@@ -1177,7 +1177,7 @@ discard block |
|
|
block discarded – undo |
1177
|
1177
|
if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') { |
1178
|
1178
|
$error = 0; |
1179
|
1179
|
|
1180
|
|
- $shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. |
|
1180
|
+ $shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. |
1181
|
1181
|
$smin = (int) dol_print_date($object->datep, "%M", 'tzuserrel'); |
1182
|
1182
|
|
1183
|
1183
|
$newdate = GETPOST('newdate', 'alpha'); |
|
@@ -1351,7 +1351,7 @@ discard block |
|
|
block discarded – undo |
1351
|
1351
|
if (new_startdate > old_enddate) { |
1352
|
1352
|
var timeDiff = old_enddate - old_startdate; |
1353
|
1353
|
var new_enddate = new Date(new_startdate.getTime() + timeDiff); |
1354
|
|
- $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); |
|
1354
|
+ $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'")); |
1355
|
1355
|
$("#p2day").val(new_enddate.getDate()); |
1356
|
1356
|
$("#p2month").val(new_enddate.getMonth() + 1); |
1357
|
1357
|
$("#p2year").val(new_enddate.getFullYear()); |
|
@@ -1419,7 +1419,7 @@ discard block |
|
|
block discarded – undo |
1419
|
1419
|
$default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV'); |
1420
|
1420
|
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"'); |
1421
|
1421
|
$selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default); |
1422
|
|
- print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot |
|
1422
|
+ print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot |
1423
|
1423
|
print '</td></tr>'; |
1424
|
1424
|
} |
1425
|
1425
|
|
|
@@ -1504,7 +1504,7 @@ discard block |
|
|
block discarded – undo |
1504
|
1504
|
*/ |
1505
|
1505
|
|
1506
|
1506
|
// limit date |
1507
|
|
- $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; |
|
1507
|
+ $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; |
1508
|
1508
|
|
1509
|
1509
|
print '<div class="hidden marginrightonly inline-block repeateventlimitdate">'; |
1510
|
1510
|
print $langs->trans("Until")." "; |
|
@@ -1762,7 +1762,7 @@ discard block |
|
|
block discarded – undo |
1762
|
1762
|
} |
1763
|
1763
|
//var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject); |
1764
|
1764
|
|
1765
|
|
- if (! in_array($origin, array('societe', 'project', 'task', 'user'))) { |
|
1765
|
+ if (!in_array($origin, array('societe', 'project', 'task', 'user'))) { |
1766
|
1766
|
// We do not use link for object that already contains a hard coded field to make links with agenda events |
1767
|
1767
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>'; |
1768
|
1768
|
print '<td colspan="3">'; |
|
@@ -1851,7 +1851,7 @@ discard block |
|
|
block discarded – undo |
1851
|
1851
|
$("#addreminder").prop("checked", true); |
1852
|
1852
|
|
1853
|
1853
|
// Set period with default reminder period |
1854
|
|
- $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset) . '\'); |
|
1854
|
+ $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset).'\'); |
1855
|
1855
|
$("#select_offsetunittype_duration").select2("destroy"); |
1856
|
1856
|
$("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\'); |
1857
|
1857
|
$("#select_offsetunittype_duration").select2(); |
|
@@ -2011,7 +2011,7 @@ discard block |
|
|
block discarded – undo |
2011
|
2011
|
if (new_startdate > old_enddate) { |
2012
|
2012
|
var timeDiff = old_enddate - old_startdate; |
2013
|
2013
|
var new_enddate = new Date(new_startdate.getTime() + timeDiff); |
2014
|
|
- $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); |
|
2014
|
+ $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'")); |
2015
|
2015
|
$("#p2day").val(new_enddate.getDate()); |
2016
|
2016
|
$("#p2month").val(new_enddate.getMonth() + 1); |
2017
|
2017
|
$("#p2year").val(new_enddate.getFullYear()); |
|
@@ -2036,7 +2036,7 @@ discard block |
|
|
block discarded – undo |
2036
|
2036
|
if ($backtopage) { |
2037
|
2037
|
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">'; |
2038
|
2038
|
} |
2039
|
|
- if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { |
|
2039
|
+ if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && !preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { |
2040
|
2040
|
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">'; |
2041
|
2041
|
} |
2042
|
2042
|
|
|
@@ -2462,7 +2462,7 @@ discard block |
|
|
block discarded – undo |
2462
|
2462
|
}); |
2463
|
2463
|
})'; |
2464
|
2464
|
print '</script>'."\n"; |
2465
|
|
- print '</div>'; // End of div for reminderparameters |
|
2465
|
+ print '</div>'; // End of div for reminderparameters |
2466
|
2466
|
} |
2467
|
2467
|
|
2468
|
2468
|
print dol_get_fiche_end(); |
|
@@ -2740,7 +2740,7 @@ discard block |
|
|
block discarded – undo |
2740
|
2740
|
|
2741
|
2741
|
// Priority |
2742
|
2742
|
if (getDolGlobalString('AGENDA_SUPPORT_PRIORITY_IN_EVENTS')) { |
2743
|
|
- print '<tr><td class="nowrap" class="titlefield">' . $langs->trans("Priority") . '</td><td>'; |
|
2743
|
+ print '<tr><td class="nowrap" class="titlefield">'.$langs->trans("Priority").'</td><td>'; |
2744
|
2744
|
print($object->priority ? $object->priority : ''); |
2745
|
2745
|
print '</td></tr>'; |
2746
|
2746
|
} |