Eliminated non-static method calls and other bulk fixes to fix php5 warnings
[fa-stable.git] / gl / manage / bank_accounts.php
index 45bea5e819c3cc174eaa3036ed60167cf37e5b48..c70fc9e9aa14059b2eb01496ce2ccecb1da118f1 100644 (file)
@@ -9,8 +9,8 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-$page_security = 10;
-$path_to_root="../..";
+$page_security = 'SA_BANKACCOUNT';
+$path_to_root = "../..";
 include($path_to_root . "/includes/session.inc");
 
 page(_("Bank Accounts"));
@@ -100,8 +100,9 @@ if ($Mode == 'RESET')
 
 $sql = "SELECT account.*, gl_account.account_name 
        FROM ".TB_PREF."bank_accounts account, ".TB_PREF."chart_master gl_account 
-       WHERE account.account_code = gl_account.account_code"
-       ." ORDER BY account_code, bank_curr_code";
+       WHERE account.account_code = gl_account.account_code";
+if (!check_value('show_inactive')) $sql .= " AND !account.inactive";
+$sql .= " ORDER BY account_code, bank_curr_code";
 
 $result = db_query($sql,"could not get bank accounts");
 
@@ -112,6 +113,7 @@ start_table("$table_style width='80%'");
 
 $th = array(_("Account Name"), _("Type"), _("Currency"), _("GL Account"), 
        _("Bank"), _("Number"), _("Bank Address"),'','');
+inactive_control_column($th);
 table_header($th);     
 
 $k = 0; 
@@ -121,21 +123,20 @@ while ($myrow = db_fetch($result))
        alt_table_row_color($k);
 
     label_cell($myrow["bank_account_name"], "nowrap");
-       label_cell(bank_account_types::name($myrow["account_type"]), "nowrap");
+       label_cell($bank_account_types[$myrow["account_type"]], "nowrap");
     label_cell($myrow["bank_curr_code"], "nowrap");
     label_cell($myrow["account_code"] . " " . $myrow["account_name"], "nowrap");
     label_cell($myrow["bank_name"], "nowrap");
     label_cell($myrow["bank_account_number"], "nowrap");
     label_cell($myrow["bank_address"]);
+       inactive_control_cell($myrow["id"], $myrow["inactive"], 'bank_accounts', 'id');
        edit_button_cell("Edit".$myrow["id"], _("Edit"));
        delete_button_cell("Delete".$myrow["id"], _("Delete"));
     end_row(); 
 }
 
-end_table();
-end_form();
-echo '<br>';
-start_form();
+inactive_control_row($th);
+end_table(1);
 
 $is_editing = $selected_id != -1; 
 
@@ -156,14 +157,21 @@ if ($is_editing)
   }
        hidden('selected_id', $selected_id);
        hidden('account_code');
+       hidden('account_type');
        hidden('BankAccountCurrency', $_POST['BankAccountCurrency']);   
        set_focus('bank_account_name');
 } 
 
 text_row(_("Bank Account Name:"), 'bank_account_name', null, 50, 100);
 
-bank_account_types_list_row(_("Account Type:"), 'account_type', null); 
-
+if ($is_editing) 
+{
+       label_row(_("Account Type:"), $bank_account_types[$_POST['account_type']]);
+} 
+else 
+{
+       bank_account_types_list_row(_("Account Type:"), 'account_type', null); 
+}
 if ($is_editing) 
 {
        label_row(_("Bank Account Currency:"), $_POST['BankAccountCurrency']);
@@ -184,7 +192,7 @@ textarea_row(_("Bank Address:"), 'bank_address', null, 40, 5);
 
 end_table(1);
 
-submit_add_or_update_center($selected_id == -1, '', 'default');
+submit_add_or_update_center($selected_id == -1, '', 'both');
 
 end_form();