To correct the error described here #102

wants to merge 1 commit into


None yet
2 participants

Francesco Guerricchio


jmertic commented May 15, 2012

Hi Fancesco,

First off, thanks for the contribution!

So the only issue I'm seeing is moving the parent::save() call is now breaking the before_save hook, meaning the emails will be saved before the before_save fires. So I think the fix needs to happen inside the SugarBean::save(), but perhaps by adding a bean method in here to call between the before_save and after_save hooks for things like this.

If you want to hack something up for this, I can pass it along to our architects to look over.

Thanks again!


You're right, reviewing better the code, I have to move the paren::save() method before these lines
if($ori_in_workflow === false || !empty($override_email)){
$this->emailAddress->save($this->id, $this->module_dir, $override_email,'','','','',$this->in_workflow);
so the correction resambles like this
so the correction became:
function save($check_notify=false) {
$ori_in_workflow = empty($this->in_workflow) ? false : true;
$this->emailAddress->handleLegacySave($this, $this->module_dir);
// Move from here
// parent::save($check_notify);
$override_email = array();
if(!empty($this->email1_set_in_workflow)) {
$override_email['emailAddress0'] = $this->email1_set_in_workflow;
if(!empty($this->email2_set_in_workflow)) {
$override_email['emailAddress1'] = $this->email2_set_in_workflow;
if(!isset($this->in_workflow)) {
$this->in_workflow = false;

// To here

    if($ori_in_workflow === false || !empty($override_email)){
        $this->emailAddress->save($this->id, $this->module_dir, $override_email,'','','','',$this->in_workflow);

    return $this->id;

jmertic commented May 21, 2012

Could you update the pull request accordingly? Just making the change in your branch should do it.


@jmertic jmertic closed this Feb 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment