From 35a1f9ac4b69d61955fb461fd848f7f4c19a476a Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Fri, 27 May 2022 16:30:26 +0200
Subject: [PATCH 01/13] php V8 warning
---
htdocs/comm/action/card.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index aca1e0b7e3b..ea5de0eb938 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1185,7 +1185,7 @@ if ($action == 'create') {
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '';
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
// Categories
print '
| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
@@ -1201,7 +1201,7 @@ if ($action == 'create') {
print '';
- if ($conf->societe->enabled) {
+ if (!empty($conf->societe->enabled)) {
// Related company
print '| '.$langs->trans("ActionOnCompany").' | ';
if (GETPOST('socid', 'int') > 0) {
@@ -1693,7 +1693,7 @@ if ($id > 0) {
print ' | ';
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print '| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
@@ -1714,7 +1714,7 @@ if ($id > 0) {
print '';
- if ($conf->societe->enabled) {
+ if (!empty($conf->societe->enabled)) {
// Related company
print '| '.$langs->trans("ActionOnCompany").' | ';
print '';
@@ -2099,7 +2099,7 @@ if ($id > 0) {
}
// Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print ' | | '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1);
print " | ";
@@ -2114,7 +2114,7 @@ if ($id > 0) {
print '';
print '';
- if ($conf->societe->enabled) {
+ if (!empty($conf->societe->enabled)) {
// Related company
print '| '.$langs->trans("ActionOnCompany").' | '.($object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : (''.$langs->trans("None").''));
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') {
From 8bc313980a0517649942804135f6aebf5df2406d Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Fri, 27 May 2022 16:32:11 +0200
Subject: [PATCH 02/13] php V8 warning
---
htdocs/comm/propal/card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 7e873e168ad..cc35cfc65a9 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -2791,7 +2791,7 @@ if ($action == 'create') {
}
// Create contract
- if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
+ if (!empty($conf->contrat->enabled) && $object->statut == Propal::STATUS_SIGNED) {
$langs->load("contracts");
if ($usercancreatecontract) {
From 2ad50b77b7f32a9e6d81690ec08e1ccb28d188cf Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Fri, 27 May 2022 16:34:56 +0200
Subject: [PATCH 03/13] php V8 warning
---
htdocs/commande/card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 79f0c98ed68..c0aae93dff9 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2748,7 +2748,7 @@ if ($action == 'create' && $usercancreate) {
}
// Create contract
- if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) {
+ if (!empty($conf->contrat->enabled) && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) {
$langs->load("contracts");
if ($user->rights->contrat->creer) {
From 869ec8e46179613044864d3260531dae803c0ffa Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Fri, 27 May 2022 16:39:08 +0200
Subject: [PATCH 04/13] php V8 warning
---
htdocs/compta/bank/card.php | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 495dd86f268..ce373bbf5b5 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -7,6 +7,7 @@
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2016 Marcos García
* Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2022 Charlene Benke
*
* 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
@@ -436,7 +437,7 @@ if ($action == 'create') {
print ' | ';
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print '| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
@@ -713,7 +714,7 @@ if ($action == 'create') {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
print " | ";
@@ -966,7 +967,7 @@ if ($action == 'create') {
print '';
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (!empty($conf->categorie->enabled)) {
print '| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
@@ -1082,12 +1083,12 @@ if ($action == 'create') {
print ' | | '.$langs->trans($bickey).' | ';
print ' | ';
- if ($conf->prelevement->enabled) {
+ if (!empty($conf->prelevement->enabled)) {
print '| '.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').' | ';
print ' | ';
}
- if ($conf->paymentbybanktransfer->enabled) {
+ if (!empty($conf->paymentbybanktransfer->enabled)) {
print '| '.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').' | ';
print ' | ';
From bc8f20b5cbdd6478ae9012988fd9aff339ac97ff Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Fri, 27 May 2022 16:40:18 +0200
Subject: [PATCH 05/13] php V8 warning
---
htdocs/compta/facture/card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index a29f7af563e..82a5740c53a 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -5426,7 +5426,7 @@ if ($action == 'create') {
// Create contract
if (!empty($conf->global->CONTRACT_CREATE_FROM_INVOICE)) {
- if ($conf->contrat->enabled && $object->statut == Facture::STATUS_VALIDATED) {
+ if (!empty($conf->contrat->enabled) && $object->statut == Facture::STATUS_VALIDATED) {
$langs->load("contracts");
if ($usercancreatecontract) {
From 8963a41085f1e41ae8dcacacb2877d8c914ac1ba Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Fri, 27 May 2022 16:47:23 +0200
Subject: [PATCH 06/13] php V8 warning
and don instead donation
---
htdocs/core/class/html.formmail.class.php | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 19ea745c8e1..efc522945ca 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -4,7 +4,8 @@
* Copyright (C) 2010-2011 Juanjo Menent
* Copyright (C) 2015-2017 Marcos García
* Copyright (C) 2015-2017 Nicolas ZABOURI
- * Copyright (C) 2018-2021 Frédéric France
+ * Copyright (C) 2018-2021 Frédéric France
+ * Copyright (C) 2022 Charlene Benke
*
* 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
@@ -1611,36 +1612,36 @@ class FormMail extends Form
if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
$tmparray['__SECUREKEYPAYMENT__'] = $conf->global->PAYMENT_SECURITY_TOKEN;
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
- if ($conf->adherent->enabled) {
+ if (!empty($conf->adherent->enabled)) {
$tmparray['__SECUREKEYPAYMENT_MEMBER__'] = 'SecureKeyPAYMENTUniquePerMember';
}
- if ($conf->donation->enabled) {
+ if (!empty($conf->don->enabled)) {
$tmparray['__SECUREKEYPAYMENT_DONATION__'] = 'SecureKeyPAYMENTUniquePerDonation';
}
- if ($conf->facture->enabled) {
+ if (!empty($conf->facture->enabled)) {
$tmparray['__SECUREKEYPAYMENT_INVOICE__'] = 'SecureKeyPAYMENTUniquePerInvoice';
}
- if ($conf->commande->enabled) {
+ if (!empty($conf->commande->enabled)) {
$tmparray['__SECUREKEYPAYMENT_ORDER__'] = 'SecureKeyPAYMENTUniquePerOrder';
}
- if ($conf->contrat->enabled) {
+ if (!empty(contrat->enabled)) {
$tmparray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'SecureKeyPAYMENTUniquePerContractLine';
}
//Online payement link
- if ($conf->adherent->enabled) {
+ if (!empty(adherent->enabled)) {
$tmparray['__ONLINEPAYMENTLINK_MEMBER__'] = 'OnlinePaymentLinkUniquePerMember';
}
- if ($conf->donation->enabled) {
+ if (!empty($conf->don->enabled)) {
$tmparray['__ONLINEPAYMENTLINK_DONATION__'] = 'OnlinePaymentLinkUniquePerDonation';
}
- if ($conf->facture->enabled) {
+ if (!empty($conf->facture->enabled)) {
$tmparray['__ONLINEPAYMENTLINK_INVOICE__'] = 'OnlinePaymentLinkUniquePerInvoice';
}
- if ($conf->commande->enabled) {
+ if (!empty($conf->commande->enabled)) {
$tmparray['__ONLINEPAYMENTLINK_ORDER__'] = 'OnlinePaymentLinkUniquePerOrder';
}
- if ($conf->contrat->enabled) {
+ if (!empty($conf->contrat->enabled)) {
$tmparray['__ONLINEPAYMENTLINK_CONTRACTLINE__'] = 'OnlinePaymentLinkUniquePerContractLine';
}
}
From 008800cf52d4fc1ac49d1632e93adb563e7f5dd4 Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Mon, 30 May 2022 07:46:21 +0200
Subject: [PATCH 07/13] correct it
---
htdocs/core/class/html.formmail.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index efc522945ca..a3d839cbe74 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1629,7 +1629,7 @@ class FormMail extends Form
}
//Online payement link
- if (!empty(adherent->enabled)) {
+ if (!empty($conf->adherent->enabled)) {
$tmparray['__ONLINEPAYMENTLINK_MEMBER__'] = 'OnlinePaymentLinkUniquePerMember';
}
if (!empty($conf->don->enabled)) {
From 0126f043c98de69900d1baeb3d2cefeaf5e5e19b Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Wed, 1 Jun 2022 10:53:52 +0200
Subject: [PATCH 08/13] fixed
---
htdocs/core/class/html.formmail.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index a3d839cbe74..cadcee37b8c 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1624,7 +1624,7 @@ class FormMail extends Form
if (!empty($conf->commande->enabled)) {
$tmparray['__SECUREKEYPAYMENT_ORDER__'] = 'SecureKeyPAYMENTUniquePerOrder';
}
- if (!empty(contrat->enabled)) {
+ if (!empty($conf->contrat->enabled)) {
$tmparray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'SecureKeyPAYMENTUniquePerContractLine';
}
From bd1d6de326c1cd1665ce77875a9a7c131b8e505c Mon Sep 17 00:00:00 2001
From: jyhere
Date: Thu, 2 Jun 2022 10:11:53 +0200
Subject: [PATCH 09/13] FIX : array merges in expedition class
---
htdocs/expedition/class/expedition.class.php | 27 +++++++++++++-------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 9035413b533..781e0b8cbf2 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1247,7 +1247,8 @@ class Expedition extends CommonObject
if ($conf->productbatch->enabled) {
$lotArray = $shipmentlinebatch->fetchAll($obj->expeditiondet_id);
if (!is_array($lotArray)) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -1257,7 +1258,8 @@ class Expedition extends CommonObject
// We use warehouse selected for each line
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref)); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
- $error++; $this->errors = $this->errors + $mouvS->errors;
+ $error++;
+ $this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
} else {
@@ -1266,7 +1268,8 @@ class Expedition extends CommonObject
foreach ($lotArray as $lot) {
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
- $error++; $this->errors = $this->errors + $mouvS->errors;
+ $error++;
+ $this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
}
@@ -1441,7 +1444,8 @@ class Expedition extends CommonObject
// We use warehouse selected for each line
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref)); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
- $error++; $this->errors = $this->errors + $mouvS->errors;
+ $error++;
+ $this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
} else {
@@ -1450,7 +1454,8 @@ class Expedition extends CommonObject
foreach ($lotArray as $lot) {
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
- $error++; $this->errors = $this->errors + $mouvS->errors;
+ $error++;
+ $this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
}
@@ -2195,7 +2200,8 @@ class Expedition extends CommonObject
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
- $error++; break;
+ $error++;
+ break;
}
} else {
// line with batch detail
@@ -2205,7 +2211,8 @@ class Expedition extends CommonObject
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
- $error++; break;
+ $error++;
+ break;
}
}
}
@@ -2369,7 +2376,8 @@ class Expedition extends CommonObject
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
- $error++; break;
+ $error++;
+ break;
}
} else {
// line with batch detail
@@ -2379,7 +2387,8 @@ class Expedition extends CommonObject
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
- $error++; break;
+ $error++;
+ break;
}
}
}
From 858926d95eee4cd5bcc5c327ca70f3d07987854d Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Thu, 2 Jun 2022 08:15:04 +0000
Subject: [PATCH 10/13] Fixing style errors.
---
htdocs/expedition/class/expedition.class.php | 36 ++++++++++----------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 781e0b8cbf2..5b033fc11f7 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1247,8 +1247,8 @@ class Expedition extends CommonObject
if ($conf->productbatch->enabled) {
$lotArray = $shipmentlinebatch->fetchAll($obj->expeditiondet_id);
if (!is_array($lotArray)) {
- $error++;
- $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -1258,8 +1258,8 @@ class Expedition extends CommonObject
// We use warehouse selected for each line
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref)); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
- $error++;
- $this->errors = array_merge($this->errors, $mouvS->errors);
+ $error++;
+ $this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
} else {
@@ -1268,8 +1268,8 @@ class Expedition extends CommonObject
foreach ($lotArray as $lot) {
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
- $error++;
- $this->errors = array_merge($this->errors, $mouvS->errors);
+ $error++;
+ $this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
}
@@ -1444,8 +1444,8 @@ class Expedition extends CommonObject
// We use warehouse selected for each line
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref)); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
- $error++;
- $this->errors = array_merge($this->errors, $mouvS->errors);
+ $error++;
+ $this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
} else {
@@ -1454,8 +1454,8 @@ class Expedition extends CommonObject
foreach ($lotArray as $lot) {
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed
if ($result < 0) {
- $error++;
- $this->errors = array_merge($this->errors, $mouvS->errors);
+ $error++;
+ $this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
}
@@ -2200,8 +2200,8 @@ class Expedition extends CommonObject
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
- $error++;
- break;
+ $error++;
+ break;
}
} else {
// line with batch detail
@@ -2211,8 +2211,8 @@ class Expedition extends CommonObject
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
- $error++;
- break;
+ $error++;
+ break;
}
}
}
@@ -2376,8 +2376,8 @@ class Expedition extends CommonObject
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
- $error++;
- break;
+ $error++;
+ break;
}
} else {
// line with batch detail
@@ -2387,8 +2387,8 @@ class Expedition extends CommonObject
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
- $error++;
- break;
+ $error++;
+ break;
}
}
}
From 96bf5a9c8a688855fc3c88e7a24b72ea97eeefce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Thu, 2 Jun 2022 10:21:05 +0200
Subject: [PATCH 11/13] New isModEnabled function
---
htdocs/core/lib/functions.lib.php | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index a82827c30ee..015adde7eca 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -13,7 +13,7 @@
* Copyright (C) 2014 Cédric GROSS
* Copyright (C) 2014-2015 Marcos García
* Copyright (C) 2015 Jean-François Ferry
- * Copyright (C) 2018-2021 Frédéric France
+ * Copyright (C) 2018-2022 Frédéric France
* Copyright (C) 2019 Thibault Foucart
* Copyright (C) 2020 Open-Dsi
* Copyright (C) 2021 Gauthier VERDOL
@@ -68,6 +68,17 @@ function getDolGlobalInt($key, $default = 0)
return (int) (empty($conf->global->$key) ? $default : $conf->global->$key);
}
+/**
+ * Is Dolibarr module enabled
+ * @param string $module module name to check
+ * @return int
+ */
+function isModEnabled($module)
+{
+ global $conf;
+ return !empty($conf->$module->enabled);
+}
+
/**
* Return a DoliDB instance (database handler).
*
From 5b316487b4ffd020c27348d1ff45e4b99e785459 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Thu, 2 Jun 2022 10:29:34 +0200
Subject: [PATCH 12/13] Update eldy.lib.php
---
htdocs/core/menus/standard/eldy.lib.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 3fb069cca24..d305da30907 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -5,7 +5,7 @@
* Copyright (C) 2013 Cédric Salvador
* Copyright (C) 2015 Marcos García
* Copyright (C) 2018 Ferran Marcet
- * Copyright (C) 2018-2019 Frédéric France
+ * Copyright (C) 2018-2022 Frédéric France
* Copyright (C) 2021 Gauthier VERDOL
*
* This program is free software; you can redistribute it and/or modify
@@ -2030,7 +2030,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
}
// Warehouse
- if (!empty($conf->stock->enabled)) {
+ if (isModEnabled('stock')) {
$langs->load("stocks");
$newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer);
@@ -2038,18 +2038,18 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
$newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
$newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer);
- if ($conf->supplier_order->enabled) {
+ if (isModEnabled('supplier_order')) {
$newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire);
}
$newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
// Categories for warehouses
- if (!empty($conf->categorie->enabled)) {
+ if (isModEnabled('categorie')) {
$newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
}
- if ($conf->stocktransfer->enabled) {
+ if (isModEnabled('stocktransfer')) {
$newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->rights->stocktransfer->stocktransfer->read, '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
$newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->rights->stocktransfer->stocktransfer->write);
$newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->rights->stocktransfer->stocktransfer->read);
From 0bad3664fb5deb96a124ea496dc057035e0c063d Mon Sep 17 00:00:00 2001
From: lmarcouiller
Date: Thu, 2 Jun 2022 11:14:35 +0200
Subject: [PATCH 13/13] fix: php8.0 warnings
---
htdocs/core/lib/functions.lib.php | 2 +-
htdocs/holiday/card.php | 2 ++
htdocs/holiday/define_holiday.php | 2 ++
htdocs/holiday/month_report.php | 7 +++++++
htdocs/holiday/view_log.php | 3 +++
5 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index a82827c30ee..e66a0ac1a02 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9326,7 +9326,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$reg = array();
preg_match('/([<>=]+)/', $crit, $reg);
- if ($reg[1]) {
+ if (!empty($reg[1])) {
$operator = $reg[1];
}
if ($newcrit != '') {
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 942cbf2b482..5353b713207 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -49,6 +49,7 @@ $confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$fuserid = (GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id);
+$socid = GETPOST('socid', 'int');
// Load translation files required by the page
$langs->loadLangs(array("other", "holiday", "mails", "trips"));
@@ -987,6 +988,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
print dol_get_fiche_head('', '', '', -1);
$out = '';
+ $nb_holiday = 0;
$typeleaves = $object->getTypes(1, 1);
foreach ($typeleaves as $key => $val) {
$nb_type = $object->getCPforUser($user->id, $val['rowid']);
diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php
index dedc7d1da0f..0a557b0db76 100644
--- a/htdocs/holiday/define_holiday.php
+++ b/htdocs/holiday/define_holiday.php
@@ -35,6 +35,8 @@ $langs->loadlangs(array('users', 'other', 'holiday', 'hrm'));
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'defineholidaylist';
+$massaction = GETPOST('massaction', 'alpha');
+$optioncss = GETPOST('optioncss', 'alpha');
$search_name = GETPOST('search_name', 'alpha');
$search_supervisor = GETPOST('search_supervisor', 'int');
diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php
index 67c860e6f70..bfde7e34191 100644
--- a/htdocs/holiday/month_report.php
+++ b/htdocs/holiday/month_report.php
@@ -36,6 +36,8 @@ $langs->loadLangs(array('holiday', 'hrm'));
// Security check
$socid = 0;
+$id = GETPOST('id', 'int');
+
if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
@@ -63,6 +65,11 @@ if (!$sortorder) {
$sortorder = "ASC";
}
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+if (empty($page) || $page == -1) {
+ $page = 0;
+}
+
$hookmanager->initHooks(array('leavemovementlist'));
$arrayfields = array();
diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php
index 7dffc0adbfe..f2ee7d4cae4 100644
--- a/htdocs/holiday/view_log.php
+++ b/htdocs/holiday/view_log.php
@@ -306,6 +306,9 @@ print '';
print ' ';
$moreforfilter = '';
+$morefilter = '';
+$disabled = 0;
+$include = '';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = '';
| | |