diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index c4fdc3be56a..ddad89e22fc 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -51,8 +51,12 @@ $sens = GETPOST("sens", "int");
$amount = price2num(GETPOST("amount", "alpha"));
$paymenttype = GETPOST("paymenttype", "int");
$accountancy_code = GETPOST("accountancy_code", "alpha");
-$subledger_account = GETPOST("subledger_account", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
+if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
+ $subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : '';
+} else {
+ $subledger_account = GETPOST("subledger_account", "alpha");
+}
// Security check
$socid = GETPOST("socid", "int");
@@ -115,7 +119,7 @@ if (empty($reshook))
$object->category_transaction = GETPOST("category_transaction", 'alpha');
$object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
- $object->subledger_account = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "";
+ $object->subledger_account = $subledger_account;
$object->sens = GETPOST('sens');
$object->fk_project = GETPOST('fk_project', 'int');
@@ -219,9 +223,11 @@ if (empty($reshook))
}
if ($action == 'setsubledger_account') {
+ $db->begin();
+
$result = $object->fetch($id);
- $object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "");
+ $object->subledger_account = $subledger_account;
$res = $object->update($user);
if ($res > 0) {
@@ -386,7 +392,7 @@ if ($action == 'create')
// Subledger account
if (!empty($conf->accounting->enabled))
{
- print '
| '.$langs->trans("SubledgerAccount").' | ';
+ print '
| '.$langs->trans("SubledgerAccount").'aaaa | ';
print '';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php
index 4e836f10af0..befe2fa6905 100644
--- a/htdocs/compta/bank/various_payment/list.php
+++ b/htdocs/compta/bank/various_payment/list.php
@@ -62,7 +62,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) $sortfield = "v.datep,v.rowid";
-if (!$sortorder) $sortorder = "DESC";
+if (!$sortorder) $sortorder="DESC,DESC";
$filtre = GETPOST("filtre", 'alpha');
diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php
index f9a974ae1c5..4239e6f1b28 100644
--- a/htdocs/core/boxes/box_task.php
+++ b/htdocs/core/boxes/box_task.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2015-2019 Frederic France
+/* Copyright (C) 2012-2018 Charlene BENKE
+ * Copyright (C) 2015-2020 Frederic France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -184,7 +184,7 @@ class box_task extends ModeleBoxes
$taskstatic->label = $objp->label;
$taskstatic->progress = $objp->progress;
$taskstatic->fk_statut = $objp->fk_statut;
- $taskstatic->date_end = $objp->datee;
+ $taskstatic->date_end = $this->db->jdate($objp->datee);
$taskstatic->planned_workload = $objp->planned_workload;
$taskstatic->duration_effective = $objp->duration_effective;
diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php
index 2818eff65e2..837946ce706 100644
--- a/htdocs/core/db/DoliDB.class.php
+++ b/htdocs/core/db/DoliDB.class.php
@@ -229,24 +229,29 @@ abstract class DoliDB implements Database
{
if (!empty($sortfield))
{
- $return = '';
- $fields = explode(',', $sortfield);
- $orders = explode(',', $sortorder);
- $i = 0;
- foreach ($fields as $val)
+ $oldsortorder = '';
+ $return='';
+ $fields=explode(',', $sortfield);
+ $orders=explode(',', $sortorder);
+ $i=0;
+ foreach($fields as $val)
{
if (!$return) $return .= ' ORDER BY ';
else $return .= ', ';
- $return .= preg_replace('/[^0-9a-z_\.]/i', '', $val);
+ $return .= preg_replace('/[^0-9a-z_\.]/i', '', $val); // Add field
$tmpsortorder = trim($orders[$i]);
// Only ASC and DESC values are valid SQL
if (strtoupper($tmpsortorder) === 'ASC') {
+ $oldsortorder = 'ASC';
$return .= ' ASC';
} elseif (strtoupper($tmpsortorder) === 'DESC') {
+ $oldsortorder = 'DESC';
$return .= ' DESC';
+ } else {
+ $return .= ' '.($oldsortorder ? $oldsortorder : 'ASC');
}
$i++;
|