';
From e1ad7013d9b2230c0622a6f1c81b700c9481e3a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Tue, 16 Mar 2021 17:47:24 +0100
Subject: [PATCH 07/25] fix php8
---
htdocs/asset/card.php | 2 +-
htdocs/core/boxes/box_services_contracts.php | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index e4bf739515f..3d722bca400 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -79,7 +79,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action
$permissiontodelete = $user->rights->asset->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->asset->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php
-$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1];
+$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
/*
diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php
index 6623556e27f..43f5babcf04 100644
--- a/htdocs/core/boxes/box_services_contracts.php
+++ b/htdocs/core/boxes/box_services_contracts.php
@@ -90,7 +90,7 @@ class box_services_contracts extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,";
$sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut as contractline_status, cd.product_type as type, cd.date_fin_validite as date_line,";
- $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as product_type, p.entity, p.tobuy, p.tosell";
+ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as product_type, p.entity as product_entity, p.tobuy, p.tosell";
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
@@ -155,7 +155,7 @@ class box_services_contracts extends ModeleBoxes
$productstatic->id = $objp->product_id;
$productstatic->type = $objp->product_type;
$productstatic->ref = $objp->product_ref;
- $productstatic->entity = $objp->pentity;
+ $productstatic->entity = $objp->product_entity;
$productstatic->label = $objp->product_label;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
From dc39a68b583e2418dd6f34aa76db154aaccf3179 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Tue, 16 Mar 2021 17:50:43 +0100
Subject: [PATCH 08/25] fix php8
---
htdocs/holiday/list.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php
index 2518e6d7b2b..4474aecf748 100644
--- a/htdocs/holiday/list.php
+++ b/htdocs/holiday/list.php
@@ -3,7 +3,7 @@
* Copyright (C) 2013-2020 Laurent Destailleur
* Copyright (C) 2012-2016 Regis Houssin
* Copyright (C) 2018 Charlene Benke
- * Copyright (C) 2019 Frédéric France
+ * Copyright (C) 2019-2021 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'holidaylist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
-$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
+$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int');
@@ -438,7 +438,7 @@ if ($resql) {
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
- if ($user->rights->holiday->supprimer) {
+ if (!empty($user->rights->holiday->delete)) {
$arrayofmassactions['predelete'] = ''.$langs->trans("Delete");
}
if (in_array($massaction, array('presend', 'predelete'))) {
From 7b8d1abfcfb7cd4b04739e73f438f0fee760d01e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Tue, 16 Mar 2021 18:04:51 +0100
Subject: [PATCH 09/25] fix php8 warnings
---
htdocs/accountancy/bookkeeping/list.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 8ca4175f87f..39906b09bb3 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -3,7 +3,7 @@
* Copyright (C) 2013-2016 Florian Henry
* Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2016-2017 Laurent Destailleur
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2021 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -471,7 +471,7 @@ if (count($filter) > 0) {
}
}
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
-if ($conf->global->ACCOUNTING_REEXPORT == 0) {
+if (empty($conf->global->ACCOUNTING_REEXPORT)) {
$sql .= " AND t.date_export IS NULL";
}
if (count($sqlwhere) > 0) {
@@ -487,7 +487,7 @@ if (!empty($sortfield)) {
// Must be after definition of $sql
if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->export) {
// TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them.
- $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
+ $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
From aefc3bcef8f313564624545d5b98ce6a7cc23dda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Tue, 16 Mar 2021 18:13:02 +0100
Subject: [PATCH 10/25] fix php8 warnings
---
htdocs/imports/class/import.class.php | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php
index 5372a6e16c5..567aaf754a8 100644
--- a/htdocs/imports/class/import.class.php
+++ b/htdocs/imports/class/import.class.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2011 Laurent Destailleur
* Copyright (C) 2016 Raphaël Doursenaud
* Copyright (C) 2020 Ahmad Jamaly Rabib
+ * Copyright (C) 2021 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -166,15 +167,15 @@ class Import
// Array of fields to import (key=field, value=label)
$this->array_import_fields[$i] = $module->import_fields_array[$r];
// Array of hidden fields to import (key=field, value=label)
- $this->array_import_fieldshidden[$i] = $module->import_fieldshidden_array[$r];
+ $this->array_import_fieldshidden[$i] = (isset($module->import_fieldshidden_array[$r]) ? $module->import_fieldshidden_array[$r] : '');
// Tableau des entites a exporter (cle=champ, valeur=entite)
$this->array_import_entities[$i] = $module->import_entities_array[$r];
// Tableau des alias a exporter (cle=champ, valeur=alias)
- $this->array_import_regex[$i] = $module->import_regex_array[$r];
+ $this->array_import_regex[$i] = (isset($module->import_regex_array[$r]) ? $module->import_regex_array[$r] : '');
// Array of columns allowed as UPDATE options
- $this->array_import_updatekeys[$i] = $module->import_updatekeys_array[$r];
+ $this->array_import_updatekeys[$i] = (isset($module->import_updatekeys_array[$r]) ? $module->import_updatekeys_array[$r] : '');
// Array of examples
- $this->array_import_examplevalues[$i] = $module->import_examplevalues_array[$r];
+ $this->array_import_examplevalues[$i] = (isset($module->import_examplevalues_array[$r]) ? $module->import_examplevalues_array[$r] : '');
// Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles)
$this->array_import_convertvalue[$i] = (isset($module->import_convertvalue_array[$r]) ? $module->import_convertvalue_array[$r] : '');
// Sql request to run after import
From 519b08b78210b30a73232a89589441088318ee27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Tue, 16 Mar 2021 18:25:25 +0100
Subject: [PATCH 11/25] fix php8 warnings
---
htdocs/compta/facture/list.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 8f3a54fe4ba..9f2585ea3cb 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -204,8 +204,8 @@ $arrayfields = array(
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>75),
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>80),
'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1, 'position'=>85),
- 'f.module_source'=>array('label'=>"Module", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->INVOICE_SHOW_POS), 'position'=>90),
- 'f.pos_source'=>array('label'=>"Terminal", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->INVOICE_SHOW_POS), 'position'=>91),
+ 'f.module_source'=>array('label'=>"Module", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>90),
+ 'f.pos_source'=>array('label'=>"Terminal", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>91),
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>95),
'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>100),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj == "1"), 'position'=>110),
From d4ad9294c47fc221e3e800d4de2859478b9c8abd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Tue, 16 Mar 2021 18:32:10 +0100
Subject: [PATCH 12/25] fix unknown var
---
htdocs/adherents/stats/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index b092c7bcf20..11c0025dcc5 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -137,7 +137,7 @@ if (!$mesg) {
}
-$head = member_stats_prepare_head($adh);
+$head = member_stats_prepare_head($memberstatic);
print dol_get_fiche_head($head, 'statssubscription', '', -1, '');
From bdae6794639fc304193509e2e5468db46200425e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Tue, 16 Mar 2021 18:42:35 +0100
Subject: [PATCH 13/25] fix php8 warnings
---
htdocs/adherents/stats/byproperties.php | 6 +++---
htdocs/adherents/stats/geo.php | 18 +++++++++---------
htdocs/adherents/stats/index.php | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php
index 9f8691a69a6..1238fd0fe15 100644
--- a/htdocs/adherents/stats/byproperties.php
+++ b/htdocs/adherents/stats/byproperties.php
@@ -59,7 +59,7 @@ $title = $langs->trans("MembersStatisticsByProperties");
print load_fiche_titre($title, '', $memberstatic->picto);
-dol_mkdir($dir);
+//dol_mkdir($dir);
$data = array();
@@ -134,7 +134,7 @@ if ($resql) {
}
-$head = member_stats_prepare_head($adh);
+$head = member_stats_prepare_head($memberstatic);
print dol_get_fiche_head($head, 'statsbyproperties', '', -1, '');
@@ -169,7 +169,7 @@ if (!$foundmor) {
foreach ($data as $val) {
$nb = $val['nb'];
- $nbsubscriptions = $val['nbsubscriptions'];
+ $nbsubscriptions = isset($val['nbsubscriptions']) ? $val['nbsubscriptions'] : 0;
$nbactive = $val['nbactive'];
print '
';
diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php
index 6107669c967..2d1450b8ae5 100644
--- a/htdocs/adherents/stats/geo.php
+++ b/htdocs/adherents/stats/geo.php
@@ -78,7 +78,7 @@ llxHeader('', $title, '', '', 0, 0, $arrayjs);
print load_fiche_titre($title, '', $memberstatic->picto);
-dol_mkdir($dir);
+//dol_mkdir($dir);
if ($mode) {
// Define sql
@@ -87,7 +87,7 @@ if ($mode) {
$tab = 'statscountry';
$data = array();
- $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
+ $sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
@@ -103,7 +103,7 @@ if ($mode) {
$tab = 'statsstate';
$data = array();
- $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
+ $sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
@@ -120,7 +120,7 @@ if ($mode) {
$tab = 'statsregion'; //onglet
$data = array(); //tableau de donnée
- $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
+ $sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
@@ -137,7 +137,7 @@ if ($mode) {
$tab = 'statstown';
$data = array();
- $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
+ $sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
@@ -207,7 +207,7 @@ if ($mode) {
}
-$head = member_stats_prepare_head($adh);
+$head = member_stats_prepare_head($memberstatic);
print dol_get_fiche_head($head, $tab, '', -1, '');
@@ -299,7 +299,7 @@ if ($mode) {
print '
';
print '
';
print '
'.$label.'
';
- if ($label2) {
+ if (isset($label2)) {
print '