diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index cb0ab675301..ba445cb2c09 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) +{ + $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); +} + +/* + * 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']) { - $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); + $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 '
'; } @@ -1162,13 +1164,23 @@ if ($_GET['propalid'] > 0) print ''; if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - print 'rowid.'">'; + if ($conf->use_ajax) + { + $url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&ligne='.$objp->rowid.'&action=confirm_deleteline&confirm=yes'; + print 'trans("No").'\')">'; + print img_delete(); + } + else + { + print 'rowid.'">'; + print img_delete(); + } } else { - print 'rowid.'">'; + print 'rowid.'">'; + print img_delete(); } - print img_delete(); print ''; if ($num > 1) { diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js index cc2b8a6cb47..52105418761 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 e118f6daf42..3eb074a64a0 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 ''."\n"; print ''."\n"; + print ''."\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 ''."\n"; print ''."\n"; print ''."\n"; - //print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/theme/common/window/alert/bottom.gif b/htdocs/theme/common/window/alert/bottom.gif new file mode 100644 index 00000000000..9870f5224ab 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 00000000000..583f113faf4 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 00000000000..230ba12bedb 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 00000000000..4a3fab52023 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 00000000000..2f3344e5cbb 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 00000000000..529e72f45a2 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 00000000000..85ba9e2a56a 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 00000000000..8f6193664b7 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 00000000000..fabb33a189b 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 00000000000..9fec6fa2b34 Binary files /dev/null and b/htdocs/theme/common/window/alert/top_right.gif differ