commit
f1d19ae3de
@ -315,8 +315,28 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$result = $object->set_date($user, $datep);
|
$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) {
|
if ($result < 0) {
|
||||||
dol_print_error($db, $object->error);
|
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) {
|
} elseif ($action == 'setecheance' && $usercancreate) {
|
||||||
@ -325,8 +345,8 @@ if (empty($reshook)) {
|
|||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
if (!empty($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)) $newlang = $object->thirdparty->default_lang;
|
||||||
if (!empty($newlang)) {
|
if (!empty($newlang)) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
@ -2281,13 +2301,16 @@ if ($action == 'create') {
|
|||||||
// Date of proposal
|
// Date of proposal
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
// print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('DatePropal');
|
// print $langs->trans('DatePropal');
|
||||||
print '</td>';
|
// print '</td>';
|
||||||
if ($action != 'editdate' && $usercancreate && $caneditfield) {
|
// if ($action != 'editdate' && $usercancreate && $caneditfield) {
|
||||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
// print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||||
}
|
// }
|
||||||
print '</tr></table>';
|
|
||||||
|
// print '</tr></table>';
|
||||||
|
$editenable = $usercancreate && $caneditfield && $object->statut == Propal::STATUS_DRAFT;
|
||||||
|
print $form->editfieldkey("DatePropal", 'date', '', $object, $editenable);
|
||||||
print '</td><td class="valuefield">';
|
print '</td><td class="valuefield">';
|
||||||
if ($action == 'editdate' && $usercancreate && $caneditfield) {
|
if ($action == 'editdate' && $usercancreate && $caneditfield) {
|
||||||
print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||||
|
|||||||
@ -384,7 +384,7 @@ class Propal extends CommonObject
|
|||||||
$this->socid = $socid;
|
$this->socid = $socid;
|
||||||
$this->id = $propalid;
|
$this->id = $propalid;
|
||||||
|
|
||||||
$this->duree_validite = ((int) $conf->global->PROPALE_VALIDITY_DURATION);
|
$this->duree_validite = getDolGlobalInt('PROPALE_VALIDITY_DURATION', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user