This makes a los of sense because we filter both Leads and Opportunities by modified Dates (leads in order to know when was the last contact with the lead), Opportunities to track the updates and also to track the processing statuses (delivery, customs clearence etc.)
On this regards our staff needs to add Notes reflecting this updates and we're interested this modifying the Modified_DATE; here's the code I used to accomplish this:
1. Open up custom/modules/Notes/logic_hooks.php' and add the following code calling a function after saving the NOTE.
$hook_array['after_save'][] = Array(1, 'update_time', 'custom/modules/Notes/update_time.php','update_time', 'update_time');
2. Add the file containing the code to modify the TIME:
<?php
class update_time
{
public function update_time(&$bean, $event, $arguments)
{
{
$sql = "update leads "
. "set leads.date_modified = TIMESTAMPADD(HOUR, 4, NOW()) "
. "where leads.id = '". $bean->parent_id ."'";$result = $bean->db->query($sql, true);
$sql = "update opportunities "
. "set opportunities.date_modified = TIMESTAMPADD(HOUR, 4, NOW()) "
. "where opportunities.id = '". $bean->parent_id ."'";$result = $bean->db->query($sql, true);
}$GLOBALS['log']->info("SQL = ". $sql);
}
}
?>