diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 0cda3774f04..00353678624 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -49,15 +49,17 @@ $html = new Form($db);
$mesg='';
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
-
-if ($_GET["action"] == 'valid')
+if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes && $user->rights->fournisseur->facture->valider)
{
$facturefourn=new FactureFournisseur($db);
$facturefourn->fetch($_GET["facid"]);
$facturefourn->set_valid($user->id);
+
+ Header("Location: fiche.php?facid=".$_GET["facid"]);
}
+
if ($_GET["action"] == 'payed')
{
$facturefourn=new FactureFournisseur($db);
@@ -410,6 +412,17 @@ else
dolibarr_fiche_head($head, $hselected);
+
+ /*
+ * Confirmation de la validation
+ *
+ */
+ if ($_GET["action"] == 'valid')
+ {
+ $html->form_confirm("fiche.php?facid=$fac->id","Valider la facture","Etes-vous sūr de vouloir valider cette facture ?","confirm_valid");
+ print '
';
+ }
+
print "
| '; /* @@ -578,17 +591,16 @@ else print "id&action=payed\">".$langs->trans('ClassifyPayed').""; } - if ($user->societe_id == 0) + if ($fac->statut == 0 && $user->rights->fournisseur->facture->valider) { - if ($fac->statut == 0) - { - if ($_GET["action"] <> "edit") - print "id&action=valid\">".$langs->trans('Valid').""; - } - else - { - print "id&action=copy&socid=$fac->socidp\">".$langs->trans('Copy').""; - } + if ($_GET["action"] <> "edit") + print "id&action=valid\">".$langs->trans('Valid').""; + } + else + + if ($user->rights->fournisseur->facture->creer) + { + print "id&action=copy&socid=$fac->socidp\">".$langs->trans('Copy').""; } if ($fac->statut == 0 && $user->societe_id == 0) |