dbut ajout option : confirmation de suppression d'une ligne produit

This commit is contained in:
Regis Houssin
2006-06-08 10:35:21 +00:00
parent 6151457bf9
commit fa894fcf2e
4 changed files with 46 additions and 10 deletions

View File

@@ -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)
{

View File

@@ -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 '<br />';
}
@@ -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 '<br />';
}
@@ -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 '<br />';
}
@@ -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 '<br />';
}
/*
* 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.'&amp;lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline');
print '<br>';
}
/*
* Commande
@@ -1110,10 +1134,17 @@ else
// Icone d'edition et suppression
if ($commande->statut == 0 && $user->rights->commande->creer)
{
print '<td align="right"><a href="fiche.php?id='.$id.'&amp;action=editline&amp;rowid='.$objp->rowid.'">';
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=editline&amp;rowid='.$objp->rowid.'">';
print img_edit();
print '</a></td>';
print '<td align="right"><a href="fiche.php?id='.$id.'&amp;action=deleteline&amp;lineid='.$objp->rowid.'">';
if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=delete_product_line&amp;lineid='.$objp->rowid.'">';
}
else
{
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=deleteline&amp;lineid='.$objp->rowid.'">';
}
print img_delete();
print '</a></td>';
print '<td align="right">';

View File

@@ -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
ExportDataset_produit_1=Products and services
DeleteProductLine=Delete product line
ConfirmDeleteProductLine=Are you sure you want to delete this product line?

View File

@@ -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" <20> <20>t<EFBFBD> supprim<69> de la base.
ExportDataset_produit_1=Produits et services
DeleteProductLine=Supprimer ligne produit
ConfirmDeleteProductLine=<3D>tes-vous s<>r de vouloir effacer cette ligne produit ?