Error 500 on propal card when we change the deadline

if we don't use the automatic generation for PDF documents (MAIN_DISABLE_PDF_AUTOUPDATE is set to 1) when we change the deadline on a proposal we get an error 500.
This commit is contained in:
Sylvain Legrand 2021-04-28 11:58:34 +02:00 committed by GitHub
parent 0037da1a56
commit 18d2bef8f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -285,8 +285,28 @@ if (empty($reshook))
} elseif ($action == 'setecheance' && $usercancreate)
{
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0)
if ($result >= 0)
{
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($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 ($result < 0)
dol_print_error($db, $object->error);
} elseif ($action == 'setdate_livraison' && $usercancreate)
{