From f613688b28c5b104d7816bc5ab5756d48a420b08 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 8 Apr 2021 13:37:09 +0200
Subject: [PATCH 01/75] add_option
---
htdocs/admin/notification.php | 17 +++++++++++++++++
htdocs/core/class/notify.class.php | 24 +++++++++++++++++++++---
htdocs/langs/en_US/admin.lang | 1 +
htdocs/langs/en_US/other.lang | 3 +++
htdocs/langs/fr_FR/admin.lang | 1 +
htdocs/langs/fr_FR/other.lang | 3 +++
6 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index e1cf115626f..6609021cc2a 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -97,6 +97,10 @@ if ($action == 'setvalue' && $user->admin) {
$error++;
}
+ $result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE", GETPOST("notif_disable", "alphawithlgt"), 'chaine', 0, '', $conf->entity);
+ if ($result < 0) {
+ $error++;
+ }
if (!$error) {
$db->commit();
@@ -198,6 +202,19 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
}
print '';
print '';
+$arrayofnotifto = array(
+'',
+$langs->trans('notiftouser'),
+$langs->trans('notiftofixedemail'),
+$langs->trans('notiftouserandtofixedemail')
+);
+var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+print '
Date: Thu, 8 Apr 2021 11:44:24 +0000
Subject: [PATCH 02/75] Fixing style errors.
---
htdocs/admin/notification.php | 2 +-
htdocs/core/class/notify.class.php | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6609021cc2a..d467b6bb62d 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -208,7 +208,7 @@ $langs->trans('notiftouser'),
$langs->trans('notiftofixedemail'),
$langs->trans('notiftouserandtofixedemail')
);
-var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+var_dump($arrayofnotifto, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
print '';
print $langs->trans("NotificationDisableConfirmMessage").' ';
print '';
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 92555da891a..695a17a75d8 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -112,18 +112,18 @@ class Notify
$langs->load("mails");
$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
- if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE)){
- if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 1 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3){
- foreach($listofnotiftodo as $val){
- if ($val['type'] == 'touser'){
+ if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE)) {
+ if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 1 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) {
+ foreach ($listofnotiftodo as $val) {
+ if ($val['type'] == 'touser') {
unset($listofnotiftodo[$val['email']]);
$listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
- if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 2 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3){
- foreach($listofnotiftodo as $val){
- if ($val['type'] == 'tofixedemail'){
+ if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 2 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) {
+ foreach ($listofnotiftodo as $val) {
+ if ($val['type'] == 'tofixedemail') {
unset($listofnotiftodo[$val['email']]);
$listofnotiftodo = array_merge($listofnotiftodo);
}
From 822d9b227bdd2eb7e8b304f8fa501fe1d03adfb7 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 8 Apr 2021 13:50:55 +0200
Subject: [PATCH 03/75] Update notification.php
---
htdocs/admin/notification.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6609021cc2a..85e097dceb3 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -202,13 +202,14 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
}
print ' ';
print ' ';
+
$arrayofnotifto = array(
'',
$langs->trans('notiftouser'),
$langs->trans('notiftofixedemail'),
$langs->trans('notiftouserandtofixedemail')
);
-var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+
print '';
print $langs->trans("NotificationDisableConfirmMessage").' ';
print '';
From d3053c0c1b8ffaac71253bc12d6f3f0f249280f0 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Wed, 28 Apr 2021 23:35:47 +0200
Subject: [PATCH 04/75] delete_fr_lang
---
htdocs/langs/fr_FR/admin.lang | 1 -
htdocs/langs/fr_FR/other.lang | 3 ---
2 files changed, 4 deletions(-)
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 02e0b27af5d..ef48fc0a82d 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1662,7 +1662,6 @@ MailingDelay=Temps d'attente, en seconde, avant d'envoyer le prochain message
NotificationSetup=Configuration du module Notification par email
NotificationEMailFrom=Adresse émettrice (From) des emails envoyés lors des notifications
FixedEmailTarget=Email fixe cible destinataires
-NotificationDisableConfirmMessage=Notifications desactivé dans les messages de confirmation
##### Sendings #####
SendingsSetup=Configuration du module Expédition/Livraison
SendingsReceiptModel=Modèles de bordereau d'expédition
diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang
index 4e228ed50bd..a8078129464 100644
--- a/htdocs/langs/fr_FR/other.lang
+++ b/htdocs/langs/fr_FR/other.lang
@@ -35,9 +35,6 @@ OnlyOneFieldForXAxisIsPossible=1 seul champ est actuellement possible en tant qu
AtLeastOneMeasureIsRequired=Au moins 1 champ de mesure est requis
AtLeastOneXAxisIsRequired=Au moins 1 champ pour l'axe X est requis
LatestBlogPosts=Derniers articles du Blog
-notiftouser=Aux utilisateurs
-notiftofixedemail=Vers les courriers fixe
-notiftouserandtofixedemail=Aux utilisateurs et les courriers fixe
Notify_ORDER_VALIDATE=Validation commande client
Notify_ORDER_SENTBYMAIL=Envoi commande client par email
Notify_ORDER_SUPPLIER_SENTBYMAIL=Envoi commande fournisseur par email
From c1e6109c4bfecda86c9ae06be638196729b2b616 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 29 Apr 2021 00:03:16 +0200
Subject: [PATCH 05/75] Update
---
htdocs/admin/notification.php | 28 ++++++++++++++++++++++------
htdocs/core/class/notify.class.php | 24 +++++++++++-------------
htdocs/langs/en_US/admin.lang | 3 ++-
3 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 85e097dceb3..93263998cbe 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -204,16 +204,32 @@ print ' ';
print ' ';
$arrayofnotifto = array(
-'',
-$langs->trans('notiftouser'),
-$langs->trans('notiftofixedemail'),
-$langs->trans('notiftouserandtofixedemail')
+-1 => '',
+1 => $langs->trans('notiftouser'),
+2 => $langs->trans('notiftofixedemail'),
+3 => $langs->trans('notiftouserandtofixedemail')
);
print '';
-print $langs->trans("NotificationDisableConfirmMessage").' ';
+print $langs->trans("NotificationDisableConfirmMessageUser").'';
print '';
-print $form->selectarray("notif_disable", $arrayofnotifto, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE, 0, 0, 0, '', 1, 0, 0, '', 'maxwidth400', 1);
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER');
+} else {
+ $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
+ print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER);
+}
+print ' ';
+print ' ';
+print '';
+print $langs->trans("NotificationDisableConfirmMessageFix").' ';
+print '';
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX');
+} else {
+ $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
+ print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX);
+}
print ' ';
print ' ';
print '';
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 695a17a75d8..11ca1c43d3e 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -112,21 +112,19 @@ class Notify
$langs->load("mails");
$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
- if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE)) {
- if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 1 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) {
- foreach ($listofnotiftodo as $val) {
- if ($val['type'] == 'touser') {
- unset($listofnotiftodo[$val['email']]);
- $listofnotiftodo = array_merge($listofnotiftodo);
- }
+ if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) {
+ foreach ($listofnotiftodo as $val) {
+ if ($val['type'] == 'touser') {
+ unset($listofnotiftodo[$val['email']]);
+ $listofnotiftodo = array_merge($listofnotiftodo);
}
}
- if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 2 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) {
- foreach ($listofnotiftodo as $val) {
- if ($val['type'] == 'tofixedemail') {
- unset($listofnotiftodo[$val['email']]);
- $listofnotiftodo = array_merge($listofnotiftodo);
- }
+ }
+ if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) {
+ foreach ($listofnotiftodo as $val) {
+ if ($val['type'] == 'tofixedemail') {
+ unset($listofnotiftodo[$val['email']]);
+ $listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 73d2a5ca558..2154539939c 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1673,7 +1673,8 @@ MailingDelay=Seconds to wait after sending next message
NotificationSetup=Email Notification module setup
NotificationEMailFrom=Sender email (From) for emails sent by the Notifications module
FixedEmailTarget=Recipient
-NotificationDisableConfirmMessage=Notification disable in confirm message
+NotificationDisableConfirmMessageFix=Disable notification info in confirm message for fix notification
+NotificationDisableConfirmMessageUser=Disable notification info in confirm message for user notification
##### Sendings #####
SendingsSetup=Shipping module setup
SendingsReceiptModel=Sending receipt model
From b6ddea57f3e462dd2ffa312e5252b78f7571323d Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 29 Apr 2021 00:17:55 +0200
Subject: [PATCH 06/75] update
---
htdocs/admin/notification.php | 7 -------
1 file changed, 7 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6b17b9134f7..bf4928dc5a4 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -203,13 +203,6 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
print '';
print '';
-$arrayofnotifto = array(
--1 => '',
-1 => $langs->trans('notiftouser'),
-2 => $langs->trans('notiftofixedemail'),
-3 => $langs->trans('notiftouserandtofixedemail')
-);
-
print '';
print $langs->trans("NotificationDisableConfirmMessageUser").' ';
print '';
From a79abfd4e01e70850c8893c1c5b645bd5fdb962c Mon Sep 17 00:00:00 2001
From: henrynopo
Date: Thu, 26 Aug 2021 10:37:03 +0800
Subject: [PATCH 07/75] Update card.php
---
htdocs/compta/facture/card.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 31de2bbd4ff..4658c10873d 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4052,6 +4052,8 @@ if ($action == 'create') {
$i++;
$close[$i]['code'] = 'badcustomer';
$i++;
+ $close[$i]['code'] = 'bankcharge';
+ $i++;
$close[$i]['code'] = 'other';
$i++;
// Help
@@ -4060,6 +4062,8 @@ if ($action == 'create') {
$i++;
$close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");
$i++;
+ $close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBankChargeDesc");
+ $i++;
$close[$i]['label'] = $langs->trans("Other");
$i++;
// Texte
@@ -4068,6 +4072,8 @@ if ($action == 'create') {
$i++;
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
$i++;
+ $close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBankCharge", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
+ $i++;
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("Other"), $close[$i]['label'], 1);
$i++;
// arrayreasons[code]=reason
From a25580f97cfeda3e314926264063d85e0d251a18 Mon Sep 17 00:00:00 2001
From: henrynopo
Date: Thu, 26 Aug 2021 10:38:53 +0800
Subject: [PATCH 08/75] Update bills.lang
---
htdocs/langs/en_US/bills.lang | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index a921aac9e48..6a88f2599dd 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -192,6 +192,7 @@ ConfirmClassifyPaidPartiallyReasonDiscount=Remaining unpaid (%s %s) is a
ConfirmClassifyPaidPartiallyReasonDiscountNoVat=Remaining unpaid (%s %s) is a discount granted because payment was made before term. I accept to lose the VAT on this discount.
ConfirmClassifyPaidPartiallyReasonDiscountVat=Remaining unpaid (%s %s) is a discount granted because payment was made before term. I recover the VAT on this discount without a credit note.
ConfirmClassifyPaidPartiallyReasonBadCustomer=Bad customer
+ConfirmClassifyPaidPartiallyReasonBankCharge=Deduction by bank (intermediary bank fees)
ConfirmClassifyPaidPartiallyReasonProductReturned=Products partially returned
ConfirmClassifyPaidPartiallyReasonOther=Amount abandoned for other reason
ConfirmClassifyPaidPartiallyReasonDiscountNoVatDesc=This choice is possible if your invoice has been provided with suitable comments. (Example «Only the tax corresponding to the price that has been actually paid gives rights to deduction»)
@@ -199,6 +200,7 @@ ConfirmClassifyPaidPartiallyReasonDiscountVatDesc=In some countries, this choice
ConfirmClassifyPaidPartiallyReasonAvoirDesc=Use this choice if all other does not suit
ConfirmClassifyPaidPartiallyReasonBadCustomerDesc=A bad customer is a customer that refuses to pay his debt.
ConfirmClassifyPaidPartiallyReasonProductReturnedDesc=This choice is used when payment is not complete because some of products were returned
+ConfirmClassifyPaidPartiallyReasonBankChargeDesc=The unpaid amount is intermediary bank fees , deducted directly from the correct amount paid by the Customer.
ConfirmClassifyPaidPartiallyReasonOtherDesc=Use this choice if all others are not suitable, for example in following situation: - payment not complete because some products were shipped back - amount claimed too important because a discount was forgotten In all cases, amount over-claimed must be corrected in accountancy system by creating a credit note.
ConfirmClassifyAbandonReasonOther=Other
ConfirmClassifyAbandonReasonOtherDesc=This choice will be used in all other cases. For example because you plan to create a replacing invoice.
From 2da16ade6c722e1464a6c8f571beaba150f194d9 Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Fri, 8 Oct 2021 17:24:52 +0200
Subject: [PATCH 09/75] FIX: consistent UX when calling a tab from the invoice
card with empty ref / id
---
htdocs/compta/facture/card.php | 11 +++++++++++
htdocs/compta/facture/contact.php | 11 +++++++++++
htdocs/compta/facture/document.php | 11 +++++++++++
htdocs/compta/facture/info.php | 11 +++++++++++
htdocs/compta/facture/note.php | 11 +++++++++++
5 files changed, 55 insertions(+)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index e15b2722800..ab568332dd8 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2756,6 +2756,17 @@ if (empty($reshook))
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index c340d68242e..c0e0a40c2c5 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -118,6 +118,17 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer)
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index e880d77db74..64ebed251d3 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -85,6 +85,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index bad63cf1f61..9e40fd8b5a8 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -43,6 +43,17 @@ $ref = GETPOST("ref", 'alpha');
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$form = new Form($db);
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 07084a0cf2c..428383b4907 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -64,6 +64,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
From 57052e2fbabffa16b25a25fe02a1966e117d09db Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Mon, 11 Oct 2021 11:10:14 +0200
Subject: [PATCH 10/75] FIX PR#18931 Remove useless explicit call to
dol_shutdown
---
htdocs/compta/facture/card.php | 1 -
htdocs/compta/facture/contact.php | 1 -
htdocs/compta/facture/document.php | 1 -
htdocs/compta/facture/info.php | 1 -
htdocs/compta/facture/note.php | 1 -
5 files changed, 5 deletions(-)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index ab568332dd8..c772fd0ad7b 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2763,7 +2763,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index c0e0a40c2c5..7177463c30e 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -125,7 +125,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 64ebed251d3..0818b944705 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -92,7 +92,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index 9e40fd8b5a8..955c41693c0 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -50,7 +50,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 428383b4907..dadb61b551d 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -71,7 +71,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
From bd52613331d59d0d3cf8f08872319ce6c1312ea2 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sat, 16 Oct 2021 17:06:10 +0200
Subject: [PATCH 11/75] Fix phpcs
---
htdocs/compta/facture/stats/index.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index 03fcf5b37d0..c8961762a81 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -109,7 +109,6 @@ if ($mode == 'supplier') {
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)';
$stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')';
}
-
}
// Build graphic number of object
From 17773f84143a13419edef2c48b40b88ba5c598fe Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Fri, 22 Oct 2021 18:26:23 +0200
Subject: [PATCH 12/75] FIX tcpdf vulnerability to roman numeral bomb, cf.
tecnickom/TCPDF issue #315
---
dev/dolibarr_changes.txt | 12 ++++++++++++
.../tecnickcom/tcpdf/include/tcpdf_static.php | 4 ++++
2 files changed, 16 insertions(+)
diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt
index ecd25ce692b..8cb0e002d16 100644
--- a/dev/dolibarr_changes.txt
+++ b/dev/dolibarr_changes.txt
@@ -175,6 +175,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono';
+* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
+ of the function, replace:
+
+ $roman = '';
+
+with:
+
+ $roman = '';
+ if ($number >= 4000) {
+ // do not represent numbers above 4000 in Roman numerals
+ return strval($number);
+ }
diff --git a/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php b/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php
index 67bb255d187..9ed6233b46c 100644
--- a/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php
+++ b/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php
@@ -1440,6 +1440,10 @@ class TCPDF_STATIC {
*/
public static function intToRoman($number) {
$roman = '';
+ if ($number >= 4000) {
+ // do not represent numbers above 4000 in Roman numerals
+ return strval($number);
+ }
while ($number >= 1000) {
$roman .= 'M';
$number -= 1000;
From 00b617d17fee7ea93897da8f7dd958e08c785506 Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Sat, 23 Oct 2021 22:22:45 +0200
Subject: [PATCH 13/75] Fix #18961 : no_email field has been replaced by
mailing_unsubscribe table
---
htdocs/contact/list.php | 20 ++++++++-----
.../modules/mailings/contacts1.modules.php | 30 ++++++++-----------
.../modules/mailings/modules_mailings.php | 18 -----------
.../public/emailing/mailing-unsubscribe.php | 14 ---------
4 files changed, 24 insertions(+), 58 deletions(-)
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 295e63c9606..935e90e6085 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -175,7 +175,7 @@ $arrayfields = array(
'p.phone_mobile'=>array('label'=>"PhoneMobile", 'position'=>32, 'checked'=>1),
'p.fax'=>array('label'=>"Fax", 'position'=>33, 'checked'=>0),
'p.email'=>array('label'=>"EMail", 'position'=>40, 'checked'=>1),
- 'p.no_email'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))),
+ 'mu.rowid'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))),
'p.thirdparty'=>array('label'=>"ThirdParty", 'position'=>50, 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
@@ -298,7 +298,7 @@ $contactstatic = new Contact($db);
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
$sql = "SELECT s.rowid as socid, s.nom as name,";
-$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
+$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email,";
$sql .= " p.socialnetworks, p.photo,";
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
$sql .= " co.label as country, co.code as country_code";
@@ -306,6 +306,9 @@ $sql .= " co.label as country, co.code as country_code";
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
+if(!empty($conf->mailing->enabled)) {
+ $sql .= ", mu.rowid as no_email";
+}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@@ -318,6 +321,7 @@ if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_conta
if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
+if(!empty($conf->mailing->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mailing_unsubscribe as mu ON mu.email = p.email";
$sql .= ' WHERE p.entity IN ('.getEntity('socpeople').')';
if (!$user->rights->societe->client->voir && !$socid) //restriction
{
@@ -374,8 +378,8 @@ if (strlen($search_town)) $sql .= natural_search("p.town", $search_town);
if (count($search_roles) > 0) {
$sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".implode(',', $search_roles)."))";
}
-
-if ($search_no_email != '' && $search_no_email >= 0) $sql .= " AND p.no_email = ".$db->escape($search_no_email);
+if ($search_no_email != -1 && $search_no_email > 0) $sql .= " AND mu.rowid IS NOT NULL";
+if ($search_no_email != -1 && $search_no_email == 0) $sql .= " AND mu.rowid IS NULL";
if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status);
if ($search_import_key) $sql .= natural_search("p.import_key", $search_import_key);
if ($type == "o") // filtre sur type
@@ -662,7 +666,7 @@ if (!empty($arrayfields['p.email']['checked']))
print ' ';
print ' ';
}
-if (!empty($arrayfields['p.no_email']['checked']))
+if (!empty($arrayfields['mu.rowid']['checked']))
{
print '';
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
@@ -751,7 +755,7 @@ if (!empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_
if (!empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
-if (!empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
+if (!empty($arrayfields['mu.rowid']['checked'])) print_liste_field_titre($arrayfields['mu.rowid']['label'], $_SERVER["PHP_SELF"], "mu.rowid", $begin, $param, '', $sortfield, $sortorder, 'center ');
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
@@ -905,9 +909,9 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// No EMail
- if (!empty($arrayfields['p.no_email']['checked']))
+ if (!empty($arrayfields['mu.rowid']['checked']))
{
- print ' '.yn($obj->no_email).' ';
+ print ''.yn(!is_null($obj->no_email) ? 1 : 0).' ';
if (!$i) $totalarray['nbfield']++;
}
if (!empty($conf->socialnetworks->enabled)) {
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index 9d7a23ce9fd..bc370f5552e 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -80,7 +80,7 @@ class mailing_contacts1 extends MailingTargets
$statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")";
$statssql[0] .= " AND c.email != ''"; // Note that null != '' is false
- $statssql[0] .= " AND c.no_email = 0";
+ $statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
$statssql[0] .= " AND c.statut = 1";
return $statssql;
@@ -104,7 +104,6 @@ class mailing_contacts1 extends MailingTargets
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
$sql .= " WHERE c.entity IN (".getEntity('socpeople').")";
$sql .= " AND c.email != ''"; // Note that null != '' is false
- $sql .= " AND c.no_email = 0";
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
// exclude unsubscribed users
$sql .= " AND c.statut = 1";
@@ -132,9 +131,8 @@ class mailing_contacts1 extends MailingTargets
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
- /*$sql.= " AND sp.email != ''"; // Note that null != '' is false
- $sql.= " AND sp.no_email = 0";
- $sql.= " AND sp.statut = 1";*/
+ $sql .= " AND sp.email != ''"; // Note that null != '' is false
+ $sql .= " AND sp.statut = 1";
$sql .= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
$sql .= " GROUP BY sp.poste";
$sql .= " ORDER BY sp.poste";
@@ -166,10 +164,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs";
- $sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
- //$sql.= " AND sp.no_email = 0";
- //$sql.= " AND sp.email != ''";
- //$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " AND sp.email != ''"; // Note that null != '' is false
+ $sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_socpeople = sp.rowid";
$sql .= " GROUP BY c.label";
@@ -241,10 +238,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs";
- $sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
- //$sql.= " AND sp.no_email = 0";
- //$sql.= " AND sp.email != ''";
- //$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " AND sp.email != ''"; // Note that null != '' is false
+ $sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_soc = sp.fk_soc";
$sql .= " GROUP BY c.label";
@@ -283,10 +279,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs";
- $sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
- //$sql.= " AND sp.no_email = 0";
- //$sql.= " AND sp.email != ''";
- //$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " AND sp.email != ''"; // Note that null != '' is false
+ $sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_soc = sp.fk_soc";
$sql .= " GROUP BY c.label";
@@ -385,7 +380,6 @@ class mailing_contacts1 extends MailingTargets
if ($filter_category_supplier <> 'all') $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
$sql .= " AND sp.email <> ''";
- $sql .= " AND sp.no_email = 0";
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0";
// Exclude unsubscribed email adresses
$sql .= " AND sp.statut = 1";
diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php
index ffba2571d23..d4ccc3ddb38 100644
--- a/htdocs/core/modules/mailings/modules_mailings.php
+++ b/htdocs/core/modules/mailings/modules_mailings.php
@@ -209,24 +209,6 @@ class MailingTargets // This can't be abstract as it is used for some method
dol_syslog(__METHOD__.": mailing ".$j." targets added");
- /*
- //Update the status to show thirdparty mail that don't want to be contacted anymore'
- $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
- $sql .= " SET statut=3";
- $sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)";
- $sql .= " AND source_type='thirdparty'";
- dol_syslog(__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted");
- $result=$this->db->query($sql);
-
- //Update the status to show contact mail that don't want to be contacted anymore'
- $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
- $sql .= " SET statut=3";
- $sql .= " WHERE fk_mailing=".$mailing_id." AND source_type='contact' AND (email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1))";
- dol_syslog(__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG);
- $result=$this->db->query($sql);
- */
-
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " SET statut=3";
$sql .= " WHERE fk_mailing=".$mailing_id." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php
index d26bae234db..7b0fbf0ef72 100644
--- a/htdocs/public/emailing/mailing-unsubscribe.php
+++ b/htdocs/public/emailing/mailing-unsubscribe.php
@@ -100,20 +100,6 @@ if (!empty($tag) && ($unsuscrib == '1'))
$resql = $db->query($sql);
if (!$resql) dol_print_error($db);
- /*
- // Update status communication of thirdparty prospect (old usage)
- $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)";
-
- $resql=$db->query($sql);
- if (! $resql) dol_print_error($db);
-
- // Update status communication of contact prospect (old usage)
- $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)";
-
- $resql=$db->query($sql);
- if (! $resql) dol_print_error($db);
- */
-
// Update status communication of email (new usage)
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe (date_creat, entity, email) VALUES ('".$db->idate(dol_now())."', ".$db->escape($obj->entity).", '".$db->escape($obj->email)."')";
From 29950a6afa83f3df3330d8e29c137302e1481999 Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Sat, 23 Oct 2021 22:27:29 +0200
Subject: [PATCH 14/75] Replace != by <> in SQL requests
---
htdocs/core/modules/mailings/contacts1.modules.php | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index bc370f5552e..bd4300ea71d 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -79,7 +79,7 @@ class mailing_contacts1 extends MailingTargets
$statssql[0] .= " count(distinct(c.email)) as nb";
$statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")";
- $statssql[0] .= " AND c.email != ''"; // Note that null != '' is false
+ $statssql[0] .= " AND c.email <> ''"; // Note that null != '' is false
$statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
$statssql[0] .= " AND c.statut = 1";
@@ -103,7 +103,7 @@ class mailing_contacts1 extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
$sql .= " WHERE c.entity IN (".getEntity('socpeople').")";
- $sql .= " AND c.email != ''"; // Note that null != '' is false
+ $sql .= " AND c.email <> ''"; // Note that null != '' is false
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
// exclude unsubscribed users
$sql .= " AND c.statut = 1";
@@ -131,9 +131,9 @@ class mailing_contacts1 extends MailingTargets
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
- $sql .= " AND sp.email != ''"; // Note that null != '' is false
+ $sql .= " AND sp.email <> ''"; // Note that null != '' is false
$sql .= " AND sp.statut = 1";
- $sql .= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
+ $sql .= " AND (sp.poste IS NOT NULL AND sp.poste <> '')";
$sql .= " GROUP BY sp.poste";
$sql .= " ORDER BY sp.poste";
$resql = $this->db->query($sql);
@@ -165,7 +165,7 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
- $sql .= " AND sp.email != ''"; // Note that null != '' is false
+ $sql .= " AND sp.email <> ''"; // Note that null != '' is false
$sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_socpeople = sp.rowid";
@@ -239,7 +239,7 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
- $sql .= " AND sp.email != ''"; // Note that null != '' is false
+ $sql .= " AND sp.email <> ''"; // Note that null != '' is false
$sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_soc = sp.fk_soc";
@@ -280,7 +280,7 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
- $sql .= " AND sp.email != ''"; // Note that null != '' is false
+ $sql .= " AND sp.email <> ''"; // Note that null != '' is false
$sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_soc = sp.fk_soc";
From 77c716565e6baff527a398eccaca15aa8d3b0896 Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Sat, 23 Oct 2021 23:42:06 +0200
Subject: [PATCH 15/75] Fix #18922 : multicurrency sync in http with good
currencylayer url
---
htdocs/multicurrency/class/multicurrency.class.php | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php
index 5067a6e91d5..3cdcd30dd70 100644
--- a/htdocs/multicurrency/class/multicurrency.class.php
+++ b/htdocs/multicurrency/class/multicurrency.class.php
@@ -643,13 +643,12 @@ class MultiCurrency extends CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
- $urlendpoint = 'http://apilayer.net/api/live?access_key='.$key;
- //$urlendpoint.='&format=1';
- $urlendpoint .= (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '' : '&source='.$conf->global->MULTICURRENCY_APP_SOURCE);
+ $urlendpoint = 'http://api.currencylayer.com/live?access_key='.$key;
+ $urlendpoint .= '&source=' . (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? 'USD' : $conf->global->MULTICURRENCY_APP_SOURCE);
dol_syslog("Call url endpoint ".$urlendpoint);
- $resget = getURLContent($urlendpoint, 'GET', '', 1, array(), array('http', 'https'), 1);
+ $resget = getURLContent($urlendpoint);
if ($resget['content']) {
$response = $resget['content'];
From 983e28691bbd2186dda67a6a325e2b49f2a5d52d Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Sun, 24 Oct 2021 00:02:55 +0200
Subject: [PATCH 16/75] Use a subselect instead of a join
---
htdocs/contact/list.php | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 935e90e6085..64207863c79 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -175,7 +175,7 @@ $arrayfields = array(
'p.phone_mobile'=>array('label'=>"PhoneMobile", 'position'=>32, 'checked'=>1),
'p.fax'=>array('label'=>"Fax", 'position'=>33, 'checked'=>0),
'p.email'=>array('label'=>"EMail", 'position'=>40, 'checked'=>1),
- 'mu.rowid'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))),
+ 'unsubscribed'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))),
'p.thirdparty'=>array('label'=>"ThirdParty", 'position'=>50, 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
@@ -307,7 +307,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
if(!empty($conf->mailing->enabled)) {
- $sql .= ", mu.rowid as no_email";
+ $sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed";
}
// Add fields from hooks
$parameters = array();
@@ -321,7 +321,6 @@ if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_conta
if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
-if(!empty($conf->mailing->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mailing_unsubscribe as mu ON mu.email = p.email";
$sql .= ' WHERE p.entity IN ('.getEntity('socpeople').')';
if (!$user->rights->societe->client->voir && !$socid) //restriction
{
@@ -378,8 +377,8 @@ if (strlen($search_town)) $sql .= natural_search("p.town", $search_town);
if (count($search_roles) > 0) {
$sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".implode(',', $search_roles)."))";
}
-if ($search_no_email != -1 && $search_no_email > 0) $sql .= " AND mu.rowid IS NOT NULL";
-if ($search_no_email != -1 && $search_no_email == 0) $sql .= " AND mu.rowid IS NULL";
+if ($search_no_email != -1 && $search_no_email > 0) $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) > 0";
+if ($search_no_email != -1 && $search_no_email == 0) $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) = 0";
if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status);
if ($search_import_key) $sql .= natural_search("p.import_key", $search_import_key);
if ($type == "o") // filtre sur type
@@ -666,7 +665,7 @@ if (!empty($arrayfields['p.email']['checked']))
print ' ';
print '';
}
-if (!empty($arrayfields['mu.rowid']['checked']))
+if (!empty($arrayfields['unsubscribed']['checked']))
{
print '';
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
@@ -755,7 +754,7 @@ if (!empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_
if (!empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
-if (!empty($arrayfields['mu.rowid']['checked'])) print_liste_field_titre($arrayfields['mu.rowid']['label'], $_SERVER["PHP_SELF"], "mu.rowid", $begin, $param, '', $sortfield, $sortorder, 'center ');
+if (!empty($arrayfields['unsubscribed']['checked'])) print_liste_field_titre($arrayfields['unsubscribed']['label'], $_SERVER["PHP_SELF"], "unsubscribed", $begin, $param, '', $sortfield, $sortorder, 'center ');
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
@@ -909,9 +908,9 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// No EMail
- if (!empty($arrayfields['mu.rowid']['checked']))
+ if (!empty($arrayfields['unsubscribed']['checked']))
{
- print ' '.yn(!is_null($obj->no_email) ? 1 : 0).' ';
+ print ''.yn(($obj->unsubscribed > 0) ? 1 : 0).' ';
if (!$i) $totalarray['nbfield']++;
}
if (!empty($conf->socialnetworks->enabled)) {
From 0a2c950401ded7ce6af036b045b036ff76f55eb7 Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Sun, 24 Oct 2021 00:31:57 +0200
Subject: [PATCH 17/75] Fix #18916 : mass stock movements not displayed if
error while adding line
---
htdocs/product/stock/massstockmove.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php
index 9f3390d34af..ed7095473ea 100644
--- a/htdocs/product/stock/massstockmove.php
+++ b/htdocs/product/stock/massstockmove.php
@@ -443,6 +443,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
*/
$now = dol_now();
+$error = 0;
$form = new Form($db);
$formproduct = new FormProduct($db);
From 3fae8d1756c5653f295194a5c40eac7900716de8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:25:35 +0200
Subject: [PATCH 18/75] fix warnings
---
htdocs/eventorganization/conferenceorbooth_list.php | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index 0deb1707cfc..198f169a390 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -421,7 +421,7 @@ if ($projectid > 0) {
// Show message
$message = 'entity : "");
- $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
+ $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
$message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').' ';
print $message;
print " ";
@@ -433,7 +433,7 @@ if ($projectid > 0) {
//print '';
print '';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $project->id);
- $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5');
+ $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $project->id), 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '';
//print ' ';
@@ -450,7 +450,7 @@ if ($projectid > 0) {
//print '';
print '
';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.((int) $project->id).'&type=global';
- $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5');
+ $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $project->id), 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '';
//print '
';
@@ -698,6 +698,7 @@ print '
';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
+ $searchkey = (empty($search[$key]) ? '' : $search[$key]);
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@@ -710,11 +711,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
- print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
+ print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $searchkey, $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
- print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
+ print $object->showInputField($val, $key, $searchkey, '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
- print ' ';
+ print ' ';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
From 6d2cedb439088c2951946a1cb4a696aa8543f6ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:33:54 +0200
Subject: [PATCH 19/75] Fix Undefined array key
Fix Undefined array key 1 in htdocs/core/lib/project.lib.php on line 314
---
htdocs/core/lib/project.lib.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index bbc6da6a7e4..c66bcdfc2d8 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -311,7 +311,7 @@ function project_prepare_head(Project $project, $moreparam = '')
}
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$project->id;
- $head[$h][1] .= $langs->trans("Events");
+ $head[$h][1] = $langs->trans("Events");
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
From 6b3916a7b303b2e8a41eede658809ebc491b9bae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:46:58 +0200
Subject: [PATCH 20/75] fix warnings in ticket list
---
htdocs/ticket/list.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 2566ee81073..97bcef197e6 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -390,7 +390,7 @@ foreach ($search as $key => $val) {
}
continue;
}
- $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
+ $mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0);
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], $mode_search);
}
@@ -560,7 +560,7 @@ if ($projectid > 0 || $project_ref) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
From 13f04053a1194f3dfe6117da56693db409d5cbe0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:48:30 +0200
Subject: [PATCH 21/75] fix warnings in ticket list
---
htdocs/ticket/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 97bcef197e6..1b3e035e37d 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -560,7 +560,7 @@ if ($projectid > 0 || $project_ref) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if (!empty($object->thirdparty) && $object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
From d240a9f7748869a4ceb11880f2b8f5af65fa5dfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:59:30 +0200
Subject: [PATCH 22/75] fix warnings in ticket list
---
htdocs/projet/card.php | 4 ++--
htdocs/projet/contact.php | 4 ++--
htdocs/projet/document.php | 2 +-
htdocs/projet/element.php | 6 +++---
htdocs/projet/note.php | 4 ++--
htdocs/projet/tasks.php | 4 ++--
htdocs/projet/tasks/time.php | 6 +++---
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 432fc888d65..091d20c24d6 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -1006,13 +1006,13 @@ if ($action == 'create' && $user->rights->projet->creer) {
$morehtmlref .= dol_escape_htmltag($object->title);
// Thirdparty
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : ';
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index 68d12df3bcd..48f12e23ec4 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -294,13 +294,13 @@ if ($id > 0 || !empty($ref)) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index df31724d07c..9ac87b46084 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -134,7 +134,7 @@ if ($object->id > 0) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 252dafddb5d..66288159f39 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -164,7 +164,7 @@ if ($id == '' && $ref == '') {
exit();
}
-$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
+$mine = (!empty($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
@@ -216,13 +216,13 @@ $morehtmlref = '';
// Title
$morehtmlref .= $object->title;
// Thirdparty
-if ($object->thirdparty->id > 0) {
+if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
// Define a complementary filter for search of next/prev ref.
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " te.rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php
index 9fee6615c40..3c32bd528a4 100644
--- a/htdocs/projet/note.php
+++ b/htdocs/projet/note.php
@@ -33,7 +33,7 @@ $action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
+$mine = (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
@@ -100,7 +100,7 @@ if ($id > 0 || !empty($ref)) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 666f7d8343a..80d39cf08d4 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -550,13 +550,13 @@ if ($id > 0 || !empty($ref)) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index d171d130a41..4bb5ab8e503 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -719,7 +719,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
$head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'));
- $param = ($mode == 'mine' ? '&mode=mine' : '');
+ $param = ((!empty($mode) && $mode == 'mine') ? '&mode=mine' : '');
// Project card
@@ -729,13 +729,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
// Title
$morehtmlref .= $projectstatic->title;
// Thirdparty
- if ($projectstatic->thirdparty->id > 0) {
+ if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
From cc374e9eb18b660f0d9b45c99af34f677b39ee35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 10:02:12 +0200
Subject: [PATCH 23/75] fix warnings in ticket list
---
htdocs/core/boxes/box_project.php | 4 ++--
htdocs/core/boxes/box_task.php | 4 ++--
htdocs/core/boxes/box_validated_projects.php | 2 +-
htdocs/core/lib/security.lib.php | 2 +-
htdocs/eventorganization/conferenceorbooth_card.php | 2 +-
htdocs/eventorganization/conferenceorbooth_contact.php | 2 +-
htdocs/eventorganization/conferenceorbooth_document.php | 2 +-
htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +-
htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +-
htdocs/projet/class/project.class.php | 4 ++--
htdocs/projet/class/projectstats.class.php | 4 ++--
htdocs/projet/class/task.class.php | 4 ++--
htdocs/projet/comment.php | 4 ++--
htdocs/projet/document.php | 2 +-
htdocs/projet/ganttview.php | 4 ++--
htdocs/projet/info.php | 4 ++--
htdocs/projet/list.php | 4 ++--
htdocs/projet/note.php | 2 +-
htdocs/projet/tasks/comment.php | 2 +-
htdocs/projet/tasks/contact.php | 2 +-
htdocs/projet/tasks/document.php | 2 +-
htdocs/projet/tasks/list.php | 4 ++--
htdocs/projet/tasks/note.php | 2 +-
htdocs/projet/tasks/task.php | 2 +-
htdocs/ticket/card.php | 2 +-
htdocs/ticket/list.php | 2 +-
26 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php
index f14ab699690..63a4e90cdd0 100644
--- a/htdocs/core/boxes/box_project.php
+++ b/htdocs/core/boxes/box_project.php
@@ -94,7 +94,7 @@ class box_project extends ModeleBoxes
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId = '';
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
@@ -102,7 +102,7 @@ class box_project extends ModeleBoxes
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " WHERE p.entity IN (".getEntity('project').")"; // Only current entity or severals if permission ok
$sql .= " AND p.fk_statut = 1"; // Only open projects
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
}
diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php
index 0c349ad3e4c..e86a1206902 100644
--- a/htdocs/core/boxes/box_task.php
+++ b/htdocs/core/boxes/box_task.php
@@ -145,7 +145,7 @@ class box_task extends ModeleBoxes
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId = '';
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
@@ -168,7 +168,7 @@ class box_task extends ModeleBoxes
$sql .= " AND p.fk_statut = ".Project::STATUS_VALIDATED;
$sql .= " AND (pt.progress < 100 OR pt.progress IS NULL ) "; // 100% is done and not displayed
$sql .= " AND p.usage_task = 1 ";
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
}
diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php
index 3f2b2cdc221..574ee7b7d80 100644
--- a/htdocs/core/boxes/box_validated_projects.php
+++ b/htdocs/core/boxes/box_validated_projects.php
@@ -101,7 +101,7 @@ class box_validated_projects extends ModeleBoxes
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId = '';
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index fbd2651d4b3..e6d2d2aa74f 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -304,7 +304,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
$nbko++;
}
} elseif ($feature == 'projet') {
- if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) {
+ if (!$user->rights->projet->lire && empty($user->rights->projet->all->lire)) {
$readok = 0;
$nbko++;
}
diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php
index 1c544f4f7c4..8fa1f1ec288 100644
--- a/htdocs/eventorganization/conferenceorbooth_card.php
+++ b/htdocs/eventorganization/conferenceorbooth_card.php
@@ -200,7 +200,7 @@ if (!empty($withproject)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php
index 0c05f0c1946..6f921848881 100644
--- a/htdocs/eventorganization/conferenceorbooth_contact.php
+++ b/htdocs/eventorganization/conferenceorbooth_contact.php
@@ -181,7 +181,7 @@ if (!empty($withproject)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php
index 8b064c12b72..4c403332feb 100644
--- a/htdocs/eventorganization/conferenceorbooth_document.php
+++ b/htdocs/eventorganization/conferenceorbooth_document.php
@@ -138,7 +138,7 @@ if (!empty($withproject)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php
index 101bc10a0aa..e38bdd954f3 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_card.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_card.php
@@ -235,7 +235,7 @@ if (!empty($withproject)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php
index 12d62e0ab76..a5c9c308c6f 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_list.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_list.php
@@ -412,7 +412,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 8da82f45201..aa823dc44d6 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -2015,7 +2015,7 @@ class Project extends CommonObject
//$socid=$user->socid;
$projectsListId = null;
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1);
}
@@ -2107,7 +2107,7 @@ class Project extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " WHERE";
$sql .= " p.entity IN (".getEntity('project').")";
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1);
$sql .= "AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
}
diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php
index 1439ecd5f20..efd8ecc3424 100644
--- a/htdocs/projet/class/projectstats.class.php
+++ b/htdocs/projet/class/projectstats.class.php
@@ -158,7 +158,7 @@ class ProjectStats extends Stats
// Get list of project id allowed to user (in a string list separated by coma)
$object = new Project($this->db);
$projectsListId = '';
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $user->socid);
}
@@ -183,7 +183,7 @@ class ProjectStats extends Stats
$sqlwhere[] = " t.fk_opp_status IN (".$this->db->sanitize($this->status).")";
}
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$sqlwhere[] = " t.rowid IN (".$this->db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
}
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 7e84683d5b3..dac2afa4834 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -2077,7 +2077,7 @@ class Task extends CommonObject
$sql .= " AND p.fk_statut = 1";
$sql .= " AND t.fk_projet = p.rowid";
$sql .= " AND (t.progress IS NULL OR t.progress < 100)"; // tasks to do
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
}
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
@@ -2148,7 +2148,7 @@ class Task extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
$sql .= " WHERE p.entity IN (".getEntity('project', 0).')';
$sql .= " AND t.fk_projet = p.rowid"; // tasks to do
- if ($mine || !$user->rights->projet->all->lire) {
+ if ($mine || empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
}
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php
index 3d57f9657b1..52a1f581df8 100644
--- a/htdocs/projet/comment.php
+++ b/htdocs/projet/comment.php
@@ -103,13 +103,13 @@ $morehtmlref = '';
// Title
$morehtmlref .= $object->title;
// Thirdparty
-if ($object->thirdparty->id > 0) {
+if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
// Define a complementary filter for search of next/prev ref.
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index 9ac87b46084..db1f63fe8de 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -140,7 +140,7 @@ if ($object->id > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php
index 0aea36fe635..9c20aa562d7 100644
--- a/htdocs/projet/ganttview.php
+++ b/htdocs/projet/ganttview.php
@@ -116,13 +116,13 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php
index b8c6ae046cf..c0afe5d1370 100644
--- a/htdocs/projet/info.php
+++ b/htdocs/projet/info.php
@@ -128,13 +128,13 @@ $morehtmlref = '';
// Title
$morehtmlref .= $object->title;
// Thirdparty
-if ($object->thirdparty->id > 0) {
+if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
// Define a complementary filter for search of next/prev ref.
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index a5f14431eda..444dc6d525f 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -357,7 +357,7 @@ $title = $langs->trans("Projects");
// Get list of project id allowed to user (in a string list separated by comma)
$projectsListId = '';
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
@@ -421,7 +421,7 @@ $sql .= " WHERE p.entity IN (".getEntity('project').')';
if (!empty($conf->categorie->enabled)) {
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_PROJECT, "p.rowid", $search_category_array);
}
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
}
// No need to check if company is external user, as filtering of projects must be done by getProjectsAuthorizedForUser
diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php
index 3c32bd528a4..2ee52d3a247 100644
--- a/htdocs/projet/note.php
+++ b/htdocs/projet/note.php
@@ -106,7 +106,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php
index 415e735fae6..a2bbba52305 100644
--- a/htdocs/projet/tasks/comment.php
+++ b/htdocs/projet/tasks/comment.php
@@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index 2727f7f0d02..753ccc9b419 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -196,7 +196,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 3787f5b5f6a..a1e708b6a46 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -151,7 +151,7 @@ if ($object->id > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index e1ed162f9c2..53b1a85e889 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -273,7 +273,7 @@ if ($id) {
}
// Get list of project id allowed to user (in a string list separated by coma)
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
//var_dump($projectsListId);
@@ -357,7 +357,7 @@ if ($search_task_user > 0) {
}
$sql .= " WHERE t.fk_projet = p.rowid";
$sql .= " AND p.entity IN (".getEntity('project').')';
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$db->sanitize($projectsListId ? $projectsListId : '0').")"; // public and assigned to projects, or restricted to company for external users
}
if (is_object($projectstatic) && $projectstatic->id > 0) {
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index 4f5ebdbd6bb..3d1ec610b48 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -142,7 +142,7 @@ if ($object->id > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 312e6b11389..62714c72216 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -235,7 +235,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 8abba0c8cf1..18e46d9750d 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -859,7 +859,7 @@ if ($action == 'create' || $action == 'presend') {
// Ref
print ''.$langs->trans('Ref').' ';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
$projectstat->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 1b3e035e37d..76e2208ba0b 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -566,7 +566,7 @@ if ($projectid > 0 || $project_ref) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
From 7b62f5a4e4d76198ae1d122c3b94e4565c4bb7a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 10:42:24 +0200
Subject: [PATCH 24/75] fix warning
---
htdocs/ticket/contact.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php
index bee8358e5aa..73efc14a038 100644
--- a/htdocs/ticket/contact.php
+++ b/htdocs/ticket/contact.php
@@ -146,7 +146,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
print dol_get_fiche_end();
}
- if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+ if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";
From a718ec4a7449d4a2f45669db5f2148c6468ed36b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 10:44:50 +0200
Subject: [PATCH 25/75] Update document.php
---
htdocs/ticket/document.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php
index 0daac15e765..aa83b7c1038 100644
--- a/htdocs/ticket/document.php
+++ b/htdocs/ticket/document.php
@@ -80,7 +80,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id && empty($user->rights->ticket->manage)) {
accessforbidden();
}
From 6abd4cc1200abf01c927c349d53b43381c623f1c Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Sun, 24 Oct 2021 11:38:45 +0200
Subject: [PATCH 26/75] Fix #8716 : tasks were not shown in ecm auto tree
---
htdocs/core/ajax/ajaxdirpreview.php | 8 +++++++-
htdocs/core/class/html.formfile.class.php | 20 +++++++++++++++++---
htdocs/ecm/index_auto.php | 2 ++
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index 09292dd4991..917a9786ab2 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -205,12 +205,14 @@ if ($type == 'directory') {
'product',
'tax',
'project',
+ 'project_task',
'fichinter',
'user',
'expensereport',
'holiday',
'recruitment-recruitmentcandidature',
'banque',
+ 'chequereceipt',
'mrp-mo'
);
@@ -243,6 +245,8 @@ if ($type == 'directory') {
$upload_dir = $conf->tax->dir_output;
} elseif ($module == 'project') {
$upload_dir = $conf->projet->dir_output;
+ } elseif ($module == 'project_task') {
+ $upload_dir = $conf->projet->dir_output;
} elseif ($module == 'fichinter') {
$upload_dir = $conf->ficheinter->dir_output;
} elseif ($module == 'user') {
@@ -255,8 +259,10 @@ if ($type == 'directory') {
$upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
} elseif ($module == 'banque') {
$upload_dir = $conf->bank->dir_output;
+ } elseif ($module == 'chequereceipt') {
+ $upload_dir = $conf->bank->dir_output.'/checkdeposits';
} elseif ($module == 'mrp-mo') {
- $upload_dir = $conf->mrp->dir_output.'/mo';
+ $upload_dir = $conf->mrp->dir_output;
} else {
$parameters = array('modulepart'=>$module);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index b5d96a7f1e2..fcca60dad78 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1645,6 +1645,9 @@ class FormFile
} elseif ($modulepart == 'project') {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$object_instance = new Project($this->db);
+ } elseif ($modulepart == 'project_task') {
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
+ $object_instance = new Task($this->db);
} elseif ($modulepart == 'fichinter') {
include_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$object_instance = new Fichinter($this->db);
@@ -1663,6 +1666,9 @@ class FormFile
} elseif ($modulepart == 'banque') {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$object_instance = new Account($this->db);
+ } elseif ($modulepart == 'chequereceipt') {
+ include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
+ $object_instance = new RemiseCheque($this->db);
} elseif ($modulepart == 'mrp-mo') {
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
$object_instance = new Mo($this->db);
@@ -1717,14 +1723,19 @@ class FormFile
$id = (isset($reg[1]) ? $reg[1] : '');
} elseif ($modulepart == 'invoice_supplier') {
preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg);
- $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) {
+ $ref = (isset($reg[1]) ? $reg[1] : '');
+ if (is_numeric($ref)) {
$id = $ref;
$ref = '';
}
- } elseif ($modulepart == 'user' || $modulepart == 'holiday') {
+ } elseif ($modulepart == 'user') {
// $ref may be also id with old supplier invoices
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$id = (isset($reg[1]) ? $reg[1] : '');
+ } elseif ($modulepart == 'project_task') {
+ // $ref of task is the sub-directory of the project
+ $reg = explode("/", $relativefile);
+ $ref = (isset($reg[1]) ? $reg[1] : '');
} elseif (in_array($modulepart, array(
'invoice',
'propal',
@@ -1734,11 +1745,14 @@ class FormFile
'contract',
'product',
'project',
+ 'project_task',
'fichinter',
'expensereport',
'recruitment-recruitmentcandidature',
'mrp-mo',
- 'banque'))) {
+ 'banque',
+ 'chequereceipt',
+ 'holiday'))) {
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$ref = (isset($reg[1]) ? $reg[1] : '');
} else {
diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php
index d54dcf14d1e..acce421fb9a 100644
--- a/htdocs/ecm/index_auto.php
+++ b/htdocs/ecm/index_auto.php
@@ -341,6 +341,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
}
if (!empty($conf->projet->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
+ $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
}
if (!empty($conf->ficheinter->enabled)) {
$langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
@@ -353,6 +354,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
}
if (!empty($conf->banque->enabled)) {
$langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
+ $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
}
if (!empty($conf->mrp->enabled)) {
$langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
From dc32350ee71f126f2c95a851584dfe8002dff2f1 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 13:02:45 +0200
Subject: [PATCH 27/75] Code comment
---
htdocs/core/modules/modPropale.class.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php
index 83e2b5a0402..eb589fc1759 100644
--- a/htdocs/core/modules/modPropale.class.php
+++ b/htdocs/core/modules/modPropale.class.php
@@ -23,7 +23,7 @@
/**
* \defgroup propale Module commercial proposals
- * \brief Module pour gerer la tenue de propositions commerciales
+ * \brief Module to manage commercial proposals
* \file htdocs/core/modules/modPropale.class.php
* \ingroup propale
* \brief Description and activation file for the module customer proposal
@@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
*/
class modPropale extends DolibarrModules
{
-
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
From 55d30884b8e892c3c5bc3a2744363ff1adbd5c77 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 13:15:01 +0200
Subject: [PATCH 28/75] Remove strange code
---
htdocs/core/class/notify.class.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 7128a6cf01d..a88f673405c 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -116,7 +116,7 @@ class Notify
foreach ($listofnotiftodo as $val) {
if ($val['type'] == 'touser') {
unset($listofnotiftodo[$val['email']]);
- $listofnotiftodo = array_merge($listofnotiftodo);
+ //$listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
@@ -124,7 +124,7 @@ class Notify
foreach ($listofnotiftodo as $val) {
if ($val['type'] == 'tofixedemail') {
unset($listofnotiftodo[$val['email']]);
- $listofnotiftodo = array_merge($listofnotiftodo);
+ //$listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
From 50df842417cac9240036872ab923c58ed48667bf Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 13:18:06 +0200
Subject: [PATCH 29/75] Doc
---
ChangeLog | 1 +
1 file changed, 1 insertion(+)
diff --git a/ChangeLog b/ChangeLog
index 3f5fad835f7..1c0e96fc27c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@ For users:
NEW: Online proposal signature
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
+NEW: Add option to disable globaly some notifications emails.
NEW: #18326 Workflow: Close order on shipment closing.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment
From ad3297b0ef15d5b4864b16890ce931c527fb8591 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 14:01:23 +0200
Subject: [PATCH 30/75] Use of MAIN_FIRST_PING_OK_ID = 'disabled' works when
forcing reinstall.
---
htdocs/install/step2.php | 2 +-
htdocs/main.inc.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php
index f95cb218561..9754ae78762 100644
--- a/htdocs/install/step2.php
+++ b/htdocs/install/step2.php
@@ -571,7 +571,7 @@ dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("- step2: end");
-$out = ' ';
+$out = ' global->MAIN_FIRST_PING_OK_ID) && $conf->global->MAIN_FIRST_PING_OK_ID == 'disabled') ? '' : ' value="checked" checked="true"').'> ';
$out .= ''.$langs->trans("MakeAnonymousPing").' ';
$out .= '';
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 07ab0949a10..a588937e2bf 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -3214,7 +3214,7 @@ if (!function_exists("llxFooter")) {
print "\n\n";
} elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) { // Cookie is set when we uncheck the checkbox in the installation wizard.
// MAIN_LAST_PING_KO_DATE
- // Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent
+ // Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent (this month)
if (!empty($conf->global->MAIN_LAST_PING_KO_DATE) && substr($conf->global->MAIN_LAST_PING_KO_DATE, 0, 6) == dol_print_date(dol_now(), '%Y%m') && !$forceping) {
print "\n\n";
} else {
From 4ab759b067178dda42a17bc4f52c919c9cd92a51 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 14:23:35 +0200
Subject: [PATCH 31/75] Fix check/uncheck of ping
---
htdocs/install/step2.php | 14 +++++++++++---
htdocs/main.inc.php | 1 +
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php
index 9754ae78762..b3d59b2e741 100644
--- a/htdocs/install/step2.php
+++ b/htdocs/install/step2.php
@@ -570,6 +570,11 @@ dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("- step2: end");
+// Force here a value we need after because master.inc.php is not loaded into step2.
+// This code must be similar with the one into main.inc.php
+$conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance
+
+$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
$out = ' global->MAIN_FIRST_PING_OK_ID) && $conf->global->MAIN_FIRST_PING_OK_ID == 'disabled') ? '' : ' value="checked" checked="true"').'> ';
$out .= ''.$langs->trans("MakeAnonymousPing").' ';
@@ -577,12 +582,15 @@ $out .= ''.$langs->trans("MakeAnonymousPing").'';
$out .= '';
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index a588937e2bf..2e9f0558421 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -3206,6 +3206,7 @@ if (!function_exists("llxFooter")) {
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) {
//print '';
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
+
if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled'))
|| $forceping) {
From b8250be2372b0ef8eee1f1314eef891816584432 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 16:35:42 +0200
Subject: [PATCH 32/75] css for toolitp
---
htdocs/core/js/lib_foot.js.php | 6 +++---
htdocs/core/lib/functions.lib.php | 4 ++--
htdocs/theme/eldy/global.inc.php | 23 +++++++++++++++++++++++
htdocs/theme/md/style.css.php | 24 ++++++++++++++++++++++++
4 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php
index 1de4fef0176..997132ca132 100644
--- a/htdocs/core/js/lib_foot.js.php
+++ b/htdocs/core/js/lib_foot.js.php
@@ -258,12 +258,12 @@ print '
window.getSelection().removeAllRanges();
/* Show message */
- var lastchild = this.parentNode.lastChild;
+ var lastchild = this.parentNode.lastChild; /* .parentNode is clipboardCP and last child is clipboardCPText */
var tmp = lastchild.innerHTML
if (succeed) {
- lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\';
+ lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'
\';
} else {
- lastchild.innerHTML = \''.dol_escape_js($langs->trans('Error')).'\';
+ lastchild.innerHTML = \''.dol_escape_js($langs->trans('Error')).'
\';
}
setTimeout(() => { lastchild.innerHTML = tmp; }, 1000);
});
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 98a879410b0..7ee19214c64 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -10520,9 +10520,9 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex
$tag = 'span'; // Using div does not work when using the js copy code.
if ($texttoshow) {
- $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'>'.dol_escape_htmltag($texttoshow, 1, 1).' ';
+ $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'>'.dol_escape_htmltag($texttoshow, 1, 1).' ';
} else {
- $result = '<'.$tag.' class="clipboardCPValue">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'> ';
+ $result = '<'.$tag.' class="clipboardCPValue">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'> ';
}
return $result;
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 366e9322dde..91736813d15 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -6879,6 +6879,29 @@ div.clipboardCPValue.hidewithsize {
display: none;
}
+/* To make a div popup, we must use a position aboluste inside a position relative */
+.clipboardCPText {
+ position: relative;
+}
+.clipboardCPTextDivInside {
+ position: absolute;
+ background: #f8f8fa;
+ color: #888;
+ border: 1px solid #E0E0E0;
+ opacity: 1;
+ z-index: 20;
+ padding: 2px;
+ padding-left: 5px;
+ padding-right: 5px;
+ top: -5px;
+ left: 0px;
+ border-radius: 5px;
+ white-space: nowrap;
+ font-size: 0.9em;
+ box-shadow: 1px 1px 6px #ddd;
+}
+
+
/* ============================================================================== */
/* CSS style used for small screen */
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 51e625438fd..1acc8e26ed1 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -6717,6 +6717,30 @@ div.clipboardCPValue.hidewithsize {
display: none;
}
+/* To make a div popup, we must use a position aboluste inside a position relative */
+
+.clipboardCPText {
+ position: relative;
+}
+.clipboardCPTextDivInside {
+ position: absolute;
+ background: #EEE;
+ color: 888;
+ border: 1px solid #DDD;
+ opacity: 1;
+ z-index: 20;
+ padding: 2px;
+ padding-left: 4px;
+ padding-right: 4px;
+ top: -5px;
+ left: 0px;
+ border-radius: 5px;
+ white-space: nowrap;
+ font-size: 0.95em;
+ box-shadow: 1px 1px 6px #ddd;
+}
+
+
/* ============================================================================== */
/* CSS style used for small screen */
From 940c69b46d9f2c90e349090c4d91e976a4fd0fca Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Mon, 25 Oct 2021 12:09:17 +0200
Subject: [PATCH 33/75] Clean code
---
htdocs/core/bookmarks_page.php | 126 +++++++++++++++++++++++++++++++++
htdocs/main.inc.php | 6 +-
2 files changed, 128 insertions(+), 4 deletions(-)
create mode 100644 htdocs/core/bookmarks_page.php
diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php
new file mode 100644
index 00000000000..05ae866463f
--- /dev/null
+++ b/htdocs/core/bookmarks_page.php
@@ -0,0 +1,126 @@
+
+ *
+ * This file is a modified version of datepicker.php from phpBSM to fix some
+ * bugs, to add new features and to dramatically increase speed.
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/bookmarks_page.php
+ * \brief File to return a page with the complete list of bookmarks (all search input fields)
+ */
+
+//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
+if (!defined('NOCSRFCHECK')) {
+ define('NOCSRFCHECK', 1);
+}
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', 1);
+}
+//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', 1);
+}
+//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
+
+require_once '../main.inc.php';
+
+if (GETPOST('lang', 'aZ09')) {
+ $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
+}
+
+$langs->load("main");
+
+$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
+$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
+
+
+/*
+ * View
+ */
+
+$title = $langs->trans("Bookmarks");
+
+// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
+$head = ''."\n";
+$arrayofjs = array();
+$arrayofcss = array();
+top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
+
+
+
+print ''."\n";
+print '';
+//print '
';
+
+$nbofsearch = 0;
+
+// Instantiate hooks of thirdparty module
+$hookmanager->initHooks(array('bookmarks'));
+
+// Define $bookmarks
+$bookmarks = '';
+
+
+$arrayresult = array();
+//include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
+
+$i = 0;
+$accesskeyalreadyassigned = array();
+foreach ($arrayresult as $key => $val) {
+ $tmp = explode('?', $val['url']);
+ $urlaction = $tmp[0];
+ $keysearch = 'search_all';
+
+ $accesskey = '';
+ if (!$accesskeyalreadyassigned[$val['label'][0]]) {
+ $accesskey = $val['label'][0];
+ $accesskeyalreadyassigned[$accesskey] = $accesskey;
+ }
+
+ //$bookmarks .= printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, $val['img'], $showtitlebefore, ($i > 0 ? 0 : 1));
+
+ $i++;
+}
+
+
+// Execute hook printSearchForm
+$parameters = array('bookmarks'=>$bookmarks);
+$reshook = $hookmanager->executeHooks('printBookmarks', $parameters); // Note that $action and $object may have been modified by some hooks
+if (empty($reshook)) {
+ $bookmarks .= $hookmanager->resPrint;
+} else {
+ $bookmarks = $hookmanager->resPrint;
+}
+
+
+print "\n";
+print "\n";
+print '
';
+print '';
+print ''."\n";
+print '
';
+print "\n\n";
+
+print '
';
+print '