Hello, i encountered a problem why creating custom hook. I wanted to change colors in list view custom module depending on due date. I was reading the technical blog to understand it
So i made step by step and made code below
public/legacy/custom/Extensions/modules/Tasks/Ext/LogicHooks/ListViewHighlight.php
<?php $hook_array['process_record'][] = Array( 1, 'Highlight Task Due Date', 'custom/modules/Tasks/HighlightDueDateLogicHook.php', 'HighlightDueDateLogicHook', 'highlightDueDate' );
and public/legacy/custom/modules/Task/HighlightDueDateLogicHook.php
<?php class HighlightDueDateLogicHook { public function highlightDueDate(SugarBean $bean, $event, $arguments) { $dueDate = strtotime($bean->date_due); $today = strtotime(date('Y-m-d')); if ($dueDate < $today) { $color = '#31708F'; } elseif ($dueDate == $today) { $color = '#8A6D3B'; } $bean->date_due = "".$bean->date_due.""; } }
and after Quick and Rebuild i got the next result - due date column is blank and i dont know how to fix that. Has anyone else know the fix?? Thank you in advance
P.S. I dont know why when i paste code its not correctly looks. I tried to add space but it doesnt work. Sorry for that