From efaa2be3b81a7504e271b6b4e8c74ba413ca3453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 17 Mar 2021 18:38:24 +0100 Subject: [PATCH 1/5] fix php8 warnings --- htdocs/core/photos_resize.php | 2 +- htdocs/projet/stats/index.php | 21 +++++++++++---------- htdocs/projet/tasks/stats/index.php | 12 ++++++------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 008e524f299..f03436c0043 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -142,7 +142,7 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv if ($result <= 0) { dol_print_error($db, 'Failed to load object'); } - $dir = $conf->project->multidir_output[$object->entity]; // By default + $dir = $conf->projet->multidir_output[$object->entity]; // By default } } elseif ($modulepart == 'propal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index f25e78bceda..afbc4f7c55b 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -99,7 +99,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $data1 = array(array(0=>$langs->trans("None"), 1=>1)); } - $filenamenb = $conf->project->dir_output."/stats/projectbystatus.png"; + $filenamenb = $conf->projet->dir_output."/stats/projectbystatus.png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&file=projectbystatus.png'; $px = new DolGraph(); $mesg = $px->isGraphKo(); @@ -150,7 +150,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $data = $stats_project->getNbByMonthWithPrevYear($endyear, $startyear); //var_dump($data); -$filenamenb = $conf->project->dir_output."/stats/projectnbprevyear-".$year.".png"; +$filenamenb = $conf->projet->dir_output."/stats/projectnbprevyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&file=projectnbprevyear-'.$year.'.png'; $px1 = new DolGraph(); @@ -182,7 +182,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) - $filenamenb = $conf->project->dir_output."/stats/projectamountprevyear-".$year.".png"; + $filenamenb = $conf->projet->dir_output."/stats/projectamountprevyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&file=projectamountprevyear-'.$year.'.png'; $px2 = new DolGraph(); @@ -217,14 +217,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) - $filenamenb = $conf->project->dir_output."/stats/projecttransrateprevyear-".$year.".png"; + $filenamenb = $conf->projet->dir_output."/stats/projecttransrateprevyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&file=projecttransrateprevyear-'.$year.'.png'; $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); if (!$mesg) { $px3->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -268,7 +269,7 @@ $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; -complete_head_from_modules($conf, $langs, null, $head, $h, $type); +complete_head_from_modules($conf, $langs, null, $head, $h, 'projet_stats'); print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1, ''); @@ -337,9 +338,9 @@ foreach ($data_all_year as $val) { print ' 0 ? '&userid='.$userid : '').'">'.$year.''; print ''.$val['nb'].''; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''.($val['total'] ?price(price2num($val['total'], 'MT'), 1) : '0').''; - print ''.($val['avg'] ?price(price2num($val['avg'], 'MT'), 1) : '0').''; - print ''.($val['weighted'] ?price(price2num($val['weighted'], 'MT'), 1) : '0').''; + print ''.($val['total'] ? price(price2num($val['total'], 'MT'), 1) : '0').''; + print ''.($val['avg'] ? price(price2num($val['avg'], 'MT'), 1) : '0').''; + print ''.(isset($val['weighted']) ? price(price2num($val['weighted'], 'MT'), 1) : '0').''; } print ''; $oldyear = $year; @@ -350,7 +351,7 @@ print ''; print '
'; -$stringtoshow .= '
'; +$stringtoshow = ''; - print ''; + print ''; print ''; print ''; } print ''; - print ''; + print ''; print ''; print ''; $oldyear = $year; @@ -208,7 +208,7 @@ print ''; print '
'; -$stringtoshow .= '
'; if ($mesg) { print $mesg; } else { diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index 81c05fde59d..be6ac3c7802 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -90,7 +90,7 @@ if (!empty($year)) { $data = $stats_tasks->getNbByMonthWithPrevYear($endyear, $startyear); //var_dump($data); -$filenamenb = $conf->project->dir_output."/stats/tasknbprevyear-".$year.".png"; +$filenamenb = $conf->projet->dir_output."/stats/tasknbprevyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=taskstats&file=tasknbprevyear-'.$year.'.png'; $px1 = new DolGraph(); @@ -134,12 +134,12 @@ if (!count($arrayyears)) { $h = 0; $head = array(); -$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/stats/index.php?'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; -complete_head_from_modules($conf, $langs, null, $head, $h, $type); +complete_head_from_modules($conf, $langs, null, $head, $h, 'projet_tasks_stats'); print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1, ''); @@ -191,13 +191,13 @@ foreach ($data_all_year as $val) { $oldyear--; print '
0 ? '&userid='.$userid : '').'">'.$oldyear.' 0 ? '&userid='.$userid : '').'">'.$oldyear.'0
0 ? '&userid='.$userid : '').'">'.$year.' 0 ? '&userid='.$userid : '').'">'.$year.''.$val['nb'].'
'; +$stringtoshow = '
'; if ($mesg) { print $mesg; } else { From a420d0acbd98b9c70da5f2b7c932343a5de5c391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 17 Mar 2021 18:40:11 +0100 Subject: [PATCH 2/5] fix php8 warnings --- htdocs/projet/tasks/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index be6ac3c7802..d2c53943506 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -134,7 +134,7 @@ if (!count($arrayyears)) { $h = 0; $head = array(); -$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/stats/index.php?'; +$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/stats/index.php'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; From c43d3dff92ea10ccd22c79a99467f467a5c4cbbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Mar 2021 20:51:40 +0100 Subject: [PATCH 3/5] fix project replace projet --- htdocs/core/class/conf.class.php | 2 +- htdocs/core/photos_resize.php | 2 +- htdocs/projet/stats/index.php | 8 ++++---- htdocs/projet/tasks/stats/index.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 6b50c73da8e..decab886f49 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -842,7 +842,7 @@ class Conf if (isset($this->categorie)) { $this->category = $this->categorie; } - if (isset($this->project)) { + if (isset($this->projet) && !isset($this->project)) { $this->project = $this->projet; } diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index f03436c0043..008e524f299 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -142,7 +142,7 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv if ($result <= 0) { dol_print_error($db, 'Failed to load object'); } - $dir = $conf->projet->multidir_output[$object->entity]; // By default + $dir = $conf->project->multidir_output[$object->entity]; // By default } } elseif ($modulepart == 'propal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index afbc4f7c55b..f17e326276a 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -99,7 +99,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $data1 = array(array(0=>$langs->trans("None"), 1=>1)); } - $filenamenb = $conf->projet->dir_output."/stats/projectbystatus.png"; + $filenamenb = $conf->project->dir_output."/stats/projectbystatus.png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&file=projectbystatus.png'; $px = new DolGraph(); $mesg = $px->isGraphKo(); @@ -150,7 +150,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $data = $stats_project->getNbByMonthWithPrevYear($endyear, $startyear); //var_dump($data); -$filenamenb = $conf->projet->dir_output."/stats/projectnbprevyear-".$year.".png"; +$filenamenb = $conf->project->dir_output."/stats/projectnbprevyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&file=projectnbprevyear-'.$year.'.png'; $px1 = new DolGraph(); @@ -182,7 +182,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) - $filenamenb = $conf->projet->dir_output."/stats/projectamountprevyear-".$year.".png"; + $filenamenb = $conf->project->dir_output."/stats/projectamountprevyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&file=projectamountprevyear-'.$year.'.png'; $px2 = new DolGraph(); @@ -217,7 +217,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) - $filenamenb = $conf->projet->dir_output."/stats/projecttransrateprevyear-".$year.".png"; + $filenamenb = $conf->project->dir_output."/stats/projecttransrateprevyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&file=projecttransrateprevyear-'.$year.'.png'; $px3 = new DolGraph(); diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index d2c53943506..5d1bec36f17 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -65,7 +65,7 @@ $includeuserlist = array(); llxHeader('', $langs->trans('Tasks')); $title = $langs->trans("TasksStatistics"); -$dir = $conf->projet->dir_output.'/temp'; +$dir = $conf->project->dir_output.'/temp'; print load_fiche_titre($title, '', 'projecttask'); @@ -90,7 +90,7 @@ if (!empty($year)) { $data = $stats_tasks->getNbByMonthWithPrevYear($endyear, $startyear); //var_dump($data); -$filenamenb = $conf->projet->dir_output."/stats/tasknbprevyear-".$year.".png"; +$filenamenb = $conf->project->dir_output."/stats/tasknbprevyear-".$year.".png"; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=taskstats&file=tasknbprevyear-'.$year.'.png'; $px1 = new DolGraph(); From e7ad9f129020ba1a18220295abc1f73799aba9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Mar 2021 20:55:47 +0100 Subject: [PATCH 4/5] fix project replace projet --- htdocs/projet/stats/index.php | 4 ++-- htdocs/projet/tasks/stats/index.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index f17e326276a..6b1b0eac4c1 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -65,7 +65,7 @@ $includeuserlist = array(); llxHeader('', $langs->trans('Projects')); $title = $langs->trans("ProjectsStatistics"); -$dir = $conf->projet->dir_output.'/temp'; +$dir = $conf->project->dir_output.'/temp'; print load_fiche_titre($title, '', 'project'); @@ -269,7 +269,7 @@ $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; -complete_head_from_modules($conf, $langs, null, $head, $h, 'projet_stats'); +complete_head_from_modules($conf, $langs, null, $head, $h, 'project_stats'); print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1, ''); diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index 5d1bec36f17..531b9eb7b3a 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -139,7 +139,7 @@ $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; -complete_head_from_modules($conf, $langs, null, $head, $h, 'projet_tasks_stats'); +complete_head_from_modules($conf, $langs, null, $head, $h, 'project_tasks_stats'); print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1, ''); From b584adf2995bc5fdb59009e1e8671c37e3317019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Mar 2021 21:10:55 +0100 Subject: [PATCH 5/5] fix project replace projet --- htdocs/core/class/conf.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index decab886f49..0eab527bc6b 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -826,22 +826,28 @@ class Conf unset($this->global->MAIN_NO_CONCAT_DESCRIPTION); } - // For backward compatibility + // product is new use if (isset($this->product)) { + // For backward compatibility $this->produit = $this->product; } + // invoice is new use, facture is old use still initialised if (isset($this->facture)) { $this->invoice = $this->facture; } + // order is new use, commande is old use still initialised if (isset($this->commande)) { $this->order = $this->commande; } + // contract is new use, contrat is old use still initialised if (isset($this->contrat)) { $this->contract = $this->contrat; } + // category is new use, categorie is old use still initialised if (isset($this->categorie)) { $this->category = $this->categorie; } + // project is new use, projet is old use still initialised if (isset($this->projet) && !isset($this->project)) { $this->project = $this->projet; }