diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index ba65669aca4..1ee9fe9b582 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -226,6 +226,7 @@ print ''.$form->editfieldkey("Note",'note',$object->note,$ print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->facture->paiement,'textarea'); print ''; +$disable_delete = 0; // Bank account if (! empty($conf->banque->enabled)) { @@ -233,6 +234,11 @@ if (! empty($conf->banque->enabled)) { $bankline=new AccountLine($db); $bankline->fetch($object->bank_line); + if ($bankline->rappro) + { + $disable_delete = 1; + $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment")); + } print ''; print ''.$langs->trans('BankTransactionLine').''; @@ -274,7 +280,6 @@ print ''; * List of invoices */ -$disable_delete = 0; $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s'; $sql.= ' WHERE pf.fk_facture = f.rowid'; @@ -344,6 +349,7 @@ if ($resql) if ($objp->paye == 1) // If at least one invoice is paid, disable delete { $disable_delete = 1; + $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid")); } $total = $total + $objp->amount; $i++; @@ -389,7 +395,7 @@ if ($user->societe_id == 0 && $action == '') } else { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } } } diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 847bf1b3f1e..3b93eb85cc9 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -202,6 +202,7 @@ if ($result > 0) print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->fournisseur->facture->creer,'textarea'); print ''; + $allow_delete = 1 ; // Bank account if (! empty($conf->banque->enabled)) { @@ -209,6 +210,11 @@ if ($result > 0) { $bankline=new AccountLine($db); $bankline->fetch($object->bank_line); + if ($bankline->rappro) + { + $allow_delete=0; + $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment")); + } print ''; print ''.$langs->trans('BankTransactionLine').''; @@ -236,7 +242,6 @@ if ($result > 0) /** * Liste des factures */ - $allow_delete = 1 ; $sql = 'SELECT f.rowid, f.ref, f.ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom as name, s.rowid as socid'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid'; @@ -288,6 +293,7 @@ if ($result > 0) if ($objp->paye == 1) { $allow_delete = 0; + $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid")); } $total = $total + $objp->amount; $i++; @@ -323,12 +329,18 @@ if ($result > 0) } } } - if ($user->societe_id == 0 && $allow_delete && $object->statut == 0 && $action == '') + if ($user->societe_id == 0 && $action == '') { if ($user->rights->fournisseur->facture->supprimer) { - print ''.$langs->trans('Delete').''; - + if ($allow_delete) + { + print ''.$langs->trans('Delete').''; + } + else + { + print ''.$langs->trans('Delete').''; + } } } print ''; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 20f6fe0619c..ee08358e562 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -396,6 +396,7 @@ Reported=Delayed DisabledBecausePayments=Not possible since there are some payments CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least one invoice classified paid ExpectedToPay=Expected payment +CantRemoveConciliatedPayment=Can't remove conciliated payment PayedByThisPayment=Paid by this payment ClosePaidInvoicesAutomatically=Classify "Paid" all standard, situation or replacement invoices entirely paid. ClosePaidCreditNotesAutomatically=Classify "Paid" all credit notes entirely paid back.