From c1a2e7b12e1706f02dd9f5df50256cc7f0c1fc2b Mon Sep 17 00:00:00 2001
From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com>
Date: Mon, 8 Nov 2021 17:51:19 +0100
Subject: [PATCH 1/7] FIX: project task list: extrafields could not be
displayed
---
htdocs/projet/tasks.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index d61dffeee3c..03816ff91df 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -135,6 +135,7 @@ if ($object->usage_bill_time) {
}
// Extra fields
+$extrafieldsobjectkey = $taskstatic->table_element;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$arrayfields = dol_sort_array($arrayfields, 'position');
@@ -774,7 +775,6 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print '
| ';
- $extrafieldsobjectkey = $taskstatic->table_element;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Action column
From 33e40c12c8e5552f568f8c70f620b53f2dfa168a Mon Sep 17 00:00:00 2001
From: lvessiller
Date: Tue, 9 Nov 2021 14:12:28 +0100
Subject: [PATCH 2/7] FIX close cash with some terminals in TakePOS
---
htdocs/takepos/index.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php
index 344955a9167..f3b9991061e 100644
--- a/htdocs/takepos/index.php
+++ b/htdocs/takepos/index.php
@@ -732,6 +732,7 @@ $( document ).ready(function() {
if ($conf->global->TAKEPOS_CONTROL_CASH_OPENING) {
$sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
$sql .= " entity = ".$conf->entity." AND ";
+ $sql .= " posnumber = ".$_SESSION["takeposterminal"]." AND ";
$sql .= " date(date_creation) = CURDATE()";
$resql = $db->query($sql);
if ($resql) {
@@ -918,6 +919,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
$sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
$sql .= " entity = ".$conf->entity." AND ";
+$sql .= " posnumber = ".$_SESSION["takeposterminal"]." AND ";
$sql .= " date(date_creation) = CURDATE()";
$resql = $db->query($sql);
if ($resql)
From cea3d93b91c3eaa829f34ae73aa9ee2d8bed676a Mon Sep 17 00:00:00 2001
From: daraelmin
Date: Tue, 9 Nov 2021 20:51:27 +0100
Subject: [PATCH 3/7] Fix wrong sign in test
---
htdocs/adherents/subscription.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index 05e55206c02..d9ab62336a1 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -943,7 +943,7 @@ if ($rowid > 0) {
}
if (!$datefrom) {
$datefrom = $object->datevalid;
- if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) < dol_now()) {
+ if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
} else {
$datefrom = dol_get_first_day(dol_print_date(time(), "%Y"));
From fd3fd9d945f51a14146df69be9e60baf2f755946 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 11 Nov 2021 13:46:58 +0100
Subject: [PATCH 4/7] Fix getpost
---
htdocs/compta/bank/transfer.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php
index 9665a8a2b1f..f728dc74f4e 100644
--- a/htdocs/compta/bank/transfer.php
+++ b/htdocs/compta/bank/transfer.php
@@ -61,8 +61,8 @@ if ($action == 'add') {
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$label = GETPOST('label', 'alpha');
- $amount = price2num(GETPOST('amount', 'alpha'), 'MT');
- $amountto = price2num(GETPOST('amountto', 'alpha'), 'MT');
+ $amount = price2num(GETPOST('amount', 'alpha'), 'MT', 2);
+ $amountto = price2num(GETPOST('amountto', 'alpha'), 'MT', 2);
if (!$label) {
$error++;
From 28aa17e4fd5d17511f1646021ebf98b397990903 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 11 Nov 2021 13:49:21 +0100
Subject: [PATCH 5/7] FIX calculation of balance in conciliation page on desc
sorting.
---
htdocs/compta/bank/bankentries_list.php | 13 ++++++-------
htdocs/core/lib/functions.lib.php | 8 +++++++-
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index 14aeee29d69..84938f24dbc 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -175,7 +175,6 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
-
/*
* Actions
*/
@@ -266,13 +265,15 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
if (!$error) {
$param = 'action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id;
- $param .= '&search_conciliated='.urlencode($search_conciliated);
if ($page) {
$param .= '&page='.urlencode($page);
}
if ($offset) {
$param .= '&offset='.urlencode($offset);
}
+ if ($search_conciliated != '' && $search_conciliated != '-1') {
+ $param .= '&search_conciliated='.urlencode($search_conciliated);
+ }
if ($search_thirdparty_user) {
$param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
}
@@ -415,7 +416,6 @@ $banklinestatic = new AccountLine($db);
$now = dol_now();
-
// Must be before button action
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
@@ -748,7 +748,7 @@ if ($resql) {
// Confirmation delete
if ($action == 'delete') {
$text = $langs->trans('ConfirmDeleteTransaction');
- print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
+ print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid", 'int'), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
}
// Lines of title fields
@@ -1189,7 +1189,7 @@ if ($resql) {
$objforbalance = $db->fetch_object($resqlforbalance);
if ($objforbalance) {
// If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
- if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
+ if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
} else {
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
@@ -1274,8 +1274,7 @@ if ($resql) {
}
}
-
- if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
+ if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
$balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
$balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT');
} else {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index eae8546a338..07ff2930f0f 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -5329,13 +5329,16 @@ function price2num($amount, $rounding = '', $option = 0)
if ($thousand != ',' && $thousand != '.') {
$amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
}
+
$amount = str_replace(' ', '', $amount); // To avoid spaces
$amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
$amount = str_replace($dec, '.', $amount);
+
+ $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example.
}
//print ' XX'.$amount.' '.$rounding;
- // Now, make a rounding if required
+ // Now, $amount is a real PHP float number. We make a rounding if required.
if ($rounding) {
$nbofdectoround = '';
if ($rounding == 'MU') {
@@ -5375,9 +5378,12 @@ function price2num($amount, $rounding = '', $option = 0)
if ($thousand != ',' && $thousand != '.') {
$amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
}
+
$amount = str_replace(' ', '', $amount); // To avoid spaces
$amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
$amount = str_replace($dec, '.', $amount);
+
+ $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example.
}
return $amount;
From fa4b5d99c0f728c66238e1da52694190af5c7bd0 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 11 Nov 2021 15:35:34 +0100
Subject: [PATCH 6/7] FIX Bad use of dol_concatdesc()
---
htdocs/datapolicy/class/datapolicy.class.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php
index a7ed08d7e6f..7d53020ce3a 100644
--- a/htdocs/datapolicy/class/datapolicy.class.php
+++ b/htdocs/datapolicy/class/datapolicy.class.php
@@ -269,11 +269,11 @@ class DataPolicy
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
if ($message) {
if ($sendtocc) {
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
}
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
- $actionmsg .= dol_concatdesc($actionmsg, $message);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
+ $actionmsg = dol_concatdesc($actionmsg, $message);
}
// Send mail
@@ -343,11 +343,11 @@ class DataPolicy
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
if ($message) {
if ($sendtocc) {
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
}
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
- $actionmsg .= dol_concatdesc($actionmsg, $message);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
+ $actionmsg = dol_concatdesc($actionmsg, $message);
}
From ba724204a430cc841a068b777ebf1d6e2ca727cc Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 11 Nov 2021 15:50:32 +0100
Subject: [PATCH 7/7] FIX Bad use of dol_concatdesc()
---
htdocs/datapolicy/class/datapolicy.class.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php
index bf1033084d5..7383e059ae3 100644
--- a/htdocs/datapolicy/class/datapolicy.class.php
+++ b/htdocs/datapolicy/class/datapolicy.class.php
@@ -259,11 +259,11 @@ class DataPolicy
{
if ($sendtocc)
{
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
}
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg .= dol_concatdesc($actionmsg, $message);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
+ $actionmsg = dol_concatdesc($actionmsg, $message);
}
// Send mail
@@ -329,11 +329,11 @@ class DataPolicy
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
if ($message) {
if ($sendtocc) {
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
}
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg .= dol_concatdesc($actionmsg, $message);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
+ $actionmsg = dol_concatdesc($actionmsg, $message);
}