From a815c99d5320b1a1a611d07ec2a868e88b3d0c18 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 26 Oct 2023 12:48:40 +0200 Subject: [PATCH] FIX suggested end for membership can be before subscription start (#26351) * Fix wrong debug log * Fix suggested end for membership can be in the past MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR and MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH should be based on the subscription start date, not on the creation date * Fix typo --- htdocs/adherents/class/adherentstats.class.php | 2 +- htdocs/adherents/subscription.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 5075154c4c8ab..8ae8c77146c2b 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -282,7 +282,7 @@ public function countMembersByTagAndStatus($numberYears = 0) $sql .= " GROUP BY c.rowid, c.label"; $sql .= " ORDER BY label ASC"; - dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG); + dol_syslog("box_members_by_tag::select nb of members per tag", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index eb07c7ab048b5..b9cd776c17691 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -990,9 +990,9 @@ } if (!$dateto) { if (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH')) { - $dateto = dol_get_last_day($currentyear, $currentmonth); + $dateto = dol_get_last_day(dol_print_date($datefrom, "%Y"), dol_print_date($datefrom, "%m")); } elseif (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) { - $dateto = dol_get_last_day($currentyear); + $dateto = dol_get_last_day(dol_print_date($datefrom, "%Y")); } else { $dateto = -1; // By default, no date is suggested }