Hello! I have one issue related with my custom logic hook, and when i save the record on AOS_Contracts, is triggering the logic hook but is cycling it… what could be happening?
HI PGR, when I hit the ‘Save’ button, i have a bean, but i created a custom template, this template is able to generate and duplicate dynamic fields, so, for example the field named ‘$fecha_de_pago’ is an array, then when i finish to save the module bean, i’d like generate many records as ‘$fecha_de_pago’ has items and save it on the other table, then te relation could be ‘one to many’ ,
I have this:
function showData(&$bean, $event, $arguments){
$fecha_de_pago = $_REQUEST['fecha_de_pago'];
//$descripcion = $_REQUEST[$key.'descripcion'];
//$huboacuerdo = $_REQUEST[$key.'huboacuerdo'];
$asignado = $_REQUEST['compromiso_responsable'];
$asignadoId = $_REQUEST['compromiso_responsable_id'];
$monda_c = $_REQUEST['monda_c'];
$valor_c = $_REQUEST['valor_c'];
$qty = intval($_REQUEST['compromiso_Qty']) - 1;
while ($qty >= 0){
if (isset($bean->id) && !is_null($bean->id)) {
$cct = new AOS_Contracts();
//$uuid = $this->generateUUIDPhp();
$cct->retrieve($bean->id);
$cct->fecha_pago_c = $fecha_de_pago[$qty];
$cct->user_id_c= $asignadoId[$qty];
$cct->description2_c= 'this is the way '.$qty;
$cct->moneda_c= $monda_c[$qty];
$cct->valor_c= $valor_c[$qty];
$cct->cotizaciones_c= $bean->id;
//$cct->parent_type = 'Meetings';
//$cct->id_c = $bean->id;
//$cct->deleted = $deleted[$qty];
$cct->save();
$qty--;
}else{
$cct = new AOS_Contracts();
$uuid = $this->generateUUIDPhp();
//$cct->retrieve($bean->id);
$cct->fecha_pago_c = $fecha_de_pago[$qty];
$cct->user_id_c= $asignadoId[$qty];
$cct->description2_c= 'this is the way '.$qty;
$cct->moneda_c= $monda_c[$qty];
$cct->valor_c= $valor_c[$qty];
$cct->cotizaciones_c = $bean->id;
$cct->id_c = $uuid;
$cct->save();
$qty--;
}
}
}
Just an other thing, how I can use a logic hook after_save, for execute the file .php,
only when I save a record of a modul and not when I modify the same record?