I use SugarCRM and i try to make a Hook when someone save a opportunity.
This is the situation:
I have the column "Opportunity Amount" and i want to calculate the column "Montant %".
So i have add twoo ligne in the hook:
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1,'calcul montant heure','custom/modules/Opportunities/calcul.php','calcul','montant');
I add the class file:
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class calcul
{
var $module = "Opportunities";
function montant($bean, $event, $arguments)
{
$bean->Montant_perc = ($bean->amount_usdollar * $bean->Probability (%))/100;
}
}
?>
it does not work but I do not understand why?
thanks for your help