diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 850cd20b831..2e47b48645d 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -33,7 +33,7 @@ if (isModEnabled("banque")) { } // Load translation files required by the page -$langs->loadLangs(array("companies", "members", "bills", "users")); +$langs->loadLangs(array("companies", "members", "bills", "users", "banks")); $adh = new Adherent($db); $adht = new AdherentType($db); @@ -86,7 +86,10 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'update' && $errmsg = ''; - if ($object->fk_bank) { + $newdatestart = dol_mktime(GETPOST('datesubhour', 'int'), GETPOST('datesubmin', 'int'), 0, GETPOST('datesubmonth', 'int'), GETPOST('datesubday', 'int'), GETPOST('datesubyear', 'int')); + $newdateend = dol_mktime(GETPOST('datesubendhour', 'int'), GETPOST('datesubendmin', 'int'), 0, GETPOST('datesubendmonth', 'int'), GETPOST('datesubendday', 'int'), GETPOST('datesubendyear', 'int')); + + if ($object->fk_bank > 0) { $accountline = new AccountLine($db); $result = $accountline->fetch($object->fk_bank); @@ -94,9 +97,10 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'update' && if ($accountline->rappro) { $errmsg = $langs->trans("SubscriptionLinkedToConciliatedTransaction"); } else { - $accountline->datev = dol_mktime(GETPOST('datesubhour', 'int'), GETPOST('datesubmin', 'int'), 0, GETPOST('datesubmonth', 'int'), GETPOST('datesubday', 'int'), GETPOST('datesubyear', 'int')); - $accountline->dateo = dol_mktime(GETPOST('datesubhour', 'int'), GETPOST('datesubmin', 'int'), 0, GETPOST('datesubmonth', 'int'), GETPOST('datesubday', 'int'), GETPOST('datesubyear', 'int')); + $accountline->datev = $newdatestart; + $accountline->dateo = $newdatestart; $accountline->amount = $amount; + $result = $accountline->update($user); if ($result < 0) { $errmsg = $accountline->error; @@ -106,8 +110,8 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'update' && if (!$errmsg) { // Modify values - $object->dateh = dol_mktime(GETPOST('datesubhour', 'int'), GETPOST('datesubmin', 'int'), 0, GETPOST('datesubmonth', 'int'), GETPOST('datesubday', 'int'), GETPOST('datesubyear', 'int')); - $object->datef = dol_mktime(GETPOST('datesubendhour', 'int'), GETPOST('datesubendmin', 'int'), 0, GETPOST('datesubendmonth', 'int'), GETPOST('datesubendday', 'int'), GETPOST('datesubendyear', 'int')); + $object->dateh = $newdatestart; + $object->datef = $newdateend; $object->fk_type = $typeid; $object->note_public = $note; $object->note_private = $note; @@ -335,7 +339,7 @@ if ($rowid && $action != 'edit') { // Bank line if (isModEnabled("banque") && (getDolGlobalString('ADHERENT_BANK_USE') || $object->fk_bank)) { print ''.$langs->trans("BankTransactionLine").''; - if ($object->fk_bank) { + if ($object->fk_bank > 0) { $bankline = new AccountLine($db); $result = $bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1, 0, 'showall'); @@ -358,8 +362,8 @@ if ($rowid && $action != 'edit') { print '
'; if ($user->hasRight('adherent', 'cotisation', 'creer')) { - if (!empty($bankline->rappro) || empty($bankline)) { - print '
'.$langs->trans("Modify")."
"; + if (empty($bankline->rappro) || empty($bankline)) { + print '
'.$langs->trans("Modify")."
"; } else { print '
'.$langs->trans("Modify")."
"; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index bdeed68f0b0..0186d9ebd68 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -2092,7 +2092,7 @@ class AccountLine extends CommonObjectLine $this->fk_user_rappro = $obj->fk_user_rappro; $this->fk_type = $obj->fk_type; // Type of transaction - $this->rappro = $obj->rappro; + $this->rappro = (int) $obj->rappro; $this->num_releve = $obj->num_releve; $this->num_chq = $obj->num_chq; diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index b4fde2cb558..ce3bed63372 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -244,3 +244,4 @@ MemberCodeDesc=Member Code, unique for all members NoRecordedMembers=No recorded 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) +SubscriptionLinkedToConciliatedTransaction=Membership is linked to a conciliated transaction so this modification is not allowed. \ No newline at end of file