From 82bf9cd3e970b305ca581c48c33ae214305c5798 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:13:49 +0200 Subject: [PATCH 1/6] Fix public new member form use adh type amount --- htdocs/public/members/new.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 233bc483d06..9bf8cfdb18e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -543,6 +543,10 @@ jQuery(document).ready(function () { document.newmember.action.value="create"; document.newmember.submit(); }); + jQuery("#typeid").change(function() { + document.newmember.action.value="create"; + document.newmember.submit(); + }); }); }); '; @@ -561,7 +565,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { $isempty = 0; } print ''.$langs->trans("Type").' *'; - print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); + print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); print ''."\n"; } else { $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); @@ -704,7 +708,8 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount // Set amount for the subscription - $amount = isset($amount) ? $amount : 0; + $amountbytype = adht->amountByType(1); + $amount = !empty($amountbytype[GETPOST('typeid',int)]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; @@ -713,6 +718,9 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); } + + $amount = price2num($amount); + // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' print ''.$langs->trans("Subscription").''; if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { From 2e2b6af98ea80217d4602e01406e25a43e3c219e Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:23:46 +0200 Subject: [PATCH 2/6] Update new.php --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 9bf8cfdb18e..1b4fc6283b1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -708,7 +708,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount // Set amount for the subscription - $amountbytype = adht->amountByType(1); + $amountbytype = $adht->amountByType(1); $amount = !empty($amountbytype[GETPOST('typeid',int)]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { From 9af05f3c6eff76e6106bf26687b3ebc24e29c1c4 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:25:38 +0200 Subject: [PATCH 3/6] Update new.php --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 1b4fc6283b1..33af176a169 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -709,7 +709,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // Set amount for the subscription $amountbytype = $adht->amountByType(1); - $amount = !empty($amountbytype[GETPOST('typeid',int)]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); + $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; From 912995a5588511a11409d534ee959052ee052243 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:28:03 +0200 Subject: [PATCH 4/6] Create new.php --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 33af176a169..aaa504bc54d 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -709,7 +709,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // Set amount for the subscription $amountbytype = $adht->amountByType(1); - $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); + $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset ($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; From 949e797390437fd3a03c68f5eb6df6a482d29174 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 6 May 2021 22:31:41 +0000 Subject: [PATCH 5/6] Fixing style errors. --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index aaa504bc54d..bbd1661ad94 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -709,7 +709,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // Set amount for the subscription $amountbytype = $adht->amountByType(1); - $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset ($amount) ? $amount : 0); + $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; From 6504f961887f5e442071a71ed57aa437d9d49ce4 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:43:01 +0200 Subject: [PATCH 6/6] Copyright --- htdocs/public/members/new.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index bbd1661ad94..71446b58779 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2021 Waël Almoman * * 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