i have create this file logic_hooks.php in the custom folder:
PHP Code:
<?php
// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'calcola_totale', 'modules/med_Rimborso_Righe/aggiornaRimborsoHook.php','aggiornaRimborsoHook', 'aggiornaRiga');
?>
also I have create this file aggiornaRimborsoHook.php
PHP Code:
<?php
class aggiornaRimborsoHook
{
// Aggiorno i Rimborsi
function aggiornaRiga(&$bean, $event, $arguments)
{
$tbl = $bean->table_name;
$id = $bean->id;
// calcolo il rimborso
$rimborso = $bean->costo_km * $bean->km;
$q = "UPDATE med_rimborso_righe md SET md.rimborso_km = $rimborso WHERE md.id = '$id'";
$bean->db->query($q);
}
}
?>
The problem is that: the field rimborso_km is not updated..
Why ?
Bookmarks