update date

This commit is contained in:
Anthony Berton 2022-08-22 17:18:31 +02:00
parent 4a91316c7f
commit 8328923e09
2 changed files with 22 additions and 3 deletions

View File

@ -315,9 +315,28 @@ if (empty($reshook)) {
}
if (!$error) {
if (isset($object->duree_validite) && !empty($object->fin_validite)) {
$object->fin_validite = $datep + ($object->duree_validite * 24 * 3600);
}
$result = $object->set_date($user, $datep);
if ($result < 0) {
dol_print_error($db, $object->error);
} elseif (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs;
$newlang = '';
if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->model_pdf;
$ret = $object->fetch($id); // Reload to get new records
if ($ret > 0) {
$object->fetch_thirdparty();
}
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
} elseif ($action == 'setecheance' && $usercancreate) {
@ -326,8 +345,8 @@ if (empty($reshook)) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);

View File

@ -2066,7 +2066,7 @@ class Propal extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."',fin_validite = '".$this->db->idate($this->fin_validite)."'";
$sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT;
dol_syslog(__METHOD__, LOG_DEBUG);