From 80dd97a37f674cc3691fa04af4c29607067566b2 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sun, 13 Sep 2009 21:14:10 +0000 Subject: [PATCH] Eliminated non-static method calls and other bulk fixes to fix php5 warnings --- admin/db/voiding_db.inc | 8 ++-- admin/display_prefs.php | 2 +- admin/fiscalyears.php | 4 +- admin/forms_setup.php | 2 +- admin/view_print_transaction.php | 4 +- admin/void_transaction.php | 8 ++-- dimensions/dimension_entry.php | 12 ++--- dimensions/includes/dimensions_db.inc | 10 ++-- dimensions/inquiry/search_dimensions.php | 2 +- dimensions/view/view_dimension.php | 4 +- frontaccounting.php | 4 +- gl/bank_account_reconcile.php | 6 ++- gl/bank_transfer.php | 13 ++++-- gl/gl_bank.php | 24 +++++----- gl/gl_journal.php | 14 +++--- gl/includes/db/gl_db_banking.inc | 28 ++++++----- gl/includes/db/gl_db_trans.inc | 10 ++-- gl/includes/ui/gl_bank_ui.inc | 32 ++++++------- gl/inquiry/bank_inquiry.php | 4 +- gl/inquiry/gl_account_inquiry.php | 6 +-- gl/inquiry/journal_inquiry.php | 4 +- gl/manage/bank_accounts.php | 4 +- gl/manage/gl_account_types.php | 2 +- gl/view/bank_transfer_view.php | 11 +++-- gl/view/gl_deposit_view.php | 12 ++--- gl/view/gl_payment_view.php | 12 ++--- gl/view/gl_trans_view.php | 8 ++-- inventory/adjustments.php | 10 ++-- inventory/cost_update.php | 2 +- inventory/includes/db/items_adjust_db.inc | 22 +++++---- inventory/includes/db/items_trans_db.inc | 8 ++-- inventory/includes/db/items_transfer_db.inc | 18 ++++---- inventory/includes/item_adjustments_ui.inc | 4 +- inventory/includes/stock_transfers_ui.inc | 4 +- inventory/inquiry/stock_movements.php | 6 +-- inventory/manage/movement_types.php | 2 +- inventory/transfers.php | 9 ++-- inventory/view/view_adjustment.php | 6 +-- inventory/view/view_transfer.php | 8 ++-- .../includes/db/work_order_issues_db.inc | 4 +- .../db/work_order_produce_items_db.inc | 4 +- manufacturing/includes/db/work_orders_db.inc | 28 +++++------ .../includes/db/work_orders_quick_db.inc | 46 ++++++++++--------- manufacturing/includes/manufacturing_ui.inc | 24 +++++----- .../includes/work_order_issue_ui.inc | 4 +- manufacturing/search_work_orders.php | 10 ++-- manufacturing/view/wo_issue_view.php | 4 +- manufacturing/view/wo_production_view.php | 4 +- manufacturing/view/work_order_view.php | 8 ++-- manufacturing/work_order_add_finished.php | 12 ++--- manufacturing/work_order_costs.php | 14 +++--- manufacturing/work_order_entry.php | 28 +++++------ manufacturing/work_order_issue.php | 6 ++- manufacturing/work_order_release.php | 2 +- purchasing/allocations/supplier_allocate.php | 2 +- .../allocations/supplier_allocation_main.php | 6 ++- purchasing/includes/db/grn_db.inc | 4 +- purchasing/includes/db/invoice_db.inc | 8 ++-- purchasing/includes/db/po_db.inc | 10 ++-- purchasing/includes/db/supp_payment_db.inc | 8 ++-- purchasing/includes/db/suppalloc_db.inc | 2 +- purchasing/includes/purchasing_db.inc | 2 +- purchasing/includes/ui/grn_ui.inc | 6 +-- purchasing/includes/ui/invoice_ui.inc | 10 ++-- purchasing/includes/ui/po_ui.inc | 8 ++-- purchasing/inquiry/po_search.php | 2 +- purchasing/inquiry/po_search_completed.php | 6 +-- .../inquiry/supplier_allocation_inquiry.php | 10 ++-- purchasing/inquiry/supplier_inquiry.php | 11 +++-- purchasing/po_entry_items.php | 8 ++-- purchasing/po_receive_items.php | 8 ++-- purchasing/supplier_credit.php | 6 +-- purchasing/supplier_invoice.php | 19 ++++---- purchasing/supplier_payment.php | 6 ++- purchasing/view/view_supp_credit.php | 2 +- purchasing/view/view_supp_payment.php | 4 +- reporting/includes/header2.inc | 4 +- reporting/includes/reporting.inc | 8 ++-- reporting/includes/reports_classes.inc | 6 +-- reporting/rep101.php | 10 ++-- reporting/rep102.php | 10 ++-- reporting/rep103.php | 4 +- reporting/rep104.php | 6 +-- reporting/rep105.php | 4 +- reporting/rep108.php | 6 +-- reporting/rep201.php | 10 ++-- reporting/rep202.php | 10 ++-- reporting/rep203.php | 10 ++-- reporting/rep204.php | 4 +- reporting/rep301.php | 4 +- reporting/rep302.php | 4 +- reporting/rep303.php | 4 +- reporting/rep304.php | 10 ++-- reporting/rep409.php | 4 +- reporting/rep601.php | 6 +-- reporting/rep702.php | 8 ++-- reporting/rep704.php | 6 +-- reporting/rep709.php | 4 +- reporting/rep710.php | 6 +-- sales/allocations/customer_allocate.php | 4 +- .../allocations/customer_allocation_main.php | 6 ++- sales/create_recurrent_invoices.php | 8 ++-- sales/credit_note_entry.php | 3 +- sales/customer_credit_invoice.php | 8 ++-- sales/customer_delivery.php | 16 ++++--- sales/customer_invoice.php | 8 ++-- sales/customer_payments.php | 10 ++-- sales/includes/cart_class.inc | 8 ++-- sales/includes/db/cust_trans_db.inc | 8 ++-- sales/includes/db/custalloc_db.inc | 6 +-- sales/includes/db/payment_db.inc | 10 ++-- sales/includes/db/sales_credit_db.inc | 12 +++-- sales/includes/db/sales_delivery_db.inc | 7 +-- sales/includes/db/sales_invoice_db.inc | 7 +-- sales/includes/db/sales_order_db.inc | 10 ++-- sales/includes/sales_db.inc | 2 +- sales/includes/ui/sales_credit_ui.inc | 6 +-- sales/includes/ui/sales_order_ui.inc | 10 ++-- sales/inquiry/customer_allocation_inquiry.php | 18 ++++---- sales/inquiry/customer_inquiry.php | 16 ++++--- sales/inquiry/sales_deliveries_view.php | 4 +- sales/inquiry/sales_orders_view.php | 4 +- sales/manage/customers.php | 2 +- sales/sales_order_entry.php | 14 ++++-- sales/view/view_credit.php | 2 +- sales/view/view_dispatch.php | 2 +- sales/view/view_invoice.php | 4 +- sales/view/view_receipt.php | 10 ++-- taxes/tax_groups.php | 8 ++-- 129 files changed, 588 insertions(+), 488 deletions(-) diff --git a/admin/db/voiding_db.inc b/admin/db/voiding_db.inc index cb433def..e8a3f14f 100644 --- a/admin/db/voiding_db.inc +++ b/admin/db/voiding_db.inc @@ -54,13 +54,13 @@ function void_transaction($type, $type_no, $date_, $memo_) post_void_customer_trans($type, $type_no); break; - case systypes::location_transfer() : // it's a stock transfer + case ST_LOCTRANSFER : // it's a stock transfer if (get_stock_transfer_items($type_no) == null) return false; void_stock_transfer($type_no); break; - case systypes::inventory_adjustment() : // it's a stock adjustment + case ST_INVADJUST : // it's a stock adjustment if (get_stock_adjustment_items($type_no) == null) return false; void_stock_adjustment($type_no); @@ -78,7 +78,7 @@ function void_transaction($type, $type_no, $date_, $memo_) return false; break; - case systypes::work_order() : // it's a work order + case ST_WORKORDER : // it's a work order if (!get_work_order($type_no, true)) return false; void_work_order($type_no); @@ -100,7 +100,7 @@ function void_transaction($type, $type_no, $date_, $memo_) case 32: // it's a sales quotation return false; - case systypes::cost_update() : // it's a stock cost update + case ST_COSTUPDATE : // it's a stock cost update return false; break; } diff --git a/admin/display_prefs.php b/admin/display_prefs.php index 40795285..2581b259 100644 --- a/admin/display_prefs.php +++ b/admin/display_prefs.php @@ -45,7 +45,7 @@ if (isset($_POST['setprefs'])) $_POST['language'], check_value('sticky_doc_date'), $_POST['startup_tab']); if ($chg_lang) - language::set_language($_POST['language']); + $_SESSION['language']->set_language($_POST['language']); // refresh main menu flush_dir($comp_path.'/'.user_company().'/js_cache'); diff --git a/admin/fiscalyears.php b/admin/fiscalyears.php index cc5c0029..e7a2ff74 100644 --- a/admin/fiscalyears.php +++ b/admin/fiscalyears.php @@ -108,7 +108,7 @@ function close_year($year) if ($balance != 0.0) { - $trans_type = systypes::journal_entry(); + $trans_type = ST_JOURNAL; $trans_id = get_next_trans_no($trans_type); add_gl_trans($trans_type, $trans_id, $to, $co['retained_earnings_act'], @@ -244,7 +244,7 @@ function delete_this_fiscalyear($selected_id) db_query($sql, "Could not delete purchase order details"); $sql = "DELETE FROM ".TB_PREF."purch_orders WHERE order_no = {$row['order_no']}"; db_query($sql, "Could not delete purchase order"); - delete_attachments_and_comments(systypes::po(), $row['order_no']); + delete_attachments_and_comments(ST_PURCHORDER, $row['order_no']); } } $sql = "SELECT id FROM ".TB_PREF."grn_batch WHERE delivery_date <= '$to'"; diff --git a/admin/forms_setup.php b/admin/forms_setup.php index 33982b1e..bb21dc36 100644 --- a/admin/forms_setup.php +++ b/admin/forms_setup.php @@ -53,7 +53,7 @@ while ($type = db_fetch($systypes)) table_section(2); table_header($th); } - ref_row(systypes::name($type["type_id"]), 'id' . $type["type_id"], '', $type["next_reference"]); + ref_row($systypes_array[$type["type_id"]], 'id' . $type["type_id"], '', $type["next_reference"]); } end_outer_table(1); diff --git a/admin/view_print_transaction.php b/admin/view_print_transaction.php index 93ae00cd..aca82ee8 100644 --- a/admin/view_print_transaction.php +++ b/admin/view_print_transaction.php @@ -119,8 +119,8 @@ function handle_search() $print_type = $_POST['filterType']; - $print_out = ($print_type == 10 || $print_type == 11 || $print_type == systypes::cust_dispatch() || - $print_type == systypes::po() || $print_type == systypes::sales_order() || $print_type == systypes::sales_quotation()); + $print_out = ($print_type == 10 || $print_type == 11 || $print_type == ST_CUSTDELIVERY || + $print_type == ST_PURCHORDER || $print_type == ST_SALESORDER || $print_type == ST_SALESQUOTE); $cols = array( _("#"), diff --git a/admin/void_transaction.php b/admin/void_transaction.php index c28c916b..23cb4237 100644 --- a/admin/void_transaction.php +++ b/admin/void_transaction.php @@ -56,12 +56,12 @@ function exist_transaction($type, $type_no) return false; break; - case systypes::location_transfer() : // it's a stock transfer + case ST_LOCTRANSFER : // it's a stock transfer if (get_stock_transfer_items($type_no) == null) return false; break; - case systypes::inventory_adjustment() : // it's a stock adjustment + case ST_INVADJUST : // it's a stock adjustment if (get_stock_adjustment_items($type_no) == null) return false; break; @@ -76,7 +76,7 @@ function exist_transaction($type, $type_no) return false; break; - case systypes::work_order() : // it's a work order + case ST_WORKORDER : // it's a work order if (!get_work_order($type_no, true)) return false; break; @@ -94,7 +94,7 @@ function exist_transaction($type, $type_no) case 30: // it's a sales order case 32: // it's a sales quotation return false; - case systypes::cost_update() : // it's a stock cost update + case ST_COSTUPDATE : // it's a stock cost update return false; break; } diff --git a/dimensions/dimension_entry.php b/dimensions/dimension_entry.php index 91904b53..7b9bcb37 100644 --- a/dimensions/dimension_entry.php +++ b/dimensions/dimension_entry.php @@ -105,19 +105,19 @@ function safe_exit() function can_process() { - global $selected_id; + global $selected_id, $Refs; if ($selected_id == -1) { - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error( _("The dimension reference must be entered.")); set_focus('ref'); return false; } - if (!is_new_reference($_POST['ref'], systypes::dimension())) + if (!is_new_reference($_POST['ref'], ST_DIMENSION)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); @@ -244,7 +244,7 @@ if ($selected_id != -1) $_POST['type_'] = $myrow["type_"]; $_POST['date_'] = sql2date($myrow["date_"]); $_POST['due_date'] = sql2date($myrow["due_date"]); - $_POST['memo_'] = get_comments_string(systypes::dimension(), $selected_id); + $_POST['memo_'] = get_comments_string(ST_DIMENSION, $selected_id); hidden('ref', $_POST['ref']); @@ -254,7 +254,7 @@ if ($selected_id != -1) } else { - ref_row(_("Dimension Reference:"), 'ref', '', references::get_next(systypes::dimension())); + ref_row(_("Dimension Reference:"), 'ref', '', $Refs->get_next(ST_DIMENSION)); } text_row_ex(_("Name") . ":", 'name', 50, 75); @@ -265,7 +265,7 @@ number_list_row(_("Type"), 'type_', null, 1, $dim); date_row(_("Start Date") . ":", 'date_'); -date_row(_("Date Required By") . ":", 'due_date', '', null, sys_prefs::default_dimension_required_by()); +date_row(_("Date Required By") . ":", 'due_date', '', null, $SysPrefs->default_dimension_required_by()); textarea_row(_("Memo:"), 'memo_', null, 40, 5); diff --git a/dimensions/includes/dimensions_db.inc b/dimensions/includes/dimensions_db.inc index 4013e4eb..2a89b596 100644 --- a/dimensions/includes/dimensions_db.inc +++ b/dimensions/includes/dimensions_db.inc @@ -11,6 +11,8 @@ ***********************************************************************/ function add_dimension($reference, $name, $type_, $date_, $due_date, $memo_) { + global $Refs; + begin_transaction(); $date = date2sql($date_); @@ -22,9 +24,9 @@ function add_dimension($reference, $name, $type_, $date_, $due_date, $memo_) $id = db_insert_id(); - add_comments(systypes::dimension(), $id, $date_, $memo_); + add_comments(ST_DIMENSION, $id, $date_, $memo_); - references::save(systypes::dimension(), $id, $reference); + $Refs->save(ST_DIMENSION, $id, $reference); commit_transaction(); @@ -46,7 +48,7 @@ function update_dimension($id, $name, $type_, $date_, $due_date, $memo_) db_query($sql, "could not update dimension"); - update_comments(systypes::dimension(), $id, null, $memo_); + update_comments(ST_DIMENSION, $id, null, $memo_); commit_transaction(); @@ -61,7 +63,7 @@ function delete_dimension($id) $sql="DELETE FROM ".TB_PREF."dimensions WHERE id=$id"; db_query($sql,"The dimension could not be deleted"); - delete_comments(systypes::dimension(), $id); + delete_comments(ST_DIMENSION, $id); commit_transaction(); } diff --git a/dimensions/inquiry/search_dimensions.php b/dimensions/inquiry/search_dimensions.php index eaf74c19..ffb1e612 100644 --- a/dimensions/inquiry/search_dimensions.php +++ b/dimensions/inquiry/search_dimensions.php @@ -96,7 +96,7 @@ $dim = get_company_pref('use_dimension'); function view_link($row) { - return get_dimensions_trans_view_str(systypes::dimension(), $row["id"]); + return get_dimensions_trans_view_str(ST_DIMENSION, $row["id"]); } function is_closed($row) diff --git a/dimensions/view/view_dimension.php b/dimensions/view/view_dimension.php index 9dfc01e8..bc0cdf5c 100644 --- a/dimensions/view/view_dimension.php +++ b/dimensions/view/view_dimension.php @@ -38,7 +38,7 @@ if (isset($_POST['Show'])) } -display_heading(systypes::name(systypes::dimension()) . " # " . $id); +display_heading($systypes_array[ST_DIMENSION] . " # " . $id); br(1); $myrow = get_dimension($id); @@ -63,7 +63,7 @@ label_cell(sql2date($myrow["date_"])); label_cell(sql2date($myrow["due_date"])); end_row(); -comments_display_row(systypes::dimension(), $id); +comments_display_row(ST_DIMENSION, $id); end_table(); diff --git a/frontaccounting.php b/frontaccounting.php index ffd9c7f5..033c9928 100644 --- a/frontaccounting.php +++ b/frontaccounting.php @@ -91,11 +91,11 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ { foreach ($installed_extensions as $ext) { - get_text::add_domain($_SESSION['language']->code, + $_SESSION['get_text']->add_domain($_SESSION['language']->code, $ext['folder']."/lang"); $class = $ext['name']."_app"; $this->add_application(new $class()); - get_text::add_domain($_SESSION['language']->code, + $_SESSION['get_text']->add_domain($_SESSION['language']->code, $path_to_root."/lang"); } } diff --git a/gl/bank_account_reconcile.php b/gl/bank_account_reconcile.php index 1810b641..1bc65300 100644 --- a/gl/bank_account_reconcile.php +++ b/gl/bank_account_reconcile.php @@ -59,7 +59,9 @@ function rec_checkbox($row) function systype_name($dummy, $type) { - return systypes::name($type); + global $systypes_array; + + return $systypes_array[$type]; } function trans_view($trans) @@ -86,7 +88,7 @@ function fmt_credit($row) function fmt_person($row) { - return payment_person_types::person_name($row["person_type_id"],$row["person_id"]); + return payment_person_name($row["person_type_id"],$row["person_id"]); } $update_pager = false; diff --git a/gl/bank_transfer.php b/gl/bank_transfer.php index b7c7fcc5..893fabea 100644 --- a/gl/bank_transfer.php +++ b/gl/bank_transfer.php @@ -34,7 +34,7 @@ check_db_has_bank_accounts(_("There are no bank accounts defined in the system." if (isset($_GET['AddedID'])) { $trans_no = $_GET['AddedID']; - $trans_type = systypes::bank_transfer(); + $trans_type = ST_BANKTRANSFER; display_notification_centered( _("Transfer has been entered")); @@ -53,7 +53,8 @@ if (isset($_POST['_DatePaid_changed'])) { function gl_payment_controls() { - global $table_style2; + global $table_style2, $Refs; + $home_currency = get_company_currency(); start_form(); @@ -85,7 +86,7 @@ function gl_payment_controls() table_section(2); - ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_transfer())); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKTRANSFER)); textarea_row(_("Memo:"), 'memo_', null, 40,4); @@ -100,6 +101,8 @@ function gl_payment_controls() function check_valid_entries() { + global $Refs; + if (!is_date($_POST['DatePaid'])) { display_error(_("The entered date is invalid.")); @@ -126,14 +129,14 @@ function check_valid_entries() set_focus('charge'); return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); return false; } - if (!is_new_reference($_POST['ref'], systypes::bank_transfer())) + if (!is_new_reference($_POST['ref'], ST_BANKTRANSFER)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); diff --git a/gl/gl_bank.php b/gl/gl_bank.php index aff95cb3..1e5718b5 100644 --- a/gl/gl_bank.php +++ b/gl/gl_bank.php @@ -29,11 +29,11 @@ if ($use_date_picker) if (isset($_GET['NewPayment'])) { $_SESSION['page_title'] = _("Bank Account Payment Entry"); - handle_new_order(systypes::bank_payment()); + handle_new_order(ST_BANKPAYMENT); } else if(isset($_GET['NewDeposit'])) { $_SESSION['page_title'] = _("Bank Account Deposit Entry"); - handle_new_order(systypes::bank_deposit()); + handle_new_order(ST_BANKDEPOSIT); } page($_SESSION['page_title'], false, false, '', $js); @@ -60,7 +60,7 @@ function line_start_focus() { if (isset($_GET['AddedID'])) { $trans_no = $_GET['AddedID']; - $trans_type = systypes::bank_payment(); + $trans_type = ST_BANKPAYMENT; display_notification_centered(_("Payment has been entered")); @@ -76,7 +76,7 @@ if (isset($_GET['AddedID'])) if (isset($_GET['AddedDep'])) { $trans_no = $_GET['AddedDep']; - $trans_type = systypes::bank_deposit(); + $trans_type = ST_BANKDEPOSIT; display_notification_centered(_("Deposit has been entered")); @@ -123,7 +123,7 @@ if (isset($_POST['Process'])) $input_error = 1; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error( _("You must enter a reference.")); set_focus('ref'); @@ -168,7 +168,7 @@ if (isset($_POST['Process'])) $_SESSION['pay_items']->clear_items(); unset($_SESSION['pay_items']); - meta_forward($_SERVER['PHP_SELF'], $trans_type==systypes::bank_payment() ? + meta_forward($_SERVER['PHP_SELF'], $trans_type==ST_BANKPAYMENT ? "AddedID=$trans_no" : "AddedDep=$trans_no"); } /*end of process credit note */ @@ -193,7 +193,7 @@ function check_item_data() //if (is_bank_account($_POST['code_id'])) //{ - // if ($_SESSION['pay_items']->trans_type == systypes::bank_payment()) + // if ($_SESSION['pay_items']->trans_type == ST_BANKPAYMENT) // display_error( _("You cannot make a payment to a bank account. Please use the transfer funds facility for this.")); // else // display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this.")); @@ -208,7 +208,7 @@ function check_item_data() function handle_update_item() { - $amount = ($_SESSION['pay_items']->trans_type==systypes::bank_payment() ? 1:-1) * input_num('amount'); + $amount = ($_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ? 1:-1) * input_num('amount'); if($_POST['UpdateItem'] != "" && check_item_data()) { $_SESSION['pay_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'], @@ -231,7 +231,7 @@ function handle_new_item() { if (!check_item_data()) return; - $amount = ($_SESSION['pay_items']->trans_type==systypes::bank_payment() ? 1:-1) * input_num('amount'); + $amount = ($_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ? 1:-1) * input_num('amount'); $_SESSION['pay_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'], $_POST['dimension2_id'], $amount, $_POST['LineMemo']); @@ -254,7 +254,7 @@ if (isset($_POST['CancelItemChanges'])) if (isset($_POST['go'])) { display_quick_entries($_SESSION['pay_items'], $_POST['person_id'], input_num('totamount'), - $_SESSION['pay_items']->trans_type==systypes::bank_payment() ? QE_PAYMENT : QE_DEPOSIT); + $_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ? QE_PAYMENT : QE_DEPOSIT); $_POST['totamount'] = price_format(0); $Ajax->activate('totamount'); line_start_focus(); } @@ -267,7 +267,7 @@ display_bank_header($_SESSION['pay_items']); start_table("$table_style2 width=90%", 10); start_row(); echo ""; -display_gl_items($_SESSION['pay_items']->trans_type==systypes::bank_payment() ? +display_gl_items($_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ? _("Payment Items"):_("Deposit Items"), $_SESSION['pay_items']); gl_options_controls(); echo ""; @@ -275,7 +275,7 @@ end_row(); end_table(1); submit_center_first('Update', _("Update"), '', null); -submit_center_last('Process', $_SESSION['pay_items']->trans_type==systypes::bank_payment() ? +submit_center_last('Process', $_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ? _("Process Payment"):_("Process Deposit"), '', 'default'); end_form(); diff --git a/gl/gl_journal.php b/gl/gl_journal.php index 33431822..9cfc9332 100644 --- a/gl/gl_journal.php +++ b/gl/gl_journal.php @@ -49,7 +49,7 @@ function line_start_focus() { if (isset($_GET['AddedID'])) { $trans_no = $_GET['AddedID']; - $trans_type = systypes::journal_entry(); + $trans_type = ST_JOURNAL; display_notification_centered( _("Journal entry has been entered") . " #$trans_no"); @@ -62,7 +62,7 @@ if (isset($_GET['AddedID'])) } elseif (isset($_GET['UpdatedID'])) { $trans_no = $_GET['UpdatedID']; - $trans_type = systypes::journal_entry(); + $trans_type = ST_JOURNAL; display_notification_centered( _("Journal entry has been updated") . " #$trans_no"); @@ -90,6 +90,8 @@ elseif (isset($_GET['ModifyGL'])) function create_cart($type=0, $trans_no=0) { + global $Refs; + if (isset($_SESSION['journal_items'])) { unset ($_SESSION['journal_items']); @@ -111,9 +113,9 @@ function create_cart($type=0, $trans_no=0) } $cart->memo_ = get_comments_string($type, $trans_no); $cart->tran_date = sql2date($date); - $cart->reference = references::get($type, $trans_no); + $cart->reference = $Refs->get($type, $trans_no); } else { - $cart->reference = references::get_next(0); + $cart->reference = $Refs->get_next(0); $cart->tran_date = new_doc_date(); } if (!is_date_in_fiscalyear($cart->tran_date)) @@ -158,13 +160,13 @@ if (isset($_POST['Process'])) $input_error = 1; } if ($_SESSION['journal_items']->order_id == 0) { - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error( _("You must enter a reference.")); set_focus('ref'); $input_error = 1; } - elseif (references::exists(systypes::journal_entry(), $_POST['ref'])) + elseif ($Refs->exists(ST_JOURNAL, $_POST['ref'])) { display_error( _("The entered reference is already in use.")); set_focus('ref'); diff --git a/gl/includes/db/gl_db_banking.inc b/gl/includes/db/gl_db_banking.inc index e73e1e3a..cc028ac7 100644 --- a/gl/includes/db/gl_db_banking.inc +++ b/gl/includes/db/gl_db_banking.inc @@ -27,11 +27,11 @@ function add_exchange_variation($trans_type, $trans_no, $date_, $acc_id, $accoun if ($diff != 0) { if ($trans_type == null) - $trans_type = systypes::journal_entry(); + $trans_type = ST_JOURNAL; if ($trans_no == null) $trans_no = get_next_trans_no($trans_type); if ($person_type_id == null) - $person_type_id = payment_person_types::misc(); + $person_type_id = PT_MISC; add_gl_trans($trans_type, $trans_no, $date_, $account, 0, 0, _("Exchange Variance"), -$diff, null, $person_type_id, $person_id); add_gl_trans($trans_type, $trans_no, $date_, get_company_pref('exchange_diff_act'), 0, 0, @@ -58,9 +58,11 @@ function add_exchange_variation_all() function add_bank_transfer($from_account, $to_account, $date_, $amount, $ref, $memo_, $charge=0) { + global $Refs; + begin_transaction(); - $trans_type = systypes::bank_transfer(); + $trans_type = ST_BANKTRANSFER; $currency = get_bank_account_currency($from_account); @@ -76,11 +78,11 @@ function add_bank_transfer($from_account, $to_account, $date_, add_bank_trans($trans_type, $trans_no, $from_account, $ref, $date_, -($amount + $charge), - payment_person_types::misc(), "", $currency, + PT_MISC, "", $currency, "Cannot insert a source bank transaction"); add_exchange_variation($trans_type, $trans_no, $date_, $from_account, $from_gl_account, - $currency, payment_person_types::misc(), ""); + $currency, PT_MISC, ""); if ($charge != 0) { @@ -97,15 +99,15 @@ function add_bank_transfer($from_account, $to_account, $date_, add_gl_balance($trans_type, $trans_no, $date_, -$total); add_bank_trans($trans_type, $trans_no, $to_account, $ref, - $date_, $amount, payment_person_types::misc(), "", + $date_, $amount, PT_MISC, "", $currency, "Cannot insert a destination bank transaction"); add_exchange_variation($trans_type, $trans_no, $date_, $from_account, $from_gl_account, - $currency, payment_person_types::misc(), ""); + $currency, PT_MISC, ""); add_comments($trans_type, $trans_no, $date_, $memo_); - references::save($trans_type, $trans_no, $ref); + $Refs->save($trans_type, $trans_no, $ref); add_audit_trail($trans_type, $trans_no, $date_); commit_transaction(); @@ -127,8 +129,10 @@ function add_bank_transfer($from_account, $to_account, $date_, function add_bank_transaction($trans_type, $from_account, $items, $date_, $person_type_id, $person_id, $person_detail_id, $ref, $memo_) { + global $Refs; + // we can only handle type 1 (payment)and type 2 (deposit) - if ($trans_type != systypes::bank_payment() && $trans_type != systypes::bank_deposit()) + if ($trans_type != ST_BANKPAYMENT && $trans_type != ST_BANKDEPOSIT) display_db_error("Invalid type ($trans_type) sent to add_bank_transaction"); $do_exchange_variance = false; @@ -141,7 +145,7 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_, // the gl items are already inversed/negated for type 2 (deposit) $total_amount = $items->gl_items_total(); - if ($person_type_id == payment_person_types::customer()) + if ($person_type_id == PT_CUSTOMER) { // we need to add a customer transaction record @@ -154,7 +158,7 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_, $ref, $cust_amount); } - elseif ($person_type_id == payment_person_types::supplier()) + elseif ($person_type_id == PT_SUPPLIER) { // we need to add a supplier transaction record // convert to supp currency @@ -225,7 +229,7 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_, add_comments($trans_type, $trans_no, $date_, $memo_); - references::save($trans_type, $trans_no, $ref); + $Refs->save($trans_type, $trans_no, $ref); add_audit_trail($trans_type, $trans_no, $date_); commit_transaction(); diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index 111d4e33..723ea087 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -142,8 +142,8 @@ function get_gl_wo_cost_trans($trans_id, $person_id=-1) { $sql = "SELECT ".TB_PREF."gl_trans.*, ".TB_PREF."chart_master.account_name FROM ".TB_PREF."gl_trans, ".TB_PREF."chart_master WHERE ".TB_PREF."chart_master.account_code=".TB_PREF."gl_trans.account - AND ".TB_PREF."gl_trans.type=".systypes::work_order()." AND ".TB_PREF."gl_trans.type_no=$trans_id - AND ".TB_PREF."gl_trans.person_type_id=".payment_person_types::WorkOrder(); + AND ".TB_PREF."gl_trans.type=".ST_WORKORDER." AND ".TB_PREF."gl_trans.type_no=$trans_id + AND ".TB_PREF."gl_trans.person_type_id=".PT_WORKORDER; if ($person_id != -1) $sql .= " AND ".TB_PREF."gl_trans.person_id=$person_id"; $sql .= " AND amount < 0"; @@ -356,6 +356,8 @@ function get_tax_summary($from, $to) // function write_journal_entries(&$cart, $reverse) { + global $Refs; + $date_ = $cart->tran_date; $ref = $cart->reference; $memo_ = $cart->memo_; @@ -393,7 +395,7 @@ function write_journal_entries(&$cart, $reverse) if ($new) { add_comments($trans_type, $trans_id, $date_, $memo_); - references::save($trans_type, $trans_id, $ref); + $Refs->save($trans_type, $trans_id, $ref); } else update_comments($trans_type, $trans_id, null, $memo_); @@ -430,7 +432,7 @@ function write_journal_entries(&$cart, $reverse) add_comments($trans_type, $trans_id_reverse, $reversingDate, $memo_); - references::save($trans_type, $trans_id_reverse, $ref); + $Refs->save($trans_type, $trans_id_reverse, $ref); add_audit_trail($trans_type, $trans_id_reverse, $reversingDate); } diff --git a/gl/includes/ui/gl_bank_ui.inc b/gl/includes/ui/gl_bank_ui.inc index f42e8e36..48c82392 100644 --- a/gl/includes/ui/gl_bank_ui.inc +++ b/gl/includes/ui/gl_bank_ui.inc @@ -11,8 +11,8 @@ ***********************************************************************/ function display_bank_header(&$order) { - global $table_style2, $Ajax; - $payment = $order->trans_type == systypes::bank_payment(); + global $table_style2, $Ajax, $Refs; + $payment = $order->trans_type == ST_BANKPAYMENT; div_start('pmt_header'); @@ -51,17 +51,17 @@ function display_bank_header(&$order) 'PayType', $_POST['PayType'], true); switch ($_POST['PayType']) { - case payment_person_types::misc() : + case PT_MISC : text_row_ex($payment ?_("To the Order of:"):_("Name:"), 'person_id', 40, 50); break; - //case payment_person_types::WorkOrder() : + //case PT_WORKORDER : // workorders_list_row(_("Work Order:"), 'person_id', null); // break; - case payment_person_types::supplier() : + case PT_SUPPLIER : supplier_list_row(_("Supplier:"), 'person_id', null, false, true, false, true); break; - case payment_person_types::customer() : + case PT_CUSTOMER : customer_list_row(_("Customer:"), 'person_id', null, false, true, false, true); if (db_customer_has_branches($_POST['person_id'])) @@ -71,12 +71,12 @@ function display_bank_header(&$order) } else { - $_POST['PersonDetailID'] = reserved_words::get_any_numeric(); + $_POST['PersonDetailID'] = ANY_NUMERIC; hidden('PersonDetailID'); } break; - case payment_person_types::QuickEntry() : + case PT_QUICKENTRY : quick_entries_list_row(_("Type").":", 'person_id', null, ($payment ? QE_PAYMENT : QE_DEPOSIT), true); $qid = get_quick_entry(get_post('person_id')); if (list_updated('person_id')) { @@ -91,7 +91,7 @@ function display_bank_header(&$order) // break; } - $person_currency = payment_person_types::person_currency($_POST['PayType'], $_POST['person_id']); + $person_currency = payment_person_currency($_POST['PayType'], $_POST['person_id']); $bank_currency = get_bank_account_currency($_POST['bank_account']); exchange_rate_display($bank_currency, $person_currency, $_POST['date_']); @@ -99,9 +99,9 @@ function display_bank_header(&$order) table_section(3, "33%"); if (isset($_GET['NewPayment'])) - ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_payment())); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKPAYMENT)); else - ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_deposit())); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKDEPOSIT)); end_outer_table(1); // outer table @@ -149,7 +149,7 @@ function display_gl_items($title, &$order) if ($dim > 1) label_cell(get_dimension_string($item->dimension2_id, true)); //amount_cell(abs($item->amount)); - if ($order->trans_type == systypes::bank_deposit()) + if ($order->trans_type == ST_BANKDEPOSIT) amount_cell(-$item->amount); else amount_cell($item->amount); @@ -182,7 +182,7 @@ function display_gl_items($title, &$order) function gl_edit_item_controls(&$order, $dim, $Index=null) { global $Ajax; - $payment = $order->trans_type == systypes::bank_payment(); + $payment = $order->trans_type == ST_BANKPAYMENT; start_row(); $id = find_submit('Edit'); @@ -216,17 +216,17 @@ function gl_edit_item_controls(&$order, $dim, $Index=null) $Ajax->activate('code_id'); } - if ($_POST['PayType'] == payment_person_types::customer()) + if ($_POST['PayType'] == PT_CUSTOMER) { $acc = get_branch_accounts($_POST['PersonDetailID']); $_POST['code_id'] = $acc['receivables_account']; } - elseif ($_POST['PayType'] == payment_person_types::supplier()) + elseif ($_POST['PayType'] == PT_SUPPLIER) { $acc = get_supplier_accounts($_POST['person_id']); $_POST['code_id'] = $acc['payable_account']; } - //elseif ($_POST['PayType'] == payment_person_types::WorkOrder()) + //elseif ($_POST['PayType'] == PT_WORKORDER) // $_POST['code_id'] = get_company_pref('default_assembly_act'); else { $_POST['code_id'] = diff --git a/gl/inquiry/bank_inquiry.php b/gl/inquiry/bank_inquiry.php index e287d77b..ec98d993 100644 --- a/gl/inquiry/bank_inquiry.php +++ b/gl/inquiry/bank_inquiry.php @@ -100,13 +100,13 @@ while ($myrow = db_fetch($result)) $running_total += $myrow["amount"]; $trandate = sql2date($myrow["trans_date"]); - label_cell(systypes::name($myrow["type"])); + label_cell($systypes_array[$myrow["type"]]); label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"])); label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"],$myrow['ref'])); label_cell($trandate); display_debit_or_credit_cells($myrow["amount"]); amount_cell($running_total); - label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"])); + label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"])); label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"])); end_row(); diff --git a/gl/inquiry/gl_account_inquiry.php b/gl/inquiry/gl_account_inquiry.php index 17a88907..3c415566 100644 --- a/gl/inquiry/gl_account_inquiry.php +++ b/gl/inquiry/gl_account_inquiry.php @@ -82,7 +82,7 @@ function gl_inquiry_controls() function show_results() { - global $path_to_root, $table_style; + global $path_to_root, $table_style, $systypes_array; if (!isset($_POST["account"]) || $_POST["account"] == "") return; @@ -145,14 +145,14 @@ function show_results() $trandate = sql2date($myrow["tran_date"]); - label_cell(systypes::name($myrow["type"])); + label_cell($systypes_array[$myrow["type"]]); label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true)); label_cell($trandate); if ($dim >= 1) label_cell(get_dimension_string($myrow['dimension_id'], true)); if ($dim > 1) label_cell(get_dimension_string($myrow['dimension2_id'], true)); - label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"])); + label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"])); display_debit_or_credit_cells($myrow["amount"]); amount_cell($running_total); label_cell($myrow['memo_']); diff --git a/gl/inquiry/journal_inquiry.php b/gl/inquiry/journal_inquiry.php index 6cfd3ccc..fee17602 100644 --- a/gl/inquiry/journal_inquiry.php +++ b/gl/inquiry/journal_inquiry.php @@ -64,7 +64,9 @@ function journal_pos($row) function systype_name($dummy, $type) { - return systypes::name($type); + global $systypes_array; + + return $systypes_array[$type]; } function view_link($row) diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php index a04d3c1e..c70fc9e9 100644 --- a/gl/manage/bank_accounts.php +++ b/gl/manage/bank_accounts.php @@ -123,7 +123,7 @@ 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"); @@ -166,7 +166,7 @@ text_row(_("Bank Account Name:"), 'bank_account_name', null, 50, 100); if ($is_editing) { - label_row(_("Account Type:"), bank_account_types::name($_POST['account_type'])); + label_row(_("Account Type:"), $bank_account_types[$_POST['account_type']]); } else { diff --git a/gl/manage/gl_account_types.php b/gl/manage/gl_account_types.php index fd7d92ab..12843843 100644 --- a/gl/manage/gl_account_types.php +++ b/gl/manage/gl_account_types.php @@ -137,7 +137,7 @@ while ($myrow = db_fetch($result)) $bs_text = get_account_class_name($myrow["class_id"]); - if ($myrow["parent"] == reserved_words::get_any_numeric()) + if ($myrow["parent"] == ANY_NUMERIC) { $parent_text = ""; } diff --git a/gl/view/bank_transfer_view.php b/gl/view/bank_transfer_view.php index 36932c3e..3ae52d96 100644 --- a/gl/view/bank_transfer_view.php +++ b/gl/view/bank_transfer_view.php @@ -25,7 +25,7 @@ if (isset($_GET["trans_no"])){ $trans_no = $_GET["trans_no"]; } -$result = get_bank_trans(systypes::bank_transfer(), $trans_no); +$result = get_bank_trans(ST_BANKTRANSFER, $trans_no); if (db_num_rows($result) != 2) display_db_error("Bank transfer does not contain two records", $sql); @@ -58,7 +58,7 @@ if ($from_trans['bank_curr_code'] != $to_trans['bank_curr_code']) $show_both_amounts = true; } -display_heading(systypes::name(systypes::bank_transfer()) . " #$trans_no"); +display_heading($systypes_array[ST_BANKTRANSFER] . " #$trans_no"); echo "
"; start_table("$table_style width=80%"); @@ -81,14 +81,15 @@ if ($show_both_amounts) end_row(); start_row(); label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'"); -label_cells(_("Transfer Type"), bank_account_types::transfer_type($from_trans['account_type']), "class='tableheader2'"); +label_cells(_("Transfer Type"), $bank_transfer_types[$from_trans['account_type']], + "class='tableheader2'"); label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'"); end_row(); -comments_display_row(systypes::bank_transfer(), $trans_no); +comments_display_row(ST_BANKTRANSFER, $trans_no); end_table(1); -is_voided_display(systypes::bank_transfer(), $trans_no, _("This transfer has been voided.")); +is_voided_display(ST_BANKTRANSFER, $trans_no, _("This transfer has been voided.")); end_page(true); ?> \ No newline at end of file diff --git a/gl/view/gl_deposit_view.php b/gl/view/gl_deposit_view.php index 52c01e01..04232dd7 100644 --- a/gl/view/gl_deposit_view.php +++ b/gl/view/gl_deposit_view.php @@ -27,7 +27,7 @@ if (isset($_GET["trans_no"])) } // get the pay-to bank payment info -$result = get_bank_trans(systypes::bank_deposit(), $trans_no); +$result = get_bank_trans(ST_BANKDEPOSIT, $trans_no); if (db_num_rows($result) != 1) display_db_error("duplicate payment bank transaction found", ""); @@ -68,19 +68,19 @@ label_cells(_("Amount"), number_format2($to_trans['amount'], user_price_dec()), label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'"); end_row(); start_row(); -label_cells(_("From"), payment_person_types::person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1"); -label_cells(_("Deposit Type"), bank_account_types::transfer_type($to_trans['account_type']), "class='tableheader2'"); +label_cells(_("From"), payment_person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1"); +label_cells(_("Deposit Type"), $bank_transfer_types[$to_trans['account_type']], "class='tableheader2'"); end_row(); start_row(); label_cells(_("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan=$colspan2"); end_row(); -comments_display_row(systypes::bank_deposit(), $trans_no); +comments_display_row(ST_BANKDEPOSIT, $trans_no); end_table(1); -is_voided_display(systypes::bank_deposit(), $trans_no, _("This deposit has been voided.")); +is_voided_display(ST_BANKDEPOSIT, $trans_no, _("This deposit has been voided.")); -$items = get_gl_trans(systypes::bank_deposit(), $trans_no); +$items = get_gl_trans(ST_BANKDEPOSIT, $trans_no); if (db_num_rows($items) == 0) { diff --git a/gl/view/gl_payment_view.php b/gl/view/gl_payment_view.php index b386c5c6..e71e3dff 100644 --- a/gl/view/gl_payment_view.php +++ b/gl/view/gl_payment_view.php @@ -27,7 +27,7 @@ if (isset($_GET["trans_no"])) } // get the pay-from bank payment info -$result = get_bank_trans(systypes::bank_payment(), $trans_no); +$result = get_bank_trans(ST_BANKPAYMENT, $trans_no); if (db_num_rows($result) != 1) display_db_error("duplicate payment bank transaction found", ""); @@ -66,19 +66,19 @@ label_cells(_("Amount"), number_format2(-$from_trans['amount'], user_price_dec() label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'"); end_row(); start_row(); -label_cells(_("Pay To"), payment_person_types::person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1"); -label_cells(_("Payment Type"),bank_account_types::transfer_type($from_trans['account_type']), "class='tableheader2'"); +label_cells(_("Pay To"), payment_person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1"); +label_cells(_("Payment Type"), $bank_transfer_types[$from_trans['account_type']], "class='tableheader2'"); end_row(); start_row(); label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan=$colspan2"); end_row(); -comments_display_row(systypes::bank_payment(), $trans_no); +comments_display_row(ST_BANKPAYMENT, $trans_no); end_table(1); -$voided = is_voided_display(systypes::bank_payment(), $trans_no, _("This payment has been voided.")); +$voided = is_voided_display(ST_BANKPAYMENT, $trans_no, _("This payment has been voided.")); -$items = get_gl_trans(systypes::bank_payment(), $trans_no); +$items = get_gl_trans(ST_BANKPAYMENT, $trans_no); if (db_num_rows($items)==0) { diff --git a/gl/view/gl_trans_view.php b/gl/view/gl_trans_view.php index 3ebedfa6..c48ed819 100644 --- a/gl/view/gl_trans_view.php +++ b/gl/view/gl_trans_view.php @@ -29,8 +29,8 @@ if (!isset($_GET['type_id']) || !isset($_GET['trans_no'])) function display_gl_heading($myrow) { - global $table_style; - $trans_name = systypes::name($_GET['type_id']); + global $table_style, $systypes_array; + $trans_name = $systypes_array[$_GET['type_id']]; start_table("$table_style width=95%"); $th = array(_("General Ledger Transaction Details"), _("Date"), _("Person/Item")); @@ -38,7 +38,7 @@ function display_gl_heading($myrow) start_row(); label_cell("$trans_name #" . $_GET['trans_no']); label_cell(sql2date($myrow["tran_date"])); - label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"])); + label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"])); end_row(); @@ -53,7 +53,7 @@ $result = db_query($sql,"could not get transactions"); if (db_num_rows($result) == 0) { - echo "

