Fixed edition of purchase order (bug #0000001)
[fa-stable.git] / gl / gl_payment.php
index 12d05480f5dbf4b393e2b70947b296f85fc4879b..60efb8ae655585504fc28833d988f2de6d1e1aae 100644 (file)
@@ -17,7 +17,7 @@ if ($use_popup_windows)
        $js .= get_js_open_window(800, 500);
 if ($use_date_picker)
        $js .= get_js_date_picker();
-set_focus('CodeID2');
+
 page(_("Bank Account Payment Entry"), false, false, '', $js);
 
 //-----------------------------------------------------------------------------------------------
@@ -183,6 +183,7 @@ function handle_update_item()
        $_SESSION['pay_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'],
                $_POST['dimension2_id'], input_num('amount'), $_POST['LineMemo']);
     }
+       set_focus('_code_id_edit');
 }
 
 //-----------------------------------------------------------------------------------------------
@@ -205,20 +206,30 @@ function handle_new_item()
 
 //-----------------------------------------------------------------------------------------------
 
-if (isset($_GET['Delete']) || isset($_GET['Edit']))
+if (isset($_GET['Edit'])) {
+       copy_from_py();
+       set_focus('dimension_id');
+}
+if (isset($_GET['Delete'])) {
        copy_from_py();
-
-if (isset($_GET['Delete']))
        handle_delete_item();
-
-if (isset($_POST['AddItem']) || isset($_POST['UpdateItem']))
+       set_focus('_code_id_edit');
+}
+if (isset($_POST['AddItem'])) {
        copy_to_py();
-
-if (isset($_POST['AddItem']))
        handle_new_item();
-
-if (isset($_POST['UpdateItem']))
+       set_focus('_code_id_edit');
+}
+if (isset($_POST['UpdateItem'])) {
+       copy_to_py();
        handle_update_item();
+       set_focus('_code_id_edit');
+}
+if (isset($_POST['CancelItemChanges']))
+       set_focus('_code_id_edit');
+
+if (isset($_POST['EditItem']))
+       set_focus('dimension_id');
 
 //-----------------------------------------------------------------------------------------------
 
@@ -244,9 +255,13 @@ end_table(1);
 
 if (!isset($_POST['Process']))
 {
-    submit_center_first('Update', _("Update"));
        if ($_SESSION['pay_items']->count_gl_items() >= 1)
+       {
+       submit_center_first('Update', _("Update"));
            submit_center_last('Process', _("Process Payment"));
+       }
+       else
+       submit_center('Update', _("Update"));
 }
 
 end_form();