Skip to content

Commit

Permalink
Fix trans of option
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 20, 2024
1 parent 6d5e42b commit 23bfc5d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
16 changes: 8 additions & 8 deletions htdocs/adherents/admin/member.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,16 @@
print '<td class="soixantepercent">'.$langs->trans("Value").'</td>';
print "</tr>\n";

// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.)
print '<tr class="oddeven drag" id="startfirstdayof"><td>';
print $form->textwithpicto($langs->trans("MemberSubscriptionStartAfter"), $langs->trans("MemberSubscriptionStartAfterDesc").'<br>'.$langs->trans("MemberSubscriptionStartAfterDesc2"));
print '</td><td>';
print '<input type="text" class="right width50" id="MEMBER_SUBSCRIPTION_START_AFTER" name="MEMBER_SUBSCRIPTION_START_AFTER" value="'.getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER').'">';
print "</td></tr>\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 '<tr class="oddeven drag" id="startfirstdayof"><td>';
Expand All @@ -499,13 +506,6 @@
print $form->selectarray("MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF", $startpoint, $startfirstdayof, 0);
print "</td></tr>\n";

// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.)
print '<tr class="oddeven drag" id="startfirstdayof"><td>';
print $langs->trans("MemberSubscriptionStartAfter");
print '</td><td>';
print '<input type="text" class="right width50" id="MEMBER_SUBSCRIPTION_START_AFTER" name="MEMBER_SUBSCRIPTION_START_AFTER" value="'.getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER').'">';
print "</td></tr>\n";

// Mail required for members
print '<tr class="oddeven"><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
print $form->selectyesno('ADHERENT_MAIL_REQUIRED', getDolGlobalInt('ADHERENT_MAIL_REQUIRED'), 1, false, 0, 1);
Expand Down
5 changes: 3 additions & 2 deletions htdocs/adherents/subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -978,13 +978,14 @@
$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") {
Expand Down
7 changes: 5 additions & 2 deletions htdocs/langs/en_US/members.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
Expand Down
4 changes: 2 additions & 2 deletions htdocs/public/payment/paymentok.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,14 @@
}
}

// 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") {
Expand Down

0 comments on commit 23bfc5d

Please sign in to comment.