From bb2bb638e622e5c5e2d1f5b230c8b9cbd88a1536 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2023 03:15:42 +0200 Subject: [PATCH 1/3] FIX Filter on member status --- htdocs/adherents/list.php | 5 +++-- htdocs/adherents/type.php | 4 ++-- htdocs/core/lib/functions.lib.php | 7 ++++++- htdocs/langs/en_US/members.lang | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 64cc4fa8dc4..bcbbbd5f701 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -408,10 +408,10 @@ if ($search_filter == 'waitingsubscription') { $sql .= " AND (datefin IS NULL AND t.subscription = '1')"; } if ($search_filter == 'uptodate') { - $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = '0')"; + $sql .= " AND (datefin >= '".$db->idate($now)."' OR (datefin IS NULL AND t.subscription = '0'))"; } if ($search_filter == 'outofdate') { - $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = '1')"; + $sql .= " AND (datefin < '".$db->idate($now)."')"; } if ($search_status != '') { // Peut valoir un nombre ou liste de nombre separes par virgules @@ -500,6 +500,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { } $db->free($resql); } +//print $sql; // Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 7361ba8fa7f..2f10848a827 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -383,7 +383,7 @@ if ($action == 'create') { print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy'); print ""; - print ''.$langs->trans("SubscriptionRequired").''; + print ''.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).''; print $form->selectyesno("subscription", 1, 1); print ''; @@ -459,7 +459,7 @@ if ($rowid > 0) { print ''.$langs->trans("MembersNature").''.$object->getmorphylib($object->morphy).''; print ''; - print ''.$langs->trans("SubscriptionRequired").''; + print ''.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).''; print yn($object->subscription); print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a5303555f71..942473a362b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7953,6 +7953,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } if (is_object($object) && $object->element == 'member') { $typeforonlinepayment = 'member'; + $amounttouse = 0; + if (!empty($object->last_subscription_amount)) { + $amounttouse = $object->last_subscription_amount; + } } if (is_object($object) && $object->element == 'contrat') { $typeforonlinepayment = 'contract'; @@ -7960,7 +7964,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'fichinter') { $typeforonlinepayment = 'ficheinter'; } - $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__']); + + $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__'], $amounttouse); $paymenturl = $url; } diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index b35b704b87f..4da2b7af21b 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -92,6 +92,7 @@ NoTypeDefinedGoToSetup=No member types defined. Go to menu "Members types" NewMemberType=New member type WelcomeEMail=Welcome email SubscriptionRequired=Contribution required +SubscriptionRequiredDesc=If subscription is required, a subscription with a start or end date must be recorded to have the member up to date (whatever is subscription amount, even if subscription is free). DeleteType=Delete VoteAllowed=Vote allowed Physical=Individual From 0df02e314198a56c7f65d1596f2227242d364cd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2023 15:59:40 +0200 Subject: [PATCH 2/3] Fix var no defined --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 942473a362b..f592b20ceea 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7944,6 +7944,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, // Set the online payment url link into __ONLINE_PAYMENT_URL__ key require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $outputlangs->loadLangs(array('paypal', 'other')); + + $amounttouse = 0; $typeforonlinepayment = 'free'; if (is_object($object) && $object->element == 'commande') { $typeforonlinepayment = 'order'; @@ -7953,7 +7955,6 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } if (is_object($object) && $object->element == 'member') { $typeforonlinepayment = 'member'; - $amounttouse = 0; if (!empty($object->last_subscription_amount)) { $amounttouse = $object->last_subscription_amount; } From 8af81ff89b25dc6af9f2d176b40a365cdede6a63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2023 16:03:14 +0200 Subject: [PATCH 3/3] Fix php 8 --- htdocs/core/lib/payments.lib.php | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 29947dda57c..3942f5cbaa8 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -187,12 +187,12 @@ function getValidOnlinePaymentMethods($paymentmethod = '') /** * Return string with full online payment Url * - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...) - * @param string $ref Ref of object - * @param int $amount Amount of money to request for - * @return string Url string + * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...) + * @param string $ref Ref of object + * @param int|float $amount Amount of money to request for + * @return string Url string */ -function showOnlinePaymentUrl($type, $ref, $amount = '9.99') +function showOnlinePaymentUrl($type, $ref, $amount = 0) { global $langs; @@ -213,13 +213,13 @@ function showOnlinePaymentUrl($type, $ref, $amount = '9.99') /** * Return string with HTML link for online payment * - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...) - * @param string $ref Ref of object - * @param string $label Text or HTML tag to display, if empty it display the URL - * @param int $amount Amount of money to request for - * @return string Url string + * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...) + * @param string $ref Ref of object + * @param string $label Text or HTML tag to display, if empty it display the URL + * @param int|float $amount Amount of money to request for + * @return string Url string */ -function getHtmlOnlinePaymentLink($type, $ref, $label = '', $amount = '9.99') +function getHtmlOnlinePaymentLink($type, $ref, $label = '', $amount = 0) { $url = getOnlinePaymentUrl(0, $type, $ref, $amount); $label = $label ? $label : $url; @@ -230,15 +230,15 @@ function getHtmlOnlinePaymentLink($type, $ref, $label = '', $amount = '9.99') /** * Return string with full Url * - * @param int $mode 0=True url, 1=Url formated with colors - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member', 'boothlocation', ...) - * @param string $ref Ref of object - * @param int $amount Amount of money to request for - * @param string $freetag Free tag (required and used for $type='free' only) - * @param string $localorexternal 0=Url for browser, 1=Url for external access - * @return string Url string + * @param int $mode 0=True url, 1=Url formated with colors + * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member', 'boothlocation', ...) + * @param string $ref Ref of object + * @param int|float $amount Amount of money to request for + * @param string $freetag Free tag (required and used for $type='free' only) + * @param string $localorexternal 0=Url for browser, 1=Url for external access + * @return string Url string */ -function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag', $localorexternal = 1) +function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'your_tag', $localorexternal = 1) { global $conf, $dolibarr_main_url_root;