From e1c41b82acc4ea68f59acb1f70b12800c0c7683d Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Wed, 22 Apr 2009 21:31:31 +0000 Subject: [PATCH] Slightly changed inactive record support --- includes/ui/ui_input.inc | 17 ++++++++++++++--- includes/ui/ui_lists.inc | 10 +++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 091a874c..82279aea 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -754,7 +754,7 @@ function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $ // displays value of inactive field as checkbox cell. // Also updates database record after status change. // -function inactive_status_cell($id, $value, $table, $key) +function inactive_control_cell($id, $value, $table, $key) { global $Ajax; @@ -773,7 +773,7 @@ function inactive_status_cell($id, $value, $table, $key) // // Displays controls for optional display of inactive records // -function show_inactive_row($th) { +function inactive_control_row($th) { echo "" ."
" . checkbox(null, 'show_inactive', null, true). _("Show also Inactive") @@ -781,5 +781,16 @@ function show_inactive_row($th) { . submit('Update', _('Update'), false, '', null) ."
"; } - +// +// Inserts additional column header when display of inactive records is on. +// +function inactive_control_column(&$th) { + global $Ajax; + + if (check_value('show_inactive')) + array_insert($th, count($th)-2 , _("Inactive")); + if (get_post('_show_inactive_update')) { + $Ajax->activate('_page_body'); + } +} ?> \ No newline at end of file diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 9312460b..1ef96705 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -652,7 +652,7 @@ function stock_items_list($name, $selected_id=null, $all_option=false, $submit_o { global $all_items; - $sql = "SELECT stock_id, s.description, c.description, inactive + $sql = "SELECT stock_id, s.description, c.description, s.inactive FROM ".TB_PREF."stock_master s,".TB_PREF."stock_category c WHERE s.category_id=c.category_id"; return combo_input($name, $selected_id, $sql, 'stock_id', 's.description', @@ -703,7 +703,7 @@ function sales_items_list($name, $selected_id=null, $all_option=false, global $all_items; // all sales codes $sql = "SELECT i.item_code, i.description, c.description, count(*)>1 as kit, - inactive + i.inactive FROM ".TB_PREF."item_codes i LEFT JOIN @@ -768,7 +768,7 @@ function base_stock_items_list($where, $name, $selected_id=null, { global $all_items; - $sql = "SELECT stock_id, s.description, c.description, inactive + $sql = "SELECT stock_id, s.description, c.description, s.inactive FROM ".TB_PREF."stock_master s,".TB_PREF."stock_category c WHERE s.category_id=c.category_id"; @@ -1559,14 +1559,14 @@ function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=fals $cells=false, $all_option=false, $submit_on_change=false) { if ($skip_bank_accounts) - $sql = "SELECT chart.account_code, chart.account_name, type.name, inactive + $sql = "SELECT chart.account_code, chart.account_name, type.name, chart.inactive FROM (".TB_PREF."chart_master chart,".TB_PREF."chart_types type) " ."LEFT JOIN ".TB_PREF."bank_accounts acc " ."ON chart.account_code=acc.account_code WHERE acc.account_code IS NULL AND chart.account_type=type.id"; else - $sql = "SELECT chart.account_code, chart.account_name, type.name, inactive + $sql = "SELECT chart.account_code, chart.account_name, type.name, chart.inactive FROM ".TB_PREF."chart_master chart,".TB_PREF."chart_types type WHERE chart.account_type=type.id"; -- 2.30.2