diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index cb0ab67530198993c6ac4039a5127404d4330397..ba445cb2c09c204a966d7e1467a27b21d4d8c572 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -95,20 +95,39 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') exit; } -if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) +/* + * Supprime une ligne produit SANS confirmation + */ +if ($_GET['action'] == 'deleteline' && $user->rights->propale->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - if ($user->rights->propale->creer) - { - $propal = new Propal($db); - $propal->fetch($_GET['propalid']); - $result=$propal->delete_product($_GET['ligne']); - if ($_REQUEST['lang_id']) + $propal = new Propal($db); + $propal->fetch($_GET['propalid']); + $propal->delete_product($_GET['ligne']); + if ($_REQUEST['lang_id']) { - $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); + $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); + propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); +} + +/* + * Supprime une ligne produit AVEC confirmation + */ +if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) +{ + if ($user->rights->propale->creer) + { + $propal = new Propal($db); + $propal->fetch($_GET['propalid']); + $result=$propal->delete_product($_GET['ligne']); + if ($_REQUEST['lang_id']) + { + $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); } + propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); + } Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET['propalid']); exit; } @@ -598,23 +617,6 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer) } } - -if ($_GET['action'] == 'del_ligne' && $user->rights->propale->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE) -{ - /* - * Supprime une ligne produit dans la propale - */ - $propal = new Propal($db); - $propal->fetch($_GET['propalid']); - $propal->delete_product($_GET['ligne']); - if ($_REQUEST['lang_id']) - { - $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); - } - propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); -} - if ($_POST['action'] == 'classin') { $propal = new Propal($db); @@ -726,11 +728,11 @@ if ($_GET['propalid'] > 0) } /* - * Confirmation de la suppression d'une ligne produit + * Confirmation de la suppression d'une ligne produit/service */ - if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) + if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); + $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline'); print '<br>'; } @@ -1162,13 +1164,23 @@ if ($_GET['propalid'] > 0) print '<td align="center">'; if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - print '<a href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=delete_product_line&ligne='.$objp->rowid.'">'; + if ($conf->use_ajax) + { + $url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&ligne='.$objp->rowid.'&action=confirm_deleteline&confirm=yes'; + print '<a href="#" onClick="confirmDelete(\''.$url.'\',\''.$langs->trans('ConfirmDeleteProductLine').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\')">'; + print img_delete(); + } + else + { + print '<a href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=ask_deleteline&ligne='.$objp->rowid.'">'; + print img_delete(); + } } else { - print '<a href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=del_ligne&ligne='.$objp->rowid.'">'; + print '<a href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=deleteline&ligne='.$objp->rowid.'">'; + print img_delete(); } - print img_delete(); print '</a></td>'; if ($num > 1) { diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js index cc2b8a6cb4760a1fe75d48d211889275cdc2ecd7..52105418761cb2d5c216d1608d91909ff974efdf 100644 --- a/htdocs/lib/lib_head.js +++ b/htdocs/lib/lib_head.js @@ -648,4 +648,21 @@ function cleanSerialize(expr) { var liste1 = expr.replace(reg, ","); var liste = liste1.replace(reg2, ""); return liste; +} + +/*================================================================= + Purpose: Affiche un message de confirmation + Input: linkurl,message,ok,cancel + Author: Regis Houssin + Licence: GPL +==================================================================*/ +function confirmDelete(linkurl,message,ok,cancel) { + Dialog.confirm(message, { + width:300, + okLabel: ok, + cancelLabel: cancel, + buttonClass: "button", + cancel:function(win){}, + ok:function(win) {window.location.href=linkurl; return true;} + }); } \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e118f6daf42cfbb1e9c427fa7a1c40db941cb808..3eb074a64a07d429e9969ada4dfe08ea32422b60 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -653,6 +653,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0) // Style sheets pour la class Window print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/default.css">'."\n"; print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/alphacube.css">'."\n"; + print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/alert.css">'."\n"; // Definition en alternate style sheet des feuilles de styles les plus maintenues // Les navigateurs qui supportent sont rares. Plus aucun connu. @@ -676,7 +677,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0) print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/scriptaculous.js"></script>'."\n"; print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/effects.js"></script>'."\n"; print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/controls.js"></script>'."\n"; - //print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/prototip.js"></script>'."\n"; print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/window/window.js"></script>'."\n"; print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/window/tooltip.js"></script>'."\n"; diff --git a/htdocs/theme/common/window/alert/bottom.gif b/htdocs/theme/common/window/alert/bottom.gif new file mode 100644 index 0000000000000000000000000000000000000000..9870f5224ab4a6c73dd6047a53b59b3fc02d4768 Binary files /dev/null and b/htdocs/theme/common/window/alert/bottom.gif differ diff --git a/htdocs/theme/common/window/alert/bottom_left.gif b/htdocs/theme/common/window/alert/bottom_left.gif new file mode 100644 index 0000000000000000000000000000000000000000..583f113faf44672d7e50e064c54d39804a8a0241 Binary files /dev/null and b/htdocs/theme/common/window/alert/bottom_left.gif differ diff --git a/htdocs/theme/common/window/alert/bottom_right.gif b/htdocs/theme/common/window/alert/bottom_right.gif new file mode 100644 index 0000000000000000000000000000000000000000..230ba12bedb5e82cbe13af02c4ea60fac1c7187c Binary files /dev/null and b/htdocs/theme/common/window/alert/bottom_right.gif differ diff --git a/htdocs/theme/common/window/alert/left.gif b/htdocs/theme/common/window/alert/left.gif new file mode 100644 index 0000000000000000000000000000000000000000..4a3fab520239d0d923d95d3128e1b035dbb89381 Binary files /dev/null and b/htdocs/theme/common/window/alert/left.gif differ diff --git a/htdocs/theme/common/window/alert/overlay.png b/htdocs/theme/common/window/alert/overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..2f3344e5cbba86538a03e06e171d119ac2da0139 Binary files /dev/null and b/htdocs/theme/common/window/alert/overlay.png differ diff --git a/htdocs/theme/common/window/alert/progress.gif b/htdocs/theme/common/window/alert/progress.gif new file mode 100644 index 0000000000000000000000000000000000000000..529e72f45a2395e2eddb0487edbe79b306c92c3a Binary files /dev/null and b/htdocs/theme/common/window/alert/progress.gif differ diff --git a/htdocs/theme/common/window/alert/right.gif b/htdocs/theme/common/window/alert/right.gif new file mode 100644 index 0000000000000000000000000000000000000000..85ba9e2a56a93527dde4f14eccfe386e6af2e2b7 Binary files /dev/null and b/htdocs/theme/common/window/alert/right.gif differ diff --git a/htdocs/theme/common/window/alert/top.gif b/htdocs/theme/common/window/alert/top.gif new file mode 100644 index 0000000000000000000000000000000000000000..8f6193664b77e0b385df5400b8fe25ef43a24201 Binary files /dev/null and b/htdocs/theme/common/window/alert/top.gif differ diff --git a/htdocs/theme/common/window/alert/top_left.gif b/htdocs/theme/common/window/alert/top_left.gif new file mode 100644 index 0000000000000000000000000000000000000000..fabb33a189bcf331976100f954a125f1a3a10e8c Binary files /dev/null and b/htdocs/theme/common/window/alert/top_left.gif differ diff --git a/htdocs/theme/common/window/alert/top_right.gif b/htdocs/theme/common/window/alert/top_right.gif new file mode 100644 index 0000000000000000000000000000000000000000..9fec6fa2b34647940d7aa1143ea58f448667f128 Binary files /dev/null and b/htdocs/theme/common/window/alert/top_right.gif differ