Fix by adding a redirect to avoid the order2billing being done twice.

This commit is contained in:
Laurent Destailleur 2018-03-07 14:33:29 +01:00
parent 78259db0ee
commit 317a5f5b2f
2 changed files with 30 additions and 1 deletions

View File

@ -670,7 +670,7 @@ if ($resql)
// Status billed
if (! empty($arrayfields['c.facture']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectyesno('billed', $billed, 1, 0, 1);
print '</td>';
}

View File

@ -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
{