Javascript confirm dialog added for destructive submits.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 20 Apr 2009 08:22:42 +0000 (08:22 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 20 Apr 2009 08:22:42 +0000 (08:22 +0000)
purchasing/includes/ui/invoice_ui.inc
purchasing/supplier_invoice.php
sales/sales_order_entry.php

index 14d0288985ac22bb73496c1c72a30b5d6e05167f..14ff76e2f2d8f3b2777e7a76785043d1b99cecc0 100644 (file)
@@ -385,8 +385,11 @@ function display_grn_items_for_selection(&$supp_trans, $k)
                        submit_cells('grn_item_id'.$n, _("Add"), '', _("Add to Invoice"), true);
                else    
                        submit_cells('grn_item_id'.$n, _("Add"), '', _("Add to Credit Note"), true);
-               if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2)       // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
+               if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2) {     // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
                        submit_cells('void_item_id'.$n, _("Remove"), '', _("WARNING! Be careful with removal. The operation is executed immediately and cannot be undone !!!"), true);
+                               submit_js_confirm('void_item_id'.$n,
+                                       sprintf(_('You are about to remove all yet non-invoiced items from delivery line #%d. This operation also irreversibly changes related order line. Do you want to continue ?'), $n));
+                       }
                        end_row();
        }
     }
index 148e7b92b9b18aec0ad0a0b6e71ebf0af0c94e44..b2ea26a39e24aed0b343ac310fec8b14da19a30e 100644 (file)
@@ -337,18 +337,8 @@ if ($id4 != -1)
 $id2 = -1;
 if ($_SESSION["wa_current_user"]->access == 2)
 {
-       $id3 = find_submit('void_item_id');
-       if ($id3 != -1) 
-       {
-               $js = "if(confirm(\""
-               .sprintf(_('You are about to remove all yet non-invoiced items from delivery line #%d. This operation also irreversibly changes related order line. Do you want to continue ?'), $id3)
-               ."\")) {
-                       JsHttpRequest.request(\"void_confirm".$id3."\");
-               }";
-               $Ajax->addScript(true,$js);
-       }
-       $id2 = find_submit('void_confirm');
-       if ($id2 != -1) // Added section 2008-10-18 Joe Hunt for voiding delivery lines
+       $id2 = find_submit('void_item_id');
+       if ($id2 != -1) 
        {
                begin_transaction();
                
index d508c2ce894203aa4d6d8f12a7c87f7cd59fecac..f6cf66d37cd664b7d8eac9cc498ebec69d8818ed 100644 (file)
@@ -141,7 +141,6 @@ if (isset($_GET['AddedID'])) {
        display_footer_exit();
 } else
        check_edit_conflicts();
-
 //-----------------------------------------------------------------------------
 
 function copy_to_cart()
@@ -229,8 +228,8 @@ function line_start_focus() {
   $Ajax->activate('items_table');
   set_focus('_stock_id_edit');
 }
-//--------------------------------------------------------------------------------
 
+//--------------------------------------------------------------------------------
 function can_process() {
        if (!is_date($_POST['OrderDate'])) {
                display_error(_("The entered date is invalid."));
@@ -356,8 +355,6 @@ function check_item_data()
 function handle_update_item()
 {
        if ($_POST['UpdateItem'] != '' && check_item_data()) {
-               //alert("description=".$_POST['item_description']);
-               //$_SESSION['items']->line_items[$_POST['LineNo']]->item_description = $_POST['item_description'];
                $_SESSION['Items']->update_cart_item($_POST['LineNo'],
                 input_num('qty'), input_num('price'),
                 input_num('Disc') / 100, $_POST['item_description'] );
@@ -432,7 +429,7 @@ function  handle_cancel_order()
 //--------------------------------------------------------------------------------
 
 function create_cart($type, $trans_no)
-{
+{ 
        processing_start();
        $doc_type = $type;
 
@@ -509,6 +506,7 @@ if ($_SESSION['Items']->trans_type == 10) {
        $porder = _("Place Order");
        $corder = _("Commit Order Changes");
 }
+
 start_form(false, true);
 hidden('cart_id');
 
@@ -529,6 +527,7 @@ if ($customer_error == "") {
 
                submit_center_first('ProcessOrder', $porder,
                    _('Check entered data and save document'), true);
+               submit_js_confirm('CancelOrder', _('You are about to void this Sales Order.\nDo you want to continue?'));
        } else {
                submit_center_first('ProcessOrder', $corder,
                    _('Validate changes and update document'), true);