diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 43dd75d70c6..7f3b1fd401b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -594,10 +594,20 @@ if (empty($reshook)) { $db->commit(); if ($nb_bills_created == 1) { + if (getDolGlobalInt('MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_ONE') == 1) { + // Redirect to generated invoice if unique + header('Location: '.DOL_URL_ROOT.'/compta/facture/card.php?id='.urlencode((string) $lastid)); + exit; + } $texttoshow = $langs->trans('BillXCreated', '{s1}'); $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); setEventMessages($texttoshow, null, 'mesgs'); } else { + if (getDolGlobalInt('MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_MANY') == 1) { + // Redirect to invoice list + header("Location: ".DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills'); + exit; + } setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); }