Fix: avoid infinite loop
This commit is contained in:
parent
4a5988accb
commit
62f895e2ec
@ -33,7 +33,7 @@
|
|||||||
// Build doc
|
// Build doc
|
||||||
if ($action == 'builddoc' && $permissioncreate)
|
if ($action == 'builddoc' && $permissioncreate)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (is_numeric(GETPOST('model')))
|
if (is_numeric(GETPOST('model')))
|
||||||
{
|
{
|
||||||
$error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
$error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
||||||
@ -48,13 +48,13 @@ if ($action == 'builddoc' && $permissioncreate)
|
|||||||
dol_print_error('Object must have been loaded by a fetch');
|
dol_print_error('Object must have been loaded by a fetch');
|
||||||
exit;
|
exit;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Save last template used to generate document
|
// Save last template used to generate document
|
||||||
if (GETPOST('model'))
|
if (GETPOST('model'))
|
||||||
{
|
{
|
||||||
$object->setDocModel($user, GETPOST('model','alpha'));
|
$object->setDocModel($user, GETPOST('model','alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special case to force bank account
|
// Special case to force bank account
|
||||||
//if (property_exists($object, 'fk_bank'))
|
//if (property_exists($object, 'fk_bank'))
|
||||||
//{
|
//{
|
||||||
@ -76,13 +76,13 @@ if ($action == 'builddoc' && $permissioncreate)
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
// To be sure vars is defined
|
// To be sure vars is defined
|
||||||
if (empty($hidedetails)) $hidedetails=0;
|
if (empty($hidedetails)) $hidedetails=0;
|
||||||
if (empty($hidedesc)) $hidedesc=0;
|
if (empty($hidedesc)) $hidedesc=0;
|
||||||
if (empty($hideref)) $hideref=0;
|
if (empty($hideref)) $hideref=0;
|
||||||
if (empty($moreparams)) $moreparams=null;
|
if (empty($moreparams)) $moreparams=null;
|
||||||
|
|
||||||
$result= $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
$result= $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
@ -91,11 +91,15 @@ if ($action == 'builddoc' && $permissioncreate)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (empty($donotredirect)) // This is se when include is done by bulk action "Bill Orders"
|
if (empty($donotredirect)) // This is set when include is done by bulk action "Bill Orders"
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("FileGenerated"), null);
|
setEventMessages($langs->trans("FileGenerated"), null);
|
||||||
|
|
||||||
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
|
$urltoredirect = $_SERVER['REQUEST_URI'];
|
||||||
|
$urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect);
|
||||||
|
$urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop
|
||||||
|
|
||||||
|
header('Location: '.$urltoredirect.'#builddoc');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user