setEventMessages($langs->trans("ErrorFailedToSendMail", $emailFrom, $emailTo), null, 'errors'); $mesg = "Impossible d'envoyer l'email."; } // END - Send mail } } } else { setEventMessages($object->error, $object->errors, 'errors'); } } //var_dump($user->id == $object->fk_user_validator);exit; if ($action == "confirm_cancel" && GETPOST('confirm') == "yes" && GETPOST('detail_cancel') && $id > 0 && $user->rights->expensereport->creer) { $object = new ExpenseReport($db); $object->fetch($id); if ($user->id == $object->fk_user_valid || $user->id == $object->fk_user_author) { $result = $object->set_cancel($user, GETPOST('detail_cancel')); if ($result > 0) { // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) { $newlang = GETPOST('lang_id', 'alpha'); } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); }