diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index 0e9b9dbbd99..174d8fdf13e 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -66,12 +66,7 @@ $error = 0;
* Actions
*/
-if (in_array($action, array(
- 'setBANK_DISABLE_DIRECT_INPUT',
- 'setACCOUNTANCY_COMBO_FOR_AUX',
- 'setACCOUNTING_MANAGE_ZERO',
- 'setACCOUNTING_LIST_SORT_VENTILATION_TODO',
- 'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) {
+if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO'))) {
$constname = preg_replace('/^set/', '', $action);
$constvalue = GETPOST('value', 'int');
$res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
@@ -121,34 +116,6 @@ if ($action == 'update') {
}
}
-if ($action == 'setlistsorttodo') {
- $setlistsorttodo = GETPOST('value', 'int');
- $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
- if (!($res > 0)) {
- $error++;
- }
-
- if (!$error) {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- } else {
- setEventMessages($langs->trans("Error"), null, 'mesgs');
- }
-}
-
-if ($action == 'setlistsortdone') {
- $setlistsortdone = GETPOST('value', 'int');
- $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
- if (!($res > 0)) {
- $error++;
- }
-
- if (!$error) {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- } else {
- setEventMessages($langs->trans("Error"), null, 'mesgs');
- }
-}
-
if ($action == 'setmanagezero') {
$setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
@@ -417,33 +384,6 @@ print '
';
print '| '.$langs->trans('BindingOptions').' | ';
print "
\n";
-// TO DO Mutualize code for yes/no constants
-print '';
-print '| '.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").' | ';
-if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
- print '';
- print img_picto($langs->trans("Activated"), 'switch_on');
- print ' | ';
-} else {
- print '';
- print img_picto($langs->trans("Disabled"), 'switch_off');
- print ' | ';
-}
-print '
';
-
-print '';
-print '| '.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").' | ';
-if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
- print '';
- print img_picto($langs->trans("Activated"), 'switch_on');
- print ' | ';
-} else {
- print '';
- print img_picto($langs->trans("Disabled"), 'switch_off');
- print ' | ';
-}
-print '
';
-
// Param a user $user->rights->accounting->chartofaccount can access
foreach ($list_binding as $key) {
print '';
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index a0488793ebf..0e5ecd25563 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -65,10 +65,10 @@ $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
// Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
-$page = GETPOSTISSET('pageplusonPour le détail de la facture ref…e') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) {
$page = 0;
}
@@ -81,6 +81,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC";
+ } else {
+ $sortorder = "ASC";
}
}
@@ -159,6 +161,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('ac
}
}
+if (GETPOST('sortfield') == 'f.datef, f.ref, fd.rowid') {
+ $value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+ $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
+}
+
/*
* View
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 753ad06a503..509e131f766 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -91,6 +91,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC";
+ } else {
+ $sortorder = "ASC";
}
}
@@ -208,6 +210,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
}
}
+if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
+ $value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+ $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
+}
/*
diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php
index f38b617509e..fbb92ebb18e 100644
--- a/htdocs/accountancy/expensereport/lines.php
+++ b/htdocs/accountancy/expensereport/lines.php
@@ -75,6 +75,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC";
+ } else {
+ $sortorder = "ASC";
}
}
@@ -149,6 +151,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
}
}
+if (GETPOST('sortfield') == 'erd.date, erd.rowid') {
+ $value = (GETPOST('sortorder') == 'asc,asc' ? 0 : 1);
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+ $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
+}
+
/*
* View
diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index 0eb84e6d77b..e8822f2f669 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -84,6 +84,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC";
+ } else {
+ $sortorder = "ASC";
}
}
@@ -199,6 +201,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
}
}
+if (GETPOST('sortfield') == 'erd.date, erd.rowid') {
+ $value = (GETPOST('sortorder') == 'asc,asc' ? 0 : 1);
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+ $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
+}
/*
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index 1eef199894d..11c4bf290fd 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -83,6 +83,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC";
+ } else {
+ $sortorder = "ASC";
}
}
@@ -164,6 +166,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
}
}
+if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
+ $value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+ $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
+}
+
/*
* View
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index 03b3fb8eeec..9c9ee109383 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -93,6 +93,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC";
+ } else {
+ $sortorder = "ASC";
}
}
@@ -210,6 +212,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
}
}
+if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
+ $value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+ $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
+}
/*
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index c3fdbf377a3..a839daf86d5 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -5329,7 +5329,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
$options = '&'.$options;
}
- if (!$sortorder || $field1 != $sortfield1) {
+ if (!$sortorder || ($field1 != $sortfield1)) {
//$out.= ''.img_down("A-Z",0).'';
//$out.= ''.img_up("Z-A",0).'';
} else {
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index 8aa1b0ec9ef..7a4ffabd4ab 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -124,18 +124,6 @@ class modAccounting extends DolibarrModules
"",
"", 0, 'current', 0
);
- $this->const[9] = array(
- "ACCOUNTING_LIST_SORT_VENTILATION_TODO",
- "yesno",
- "1",
- "", 0, 'current', 0
- );
- $this->const[10] = array(
- "ACCOUNTING_LIST_SORT_VENTILATION_DONE",
- "yesno",
- "1",
- "", 0, 'current', 0
- );
$this->const[11] = array(
"ACCOUNTING_EXPORT_DATE",
"chaine",