feat: hide ticket validation button for HR ticket is older than 48 hours
This commit is contained in:
@ -714,7 +714,7 @@
|
||||
|
||||
from glpi_tickets
|
||||
|
||||
where id = ?' LIMIT 1";
|
||||
where id = ? LIMIT 1";
|
||||
|
||||
$stmt = $DB->prepare($query);
|
||||
|
||||
@ -1106,7 +1106,7 @@
|
||||
|
||||
|
||||
|
||||
// closing hr tickets after 1 day
|
||||
// closing hr tickets after 2 days
|
||||
function close_hr_tickets(){
|
||||
global $DB;
|
||||
$stmt = $DB->prepare("update glpi_tickets set status = 6 , closedate = now() where id in ( SELECT
|
||||
@ -1122,3 +1122,22 @@
|
||||
return $stmt->execute();
|
||||
}
|
||||
|
||||
function getMaxTicketValidationDateTime(DateTime $requisition_date): DateTime {
|
||||
$weekday = (int) $requisition_date->format('N'); // 1 (Mon) to 7 (Sun)
|
||||
|
||||
if ($weekday === 5) { // Friday
|
||||
$sunday = clone $requisition_date;
|
||||
$sunday->modify('+2 days')->setTime(0, 0);
|
||||
return $sunday->modify('+48 hours');
|
||||
} elseif ($weekday === 6) { // Saturday
|
||||
$sunday = clone $requisition_date;
|
||||
$sunday->modify('+1 day')->setTime(0, 0);
|
||||
return $sunday->modify('+48 hours');
|
||||
} elseif (in_array($weekday, [3, 4])) { // Wednesday or Thursday
|
||||
$result = clone $requisition_date;
|
||||
return $result->modify('+96 hours');
|
||||
} else {
|
||||
$result = clone $requisition_date;
|
||||
return $result->modify('+48 hours');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user