diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 96a9cf398e4..4c5703e4540 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1836,6 +1836,13 @@ class Adherent extends CommonObject } } $invoice->socid = $this->fk_soc; + // set customer's bank account on the invoice + if (!empty($customer->fk_account)) { + $invoice->fk_account = $customer->fk_account; + } elseif (getDolGlobalString('FACTURE_RIB_NUMBER')) { + // set default bank account from invoice module settings + $invoice->fk_account = (int) getDolGlobalString('FACTURE_RIB_NUMBER'); + } //$invoice->date = $datesubscription; $invoice->date = dol_now();