From 11b63325bf695d45486257bf936b4ebc83e207ae Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 24 May 2018 10:48:03 +0200 Subject: [PATCH] clean and update code --- htdocs/comm/index.php | 11 ++--------- htdocs/comm/prospect/index.php | 11 ++--------- htdocs/commande/customer.php | 8 ++------ htdocs/commande/orderstoinvoice.php | 7 +++---- 4 files changed, 9 insertions(+), 28 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index eab813653d6..c818659683f 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -37,8 +37,8 @@ if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn if (! $user->rights->societe->lire) accessforbidden(); -$langs->load("commercial"); -$langs->load("propal"); +// Load traductions files requiredby by page +$langs->loadLangs(array("commercial", "propal")); $action=GETPOST('action', 'alpha'); $bid=GETPOST('bid', 'int'); @@ -161,7 +161,6 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) print ''; print ''.$langs->trans("ProposalsDraft").($num?' '.$num.'':'').''; - $var=true; if ($num > 0) { $i = 0; @@ -243,7 +242,6 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos print ''; print ''.$langs->trans("SupplierProposalsDraft").($num?' '.$num.'':'').''; - $var=true; if ($num > 0) { $i = 0; @@ -274,13 +272,11 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos } if ($total>0) { - print ''.$langs->trans("Total").''.price($total).""; } } else { - print ''.$langs->trans("NoProposal").''; } print "
"; @@ -323,7 +319,6 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; print ''.$langs->trans("DraftOrders").($num?' '.$num.'':'').''; - $var = true; if ($num > 0) { $i = 0; @@ -411,7 +406,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande print ''; print ''.$langs->trans("DraftSuppliersOrders").($num?' '.$num.'':'').''; - $var = true; if ($num > 0) { $i = 0; @@ -528,7 +522,6 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) print ''; $i++; - } $db->free($resql); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 8db5308bf3f..7bdb6220493 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -88,8 +88,6 @@ if ($resql) $i = 0; if ($num > 0 ) { - $var=true; - print ''; print ''; print ''; @@ -126,8 +124,6 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $resql=$db->query($sql); if ($resql) { - $var=true; - $total=0; $num = $db->num_rows($resql); $i = 0; @@ -197,8 +193,6 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $i = 0; if ($num > 0) { - $var=true; - print '
'.$langs->trans("ProspectsByStatus").'
'; print ''; @@ -223,7 +217,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $i++; $total += $obj->price; } - if ($total>0) { + if ($total>0) + { print '"; } print "
'.$langs->trans("ProposalsOpened").'
'.$langs->trans("Total")."".price($total)."

"; @@ -255,8 +250,6 @@ if ($resql) $i = 0; if ($num > 0 ) { - $var=true; - print ''; print ''; diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 2d97b06238b..7a2d0be27b2 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -42,8 +42,8 @@ if ($user->societe_id > 0) if (! $user->rights->facture->creer) accessforbidden(); -$langs->load("companies"); -$langs->load("orders"); +// Load traductions files requiredby by page +$langs->loadLangs(array("companies", "orders")); $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -155,14 +155,10 @@ if ($resql) print "\n"; - $var=true; - while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - - print ''; print '
'.$langs->trans("ProspectToContact").'
'; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 5542218b18b..1f0b950ad0f 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -39,9 +39,8 @@ if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } -$langs->load('orders'); -$langs->load('deliveries'); -$langs->load('companies'); +// Load traductions files requiredby by page +$langs->loadLangs(array("orders", "deliveries", "companies")); if (! $user->rights->facture->creer) accessforbidden(); @@ -655,7 +654,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; print '
'; - $var=true; + $generic_commande = new Commande($db); while ($i < $num)