diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 617e8037983..358be3f295d 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -487,9 +487,16 @@ print ''.$langs->trans("Description").''; print ''.$langs->trans("Value").''; print "\n"; +// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.) +print ''; +print $form->textwithpicto($langs->trans("MemberSubscriptionStartAfter"), $langs->trans("MemberSubscriptionStartAfterDesc").'
'.$langs->trans("MemberSubscriptionStartAfterDesc2")); +print ''; +print ''; +print "\n"; + // Start date of new membership $startpoint = array(); -$startpoint[0] = $langs->trans("SubscriptionPayment"); +$startpoint[0] = $langs->trans("NoCorrection"); $startpoint["m"] = $langs->trans("Month"); $startpoint["Y"] = $langs->trans("Year"); print ''; @@ -499,13 +506,6 @@ $startfirstdayof = !getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') print $form->selectarray("MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF", $startpoint, $startfirstdayof, 0); print "\n"; -// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.) -print ''; -print $langs->trans("MemberSubscriptionStartAfter"); -print ''; -print ''; -print "\n"; - // Mail required for members print ''.$langs->trans("AdherentMailRequired").''; print $form->selectyesno('ADHERENT_MAIL_REQUIRED', getDolGlobalInt('ADHERENT_MAIL_REQUIRED'), 1, false, 0, 1); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 62f8ae41968..c6e31ea706c 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -978,13 +978,14 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h $datefrom = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); } if (!$datefrom) { - $datefrom = $object->datevalid; + // Guess the subscription start date + $datefrom = $object->datevalid; // By default, the subscription start date is the payment date if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) { $datefrom = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)); } elseif ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > $now) { $datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); } - + // Now do a correction of the suggested date if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "m") { $datefrom = dol_get_first_day(dol_print_date($datefrom, "%Y"), dol_print_date($datefrom, "%m")); } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "Y") { diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 36e4e0ce347..05cd4df8f3a 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -237,8 +237,11 @@ CreateDolibarrThirdPartyDesc=A third party is the legal entity that will be used MemberFirstname=Member firstname MemberLastname=Member lastname MemberCodeDesc=Member Code, unique for all members -MemberSubscriptionStartFirstDayOf=The start date of a membership corresponds to the first day of a -MemberSubscriptionStartAfter=Minimum period before the entry into force of the start date of a subscription except renewals (example +3m = +3 months, -5d = -5 days, +1Y = +1 year) +MemberSubscriptionStartFirstDayOf=Force the suggested date of a membership to corresponds to the first day of a +MemberSubscriptionStartAfter=Minimum period before the entry into force of the start date of a first membership subscription (excluding renewals) +NoCorrection=No correction +MemberSubscriptionStartAfterDesc=Example: +3m = +3 months, -5d = -5 days, +1Y = +1 year +MemberSubscriptionStartAfterDesc2=This is the suggested date when creating a first membership subscription compared to the current date. For renewal, the date suggested by default will remain the end of the previous membership. SubscriptionLinkedToConciliatedTransaction=Membership is linked to a conciliated transaction so this modification is not allowed. ConfirmMassSubsriptionCreation=Confirm subscription creation ConfirmMassSubsriptionCreationQuestion=Are you sure you want to create the %s selected subscription(s)? diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 082ac3c4d1d..1e172693b16 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -538,14 +538,14 @@ if ($ispaymentok) { } } - // Subscription information + // Guess the subscription start date $datesubscription = $object->datevalid; // By default, the subscription start date is the payment date if ($object->datefin > 0) { $datesubscription = dol_time_plus_duree($object->datefin, 1, 'd'); } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) { $datesubscription = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)); } - + // Now do a correction of the suggested date if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "m") { $datesubscription = dol_get_first_day(dol_print_date($datesubscription, "%Y"), dol_print_date($datesubscription, "%m")); } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "Y") {