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 '