Hey Everyone.
I have the below code which I am running to go through my cases and update the SLA status every few minutes:
<?php
$job_strings['update_colour']='update_colour';
function update_colour() {
global $db,$timedate, $current_user;
$sql = "SELECT id, date_modified FROM cases WHERE date_entered BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE() AND deleted = 0 and status in('Open_New','Open_Qualified','Open_Assigned','Open_WithCustomer','Open_With3rdparty','Open_InDevelopment')";
$result = $db->query($sql);
$case->date_modified = '2017-01-06 09:00:00';
require_once("custom/modules/Cases/views/view.detail.php");
foreach($result as $id){
$case = BeanFactory::getBean("Cases", $id['id']);
if(!empty($case->id)) {
$class = CustomCasesViewDetail::highlight_cases($case);
$case->sla_list_c = $class;
$case->date_modified;
$case->save();
}
}
return true;
}
?>
Once the above is executed it is then passed onto cases in order to complete the updating of the case. My issue here is I do not want the case modified to be updated. I only want the case data to be updated and the modified to be updated when a user manually edits the case.
I found the $case->date_modified in cases and trying to pass this through with a specific date through my scheduled task, in the hope that cases will pick it up and save it with that specific value.
The above obviously does not work and I am not sure how to proceed with this. Do I need to call another function in the scheduled task to pass data on cases? Or is there another way of doing the above?
Feedback is appreciated.
Kind regards,
Ab