|
@@ -45,6 +45,26 @@ if ($cat_id == 0) {
|
|
|
$cat_id = null;
|
|
|
}
|
|
|
|
|
|
+// Load variable for pagination
|
|
|
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|
|
+$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
|
+$sortorder = GETPOST('sortorder', 'aZ09comma');
|
|
|
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
|
|
+if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
|
|
+ // If $page is not defined, or '' or -1 or if we click on clear filters
|
|
|
+ $page = 0;
|
|
|
+}
|
|
|
+$offset = $limit * $page;
|
|
|
+$pageprev = $page - 1;
|
|
|
+$pagenext = $page + 1;
|
|
|
+
|
|
|
+if (empty($sortfield)) {
|
|
|
+ $sortfield = 'account_number';
|
|
|
+}
|
|
|
+if (empty($sortorder)) {
|
|
|
+ $sortorder = 'ASC';
|
|
|
+}
|
|
|
+
|
|
|
// Security check
|
|
|
if (!$user->hasRight('accounting', 'chartofaccount')) {
|
|
|
accessforbidden();
|
|
@@ -137,14 +157,6 @@ if (!empty($cat_id)) {
|
|
|
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
|
|
print img_picto($langs->trans("AccountingAccount"), 'accounting_account', 'class="pictofixedwith"');
|
|
|
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories"));
|
|
|
- //print '<br>';
|
|
|
- /*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
|
|
- foreach ( $accountingcategory->lines_cptbk as $cpt ) {
|
|
|
- print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
|
|
|
- }
|
|
|
- print '</select><br>';
|
|
|
- print ajax_combobox('cpt_bk');
|
|
|
- */
|
|
|
print '<input type="submit" class="button button-add small" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
|
|
|
}
|
|
|
}
|
|
@@ -152,13 +164,16 @@ if (!empty($cat_id)) {
|
|
|
print '</form>';
|
|
|
|
|
|
|
|
|
-if ($action == 'display' || $action == 'delete') {
|
|
|
+if ((empty($action) || $action == 'display' || $action == 'delete') && $cat_id > 0) {
|
|
|
+ $param = 'account_category='.((int) $cat_id);
|
|
|
+
|
|
|
print '<br>';
|
|
|
print '<table class="noborder centpercent">'."\n";
|
|
|
print '<tr class="liste_titre">';
|
|
|
- print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";
|
|
|
- print '<td class="liste_titre" colspan="2">'.$langs->trans("Label")."</td>";
|
|
|
- print "</tr>\n";
|
|
|
+ print getTitleFieldOfList('AccountAccounting', 0, $_SERVER['PHP_SELF'], 'account_number', '', $param, '', $sortfield, $sortorder, '')."\n";
|
|
|
+ print getTitleFieldOfList('Label', 0, $_SERVER['PHP_SELF'], 'label', '', $param, '', $sortfield, $sortorder, '')."\n";
|
|
|
+ print getTitleFieldOfList('', 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n";
|
|
|
+ print '</tr>'."\n";
|
|
|
|
|
|
if (!empty($cat_id)) {
|
|
|
$return = $accountingcategory->display($cat_id); // This load ->lines_display
|
|
@@ -167,6 +182,8 @@ if ($action == 'display' || $action == 'delete') {
|
|
|
}
|
|
|
|
|
|
if (is_array($accountingcategory->lines_display) && count($accountingcategory->lines_display) > 0) {
|
|
|
+ $accountingcategory->lines_display = dol_sort_array($accountingcategory->lines_display, $sortfield, $sortorder, 1, 0, 1);
|
|
|
+
|
|
|
foreach ($accountingcategory->lines_display as $cpt) {
|
|
|
print '<tr class="oddeven">';
|
|
|
print '<td>'.length_accountg($cpt->account_number).'</td>';
|