Fix trans of option

This commit is contained in:
Laurent Destailleur 2024-07-20 12:06:05 +02:00
parent 6d5e42b360
commit 23bfc5d153
4 changed files with 18 additions and 14 deletions

View file

@ -487,9 +487,16 @@ print '<td>'.$langs->trans("Description").'</td>';
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>';
@ -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 "</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);

View file

@ -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") {

View file

@ -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)?

View file

@ -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") {