Allow editing account when editing a row in GL Bank and GL Journal Entry
[fa-stable.git] / gl / includes / ui / gl_journal_ui.inc
index db92a7bb04660e09836078a881a047fdc88b7e33..04d703dda35f368e6ef9860506c7bea783dd7d29 100644 (file)
@@ -27,10 +27,8 @@ function display_order_header(&$Order)
     date_cells(_("Date:"), 'date_', '', $new);
 
        table_section(2, $qes ? "20%" : "50%");
-       if ($new)
-               ref_cells(_("Reference:"), 'ref', '');
-       else
-               label_cells(_("Reference:"), $Order->reference);
+       ref_cells(_("Reference:"), 'ref', '');
+       hidden('ref_original');
        end_row();
 
 
@@ -152,6 +150,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
        $id = find_submit('Edit');
        if ($Index != -1 && $Index == $id)
        {
+           // Modifying an existing row
                $item = $order->gl_items[$Index];
                $_POST['code_id'] = $item->code_id;
                $_POST['dimension_id'] = $item->dimension_id;
@@ -170,9 +169,8 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
                $_POST['LineMemo'] = $item->reference;
 
                hidden('Index', $id);
-               hidden('code_id', $item->code_id);
-               label_cell($_POST['code_id']);
-               label_cell($item->description);
+               $skip_bank = !$_SESSION["wa_current_user"]->can_access('SA_BANKJOURNAL');
+               gl_all_accounts_list('code_id', null, $skip_bank, true);
                if ($dim >= 1) 
                        dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
                if ($dim > 1) 
@@ -181,6 +179,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
        }
        else
        {
+           // Adding a new row
                $_POST['AmountDebit'] = '';  //price_format(0);
                $_POST['AmountCredit'] = ''; //price_format(0);
                $_POST['dimension_id'] = 0;
@@ -206,7 +205,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
 
        small_amount_cells(null, 'AmountDebit');
        small_amount_cells(null, 'AmountCredit');
-       text_cells_ex(null, 'LineMemo', 35, 50);
+       text_cells_ex(null, 'LineMemo', 35, 255);
 
        if ($id != -1)
        {