" . _("No general ledger transactions have been created for") . " " .systypes::name($_GET['type_id'])." " . _("number") . " " . $_GET['trans_no'] . "



"; + echo "

" . _("No general ledger transactions have been created for") . " " .$systypes_array$_GET['type_id']]." " . _("number") . " " . $_GET['trans_no'] . "



"; end_page(true); exit; } diff --git a/inventory/adjustments.php b/inventory/adjustments.php index 662b528b..3de3713f 100644 --- a/inventory/adjustments.php +++ b/inventory/adjustments.php @@ -38,7 +38,7 @@ check_db_has_movement_types(_("There are no inventory movement types defined in if (isset($_GET['AddedID'])) { $trans_no = $_GET['AddedID']; - $trans_type = systypes::inventory_adjustment(); + $trans_type = ST_INVADJUST; display_notification_centered(_("Items adjustment has been processed")); display_note(get_trans_view_str($trans_type, $trans_no, _("&View this adjustment"))); @@ -69,7 +69,7 @@ function handle_new_order() session_register("adj_items"); - $_SESSION['adj_items'] = new items_cart(systypes::inventory_adjustment()); + $_SESSION['adj_items'] = new items_cart(ST_INVADJUST); $_POST['AdjDate'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['AdjDate'])) $_POST['AdjDate'] = end_fiscalyear(); @@ -80,6 +80,8 @@ function handle_new_order() function can_process() { + global $Refs; + $adj = &$_SESSION['adj_items']; if (count($adj->line_items) == 0) { @@ -87,14 +89,14 @@ function can_process() set_focus('stock_id'); return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error( _("You must enter a reference.")); set_focus('ref'); return false; } - if (!is_new_reference($_POST['ref'], systypes::inventory_adjustment())) + if (!is_new_reference($_POST['ref'], ST_INVADJUST)) { display_error( _("The entered reference is already in use.")); set_focus('ref'); diff --git a/inventory/cost_update.php b/inventory/cost_update.php index ba8a39c7..bfaf0f33 100644 --- a/inventory/cost_update.php +++ b/inventory/cost_update.php @@ -68,7 +68,7 @@ if (isset($_POST['UpdateData'])) if ($update_no > 0) { - display_note(get_gl_view_str(systypes::cost_update(), $update_no, _("View the GL Journal Entries for this Cost Update")), 0, 1); + display_note(get_gl_view_str(ST_COSTUPDATE, $update_no, _("View the GL Journal Entries for this Cost Update")), 0, 1); } } } diff --git a/inventory/includes/db/items_adjust_db.inc b/inventory/includes/db/items_adjust_db.inc index b5111069..ae2e25c7 100644 --- a/inventory/includes/db/items_adjust_db.inc +++ b/inventory/includes/db/items_adjust_db.inc @@ -13,9 +13,11 @@ function add_stock_adjustment($items, $location, $date_, $type, $increase, $reference, $memo_) { + global $Refs; + begin_transaction(); - $adj_id = get_next_trans_no(systypes::inventory_adjustment()); + $adj_id = get_next_trans_no(ST_INVADJUST); foreach ($items as $line_item) { @@ -27,10 +29,10 @@ function add_stock_adjustment($items, $location, $date_, $type, $increase, $refe $line_item->quantity, $line_item->standard_cost, $memo_); } - add_comments(systypes::inventory_adjustment(), $adj_id, $date_, $memo_); + add_comments(ST_INVADJUST, $adj_id, $date_, $memo_); - references::save(systypes::inventory_adjustment(), $adj_id, $reference); - add_audit_trail(systypes::inventory_adjustment(), $adj_id, $date_); + $Refs->save(ST_INVADJUST, $adj_id, $reference); + add_audit_trail(ST_INVADJUST, $adj_id, $date_); commit_transaction(); @@ -41,15 +43,15 @@ function add_stock_adjustment($items, $location, $date_, $type, $increase, $refe function void_stock_adjustment($type_no) { - void_gl_trans(systypes::inventory_adjustment(), $type_no); - void_stock_move(systypes::inventory_adjustment(), $type_no); + void_gl_trans(ST_INVADJUST, $type_no); + void_stock_move(ST_INVADJUST, $type_no); } //------------------------------------------------------------------------------------------------------------- function get_stock_adjustment_items($trans_no) { - $result = get_stock_moves(systypes::inventory_adjustment(), $trans_no); + $result = get_stock_moves(ST_INVADJUST, $trans_no); if (db_num_rows($result) == 0) { @@ -73,7 +75,7 @@ function add_stock_adjustment_item($adj_id, $stock_id, $location, $date_, $type, update_average_material_cost(null, $stock_id, $standard_cost, $quantity, $date_); - add_stock_move(systypes::inventory_adjustment(), $stock_id, $adj_id, $location, + add_stock_move(ST_INVADJUST, $stock_id, $adj_id, $location, $date_, $reference, $quantity, $standard_cost, $type); if ($standard_cost > 0) @@ -81,10 +83,10 @@ function add_stock_adjustment_item($adj_id, $stock_id, $location, $date_, $type, $stock_gl_codes = get_stock_gl_code($stock_id); - add_gl_trans_std_cost(systypes::inventory_adjustment(), $adj_id, $date_, + add_gl_trans_std_cost(ST_INVADJUST, $adj_id, $date_, $stock_gl_codes['adjustment_account'], $stock_gl_codes['dimension_id'], $stock_gl_codes['dimension2_id'], $memo_, ($standard_cost * -($quantity))); - add_gl_trans_std_cost(systypes::inventory_adjustment(), $adj_id, $date_, $stock_gl_codes['inventory_account'], 0, 0, $memo_, ($standard_cost * $quantity)); + add_gl_trans_std_cost(ST_INVADJUST, $adj_id, $date_, $stock_gl_codes['inventory_account'], 0, 0, $memo_, ($standard_cost * $quantity)); } } diff --git a/inventory/includes/db/items_trans_db.inc b/inventory/includes/db/items_trans_db.inc index dee7ef70..0bcdb82b 100644 --- a/inventory/includes/db/items_trans_db.inc +++ b/inventory/includes/db/items_trans_db.inc @@ -38,7 +38,7 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co if ($qoh > 0) { - $update_no = get_next_trans_no(systypes::cost_update()); + $update_no = get_next_trans_no(ST_COSTUPDATE); if (!is_date_in_fiscalyear($date_)) $date_ = end_fiscalyear(); @@ -49,14 +49,14 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co $value_of_change = $qoh * ($new_cost - $last_cost); $memo_ = "Cost was " . $last_cost . " changed to " . $new_cost . " x quantity on hand of $qoh"; - add_gl_trans_std_cost(systypes::cost_update(), $update_no, $date_, $stock_gl_code["adjustment_account"], + add_gl_trans_std_cost(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["adjustment_account"], $stock_gl_code["dimension_id"], $stock_gl_code["dimension2_id"], $memo_, (-$value_of_change)); - add_gl_trans_std_cost(systypes::cost_update(), $update_no, $date_, $stock_gl_code["inventory_account"], 0, 0, $memo_, + add_gl_trans_std_cost(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["inventory_account"], 0, 0, $memo_, $value_of_change); } - add_audit_trail(systypes::cost_update(), $update_no, $date_); + add_audit_trail(ST_COSTUPDATE, $update_no, $date_); commit_transaction(); return $update_no; diff --git a/inventory/includes/db/items_transfer_db.inc b/inventory/includes/db/items_transfer_db.inc index 5784453b..da1ceec2 100644 --- a/inventory/includes/db/items_transfer_db.inc +++ b/inventory/includes/db/items_transfer_db.inc @@ -13,9 +13,11 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $reference, $memo_) { + global $Refs; + begin_transaction(); - $transfer_id = get_next_trans_no(systypes::location_transfer()); + $transfer_id = get_next_trans_no(ST_LOCTRANSFER); foreach ($Items as $line_item) { @@ -23,10 +25,10 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $location_to, $date_, $type, $reference, $line_item->quantity); } - add_comments(systypes::location_transfer(), $transfer_id, $date_, $memo_); + add_comments(ST_LOCTRANSFER, $transfer_id, $date_, $memo_); - references::save(systypes::location_transfer(), $transfer_id, $reference); - add_audit_trail(systypes::location_transfer(), $transfer_id, $date_); + $Refs->save(ST_LOCTRANSFER, $transfer_id, $reference); + add_audit_trail(ST_LOCTRANSFER, $transfer_id, $date_); commit_transaction(); @@ -43,10 +45,10 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, function add_stock_transfer_item($transfer_id, $stock_id, $location_from, $location_to, $date_, $type, $reference, $quantity) { - add_stock_move(systypes::location_transfer(), $stock_id, $transfer_id, $location_from, + add_stock_move(ST_LOCTRANSFER, $stock_id, $transfer_id, $location_from, $date_, $reference, -$quantity, 0, $type); - add_stock_move(systypes::location_transfer(), $stock_id, $transfer_id, $location_to, + add_stock_move(ST_LOCTRANSFER, $stock_id, $transfer_id, $location_to, $date_, $reference, $quantity, 0, $type); } @@ -78,7 +80,7 @@ function get_stock_transfer($trans_no) function get_stock_transfer_items($trans_no) { - $result = get_stock_moves(systypes::location_transfer(), $trans_no); + $result = get_stock_moves(ST_LOCTRANSFER, $trans_no); if (db_num_rows($result) == 0) { @@ -92,7 +94,7 @@ function get_stock_transfer_items($trans_no) function void_stock_transfer($type_no) { - void_stock_move(systypes::location_transfer(), $type_no); + void_stock_move(ST_LOCTRANSFER, $type_no); } ?> \ No newline at end of file diff --git a/inventory/includes/item_adjustments_ui.inc b/inventory/includes/item_adjustments_ui.inc index 8812438e..a8a7481a 100644 --- a/inventory/includes/item_adjustments_ui.inc +++ b/inventory/includes/item_adjustments_ui.inc @@ -26,13 +26,13 @@ function add_to_order(&$order, $new_item, $new_item_qty, $standard_cost) function display_order_header(&$order) { - global $table_style2; + global $table_style2, $Refs; start_outer_table("width=70% $table_style2"); // outer table table_section(1); locations_list_row(_("Location:"), 'StockLocation', null); - ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::inventory_adjustment())); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_INVADJUST)); table_section(2, "33%"); diff --git a/inventory/includes/stock_transfers_ui.inc b/inventory/includes/stock_transfers_ui.inc index 6f3d307e..33df8fde 100644 --- a/inventory/includes/stock_transfers_ui.inc +++ b/inventory/includes/stock_transfers_ui.inc @@ -26,7 +26,7 @@ function add_to_order(&$order, $new_item, $new_item_qty, $standard_cost) function display_order_header(&$order) { - global $table_style; + global $table_style, $Refs; start_outer_table("width=70% $table_style"); @@ -37,7 +37,7 @@ function display_order_header(&$order) table_section(2, "33%"); - ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::location_transfer())); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_LOCTRANSFER)); date_row(_("Date:"), 'AdjDate', '', true); diff --git a/inventory/inquiry/stock_movements.php b/inventory/inquiry/stock_movements.php index e3526e9b..bf80e27a 100644 --- a/inventory/inquiry/stock_movements.php +++ b/inventory/inquiry/stock_movements.php @@ -112,7 +112,7 @@ while ($myrow = db_fetch($result)) $trandate = sql2date($myrow["tran_date"]); - $type_name = systypes::name($myrow["type"]); + $type_name = $systypes_array[$myrow["type"]]; if ($myrow["qty"] > 0) { @@ -155,13 +155,13 @@ while ($myrow = db_fetch($result)) if (strlen($supp_row['supp_name']) > 0) $person = $supp_row['supp_name']; } - elseif ($myrow["type"] == systypes::location_transfer() || $myrow["type"] == systypes::inventory_adjustment()) + elseif ($myrow["type"] == ST_LOCTRANSFER || $myrow["type"] == ST_INVADJUST) { // get the adjustment type $movement_type = get_movement_type($myrow["person_id"]); $person = $movement_type["name"]; } - elseif ($myrow["type"]==systypes::work_order() || $myrow["type"] == 28 || + elseif ($myrow["type"]==ST_WORKORDER || $myrow["type"] == 28 || $myrow["type"] == 29) { $person = ""; diff --git a/inventory/manage/movement_types.php b/inventory/manage/movement_types.php index e54ff3cb..5f75844f 100644 --- a/inventory/manage/movement_types.php +++ b/inventory/manage/movement_types.php @@ -57,7 +57,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') function can_delete($selected_id) { $sql= "SELECT COUNT(*) FROM ".TB_PREF."stock_moves - WHERE type=" . systypes::inventory_adjustment(). " AND person_id=$selected_id"; + WHERE type=" . ST_INVADJUST. " AND person_id=$selected_id"; $result = db_query($sql, "could not query stock moves"); $myrow = db_fetch_row($result); if ($myrow[0] > 0) diff --git a/inventory/transfers.php b/inventory/transfers.php index 77fbc2f8..e8e995a8 100644 --- a/inventory/transfers.php +++ b/inventory/transfers.php @@ -38,7 +38,7 @@ check_db_has_movement_types(_("There are no inventory movement types defined in if (isset($_GET['AddedID'])) { $trans_no = $_GET['AddedID']; - $trans_type = systypes::location_transfer(); + $trans_type = ST_LOCTRANSFER; display_notification_centered(_("Inventory transfer has been processed")); display_note(get_trans_view_str($trans_type, $trans_no, _("&View this transfer"))); @@ -67,7 +67,7 @@ function handle_new_order() session_register("transfer_items"); - $_SESSION['transfer_items'] = new items_cart(systypes::location_transfer()); + $_SESSION['transfer_items'] = new items_cart(ST_LOCTRANSFER); $_POST['AdjDate'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['AdjDate'])) $_POST['AdjDate'] = end_fiscalyear(); @@ -78,6 +78,7 @@ function handle_new_order() if (isset($_POST['Process'])) { + global $Refs; $tr = &$_SESSION['transfer_items']; $input_error = 0; @@ -87,13 +88,13 @@ if (isset($_POST['Process'])) set_focus('stock_id'); return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); $input_error = 1; } - elseif (!is_new_reference($_POST['ref'], systypes::location_transfer())) + elseif (!is_new_reference($_POST['ref'], ST_LOCTRANSFER)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); diff --git a/inventory/view/view_adjustment.php b/inventory/view/view_adjustment.php index cd6575b9..1db79269 100644 --- a/inventory/view/view_adjustment.php +++ b/inventory/view/view_adjustment.php @@ -25,7 +25,7 @@ if (isset($_GET["trans_no"])) $trans_no = $_GET["trans_no"]; } -display_heading(systypes::name(systypes::inventory_adjustment()) . " #$trans_no"); +display_heading($systypes_array[ST_INVADJUST] . " #$trans_no"); br(1); $adjustment_items = get_stock_adjustment_items($trans_no); @@ -45,7 +45,7 @@ while ($adjustment = db_fetch($adjustment_items)) label_cells(_("Date"), sql2date($adjustment['tran_date']), "class='tableheader2'"); label_cells(_("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'"); end_row(); - comments_display_row(systypes::inventory_adjustment(), $trans_no); + comments_display_row(ST_INVADJUST, $trans_no); end_table(); $header_shown = true; @@ -70,7 +70,7 @@ while ($adjustment = db_fetch($adjustment_items)) end_table(1); -is_voided_display(systypes::inventory_adjustment(), $trans_no, _("This adjustment has been voided.")); +is_voided_display(ST_INVADJUST, $trans_no, _("This adjustment has been voided.")); end_page(true); ?> \ No newline at end of file diff --git a/inventory/view/view_transfer.php b/inventory/view/view_transfer.php index 0c448712..85c0ae85 100644 --- a/inventory/view/view_transfer.php +++ b/inventory/view/view_transfer.php @@ -30,7 +30,7 @@ $transfer_items = get_stock_transfer($trans_no); $from_trans = $transfer_items[0]; $to_trans = $transfer_items[1]; -display_heading(systypes::name(systypes::location_transfer()) . " #$trans_no"); +display_heading($systypes_array[ST_LOCTRANSFER] . " #$trans_no"); echo "
"; start_table("$table_style2 width=90%"); @@ -47,7 +47,7 @@ label_cells(_("Adjustment Type"), $adjustment_type['name'], "class='tableheader2 label_cells(_("Date"), sql2date($from_trans['tran_date']), "class='tableheader2'"); end_row(); -comments_display_row(systypes::location_transfer(), $trans_no); +comments_display_row(ST_LOCTRANSFER, $trans_no); end_table(1); @@ -56,7 +56,7 @@ start_table("$table_style width=90%"); $th = array(_("Item"), _("Description"), _("Quantity"), _("Units")); table_header($th); -$transfer_items = get_stock_moves(systypes::location_transfer(), $trans_no); +$transfer_items = get_stock_moves(ST_LOCTRANSFER, $trans_no); $k = 0; while ($item = db_fetch($transfer_items)) { @@ -74,7 +74,7 @@ while ($item = db_fetch($transfer_items)) end_table(1); -is_voided_display(systypes::location_transfer(), $trans_no, _("This transfer has been voided.")); +is_voided_display(ST_LOCTRANSFER, $trans_no, _("This transfer has been voided.")); end_page(true); ?> \ No newline at end of file diff --git a/manufacturing/includes/db/work_order_issues_db.inc b/manufacturing/includes/db/work_order_issues_db.inc index 9fbbfb69..d9361bda 100644 --- a/manufacturing/includes/db/work_order_issues_db.inc +++ b/manufacturing/includes/db/work_order_issues_db.inc @@ -14,6 +14,8 @@ function add_work_order_issue($woid, $ref, $to_work_order, $items, $location, $workcentre, $date_, $memo_) { + global $Refs; + begin_transaction(); $details = get_work_order($woid); @@ -58,7 +60,7 @@ function add_work_order_issue($woid, $ref, $to_work_order, $items, $location, $w if ($memo_) add_comments(28, $number, $date_, $memo_); - references::save(28, $number, $ref); + $Refs->save(28, $number, $ref); add_audit_trail(28, $number, $date_); commit_transaction(); diff --git a/manufacturing/includes/db/work_order_produce_items_db.inc b/manufacturing/includes/db/work_order_produce_items_db.inc index 6676549c..695e696d 100644 --- a/manufacturing/includes/db/work_order_produce_items_db.inc +++ b/manufacturing/includes/db/work_order_produce_items_db.inc @@ -11,6 +11,8 @@ ***********************************************************************/ function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo) { + global $Refs; + begin_transaction(); $details = get_work_order($woid); @@ -53,7 +55,7 @@ function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo) if ($memo_) add_comments(29, $id, $date_, $memo_); - references::save(29, $id, $ref); + $Refs->save(29, $id, $ref); add_audit_trail(29, $id, $date_, _("Production.")); commit_transaction(); diff --git a/manufacturing/includes/db/work_orders_db.inc b/manufacturing/includes/db/work_orders_db.inc index f0ce31a5..122179f0 100644 --- a/manufacturing/includes/db/work_orders_db.inc +++ b/manufacturing/includes/db/work_orders_db.inc @@ -91,7 +91,9 @@ function add_issue_cost($stock_id, $qty, $date_, $costs) function add_work_order($wo_ref, $loc_code, $units_reqd, $stock_id, $type, $date_, $required_by, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc) { - if (!($type == wo_types::advanced())) + global $Refs; + + if (!($type == WO_ADVANCED)) return add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, $date_, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc); begin_transaction(); @@ -109,10 +111,10 @@ function add_work_order($wo_ref, $loc_code, $units_reqd, $stock_id, $woid = db_insert_id(); - add_comments(systypes::work_order(), $woid, $required_by, $memo_); + add_comments(ST_WORKORDER, $woid, $required_by, $memo_); - references::save(systypes::work_order(), $woid, $wo_ref); - add_audit_trail(systypes::work_order(), $woid, $date_); + $Refs->save(ST_WORKORDER, $woid, $wo_ref); + add_audit_trail(ST_WORKORDER, $woid, $date_); commit_transaction(); @@ -140,8 +142,8 @@ function update_work_order($woid, $loc_code, $units_reqd, $stock_id, db_query($sql, "could not update work order"); - update_comments(systypes::work_order(), $woid, null, $memo_); - add_audit_trail(systypes::work_order(), $woid, $date_, _("Updated.")); + update_comments(ST_WORKORDER, $woid, null, $memo_); + add_audit_trail(ST_WORKORDER, $woid, $date_, _("Updated.")); commit_transaction(); } @@ -159,8 +161,8 @@ function delete_work_order($woid) $sql = "DELETE FROM ".TB_PREF."workorders WHERE id=$woid"; db_query($sql,"The work order could not be deleted"); - delete_comments(systypes::work_order(), $woid); - add_audit_trail(systypes::work_order(), $woid, $_POST['date_'], _("Canceled.")); + delete_comments(ST_WORKORDER, $woid); + add_audit_trail(ST_WORKORDER, $woid, $_POST['date_'], _("Canceled.")); commit_transaction(); } @@ -235,8 +237,8 @@ function release_work_order($woid, $releaseDate, $memo_) // create Work Order Requirements based on the bom create_wo_requirements($woid, $stock_id); - add_comments(systypes::work_order(), $woid, $releaseDate, $memo_); - add_audit_trail(systypes::work_order(), $woid, $releaseDate,_("Released.")); + add_comments(ST_WORKORDER, $woid, $releaseDate, $memo_); + add_audit_trail(ST_WORKORDER, $woid, $releaseDate,_("Released.")); commit_transaction(); } @@ -276,7 +278,7 @@ function void_work_order($woid) { $work_order = get_work_order($woid); - if (!($work_order["type"] == wo_types::advanced())) + if (!($work_order["type"] == WO_ADVANCED)) { begin_transaction(); @@ -284,10 +286,10 @@ function void_work_order($woid) db_query($sql, "The work order couldn't be voided"); // void all related stock moves - void_stock_move(systypes::work_order(), $woid); + void_stock_move(ST_WORKORDER, $woid); // void any related gl trans - void_gl_trans(systypes::work_order(), $woid, true); + void_gl_trans(ST_WORKORDER, $woid, true); // clear the requirements units received void_wo_requirements($woid); diff --git a/manufacturing/includes/db/work_orders_quick_db.inc b/manufacturing/includes/db/work_orders_quick_db.inc index dc6c03ed..455f918e 100644 --- a/manufacturing/includes/db/work_orders_quick_db.inc +++ b/manufacturing/includes/db/work_orders_quick_db.inc @@ -13,10 +13,12 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, $date_, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc) { + global $Refs; + begin_transaction(); // if unassembling, reverse the stock movements - if ($type == wo_types::unassemble()) + if ($type == WO_UNASSEMBLY) $units_reqd = -$units_reqd; add_material_cost($stock_id, $units_reqd, $date_); @@ -57,7 +59,7 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, db_query($sql, "The work order requirements could not be added"); // insert a -ve stock move for each item - add_stock_move(systypes::work_order(), $bom_item["component"], $woid, + add_stock_move(ST_WORKORDER, $bom_item["component"], $woid, $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, 0); } @@ -65,7 +67,7 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, // ------------------------------------------------------------------------- // insert a +ve stock move for the item being manufactured - add_stock_move(systypes::work_order(), $stock_id, $woid, $loc_code, $date_, + add_stock_move(ST_WORKORDER, $stock_id, $woid, $loc_code, $date_, $wo_ref, $units_reqd, 0); // ------------------------------------------------------------------------- @@ -74,10 +76,10 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, // ------------------------------------------------------------------------- - add_comments(systypes::work_order(), $woid, $date_, $memo_); + add_comments(ST_WORKORDER, $woid, $date_, $memo_); - references::save(systypes::work_order(), $woid, $wo_ref); - add_audit_trail(systypes::work_order(), $woid, $date_,_("Quick production.")); + $Refs->save(ST_WORKORDER, $woid, $wo_ref); + add_audit_trail(ST_WORKORDER, $woid, $date_,_("Quick production.")); commit_transaction(); return $woid; } @@ -101,10 +103,10 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced if ($advanced) { // insert a -ve stock move for each item - add_stock_move(systypes::work_order(), $bom_item["component"], $woid, + add_stock_move(ST_WORKORDER, $bom_item["component"], $woid, $bom_item["loc_code"], $date_, "", -$bom_item["quantity"] * $units_reqd, 0); } - $total_cost += add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $bom_accounts["inventory_account"], 0, 0, + $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $bom_accounts["inventory_account"], 0, 0, null, -$bom_cost); } @@ -119,7 +121,7 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced $standard_cost = get_standard_cost($item['stock_id']); $issue_cost = $standard_cost * $item['qty_issued'] * $units_reqd / $wo['units_reqd']; $issue = get_stock_gl_code($item['stock_id']); - $total_cost += add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $issue["inventory_account"], 0, 0, + $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $issue["inventory_account"], 0, 0, null, -$issue_cost); $issue_total += $issue_cost; } @@ -140,38 +142,38 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced $item_accounts = get_stock_gl_code($stock_id); if ($costs != 0.0) { - add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $cr_acc, - 0, 0, $wo_cost_types[WO_OVERHEAD], -$costs, payment_person_types::WorkOrder(), WO_OVERHEAD); + add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $cr_acc, + 0, 0, $wo_cost_types[WO_OVERHEAD], -$costs, PT_WORKORDER, WO_OVERHEAD); $is_bank_to = is_bank_account($cr_acc); if ($is_bank_to) { - add_bank_trans(systypes::work_order(), $woid, $is_bank_to, "", - $date_, -$costs, payment_person_types::WorkOrder(), WO_OVERHEAD, get_company_currency(), + add_bank_trans(ST_WORKORDER, $woid, $is_bank_to, "", + $date_, -$costs, PT_WORKORDER, WO_OVERHEAD, get_company_currency(), "Cannot insert a destination bank transaction"); } - add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $item_accounts["assembly_account"], + add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"], $item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_OVERHEAD], $costs, - payment_person_types::WorkOrder(), WO_OVERHEAD); + PT_WORKORDER, WO_OVERHEAD); } if ($labour != 0.0) { - add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $cr_lab_acc, - 0, 0, $wo_cost_types[WO_LABOUR], -$labour, payment_person_types::WorkOrder(), WO_LABOUR); + add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $cr_lab_acc, + 0, 0, $wo_cost_types[WO_LABOUR], -$labour, PT_WORKORDER, WO_LABOUR); $is_bank_to = is_bank_account($cr_lab_acc); if ($is_bank_to) { - add_bank_trans(systypes::work_order(), $woid, $is_bank_to, "", - $date_, -$labour, payment_person_types::WorkOrder(), WO_LABOUR, get_company_currency(), + add_bank_trans(ST_WORKORDER, $woid, $is_bank_to, "", + $date_, -$labour, PT_WORKORDER, WO_LABOUR, get_company_currency(), "Cannot insert a destination bank transaction"); } - add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $item_accounts["assembly_account"], + add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"], $item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_LABOUR], $labour, - payment_person_types::WorkOrder(), WO_LABOUR); + PT_WORKORDER, WO_LABOUR); } // debit total components $total_cost - add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $item_accounts["inventory_account"], + add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["inventory_account"], 0, 0, null, -$total_cost); } diff --git a/manufacturing/includes/manufacturing_ui.inc b/manufacturing/includes/manufacturing_ui.inc index e5eaf8cc..426356d9 100644 --- a/manufacturing/includes/manufacturing_ui.inc +++ b/manufacturing/includes/manufacturing_ui.inc @@ -70,7 +70,7 @@ function display_bom($item_check) function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null) { - global $table_style; + global $table_style, $SysPrefs; $result = get_wo_requirements($woid); @@ -106,7 +106,7 @@ function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null) $qoh = get_qoh_on_date($myrow["stock_id"], $myrow["loc_code"], $date); if ($show_qoh && ($myrow["units_req"] * $quantity > $qoh) && - !sys_prefs::allow_negative_stock()) + !$SysPrefs->allow_negative_stock()) { // oops, we don't have enough of one of the component items start_row("class='stockmankobg'"); @@ -226,7 +226,7 @@ function display_wo_payments($woid) { global $path_to_root, $table_style, $wo_cost_types; - //$result = get_bank_trans(null, null, payment_person_types::WorkOrder(), $woid); + //$result = get_bank_trans(null, null, PT_WORKORDER, $woid); $result = get_gl_wo_cost_trans($woid); if (db_num_rows($result) == 0) @@ -247,7 +247,7 @@ function display_wo_payments($woid) alt_table_row_color($k); - label_cell(get_gl_view_str(systypes::work_order(), $myrow["type_no"], $myrow["type_no"])); + label_cell(get_gl_view_str(ST_WORKORDER, $myrow["type_no"], $myrow["type_no"])); label_cell($wo_cost_types[$myrow['person_id']]); $date = sql2date($myrow["tran_date"]); label_cell($date); @@ -263,7 +263,7 @@ function display_wo_payments($woid) function display_wo_details($woid, $suppress_view_link=false) { - global $table_style; + global $table_style, $wo_types_array; $myrow = get_work_order($woid); @@ -288,9 +288,9 @@ function display_wo_details($woid, $suppress_view_link=false) if ($suppress_view_link) label_cell($myrow["id"]); else - label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"])); + label_cell(get_trans_view_str(ST_WORKORDER, $myrow["id"])); label_cell($myrow["wo_ref"]); - label_cell(wo_types::name($myrow["type"])); + label_cell($wo_types_array[$myrow["type"]]); view_stock_status_cell($myrow["stock_id"], $myrow["StockItemName"]); label_cell($myrow["location_name"]); label_cell(sql2date($myrow["date_"])); @@ -305,7 +305,7 @@ function display_wo_details($woid, $suppress_view_link=false) } end_row(); - comments_display_row(systypes::work_order(), $woid); + comments_display_row(ST_WORKORDER, $woid); end_table(); @@ -319,7 +319,7 @@ function display_wo_details($woid, $suppress_view_link=false) function display_wo_details_quick($woid, $suppress_view_link=false) { - global $table_style; + global $table_style, $wo_types_array; $myrow = get_work_order($woid); @@ -339,9 +339,9 @@ function display_wo_details_quick($woid, $suppress_view_link=false) if ($suppress_view_link) label_cell($myrow["id"]); else - label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"])); + label_cell(get_trans_view_str(ST_WORKORDER, $myrow["id"])); label_cell($myrow["wo_ref"]); - label_cell(wo_types::name($myrow["type"])); + label_cell($wo_types_array[$myrow["type"]]); view_stock_status_cell($myrow["stock_id"], $myrow["StockItemName"]); label_cell($myrow["location_name"]); label_cell(sql2date($myrow["date_"])); @@ -350,7 +350,7 @@ function display_wo_details_quick($woid, $suppress_view_link=false) end_row(); - comments_display_row(systypes::work_order(), $woid); + comments_display_row(ST_WORKORDER, $woid); end_table(); diff --git a/manufacturing/includes/work_order_issue_ui.inc b/manufacturing/includes/work_order_issue_ui.inc index dad39a9c..5924f2cc 100644 --- a/manufacturing/includes/work_order_issue_ui.inc +++ b/manufacturing/includes/work_order_issue_ui.inc @@ -145,9 +145,11 @@ function issue_edit_item_controls(&$order, $line_no=-1) function issue_options_controls() { + global $Refs; + echo "
"; start_table(); - ref_row(_("Reference:"), 'ref', '', references::get_next(28)); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(28)); if (!isset($_POST['IssueType'])) $_POST['IssueType'] = 0; diff --git a/manufacturing/search_work_orders.php b/manufacturing/search_work_orders.php index e03538b5..353c3be6 100644 --- a/manufacturing/search_work_orders.php +++ b/manufacturing/search_work_orders.php @@ -90,7 +90,7 @@ function check_overdue($row) function view_link($dummy, $order_no) { - return get_trans_view_str(systypes::work_order(), $order_no); + return get_trans_view_str(ST_WORKORDER, $order_no); } function view_stock($row) @@ -100,7 +100,9 @@ function view_stock($row) function wo_type_name($dummy, $type) { - return wo_types::name($type); + global $wo_types_array; + + return $wo_types_array[$type]; } function edit_link($row) @@ -134,7 +136,7 @@ function costs_link($row) return $row["closed"] || !$row["released"] ? '' : pager_link(_('Costs'), "/gl/gl_bank.php?NewPayment=1&PayType=" - .payment_person_types::WorkOrder(). "&PayPerson=" .$row["id"]); + .PT_WORKORDER. "&PayPerson=" .$row["id"]); */ return $row["closed"] || !$row["released"] ? '' : pager_link(_('Costs'), @@ -145,7 +147,7 @@ function view_gl_link($row) { if ($row['closed'] == 0) return ''; - return get_gl_view_str(systypes::work_order(), $row['id']); + return get_gl_view_str(ST_WORKORDER, $row['id']); } function dec_amount($row, $amount) diff --git a/manufacturing/view/wo_issue_view.php b/manufacturing/view/wo_issue_view.php index 7b49484e..9f0a8d7e 100644 --- a/manufacturing/view/wo_issue_view.php +++ b/manufacturing/view/wo_issue_view.php @@ -49,7 +49,7 @@ function display_wo_issue($issue_no) start_row(); label_cell($myrow["issue_no"]); label_cell($myrow["reference"]); - label_cell(get_trans_view_str(systypes::work_order(),$myrow["workorder_id"])); + label_cell(get_trans_view_str(ST_WORKORDER,$myrow["workorder_id"])); label_cell($myrow["stock_id"] . " - " . $myrow["description"]); label_cell($myrow["location_name"]); label_cell($myrow["WorkCentreName"]); @@ -111,7 +111,7 @@ function display_wo_issue_details($issue_no) //------------------------------------------------------------------------------------------------- -display_heading(systypes::name(28) . " # " . $wo_issue_no); +display_heading($systypes_array[ST_MANUISSUE] . " # " . $wo_issue_no); display_wo_issue($wo_issue_no); diff --git a/manufacturing/view/wo_production_view.php b/manufacturing/view/wo_production_view.php index 28a4c7ae..f3690b5e 100644 --- a/manufacturing/view/wo_production_view.php +++ b/manufacturing/view/wo_production_view.php @@ -50,7 +50,7 @@ function display_wo_production($prod_id) start_row(); label_cell($myrow["id"]); label_cell($myrow["reference"]); - label_cell(get_trans_view_str(systypes::work_order(),$myrow["workorder_id"])); + label_cell(get_trans_view_str(ST_WORKORDER,$myrow["workorder_id"])); label_cell($myrow["stock_id"] . " - " . $myrow["StockDescription"]); qty_cell($myrow["quantity"], false, get_qty_dec($myrow["stock_id"])); label_cell(sql2date($myrow["date_"])); @@ -65,7 +65,7 @@ function display_wo_production($prod_id) //------------------------------------------------------------------------------------------------- -display_heading(systypes::name(29) . " # " . $wo_production); +display_heading($systypes_array[ST_MANURECEIVE] . " # " . $wo_production); display_wo_production($wo_production); diff --git a/manufacturing/view/work_order_view.php b/manufacturing/view/work_order_view.php index 2c12edc8..62b3df66 100644 --- a/manufacturing/view/work_order_view.php +++ b/manufacturing/view/work_order_view.php @@ -32,12 +32,12 @@ if ($_GET['trans_no'] != "") $woid = $_GET['trans_no']; } -display_heading(systypes::name(systypes::work_order()) . " # " . $woid); +display_heading($systypes_array[ST_WORKORDER] . " # " . $woid); br(1); $myrow = get_work_order($woid); -if ($myrow["type"] == wo_types::advanced()) +if ($myrow["type"] == WO_ADVANCED) display_wo_details($woid, true); else display_wo_details_quick($woid, true); @@ -55,7 +55,7 @@ else { display_heading2(_("Work Order Requirements")); display_wo_requirements($woid, $myrow["units_reqd"]); - if ($myrow["type"] == wo_types::advanced()) + if ($myrow["type"] == WO_ADVANCED) { echo "
";*/ inactive_control_cell($myrow["id"], $myrow["inactive"], 'tax_groups', 'id'); @@ -217,7 +217,7 @@ for ($i = 0; $i < 5; $i++) $_POST['tax_type_id' . $i] = 0; tax_types_list_cells(null, 'tax_type_id' . $i, $_POST['tax_type_id' . $i], _("None"), true); - if ($_POST['tax_type_id' . $i] != 0 && $_POST['tax_type_id' . $i] != reserved_words::get_all_numeric()) + if ($_POST['tax_type_id' . $i] != 0 && $_POST['tax_type_id' . $i] != ALL_NUMERIC) { $default_rate = get_tax_type_default_rate($_POST['tax_type_id' . $i]); -- 2.30.2
"; display_heading2(_("Issues")); @@ -79,7 +79,7 @@ else echo "
"; -is_voided_display(systypes::work_order(), $woid, _("This work order has been voided.")); +is_voided_display(ST_WORKORDER, $woid, _("This work order has been voided.")); end_page(true); diff --git a/manufacturing/work_order_add_finished.php b/manufacturing/work_order_add_finished.php index 8ba7fd6e..c61f19bb 100644 --- a/manufacturing/work_order_add_finished.php +++ b/manufacturing/work_order_add_finished.php @@ -39,7 +39,7 @@ if (isset($_GET['AddedID'])) { include_once($path_to_root . "/reporting/includes/reporting.inc"); $id = $_GET['AddedID']; - $stype = systypes::work_order(); + $stype = ST_WORKORDER; display_notification(_("The manufacturing process has been entered.")); @@ -69,9 +69,9 @@ if (strlen($wo_details[0]) == 0) function can_process() { - global $wo_details; + global $wo_details, $SysPrefs, $Refs; - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); @@ -112,7 +112,7 @@ function can_process() } // if unassembling we need to check the qoh - if (($_POST['ProductionType'] == 0) && !sys_prefs::allow_negative_stock()) + if (($_POST['ProductionType'] == 0) && !$SysPrefs->allow_negative_stock()) { $wo_details = get_work_order($_POST['selected_id']); @@ -126,7 +126,7 @@ function can_process() } // if production we need to check the qoh of the wo requirements - if (($_POST['ProductionType'] == 1) && !sys_prefs::allow_negative_stock()) + if (($_POST['ProductionType'] == 1) && !$SysPrefs->allow_negative_stock()) { $err = false; $result = get_wo_requirements($_POST['selected_id']); @@ -189,7 +189,7 @@ if (!isset($_POST['quantity']) || $_POST['quantity'] == '') start_table($table_style2); br(); -ref_row(_("Reference:"), 'ref', '', references::get_next(29)); +ref_row(_("Reference:"), 'ref', '', $Refs->get_next(29)); if (!isset($_POST['ProductionType'])) $_POST['ProductionType'] = 1; diff --git a/manufacturing/work_order_costs.php b/manufacturing/work_order_costs.php index b6f6ba23..7ce5e811 100644 --- a/manufacturing/work_order_costs.php +++ b/manufacturing/work_order_costs.php @@ -38,7 +38,7 @@ if (isset($_GET['trans_no']) && $_GET['trans_no'] != "") if (isset($_GET['AddedID'])) { $id = $_GET['AddedID']; - $stype = systypes::work_order(); + $stype = ST_WORKORDER; display_notification(_("The additional cost has been entered.")); @@ -104,18 +104,18 @@ function can_process() if (isset($_POST['process']) && can_process() == true) { begin_transaction(); - add_gl_trans_std_cost(systypes::work_order(), $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'], - 0, 0, $wo_cost_types[$_POST['PaymentType']], -input_num('costs'), payment_person_types::WorkOrder(), $_POST['PaymentType']); + add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'], + 0, 0, $wo_cost_types[$_POST['PaymentType']], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType']); $is_bank_to = is_bank_account($_POST['cr_acc']); if ($is_bank_to) { - add_bank_trans(systypes::work_order(), $_POST['selected_id'], $is_bank_to, "", - $_POST['date_'], -input_num('costs'), payment_person_types::WorkOrder(), $_POST['PaymentType'], get_company_currency(), + add_bank_trans(ST_WORKORDER, $_POST['selected_id'], $is_bank_to, "", + $_POST['date_'], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType'], get_company_currency(), "Cannot insert a destination bank transaction"); } - add_gl_trans_std_cost(systypes::work_order(), $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'], - $_POST['dim1'], $_POST['dim2'], $wo_cost_types[$_POST['PaymentType']], input_num('costs'), payment_person_types::WorkOrder(), + add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'], + $_POST['dim1'], $_POST['dim2'], $wo_cost_types[$_POST['PaymentType']], input_num('costs'), PT_WORKORDER, $_POST['PaymentType']); commit_transaction(); diff --git a/manufacturing/work_order_entry.php b/manufacturing/work_order_entry.php index a278e1e6..7e06ea45 100644 --- a/manufacturing/work_order_entry.php +++ b/manufacturing/work_order_entry.php @@ -49,13 +49,13 @@ elseif(isset($_POST['selected_id'])) if (isset($_GET['AddedID'])) { $id = $_GET['AddedID']; - $stype = systypes::work_order(); + $stype = ST_WORKORDER; display_notification_centered(_("The work order been added.")); display_note(get_trans_view_str($stype, $id, _("View this Work Order"))); - if ($_GET['type'] != wo_types::advanced()) + if ($_GET['type'] != WO_ADVANCED) { include_once($path_to_root . "/reporting/includes/reporting.inc"); $ar = array('PARAM_0' => $id, 'PARAM_1' => $id, 'PARAM_2' => 0); @@ -122,18 +122,18 @@ if (!isset($_POST['date_'])) function can_process() { - global $selected_id; + global $selected_id, $SysPrefs, $Refs; if (!isset($selected_id)) { - if (!references::is_valid($_POST['wo_ref'])) + if (!$Refs->is_valid($_POST['wo_ref'])) { display_error(_("You must enter a reference.")); set_focus('wo_ref'); return false; } - if (!is_new_reference($_POST['wo_ref'], systypes::work_order())) + if (!is_new_reference($_POST['wo_ref'], ST_WORKORDER)) { display_error(_("The entered reference is already in use.")); set_focus('wo_ref'); @@ -161,7 +161,7 @@ function can_process() return false; } // only check bom and quantites if quick assembly - if (!($_POST['type'] == wo_types::advanced())) + if (!($_POST['type'] == WO_ADVANCED)) { if (!has_bom($_POST['stock_id'])) { @@ -187,9 +187,9 @@ function can_process() return false; } - if (!sys_prefs::allow_negative_stock()) + if (!$SysPrefs->allow_negative_stock()) { - if ($_POST['type'] == wo_types::assemble()) + if ($_POST['type'] == WO_ASSEMBLY) { // check bom if assembling $result = get_bom($_POST['stock_id']); @@ -213,7 +213,7 @@ function can_process() } } } - elseif ($_POST['type'] == wo_types::unassemble()) + elseif ($_POST['type'] == WO_UNASSEMBLY) { // if unassembling, check item to unassemble $qoh = get_qoh_on_date($_POST['stock_id'], $_POST['StockLocation'], $_POST['date_']); @@ -363,7 +363,7 @@ if (isset($selected_id)) $_POST['units_issued'] = $myrow["units_issued"]; $_POST['Costs'] = price_format($myrow["additional_costs"]); - $_POST['memo_'] = get_comments_string(systypes::work_order(), $selected_id); + $_POST['memo_'] = get_comments_string(ST_WORKORDER, $selected_id); hidden('wo_ref', $_POST['wo_ref']); hidden('units_issued', $_POST['units_issued']); @@ -374,13 +374,13 @@ if (isset($selected_id)) hidden('old_stk_id', $myrow["stock_id"]); label_row(_("Reference:"), $_POST['wo_ref']); - label_row(_("Type:"), wo_types::name($_POST['type'])); + label_row(_("Type:"), $wo_types_array[$_POST['type']]); hidden('type', $myrow["type"]); } else { $_POST['units_issued'] = $_POST['released'] = 0; - ref_row(_("Reference:"), 'wo_ref', '', references::get_next(systypes::work_order())); + ref_row(_("Reference:"), 'wo_ref', '', $Refs->get_next(ST_WORKORDER)); wo_types_list_row(_("Type:"), 'type', null); } @@ -409,13 +409,13 @@ else $_POST['quantity'] = qty_format($_POST['quantity'], $_POST['stock_id'], $dec); -if (get_post('type') == wo_types::advanced()) +if (get_post('type') == WO_ADVANCED) { qty_row(_("Quantity Required:"), 'quantity', null, null, null, $dec); if ($_POST['released']) label_row(_("Quantity Manufactured:"), number_format($_POST['units_issued'], get_qty_dec($_POST['stock_id']))); date_row(_("Date") . ":", 'date_', '', true); - date_row(_("Date Required By") . ":", 'RequDate', '', null, sys_prefs::default_wo_required_by()); + date_row(_("Date Required By") . ":", 'RequDate', '', null, $SysPrefs->default_wo_required_by()); } else { diff --git a/manufacturing/work_order_issue.php b/manufacturing/work_order_issue.php index 775527aa..e0349bb8 100644 --- a/manufacturing/work_order_issue.php +++ b/manufacturing/work_order_issue.php @@ -34,7 +34,7 @@ if (isset($_GET['AddedID'])) { display_notification(_("The work order issue has been entered.")); - display_note(get_trans_view_str(systypes::work_order(), $_GET['AddedID'], _("View this Work Order"))); + display_note(get_trans_view_str(ST_WORKORDER, $_GET['AddedID'], _("View this Work Order"))); hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process")); @@ -69,6 +69,8 @@ function handle_new_order() function can_process() { + global $Refs; + if (!is_date($_POST['date_'])) { display_error(_("The entered date for the issue is invalid.")); @@ -81,7 +83,7 @@ function can_process() set_focus('date_'); return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); diff --git a/manufacturing/work_order_release.php b/manufacturing/work_order_release.php index ca72da7c..eee4ed95 100644 --- a/manufacturing/work_order_release.php +++ b/manufacturing/work_order_release.php @@ -69,7 +69,7 @@ if (isset($_POST['release'])) display_notification(_("The work order has been released to manufacturing.")); - display_note(get_trans_view_str(systypes::work_order(), $selected_id, _("View this Work Order"))); + display_note(get_trans_view_str(ST_WORKORDER, $selected_id, _("View this Work Order"))); hyperlink_no_params("search_work_orders.php", _("Select another &work order")); diff --git a/purchasing/allocations/supplier_allocate.php b/purchasing/allocations/supplier_allocate.php index 4a4b85a8..4997b2de 100644 --- a/purchasing/allocations/supplier_allocate.php +++ b/purchasing/allocations/supplier_allocate.php @@ -45,7 +45,7 @@ function edit_allocations_for_transaction($type, $trans_no) { start_form(); - display_heading(_("Allocation of") . " " . systypes::name($_SESSION['alloc']->type) . " # " . $_SESSION['alloc']->trans_no); + display_heading(_("Allocation of") . " " . $systypes_array[$_SESSION['alloc']->type] . " # " . $_SESSION['alloc']->trans_no); display_heading($_SESSION['alloc']->person_name); diff --git a/purchasing/allocations/supplier_allocation_main.php b/purchasing/allocations/supplier_allocation_main.php index 78b0b660..69d342fa 100644 --- a/purchasing/allocations/supplier_allocation_main.php +++ b/purchasing/allocations/supplier_allocation_main.php @@ -47,7 +47,7 @@ start_form(); end_form(); set_global_supplier($_POST['supplier_id']); - if (isset($_POST['supplier_id']) && ($_POST['supplier_id'] == reserved_words::get_all())) + if (isset($_POST['supplier_id']) && ($_POST['supplier_id'] == ALL_TEXT)) { unset($_POST['supplier_id']); } @@ -62,7 +62,9 @@ start_form(); //-------------------------------------------------------------------------------- function systype_name($dummy, $type) { - return systypes::name($type); + global $systypes_array; + + return $systypes_array[$type; } function trans_view($trans) diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index 7e7d5510..3a9e4595 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -53,6 +53,8 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, function add_grn(&$po, $date_, $reference, $location) { + global $Refs; + begin_transaction(); $grn = add_grn_batch($po->order_no, $po->supplier_id, $reference, $location, $date_); @@ -93,7 +95,7 @@ function add_grn(&$po, $date_, $reference, $location) } /*quantity received is != 0 */ } /*end of order_line loop */ - references::save(25, $grn, $reference); + $Refs->save(25, $grn, $reference); add_audit_trail(25, $grn, $date_); diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc index ab817cf9..bca0bd2f 100644 --- a/purchasing/includes/db/invoice_db.inc +++ b/purchasing/includes/db/invoice_db.inc @@ -118,6 +118,8 @@ function get_diff_in_home_currency($supplier, $old_date, $date, $amount1, $amoun function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref because we change locally { + global $Refs; + //$company_currency = get_company_currency(); /*Start an sql transaction */ begin_transaction(); @@ -283,11 +285,11 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b } /*Post a balance post if $total != 0 */ - add_gl_balance($trans_type, $invoice_id, $date_, -$total, payment_person_types::supplier(), $supp_trans->supplier_id); + add_gl_balance($trans_type, $invoice_id, $date_, -$total, PT_SUPPLIER, $supp_trans->supplier_id); add_comments($trans_type, $invoice_id, $date_, $supp_trans->Comments); - references::save($trans_type, $invoice_id, $supp_trans->reference); + $Refs->save($trans_type, $invoice_id, $supp_trans->reference); if ($invoice_no != 0) { @@ -309,7 +311,7 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b // Exchange Variations Joe Hunt 2008-09-20 //////////////////////////////////////// exchange_variation(21, $invoice_id, 20, $invoice_no, $date_, - $allocate_amount, payment_person_types::supplier()); + $allocate_amount, PT_SUPPLIER); /////////////////////////////////////////////////////////////////////////// } diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index 8a92e8bb..1f5f5750 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -24,6 +24,8 @@ function delete_po($po) function add_po(&$po_obj) { + global $Refs; + begin_transaction(); /*Insert to purchase order header record */ @@ -56,11 +58,11 @@ function add_po(&$po_obj) } } - references::save(systypes::po(), $po_obj->order_no, $po_obj->reference); + $Refs->save(ST_PURCHORDER, $po_obj->order_no, $po_obj->reference); - //add_comments(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); + //add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); - add_audit_trail(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date); + add_audit_trail(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date); commit_transaction(); return $po_obj->order_no; @@ -116,7 +118,7 @@ function update_po(&$po_obj) db_query($sql, "One of the purchase order detail records could not be updated"); } - //add_comments(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); + //add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); commit_transaction(); diff --git a/purchasing/includes/db/supp_payment_db.inc b/purchasing/includes/db/supp_payment_db.inc index c44c8140..d4dc4706 100644 --- a/purchasing/includes/db/supp_payment_db.inc +++ b/purchasing/includes/db/supp_payment_db.inc @@ -12,6 +12,8 @@ function add_supp_payment($supplier_id, $date_, $bank_account, $amount, $discount, $ref, $memo_, $rate=0, $charge=0) { + global $Refs; + begin_transaction(); $supplier_currency = get_supplier_currency($supplier_id); @@ -67,17 +69,17 @@ function add_supp_payment($supplier_id, $date_, $bank_account, } /*Post a balance post if $total != 0 */ - add_gl_balance($trans_type, $payment_id, $date_, -$total, payment_person_types::supplier(), $supplier_id); + add_gl_balance($trans_type, $payment_id, $date_, -$total, PT_SUPPLIER, $supplier_id); /*now enter the bank_trans entry */ add_bank_trans($trans_type, $payment_id, $bank_account, $ref, - $date_, -($amount + $supp_charge), payment_person_types::supplier(), + $date_, -($amount + $supp_charge), PT_SUPPLIER, $supplier_id, $bank_account_currency, "Could not add the supplier payment bank transaction"); add_comments($trans_type, $payment_id, $date_, $memo_); - references::save($trans_type, $payment_id, $ref); + $Refs->save($trans_type, $payment_id, $ref); commit_transaction(); diff --git a/purchasing/includes/db/suppalloc_db.inc b/purchasing/includes/db/suppalloc_db.inc index 91b53396..1c0f16eb 100644 --- a/purchasing/includes/db/suppalloc_db.inc +++ b/purchasing/includes/db/suppalloc_db.inc @@ -81,7 +81,7 @@ function clear_supp_alloctions($type, $type_no, $date="") // 2008-09-20 Joe Hunt if ($date != "") exchange_variation($type, $type_no, $row['trans_type_to'], $row['trans_no_to'], $date, - $row['amt'], payment_person_types::supplier(), true); + $row['amt'], PT_SUPPLIER, true); ////////////////////// } diff --git a/purchasing/includes/purchasing_db.inc b/purchasing/includes/purchasing_db.inc index dc9ceccd..89b7533e 100644 --- a/purchasing/includes/purchasing_db.inc +++ b/purchasing/includes/purchasing_db.inc @@ -39,7 +39,7 @@ function add_gl_trans_supplier($type, $type_no, $date_, $account, $dimension, $d return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, $memo, $amount, get_supplier_currency($supplier_id), - payment_person_types::supplier(), $supplier_id, $err_msg, $rate); + PT_SUPPLIER, $supplier_id, $err_msg, $rate); } //---------------------------------------------------------------------------------------- diff --git a/purchasing/includes/ui/grn_ui.inc b/purchasing/includes/ui/grn_ui.inc index 539fc5f3..81bd8617 100644 --- a/purchasing/includes/ui/grn_ui.inc +++ b/purchasing/includes/ui/grn_ui.inc @@ -13,7 +13,7 @@ function display_grn_summary(&$po, $editable=false) { - global $table_style2; + global $table_style2, $Refs; start_table("$table_style2 width=90%"); start_row(); @@ -22,7 +22,7 @@ function display_grn_summary(&$po, $editable=false) if (!is_company_currency($po->curr_code)) label_cells(_("Order Currency"), $po->curr_code, "class='tableheader2'"); - label_cells(_("For Purchase Order"), get_trans_view_str(systypes::po(), $po->order_no), + label_cells(_("For Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no), "class='tableheader2'"); label_cells(_("Ordered On"), $po->orig_order_date, "class='tableheader2'"); @@ -33,7 +33,7 @@ function display_grn_summary(&$po, $editable=false) if ($editable) { if (!isset($_POST['ref'])) - $_POST['ref'] = references::get_next(25); + $_POST['ref'] = $Refs->get_next(25); ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'"); if (!isset($_POST['Location'])) diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index a3a599cb..75c8a24f 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -55,7 +55,7 @@ function copy_to_trans(&$supp_trans) function invoice_header(&$supp_trans) { - global $Ajax, $table_style; + global $Ajax, $table_style, $Refs; // if vars have been lost, recopy if (!isset($_POST['tran_date'])) @@ -74,7 +74,7 @@ function invoice_header(&$supp_trans) } else { - if (!isset($_POST['supplier_id']) && (get_global_supplier() != reserved_words::get_all())) + if (!isset($_POST['supplier_id']) && (get_global_supplier() != ALL_TEXT)) $_POST['supplier_id'] = get_global_supplier(); supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true); @@ -90,9 +90,9 @@ function invoice_header(&$supp_trans) } if ($supp_trans->is_invoice) - ref_row(_("Reference:"), 'reference', '', references::get_next(20)); + ref_row(_("Reference:"), 'reference', '', $Refs->get_next(20)); else - ref_row(_("Reference:"), 'reference', '', references::get_next(21)); + ref_row(_("Reference:"), 'reference', '', $Refs->get_next(21)); if (isset($_POST['invoice_no'])) { @@ -367,7 +367,7 @@ function display_grn_items_for_selection(&$supp_trans, $k) hidden('order_price'.$n, $myrow['unit_price'], false). hidden('std_cost_unit'.$n, $myrow['std_cost_unit'], false). hidden('po_detail_item'.$n, $myrow['po_detail_item'], false)); - label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"])); + label_cell(get_trans_view_str(ST_PURCHORDER, $myrow["purch_order_no"])); label_cell($myrow["item_code"]); label_cell($myrow["description"]); label_cell(sql2date($myrow["delivery_date"])); diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index 9ca5cda8..237d34b1 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -50,7 +50,7 @@ function create_new_po() function display_po_header(&$order) { - global $table_style2, $Ajax; + global $table_style2, $Ajax, $Refs; $editable = ($order->order_no == 0); @@ -59,7 +59,7 @@ function display_po_header(&$order) table_section(1); if ($editable) { - if (!isset($_POST['supplier_id']) && (get_global_supplier() != reserved_words::get_all())) + if (!isset($_POST['supplier_id']) && (get_global_supplier() != ALL_TEXT)) $_POST['supplier_id'] = get_global_supplier(); supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true, false, true); @@ -91,7 +91,7 @@ function display_po_header(&$order) if ($editable) { - ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::po())); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_PURCHORDER)); } else { @@ -238,7 +238,7 @@ function display_po_summary(&$po, $is_self=false, $editable=false) if (!$is_self) { - label_cells(_("Purchase Order"), get_trans_view_str(systypes::po(), $po->order_no), + label_cells(_("Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no), "class='tableheader2'"); } end_row(); diff --git a/purchasing/inquiry/po_search.php b/purchasing/inquiry/po_search.php index 5638582b..e8f9f0c6 100644 --- a/purchasing/inquiry/po_search.php +++ b/purchasing/inquiry/po_search.php @@ -75,7 +75,7 @@ end_form(); //--------------------------------------------------------------------------------------------- function trans_view($trans) { - return get_trans_view_str(systypes::po(), $trans["order_no"]); + return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]); } function edit_link($row) diff --git a/purchasing/inquiry/po_search_completed.php b/purchasing/inquiry/po_search_completed.php index 7f014d8c..f13c95fd 100644 --- a/purchasing/inquiry/po_search_completed.php +++ b/purchasing/inquiry/po_search_completed.php @@ -77,7 +77,7 @@ if (isset($_POST['order_number'])) } if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") && - ($_POST['SelectStockFromList'] != reserved_words::get_all())) + ($_POST['SelectStockFromList'] != ALL_TEXT)) { $selected_stock_item = $_POST['SelectStockFromList']; } @@ -89,7 +89,7 @@ else //--------------------------------------------------------------------------------------------- function trans_view($trans) { - return get_trans_view_str(systypes::po(), $trans["order_no"]); + return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]); } function edit_link($row) @@ -137,7 +137,7 @@ else $sql .= " AND porder.ord_date >= '$data_after'"; $sql .= " AND porder.ord_date <= '$date_before'"; - if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) + if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != ALL_TEXT) { $sql .= " AND porder.into_stock_location = '". $_POST['StockLocation'] . "' "; } diff --git a/purchasing/inquiry/supplier_allocation_inquiry.php b/purchasing/inquiry/supplier_allocation_inquiry.php index 30b11bfb..b0d9d51b 100644 --- a/purchasing/inquiry/supplier_allocation_inquiry.php +++ b/purchasing/inquiry/supplier_allocation_inquiry.php @@ -70,7 +70,9 @@ function check_overdue($row) function systype_name($dummy, $type) { - return systypes::name($type); + global $systypes_array; + + return $systypes_array[$type]; } function view_link($trans) @@ -140,9 +142,9 @@ function fmt_credit($row) WHERE supplier.supplier_id = trans.supplier_id AND trans.tran_date >= '$date_after' AND trans.tran_date <= '$date_to'"; - if ($_POST['supplier_id'] != reserved_words::get_all()) + if ($_POST['supplier_id'] != ALL_TEXT) $sql .= " AND trans.supplier_id = '" . $_POST['supplier_id'] . "'"; - if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) + if (isset($_POST['filterType']) && $_POST['filterType'] != ALL_TEXT) { if (($_POST['filterType'] == '1') || ($_POST['filterType'] == '2')) { @@ -185,7 +187,7 @@ $cols = array( array('insert'=>true, 'fun'=>'alloc_link') ); -if ($_POST['supplier_id'] != reserved_words::get_all()) { +if ($_POST['supplier_id'] != ALL_TEXT) { $cols[_("Supplier")] = 'skip'; $cols[_("Currency")] = 'skip'; } diff --git a/purchasing/inquiry/supplier_inquiry.php b/purchasing/inquiry/supplier_inquiry.php index 7de2319c..38508f71 100644 --- a/purchasing/inquiry/supplier_inquiry.php +++ b/purchasing/inquiry/supplier_inquiry.php @@ -89,7 +89,7 @@ function display_supplier_summary($supplier_record) //------------------------------------------------------------------------------------------------ div_start('totals_tbl'); -if (($_POST['supplier_id'] != "") && ($_POST['supplier_id'] != reserved_words::get_all())) +if (($_POST['supplier_id'] != "") && ($_POST['supplier_id'] != ALL_TEXT)) { $supplier_record = get_supplier_details($_POST['supplier_id']); display_supplier_summary($supplier_record); @@ -104,7 +104,8 @@ if(get_post('RefreshInquiry')) //------------------------------------------------------------------------------------------------ function systype_name($dummy, $type) { - return systypes::name($type); + global $systypes_array; + return $systypes_array[$type]; } function trans_view($trans) @@ -177,9 +178,9 @@ function check_overdue($row) AND trans.tran_date >= '$date_after' AND trans.tran_date <= '$date_to' AND trans.ov_amount != 0"; // exclude voided transactions - if ($_POST['supplier_id'] != reserved_words::get_all()) + if ($_POST['supplier_id'] != ALL_TEXT) $sql .= " AND trans.supplier_id = '" . $_POST['supplier_id'] . "'"; - if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) + if (isset($_POST['filterType']) && $_POST['filterType'] != ALL_TEXT) { if (($_POST['filterType'] == '1')) { @@ -220,7 +221,7 @@ $cols = array( array('insert'=>true, 'fun'=>'credit_link') ); -if ($_POST['supplier_id'] != reserved_words::get_all()) +if ($_POST['supplier_id'] != ALL_TEXT) { $cols[_("Supplier")] = 'skip'; $cols[_("Currency")] = 'skip'; diff --git a/purchasing/po_entry_items.php b/purchasing/po_entry_items.php index 09fc0663..a5f4b7d5 100644 --- a/purchasing/po_entry_items.php +++ b/purchasing/po_entry_items.php @@ -42,7 +42,7 @@ check_db_has_purchasable_items(_("There are no purchasable inventory items defin if (isset($_GET['AddedID'])) { $order_no = $_GET['AddedID']; - $trans_type = systypes::po(); + $trans_type = ST_PURCHORDER; if (!isset($_GET['Updated'])) display_notification_centered(_("Purchase Order has been entered")); @@ -261,6 +261,8 @@ function handle_add_new_item() function can_commit() { + global $Refs; + if (!is_date($_POST['OrderDate'])) { display_error(_("The entered order date is invalid.")); @@ -270,14 +272,14 @@ function can_commit() if (!$_SESSION['PO']->order_no) { - if (!references::is_valid(get_post('ref'))) + if (!$Refs->is_valid(get_post('ref'))) { display_error(_("There is no reference entered for this purchase order.")); set_focus('ref'); return false; } - if (!is_new_reference(get_post('ref'), systypes::po())) + if (!is_new_reference(get_post('ref'), ST_PURCHORDER)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); diff --git a/purchasing/po_receive_items.php b/purchasing/po_receive_items.php index cec4715f..5059807b 100644 --- a/purchasing/po_receive_items.php +++ b/purchasing/po_receive_items.php @@ -158,6 +158,8 @@ function check_po_changed() function can_process() { + global $SysPrefs, $Refs; + if (count($_SESSION['PO']->line_items) <= 0) { display_error(_("There is nothing to process. Please enter valid quantities greater than zero.")); @@ -171,7 +173,7 @@ function can_process() return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); @@ -200,7 +202,7 @@ function can_process() foreach ($_SESSION['PO']->line_items as $order_line) { if ($order_line->receive_qty+$order_line->qty_received > - $order_line->quantity * (1+ (sys_prefs::over_receive_allowance() / 100))) + $order_line->quantity * (1+ ($SysPrefs->over_receive_allowance() / 100))) { $delivery_qty_too_large = 1; break; @@ -214,7 +216,7 @@ function can_process() } elseif ($delivery_qty_too_large == 1) { - display_error(_("Entered quantities cannot be greater than the quantity entered on the purchase order including the allowed over-receive percentage") . " (" . sys_prefs::over_receive_allowance() ."%)." + display_error(_("Entered quantities cannot be greater than the quantity entered on the purchase order including the allowed over-receive percentage") . " (" . $SysPrefs->over_receive_allowance() ."%)." . "
" . _("Modify the ordered items on the purchase order if you wish to increase the quantities.")); return false; diff --git a/purchasing/supplier_credit.php b/purchasing/supplier_credit.php index 102184b0..25c24e3b 100644 --- a/purchasing/supplier_credit.php +++ b/purchasing/supplier_credit.php @@ -137,7 +137,7 @@ if (isset($_POST['AddGLCodeToTrans'])){ function check_data() { - global $total_grn_value, $total_gl_value; + global $total_grn_value, $total_gl_value, $Refs; if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) { @@ -146,7 +146,7 @@ function check_data() return false; } - if (!references::is_valid($_SESSION['supp_trans']->reference)) + if (!$Refs->is_valid($_SESSION['supp_trans']->reference)) { display_error(_("You must enter an credit note reference.")); set_focus('reference'); @@ -160,7 +160,7 @@ function check_data() return false; } - if (!references::is_valid($_SESSION['supp_trans']->supp_reference)) + if (!$Refs->is_valid($_SESSION['supp_trans']->supp_reference)) { display_error(_("You must enter a supplier's credit note reference.")); set_focus('supp_reference'); diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index 5302ee67..33c745a1 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -138,13 +138,15 @@ if (isset($_POST['AddGLCodeToTrans'])){ function check_data() { - If (!$_SESSION['supp_trans']->is_valid_trans_to_post()) + global $Refs; + + if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) { display_error(_("The invoice cannot be processed because the there are no items or values on the invoice. Invoices are expected to have a charge.")); return false; } - if (!references::is_valid($_SESSION['supp_trans']->reference)) + if (!$Refs->is_valid($_SESSION['supp_trans']->reference)) { display_error(_("You must enter an invoice reference.")); set_focus('reference'); @@ -158,7 +160,7 @@ function check_data() return false; } - if (!references::is_valid($_SESSION['supp_trans']->supp_reference)) + if (!$Refs->is_valid($_SESSION['supp_trans']->supp_reference)) { display_error(_("You must enter a supplier's invoice reference.")); set_focus('supp_reference'); @@ -228,7 +230,7 @@ if (isset($_POST['PostInvoice'])) function check_item_data($n) { global $check_price_charged_vs_order_price, - $check_qty_charged_vs_del_qty; + $check_qty_charged_vs_del_qty, $SysPrefs; if (!check_num('this_quantity_inv'.$n, 0) || input_num('this_quantity_inv'.$n)==0) { display_error( _("The quantity to invoice must be numeric and greater than zero.")); @@ -243,15 +245,16 @@ function check_item_data($n) return false; } + $margin = $SysPrefs->over_charge_allowance(); if ($check_price_charged_vs_order_price == True) { if ($_POST['order_price'.$n]!=input_num('ChgPrice'.$n)) { if ($_POST['order_price'.$n]==0 || input_num('ChgPrice'.$n)/$_POST['order_price'.$n] > - (1 + (sys_prefs::over_charge_allowance() / 100))) + (1 + ($margin/ 100))) { display_error(_("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") . - _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%"); + _("The over-charge percentage allowance is :") . $margin . "%"); set_focus('ChgPrice'.$n); return false; } @@ -261,10 +264,10 @@ function check_item_data($n) if ($check_qty_charged_vs_del_qty == True) { if (input_num('this_quantity_inv'.$n) / ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]) > - (1+ (sys_prefs::over_charge_allowance() / 100))) + (1+ ($margin / 100))) { display_error( _("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") - . _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%"); + . _("The over-charge percentage allowance is :") . $margin . "%"); set_focus('this_quantity_inv'.$n); return false; } diff --git a/purchasing/supplier_payment.php b/purchasing/supplier_payment.php index 423a97cc..ee0b81a6 100644 --- a/purchasing/supplier_payment.php +++ b/purchasing/supplier_payment.php @@ -82,6 +82,8 @@ if (isset($_GET['AddedID'])) function check_inputs() { + global $Refs; + if ($_POST['amount'] == "") { $_POST['amount'] = price_format(0); @@ -144,7 +146,7 @@ function check_inputs() set_focus('DatePaid'); return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); @@ -225,7 +227,7 @@ start_form(); table_section(2); - ref_row(_("Reference:"), 'ref', '', references::get_next(22)); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(22)); date_row(_("Date Paid") . ":", 'DatePaid', '', true, 0, 0, 0, null, true); diff --git a/purchasing/view/view_supp_credit.php b/purchasing/view/view_supp_credit.php index 9a81bec1..60fa7f41 100644 --- a/purchasing/view/view_supp_credit.php +++ b/purchasing/view/view_supp_credit.php @@ -72,7 +72,7 @@ $voided = is_voided_display(21, $trans_no, _("This credit note has been voided." if (!$voided) { - display_allocations_from(payment_person_types::supplier(), $supp_trans->supplier_id, 21, $trans_no, -($supp_trans->ov_amount + $supp_trans->ov_gst)); + display_allocations_from(PT_SUPPLIER, $supp_trans->supplier_id, 21, $trans_no, -($supp_trans->ov_amount + $supp_trans->ov_gst)); } end_page(true); diff --git a/purchasing/view/view_supp_payment.php b/purchasing/view/view_supp_payment.php index c7da2a56..7ee90978 100644 --- a/purchasing/view/view_supp_payment.php +++ b/purchasing/view/view_supp_payment.php @@ -58,7 +58,7 @@ start_row(); if ($show_currencies) label_cells(_("Payment Currency"), $receipt['bank_curr_code'], "class='tableheader2'"); label_cells(_("Amount"), number_format2(-$receipt['BankAmount'], user_price_dec()), "class='tableheader2'"); -label_cells(_("Payment Type"), bank_account_types::transfer_type($receipt['BankTransType']), "class='tableheader2'"); +label_cells(_("Payment Type"), $bank_transfer_typea[$receipt['BankTransType']], "class='tableheader2'"); end_row(); start_row(); if ($show_currencies) @@ -78,7 +78,7 @@ $voided = is_voided_display(22, $trans_no, _("This payment has been voided.")); // now display the allocations for this payment if (!$voided) { - display_allocations_from(payment_person_types::supplier(), $receipt['supplier_id'], 22, $trans_no, -$receipt['Total']); + display_allocations_from(PT_SUPPLIER, $receipt['supplier_id'], 22, $trans_no, -$receipt['Total']); } end_page(true); diff --git a/reporting/includes/header2.inc b/reporting/includes/header2.inc index 90cf3b63..5755b627 100644 --- a/reporting/includes/header2.inc +++ b/reporting/includes/header2.inc @@ -11,6 +11,8 @@ ***********************************************************************/ // New version (without vertical lines) + global $wo_types_array; + $this->row = $this->pageHeight - $this->topMargin; $upper = $this->row - 2 * $this->lineHeight; @@ -222,7 +224,7 @@ $this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C'); } elseif ($doctype == 26) - $this->TextWrap($col, $this->row, $width, wo_types::name($myrow["type"]), 'C'); + $this->TextWrap($col, $this->row, $width, $wo_types_array[$myrow["type"]], 'C'); $col += $width; if ($doctype == 26) $this->TextWrap($col, $this->row, $width, $myrow["StockItemName"], 'C'); diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 7fa0c122..9df49429 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -24,7 +24,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, switch ($type_no) { - case systypes::sales_quotation() : + case ST_SALESQUOTE : $rep = 111; // from, to, currency, bank acc, email, quote, comments $ar = array( @@ -35,7 +35,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, 'PARAM_4' => $email, 'PARAM_5' => ""); break; - case systypes::sales_order() : + case ST_SALESORDER : $rep = 109; // from, to, currency, bank acc, email, quote, comments $ar = array( @@ -47,7 +47,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, 'PARAM_5' => 0, 'PARAM_6' => ""); break; - case systypes::cust_dispatch() : + case ST_CUSTDELIVERY : $rep = 110; // from, to, email, comments $ar = array( @@ -70,7 +70,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, 'PARAM_6' => "", 'PARAM_7' => $type_no); break; - case systypes::po() : + case ST_PURCHORDER : $rep = 209; // from, to, currency, bank acc, email, comments $ar = array( diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index 2b1c6d55..9ed5a4ab 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -375,9 +375,9 @@ function dup_simple_codeandname_list($sql, $name, &$selected_id, if ($all_option == true) { if ($all_option_numeric) - $reserved_word = reserved_words::get_all_numeric(); + $reserved_word = ALL_NUMERIC; else - $reserved_word = reserved_words::get_all(); + $reserved_word = ALL_TEXT; if ($reserved_word == $selected_id) { @@ -437,7 +437,7 @@ function dup_systypes_list($name, &$selected_id, $all_option=false, $all_option_ $st = "
" . $myrow["type" . $i] . "