From 6013916d459e4b448ecf0a150755c49fc1edcb21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sun, 7 Apr 2013 21:58:24 +0200 Subject: [PATCH] Removed duplicated code and fixed a problem with orders2invoice --- htdocs/commande/orderstoinvoice.php | 35 +++++++++++++---------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index c709b2b4bbd..a6b2fe44a1f 100755 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -51,37 +51,32 @@ $sref = GETPOST('sref'); $sref_client = GETPOST('sref_client'); $sall = GETPOST('sall'); $socid = GETPOST('socid','int'); +$selected = GETPOST('orders_to_invoice'); +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$viewstatut = GETPOST('viewstatut'); - -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); if (! $sortfield) $sortfield='c.rowid'; if (! $sortorder) $sortorder='DESC'; -$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server -$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); -$date_starty=dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server -$date_endy=dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]); -$selected=GETPOST('orders_to_invoice'); -$action=GETPOST('action','alpha'); +$now = dol_now(); +$date_start = dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server +$date_end = dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +$date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server +$date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]); + if ($action == 'create') { - if (! is_array($selected)) + if (is_array($selected) == false) { - $mesgs[]='
'.$langs->trans('Error_OrderNotChecked').'
'; + $mesgs = array('
'.$langs->trans('Error_OrderNotChecked').'
'); } else { - $socid=GETPOST('socid'); - $action=GETPOST('action'); - $origin=GETPOST('origin'); - $originid=GETPOST('originid'); + $origin = GETPOST('origin'); + $originid = GETPOST('originid'); } } -$now=dol_now(); - -$viewstatut=GETPOST('viewstatut'); - /* * Actions @@ -358,7 +353,7 @@ $formfile = new FormFile($db); $companystatic = new Societe($db); // Mode creation -if ($action == 'create') +if ($action == 'create' && empty($mesgs)) { $facturestatic=new Facture($db);