From 0934860ce5b5f7328373949b941975892e76e1e7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 21 Jun 2015 08:26:42 +0200 Subject: [PATCH 1/3] Accountancy list: Use print_liste_field_titre --- htdocs/accountancy/customer/lines.php | 18 +------ htdocs/accountancy/supplier/lines.php | 68 ++++++++++++--------------- 2 files changed, 33 insertions(+), 53 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index fa549487fbb..2bbb839459f 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -106,20 +106,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched")); -$page = GETPOST("page"); -if ($page < 0) - $page = 0; - -if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { - $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -} elseif ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { - $limit = $conf->liste_limit; -} else { - $limit = $conf->liste_limit; -} - -$offset = $limit * $page; - $sql = "SELECT l.rowid , f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.qty, l.tva_tx, l.fk_code_ventilation, aa.label, aa.account_number,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; @@ -170,7 +156,7 @@ if ($result) { print ''; print ''; - print_liste_field_titre($langs->trans("Invoices"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); @@ -181,7 +167,7 @@ if ($result) { print_liste_field_titre(''); print "\n"; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 0edc9e1142f..9d9aa3814b3 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -46,6 +46,18 @@ $search_desc = GETPOST('search_desc','alpha'); $search_amount = GETPOST('search_amount','alpha'); $search_account = GETPOST('search_account','alpha'); +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); + +if ($page == -1) { $page = 0; } +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +$limit = $conf->liste_limit; +if (! $sortfield) $sortfield="f.facnumber"; +if (! $sortorder) $sortorder="DESC"; + // Security check if ($user->societe_id > 0) accessforbidden(); @@ -95,20 +107,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched")); -$page = GETPOST("page"); -if ($page < 0) - $page = 0; - -if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { - $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; -} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { - $limit = $conf->liste_limit; -} else { - $limit = $conf->liste_limit; -} - -$offset = $limit * $page; - $sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, "; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; @@ -138,12 +136,8 @@ if (strlen(trim($search_account))) { if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; } - -$sql .= " ORDER BY l.rowid"; -if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { - $sql .= " DESC "; -} -$sql .= $db->plimit($limit + 1, $offset); +$sql.= $db->order($sortfield,$sortorder); +$sql.= $db->plimit($limit + 1,$offset); dol_syslog('accountancy/supplier/lines.php::list sql= ' . $sql1); $result = $db->query($sql); @@ -152,7 +146,6 @@ if ($result) { $num_lines = $db->num_rows($result); $i = 0; - // TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list... print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); print '' . $langs->trans("DescVentilDoneSupplier") . ''; @@ -160,29 +153,30 @@ if ($result) { print '
'; print ''; - print '

'. $langs->trans("ChangeAccount"); + print '

'. $langs->trans("ChangeAccount") . '
'; print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1); print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre(''); + print_liste_field_titre(''); + print_liste_field_titre(''); print "\n"; - - print ''; + + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; + print '\n"; @@ -215,8 +209,8 @@ if ($result) { print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print '
' . $langs->trans("Invoice") . '' . $langs->trans("Ref") . '' . $langs->trans("Label") . '' . $langs->trans("Description") . '' . $langs->trans("Amount") . '' . $langs->trans("Account") . '  
  '; + print ' '; print ''; print "
' . dol_trunc($objp->product_label, 24) . '' . nl2br(dol_trunc($objp->description, 32)) . '' . price($objp->total_ht) . '' . $codeCompta . '' . price($objp->total_ht) . '' . $codeCompta . '' . $objp->rowid . ''; print img_edit(); From 0f450edfcd339f92162a3349682edb990b6e4a3d Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 21 Jun 2015 08:32:37 +0200 Subject: [PATCH 2/3] Debug --- htdocs/accountancy/supplier/lines.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 9d9aa3814b3..2ce07690f8e 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -55,7 +55,7 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; $limit = $conf->liste_limit; -if (! $sortfield) $sortfield="f.facnumber"; +if (! $sortfield) $sortfield="f.ref"; if (! $sortorder) $sortorder="DESC"; // Security check @@ -173,8 +173,8 @@ if ($result) { print ' '; print ''; From 2ab454e7571389d33735c121c810f3ea6ade3bd7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 21 Jun 2015 14:32:00 +0200 Subject: [PATCH 3/3] Presentation --- htdocs/accountancy/supplier/lines.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 2ce07690f8e..917ee15f1d4 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -173,7 +173,7 @@ if ($result) { print ' ';