diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index d3d6ff8a945..81fbea30baa 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -108,8 +108,7 @@ if (! empty($id)) { print ''; print ''; - $linkback=''.$langs->trans("Back").''; - print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'title_setup'); + print_fiche_titre($langs->trans('CustomersVentilation'),'','title_setup'); dol_fiche_head(); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 7941a7df4a8..fa549487fbb 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -45,6 +45,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(); @@ -117,7 +129,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product $sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; $sql .= " AND aa.rowid = l.fk_code_ventilation"; if (strlen(trim(GETPOST("search_facture")))) { - $sql .= " AND f.facnumber like '%" . GETPOST("search_facture") . "%'"; + $sql .= " AND f.facnumber like '%" . $search_facture . "%'"; } if (strlen(trim($search_ref))) { $sql .= " AND p.ref like '%" . $search_ref . "%'"; @@ -134,16 +146,11 @@ if (strlen(trim($search_amount))) { if (strlen(trim($search_account))) { $sql .= " AND aa.account_number like '%" . $search_account . "%'"; } - if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity IN (" . getEntity("facture", 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/customer/lines.php sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); @@ -151,7 +158,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 '