diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 29590820b72..4e589aa6529 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -670,7 +670,7 @@ if ($resql)
// Status billed
if (! empty($arrayfields['c.facture']['checked']))
{
- print '
';
+ print ' | ';
print $form->selectyesno('billed', $billed, 1, 0, 1);
print ' | ';
}
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index fae976dec80..5a713168c48 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -686,6 +686,35 @@ if ($massaction == 'confirm_createbills')
{
$db->commit();
setEventMessage($langs->trans('BillCreated', $nb_bills_created));
+
+ // Make a redirect to avoid to bill twice if we make a refresh or back
+ $param='';
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
+ if ($sall) $param.='&sall='.urlencode($sall);
+ if ($socid > 0) $param.='&socid='.urlencode($socid);
+ if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut);
+ if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday);
+ if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth);
+ if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear);
+ if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday);
+ if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth);
+ if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear);
+ if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
+ if ($search_company) $param.='&search_company='.urlencode($search_company);
+ if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer);
+ if ($search_user > 0) $param.='&search_user='.urlencode($search_user);
+ if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale);
+ if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht);
+ if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat);
+ if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc);
+ if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref);
+ if ($show_files) $param.='&show_files=' .urlencode($show_files);
+ if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
+ if ($billed != '') $param.='&billed='.urlencode($billed);
+
+ header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
+ exit;
}
else
{