From 831cc4f4b71b7f8849d08a6318aa7261d4856083 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 20 Jun 2021 14:19:05 +0200 Subject: [PATCH 1/5] Fix 17986 error on comparing integer and string in strict sql --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 62d0e03e27e..e042331b9eb 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); + $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); + $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -154,7 +154,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); + $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); From a54a955a652515a933ab14a0bbf118a96350583e Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 20 Jun 2021 15:40:32 +0200 Subject: [PATCH 2/5] Use year() instead of date_format --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index e042331b9eb..ea106e4b4c5 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; + $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; + $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -154,7 +154,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; + $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); From c820193d11b6e7d775659913eba638d2d68f2a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Jun 2021 17:01:41 +0200 Subject: [PATCH 3/5] remove not used var and fix php warnings --- htdocs/admin/agenda_extsites.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 9ce55583d99..272da835741 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -3,6 +3,7 @@ * Copyright (C) 2011-2015 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Raphaël Doursenaud + * 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 @@ -158,14 +159,6 @@ print dol_get_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action print ''.$langs->trans("AgendaExtSitesDesc")."
\n"; print "
\n"; - -$selectedvalue = $conf->global->AGENDA_DISABLE_EXT; -if ($selectedvalue == 1) { - $selectedvalue = 0; -} else { - $selectedvalue = 1; -} - print ""; print ""; @@ -226,15 +219,15 @@ while ($i <= $MAXAGENDA) { // Nb print '"; // Name - print ''; + print ''; // URL - print ''; + print ''; // Offset TZ - print ''; + print ''; // Color (Possible colors are limited by Google) print ''; print ""; $i++; From cfd7c610db7d1ae960c8e601be519c2348752f41 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 20 Jun 2021 17:14:28 +0200 Subject: [PATCH 4/5] Use dolSqlDateFilter instead of SQL function YEAR --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index ea106e4b4c5..bf8cf92bc33 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -154,7 +154,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); From 002471b1fe1177c81bfa4cefd36707dbf3bf12f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 17:25:58 +0200 Subject: [PATCH 5/5] Update adherentstats.class.php --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index bf8cf92bc33..cfa83290551 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -154,7 +154,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC');
'.$langs->trans("AgendaExtNb", $key)."'; //print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist); - print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key) ?GETPOST("AGENDA_EXT_COLOR".$key) : $conf->global->$color), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset'); + print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key) ?GETPOST("AGENDA_EXT_COLOR".$key) : getDolGlobalString($color)), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset'); print '