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..917ee15f1d4 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.ref"; +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 ''; + print ''; + print '\n"; @@ -215,8 +209,8 @@ if ($result) { 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();