\n";
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 79fef823883..f7a87e9bf0c 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1490,9 +1490,11 @@ class Adherent extends CommonObject
* @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Name of bank of cheque
* @param int $datesubend Date end subscription
+ * @param int fk_type Member type id
+ *
* @return int rowid of record added, <0 if KO
*/
- public function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0)
+ public function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0, $fk_type = NULL)
{
global $conf, $langs, $user;
@@ -1523,6 +1525,7 @@ class Adherent extends CommonObject
$subscription->amount = $amount;
$subscription->note = $label; // deprecated
$subscription->note_public = $label;
+ $subscription->fk_type = $fk_type;
$rowid = $subscription->create($user);
if ($rowid > 0) {
diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang
index 31d0790b331..7f36f759bb1 100644
--- a/htdocs/langs/en_US/members.lang
+++ b/htdocs/langs/en_US/members.lang
@@ -169,6 +169,7 @@ DocForLabels=Generate address sheets
SubscriptionPayment=Subscription payment
LastSubscriptionDate=Date of latest subscription payment
LastSubscriptionAmount=Amount of latest subscription
+LastMemberType=Last Member type
MembersStatisticsByCountries=Members statistics by country
MembersStatisticsByState=Members statistics by state/province
MembersStatisticsByTown=Members statistics by town
diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang
index ea52dc21d7a..a541c347adb 100644
--- a/htdocs/langs/fr_FR/members.lang
+++ b/htdocs/langs/fr_FR/members.lang
@@ -162,6 +162,7 @@ DocForLabels=Génération d'étiquettes d'adresses
SubscriptionPayment=Paiement cotisation
LastSubscriptionDate=Date de dernière adhésion
LastSubscriptionAmount=Montant dernière adhésion
+LastMemberType=Ancien type de membre
MembersStatisticsByCountries=Statistiques des membres par pays
MembersStatisticsByState=Statistiques des membres par département/province/canton
MembersStatisticsByTown=Statistiques des membres par ville
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index 486223b0293..d55a8add8ea 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -1437,6 +1437,39 @@ if ($source == 'membersubscription') {
$_GET['newamount'] = $member->last_subscription_amount;
}
}
+
+ if ($member->type) {
+ // Last member type
+ print '
'.$langs->trans("LastMemberType");
+ print '
'.dol_escape_htmltag($member->type);
+ print "
"."\n";
+ }
+
+ if (!empty($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE)) {
+ // Amount by member type
+ $amountbytype = json_decode($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE, true);
+ // Set the member type
+ $member->typeid = (int)(GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $member->typeid);
+ // If we change the type of membership, we set also label of new type
+ $member->type = dol_getIdFromCode($db, $member->typeid, 'adherent_type', 'rowid', 'libelle');
+ // Set amount for the subscription
+ $amount = $amountbytype[$member->typeid] ? $amountbytype[$member->typeid] : $member->last_subscription_amount;
+ // list member type
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
+ $adht = new AdherentType($db);
+ if( !$action){
+ $form = new Form($db); // so wecan call method selectarray
+ print '