diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index cf9eb2c913f..4050cf69ed0 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -315,8 +315,28 @@ if (empty($reshook)) {
if (!$error) {
$result = $object->set_date($user, $datep);
+ if ($result > 0 && !empty($object->duree_validite) && !empty($object->fin_validite)) {
+ $datev = $datep + ($object->duree_validite * 24 * 3600);
+ $result = $object->set_echeance($user, $datev, 1);
+ }
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) {
@@ -325,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);
@@ -2281,13 +2301,16 @@ if ($action == 'create') {
// Date of proposal
print '
';
print '| ';
- print '';
+ // print '';
+ $editenable = $usercancreate && $caneditfield && $object->statut == Propal::STATUS_DRAFT;
+ print $form->editfieldkey("DatePropal", 'date', '', $object, $editenable);
print ' | ';
if ($action == 'editdate' && $usercancreate && $caneditfield) {
print ' |