diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index ca2f681814f..66316dd0440 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -60,6 +60,17 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->
exit;
}
+if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
+{
+ if ($user->rights->fournisseur->facture->supprimer )
+ {
+ $facturefourn = new FactureFournisseur($db);
+ $factfournid = $_GET['facid'];
+ $facturefourn->delete($factfournid);
+ Header('Location: index.php');
+ exit;
+ }
+}
if ($_GET['action'] == 'payed')
{
@@ -359,6 +370,15 @@ else
llxHeader('','', $addons);
if ($mesg) { print $mesg.'
'; }
+
+ /*
+ * Confirmation de la suppression de la facture fournisseur
+ */
+ if ($_GET['action'] == 'delete')
+ {
+ $html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete');
+ print '
';
+ }
if ($_GET['action'] == 'edit')
{
@@ -707,7 +727,7 @@ else
print ''.$langs->trans('Copy').'';
}
- if ($_GET['action'] != 'edit' && $fac->statut == 0 && $user->rights->fournisseur->facture->creer)
+ if ($_GET['action'] != 'edit' && $fac->statut == 0 && $user->rights->fournisseur->facture->supprimer)
{
print ''.$langs->trans('Delete').'';
}