More robust various payment when data are corrupted
This commit is contained in:
parent
01698aba6b
commit
a6dae99f56
@ -1082,6 +1082,8 @@ class Account extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
// @TODO Check there is no child into llx_payment_various, ... to allow deletion ?
|
||||||
|
|
||||||
// Delete link between tag and bank account
|
// Delete link between tag and bank account
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_account";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_account";
|
||||||
|
|||||||
@ -638,20 +638,24 @@ if ($id) {
|
|||||||
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0);
|
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$bankaccountnotfound = 0;
|
||||||
|
|
||||||
if (isModEnabled('banque')) {
|
if (isModEnabled('banque')) {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if ($object->fk_account > 0) {
|
if ($object->fk_bank > 0) {
|
||||||
if ($object->fk_bank > 0) {
|
$bankline = new AccountLine($db);
|
||||||
$bankline = new AccountLine($db);
|
$result = $bankline->fetch($object->fk_bank);
|
||||||
$bankline->fetch($object->fk_bank);
|
|
||||||
|
|
||||||
print $bankline->getNomUrl(1, 0, 'showall');
|
if ($result <= 0) {
|
||||||
|
$bankaccountnotfound = 1;
|
||||||
} else {
|
} else {
|
||||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordfound").'</span>';
|
print $bankline->getNomUrl(1, 0, 'showall');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$bankaccountnotfound = 1;
|
||||||
|
|
||||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordfound").'</span>';
|
print '<span class="opacitymedium">'.$langs->trans("NoRecordfound").'</span>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -685,7 +689,7 @@ if ($id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if (empty($object->rappro)) {
|
if (empty($object->rappro) || $bankaccountnotfound) {
|
||||||
if (!empty($user->rights->banque->modifier)) {
|
if (!empty($user->rights->banque->modifier)) {
|
||||||
if ($alreadyaccounted) {
|
if ($alreadyaccounted) {
|
||||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("Accounted").'">'.$langs->trans("Delete").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("Accounted").'">'.$langs->trans("Delete").'</a></div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user