AnsweredAssumed Answered

Unable to save bean in controller

Question asked by jlabuelo on Oct 2, 2014
Latest reply on Oct 7, 2014 by Usman Saeed
Hi there

sorry to bother you with this question but I am creating a controller for a custom module, and everything works fine for the action I am creating, but if I try to change any value from the $bean, the save() method does not work.

For example, I have this function, to check the value of a field, and if it matches condition just needs to change it and send a mail.

function action_SolicitarReapertura()
global $db;
//First we change the status to Finished
        if (($this->bean->estado=='Terminado')|| ($this->bean->estado=='PendienteReapertura'))

$this->bean->estado = 'PendienteReapertura';

// Send the mail to the owner of the record

// Now we start collecting the information we need to send in the mail.
$num_expediente = $this->bean->expediente;
$cod_tramitador = $this->bean->mail_tra;
$description ='text2' ;

// Create the query to retrieve the email of the user assigned to the record
$Query="select a.email_address as MailAddress from email_addresses a, email_addr_bean_rel b where and b.deleted='0' and b.bean_id ='".$this->bean->assigned_user_id."'";

//$result =($GLOBALS['db']->query($Query)); 
$resp = $db->query($Query, true);
While($row = $db->fetchByAssoc($resp))
            if ($row!=null)
   $mail_address =$row['MailAddress'];
          if ((!($mail_address==null)) && (!($mail_address=='')))

Everything works fine excep for the $this->bean->save(); that is not working and the field "estado" is never changed from Terminado to "PendienteReapertura".

Any ideas why please??