diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 3661eec8e8e..3cde5212e2d 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -334,11 +334,12 @@ if ($result) { // Bank account print ''.$langs->trans("Account").''; print ''; - if (!$objp->rappro && !$bankline->getVentilExportCompta()) { - print img_picto('', 'bank_account', 'class="paddingright"'); - print $form->select_comptes($acct->id, 'accountid', 0, '', 0, '', 0, '', 1); - } else { + // $objp->fk_account may be not > 0 if data was lost by an old bug. In such a case, we let a chance to user to fix it. + if (($objp->rappro || $bankline->getVentilExportCompta()) && $objp->fk_account > 0) { print $acct->getNomUrl(1, 'transactions', 'reflabel'); + } else { + print img_picto('', 'bank_account', 'class="paddingright"'); + print $form->select_comptes($acct->id, 'accountid', 0, '', ($acct->id > 0 ? $acct->id : 1), '', 0, '', 1); } print ''; print '';