From 537c6b0cc7ade297b634b314b7543058b7104a97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 18 Sep 2016 15:57:53 +0200 Subject: [PATCH] Uniformize code --- htdocs/compta/bank/index.php | 11 ++++++----- htdocs/projet/list.php | 16 ++++++++-------- htdocs/societe/list.php | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 444f4a1b55d..0bd855b928a 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -185,6 +185,7 @@ if ($resql) } $db->free($resql); } +else dol_print_error($db); @@ -267,10 +268,10 @@ print '<tr class="liste_titre">'; if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); -print '<td align="center">'.$langs->trans("TransactionsToConciliate").'</td>'; -print '<td align="center" width="70">'.$langs->trans("Status").'</td>'; -print '<td align="right" width="100">'.$langs->trans("BankBalance").'</td>'; +if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -367,7 +368,7 @@ if (! empty($arrayfields['b.tms']['checked'])) // Statut if (! empty($arrayfields['b.clos']['checked'])) { - print '<td class="liste_titre">'; + print '<td class="liste_titre center">'; $array=array( 'opened'=>$langs->trans("Opened"), 'closed'=>$langs->trans("Closed") diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index a2384158926..6bf03741732 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -383,14 +383,6 @@ if ($resql) $moreforfilter=''; - // If the user can view user other than himself - $moreforfilter.='<div class="divsearchfield">'; - $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; - $includeonly=''; - if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); - $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); - $moreforfilter.='</div>'; - // Filter on categories if (! empty($conf->categorie->enabled)) { @@ -401,6 +393,14 @@ if ($resql) $moreforfilter.='</div>'; } + // If the user can view user other than himself + $moreforfilter.='<div class="divsearchfield">'; + $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; + $includeonly=''; + if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); + $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); + $moreforfilter.='</div>'; + // If the user can view thirdparties other than his' if ($user->rights->societe->client->voir || $socid) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 75d28bf41a4..f466263acdc 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -537,6 +537,17 @@ if ($type == 'c' || $type == 'p') $moreforfilter.='</div>'; } } +if ($type == 'f') +{ + if (! empty($conf->categorie->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='<div class="divsearchfield">'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories('supplier',$search_categ,'search_categ',1); + $moreforfilter.='</div>'; + } +} // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) @@ -546,17 +557,6 @@ if ($user->rights->societe->client->voir || $socid) $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); $moreforfilter.='</div>'; } -if ($type == 'f') -{ - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='<div class="divsearchfield">'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories('supplier',$search_categ,'search_categ',1); - $moreforfilter.='</div>'; - } -} if (! empty($moreforfilter)) { print '<div class="liste_titre liste_titre_bydiv centpercent">'; -- GitLab