You may alter the save function and make it call an event: after_save and in the event you create a TESTING algorithm in which you test the results of the SAVE and you decide whether or not to keep the LEAD
PHP Code:
function save($check_notify = FALSE){
$ret = parent::save($check_notify);
parent::call_custom_logic("after_save", '');
return $ret;
}
Of course you should create your logic:
PHP Code:
require_once('include/utils.php');
echo "Subscribing to Cases<br>";
check_logic_hook_file( "Cases",
"before_save",
array( 1,
"insert1",
"modules/mymod/Cases_events.php",
"casesEvt",
"before_save"));
echo " Subscribing to before_save<br>";
check_logic_hook_file( "Cases",
"after_save",
array( 2,
"insert2",
"modules/mymod/Cases_events.php",
"casesEvt",
"after_save"));
echo " Subscribing to after_save<br>";
and
PHP Code:
class casesEvt{
function before_save(&$bean, $event, $arguments) {
}
function after_save(&$bean, $event, $arguments) {
}
}
Bookmarks