No edit in supplier invoice quick entry fixed. @Braath Waate.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 19 Mar 2019 20:40:45 +0000 (21:40 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 19 Mar 2019 20:40:45 +0000 (21:40 +0100)
purchasing/includes/ui/invoice_ui.inc
purchasing/supplier_invoice.php

index 93524a4b3cd7503e2152e6e4dd6c9eaf99a07478..7805faec6106e6511c773a155ba09275fde1a82e 100644 (file)
@@ -199,8 +199,9 @@ function invoice_totals(&$supp_trans)
 function display_gl_controls(&$supp_trans, $k)
 {
        $accs = get_supplier_accounts($supp_trans->supplier_id);
-       $_POST['gl_code'] = $accs['purchase_account'] ? 
-               $accs['purchase_account'] : get_company_pref('default_cogs_act');
+    if (!isset($_POST['gl_code']))
+               $_POST['gl_code'] = $accs['purchase_account'] ? 
+                       $accs['purchase_account'] : get_company_pref('default_cogs_act');
 
        alt_table_row_color($k);
        echo gl_all_accounts_list('gl_code', null, true, true);
@@ -316,7 +317,8 @@ function display_gl_items(&$supp_trans, $mode=0)
                        {
                                delete_button_cell("Delete2" . $entered_gl_code->Counter, _("Delete"),
                                          _('Remove line from document'));
-                               label_cell("");
+                edit_button_cell("Edit" . $entered_gl_code->Counter, _("Edit"),
+                      _('Edit line from document'));
                        }       
                        end_row();
                        if ($mode > 1) {
index 080e8fc36f3d52fadf8e22becda73dc00b3db55c..a21d0c9123d846c8f98ab1c8903472e7d6e3bde5 100644 (file)
@@ -352,6 +352,20 @@ if ($id4 != -1)
        $Ajax->activate('gl_items');
 }
 
+$id5 = find_submit('Edit');
+if ($id5 != -1)
+{
+    $_POST['gl_code'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_code;
+    $_POST['dimension_id'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_dim;
+    $_POST['dimension2_id'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_dim2;
+    $_POST['amount'] = $_SESSION['supp_trans']->gl_codes[$id5]->amount;
+    $_POST['memo_'] = $_SESSION['supp_trans']->gl_codes[$id5]->memo_;
+
+       $_SESSION['supp_trans']->remove_gl_codes_from_trans($id5);
+       reset_tax_input();
+       $Ajax->activate('gl_items');
+}
+
 $id2 = -1;
 if ($_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))
 {