From: Janusz Dobrowolski Date: Sat, 3 Feb 2018 09:14:39 +0000 (+0100) Subject: Journal Edition: allow edit reconciliation status for bank related journals. X-Git-Tag: v2.4.4~16 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=c23ac0e7ff87228e01c3f84ba72aac9084b7c88e Journal Edition: allow edit reconciliation status for bank related journals. --- diff --git a/gl/gl_journal.php b/gl/gl_journal.php index 34abbedf..e8af7d23 100644 --- a/gl/gl_journal.php +++ b/gl/gl_journal.php @@ -129,7 +129,6 @@ function create_cart($type=0, $trans_no=0) } $cart->memo_ = get_comments_string($type, $trans_no); $cart->reference = $header['reference']; - // update net_amounts from tax register // retrieve tax details @@ -328,6 +327,15 @@ if (isset($_POST['Process'])) $cart->tax_info = false; $trans_no = write_journal_entries($cart); + // retain the reconciled status if desired by user + if (isset($_POST['reconciled']) + && $_POST['reconciled'] == 1) { + $sql = "UPDATE ".TB_PREF."bank_trans SET reconciled=".db_escape($_POST['reconciled_date']) + ." WHERE type=" . ST_JOURNAL . " AND trans_no=".db_escape($trans_no); + + db_query($sql, "Can't change reconciliation status"); + } + $cart->clear_items(); new_doc_date($_POST['date_']); unset($_SESSION['journal_items']); diff --git a/gl/includes/db/gl_db_bank_trans.inc b/gl/includes/db/gl_db_bank_trans.inc index a4228f5c..5ffa2d0c 100644 --- a/gl/includes/db/gl_db_bank_trans.inc +++ b/gl/includes/db/gl_db_bank_trans.inc @@ -76,13 +76,13 @@ function get_bank_trans($type, $trans_no=null, $person_type_id=null, $person_id= LEFT JOIN ".TB_PREF."suppliers supplier ON supplier.supplier_id = st.supplier_id, ".TB_PREF."bank_accounts act WHERE act.id=bt.bank_act "; - if ($type != null) + if (isset($type)) $sql .= " AND bt.type=".db_escape($type); - if ($trans_no != null) + if (isset($trans_no)) $sql .= " AND bt.trans_no = ".db_escape($trans_no); - if ($person_type_id != null) + if (isset($person_type_id)) $sql .= " AND bt.person_type_id = ".db_escape($person_type_id); - if ($person_id != null) + if (isset($person_id)) $sql .= " AND bt.person_id = ".db_escape($person_id); $sql .= " ORDER BY trans_date, bt.id"; diff --git a/gl/includes/ui/gl_journal_ui.inc b/gl/includes/ui/gl_journal_ui.inc index 675d8734..44762f7e 100644 --- a/gl/includes/ui/gl_journal_ui.inc +++ b/gl/includes/ui/gl_journal_ui.inc @@ -79,6 +79,16 @@ function display_order_header(&$Order) } check_row(_('Include in tax register:'), 'taxable_trans', null, true); + // Query the user to retain the reconciled status + if (!$new) { + $result = get_bank_trans(ST_JOURNAL, $Order->order_id); + $row = db_fetch($result); + if ($row + && $row['reconciled']) { + check_row(_('Reconciled:'), 'reconciled', 1, true); + hidden('reconciled_date', $row['reconciled']); + } + } end_outer_table(1); }