diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index a244b9245f6..5ee32bea67e 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -72,6 +72,17 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') } } +if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) +{ + if ($user->rights->fournisseur->facture->creer) + { + $facturefourn = new FactureFournisseur($db); + $facturefourn->fetch($_GET['facid']); + $facturefourn->deleteline($_GET['ligne_id']); + $_GET['action'] = 'edit'; + } +} + if ($_GET['action'] == 'payed') { $facturefourn=new FactureFournisseur($db); @@ -196,7 +207,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer) } } -if ($_GET['action'] == 'del_ligne') +if ($_GET['action'] == 'del_ligne' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE) { $facfou = new FactureFournisseur($db,'',$_GET['facid']); $facfou->deleteline($_GET['ligne_id']); @@ -387,6 +398,15 @@ else if ($_GET['action'] == 'edit') { + /* + * Confirmation de la suppression d'une ligne produit + */ + if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) + { + $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); + print '
'; + } + print_titre($langs->trans('SupplierInvoice')); print '
'; @@ -479,10 +499,16 @@ else print ''.$fac->lignes[$i][2].''; print ''.price($fac->lignes[$i][5]).''; print ''.price($fac->lignes[$i][6]).''; - print ''; - print ''.img_delete().''; - print ''.img_edit().''; - print ''; + print ''.img_edit().''; + if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE) + { + print ''.img_delete().''; + } + else + { + print ''.img_delete().''; + } + print ''; } }