diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index bd6a85a06ad..fabb43ce846 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2420,16 +2420,16 @@ class Propal extends CommonObject if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $this->thirdparty->default_lang); - $outputlangs->setDefaultLang($newlang); - } - //$ret=$object->fetch($id); // Reload to get new records - $this->generateDocument($modelpdf, $outputlangs); + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $this->thirdparty->default_lang); + $outputlangs->setDefaultLang($newlang); + } + //$ret=$object->fetch($id); // Reload to get new records + $this->generateDocument($modelpdf, $outputlangs); } if (! $error) @@ -2437,7 +2437,7 @@ class Propal extends CommonObject $this->oldcopy= clone $this; $this->statut = $statut; $this->date_cloture = $now; - $this->note_private = $note; + $this->note_private = $newprivatenote; } if (! $notrigger && empty($error)) @@ -2448,13 +2448,17 @@ class Propal extends CommonObject // End call triggers } - if ( ! $error ) + if (! $error) { $this->db->commit(); return 1; } else { + $this->statut = $this->oldcopy->statut; + $this->date_cloture = $this->oldcopy->date_cloture; + $this->note_private = $this->oldcopy->note_private; + $this->db->rollback(); return -1; }