From fa894fcf2e0bbf692234c9c7d24e5df14df2e4ad Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 8 Jun 2006 10:35:21 +0000 Subject: [PATCH] =?UTF-8?q?d=E9but=20ajout=20option=20:=20confirmation=20d?= =?UTF-8?q?e=20suppression=20d'une=20ligne=20produit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/propal.php | 3 ++- htdocs/commande/fiche.php | 45 +++++++++++++++++++++++++++----- htdocs/langs/en_US/products.lang | 6 +++-- htdocs/langs/fr_FR/products.lang | 2 ++ 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b57b27cdadf..da18e1bdb26 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -43,6 +43,7 @@ $langs->load('companies'); $langs->load('propal'); $langs->load('compta'); $langs->load('bills'); +$langs->load('products'); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php'); if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); @@ -87,7 +88,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') exit; } -if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes') +if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) { if ($user->rights->propale->creer) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index c5ff9e4a908..1abe3f8cfc3 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -45,6 +45,7 @@ $langs->load('companies'); $langs->load('bills'); $langs->load('propal'); $langs->load('deliveries'); +$langs->load('products'); $user->getrights('commande'); $user->getrights('expedition'); @@ -248,11 +249,12 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS exit; } -if ($_GET['action'] == 'deleteline' && $user->rights->commande->creer) +if ($_GET['action'] == 'deleteline' && $user->rights->commande->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE) { $commande = new Commande($db); $commande->fetch($_GET['id']); $result = $commande->delete_line($_GET['lineid']); + commande_pdf_create($db, $_GET['id'], $commande->modelpdf); Header('Location: fiche.php?id='.$_GET['id']); exit; } @@ -292,6 +294,19 @@ 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->commande->creer) + { + $commande = new Commande($db); + $commande->fetch($_GET['id']); + $commande->delete_line($_GET['lineid']); + commande_pdf_create($db, $_GET['id'], $commande->modelpdf); + } + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']); + exit; +} + if ($_GET['action'] == 'modif' && $user->rights->commande->creer) { /* @@ -798,7 +813,7 @@ else */ if ($_GET['action'] == 'delete') { - $html->form_confirm('fiche.php?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); + $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); print '
'; } @@ -808,7 +823,7 @@ else if ($_GET['action'] == 'valid') { //$numfa = commande_get_num($soc); - $html->form_confirm('fiche.php?id='.$id, $langs->trans('ValidateOrder'), $langs->trans('ConfirmValidateOrder'), 'confirm_valid'); + $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $langs->trans('ConfirmValidateOrder'), 'confirm_valid'); print '
'; } @@ -818,7 +833,7 @@ else if ($_GET['action'] == 'cloture') { //$numfa = commande_get_num($soc); - $html->form_confirm('fiche.php?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close'); + $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close'); print '
'; } @@ -827,9 +842,18 @@ else */ if ($_GET['action'] == 'annuler') { - $html->form_confirm('fiche.php?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel'); + $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel'); print '
'; } + + /* + * 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"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); + print '
'; + } /* * Commande @@ -1110,10 +1134,17 @@ else // Icone d'edition et suppression if ($commande->statut == 0 && $user->rights->commande->creer) { - print ''; + print 'rowid.'">'; print img_edit(); print ''; - print ''; + if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE) + { + print 'rowid.'">'; + } + else + { + print 'rowid.'">'; + } print img_delete(); print ''; print ''; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 637d0f10920..ab68041b01a 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -90,6 +90,8 @@ AddDel=Add/Delete Quantity=Quantity NoMatchFound=No match found DeleteProduct=Delete a product/service -ConfirmDeleteProduct=Are you sure you want to delete this product/service ? +ConfirmDeleteProduct=Are you sure you want to delete this product/service? ProductDeleted=Product/Service "%s" deleted from database. -ExportDataset_produit_1=Products and services \ No newline at end of file +ExportDataset_produit_1=Products and services +DeleteProductLine=Delete product line +ConfirmDeleteProductLine=Are you sure you want to delete this product line? \ No newline at end of file diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 90ad2cc95ed..300e03c7b62 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -103,3 +103,5 @@ DeleteProduct=Supprimer un produit/service ConfirmDeleteProduct=Etes-vous sûr de vouloir supprimer ce produit/service ? ProductDeleted=Le produit/service "%s" à été supprimé de la base. ExportDataset_produit_1=Produits et services +DeleteProductLine=Supprimer ligne produit +ConfirmDeleteProductLine=Êtes-vous sûr de vouloir effacer cette ligne produit ? \ No newline at end of file