Eliminated non-static method calls and other bulk fixes to fix php5 warnings
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 13 Sep 2009 21:14:10 +0000 (21:14 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 13 Sep 2009 21:14:10 +0000 (21:14 +0000)
129 files changed:
admin/db/voiding_db.inc
admin/display_prefs.php
admin/fiscalyears.php
admin/forms_setup.php
admin/view_print_transaction.php
admin/void_transaction.php
dimensions/dimension_entry.php
dimensions/includes/dimensions_db.inc
dimensions/inquiry/search_dimensions.php
dimensions/view/view_dimension.php
frontaccounting.php
gl/bank_account_reconcile.php
gl/bank_transfer.php
gl/gl_bank.php
gl/gl_journal.php
gl/includes/db/gl_db_banking.inc
gl/includes/db/gl_db_trans.inc
gl/includes/ui/gl_bank_ui.inc
gl/inquiry/bank_inquiry.php
gl/inquiry/gl_account_inquiry.php
gl/inquiry/journal_inquiry.php
gl/manage/bank_accounts.php
gl/manage/gl_account_types.php
gl/view/bank_transfer_view.php
gl/view/gl_deposit_view.php
gl/view/gl_payment_view.php
gl/view/gl_trans_view.php
inventory/adjustments.php
inventory/cost_update.php
inventory/includes/db/items_adjust_db.inc
inventory/includes/db/items_trans_db.inc
inventory/includes/db/items_transfer_db.inc
inventory/includes/item_adjustments_ui.inc
inventory/includes/stock_transfers_ui.inc
inventory/inquiry/stock_movements.php
inventory/manage/movement_types.php
inventory/transfers.php
inventory/view/view_adjustment.php
inventory/view/view_transfer.php
manufacturing/includes/db/work_order_issues_db.inc
manufacturing/includes/db/work_order_produce_items_db.inc
manufacturing/includes/db/work_orders_db.inc
manufacturing/includes/db/work_orders_quick_db.inc
manufacturing/includes/manufacturing_ui.inc
manufacturing/includes/work_order_issue_ui.inc
manufacturing/search_work_orders.php
manufacturing/view/wo_issue_view.php
manufacturing/view/wo_production_view.php
manufacturing/view/work_order_view.php
manufacturing/work_order_add_finished.php
manufacturing/work_order_costs.php
manufacturing/work_order_entry.php
manufacturing/work_order_issue.php
manufacturing/work_order_release.php
purchasing/allocations/supplier_allocate.php
purchasing/allocations/supplier_allocation_main.php
purchasing/includes/db/grn_db.inc
purchasing/includes/db/invoice_db.inc
purchasing/includes/db/po_db.inc
purchasing/includes/db/supp_payment_db.inc
purchasing/includes/db/suppalloc_db.inc
purchasing/includes/purchasing_db.inc
purchasing/includes/ui/grn_ui.inc
purchasing/includes/ui/invoice_ui.inc
purchasing/includes/ui/po_ui.inc
purchasing/inquiry/po_search.php
purchasing/inquiry/po_search_completed.php
purchasing/inquiry/supplier_allocation_inquiry.php
purchasing/inquiry/supplier_inquiry.php
purchasing/po_entry_items.php
purchasing/po_receive_items.php
purchasing/supplier_credit.php
purchasing/supplier_invoice.php
purchasing/supplier_payment.php
purchasing/view/view_supp_credit.php
purchasing/view/view_supp_payment.php
reporting/includes/header2.inc
reporting/includes/reporting.inc
reporting/includes/reports_classes.inc
reporting/rep101.php
reporting/rep102.php
reporting/rep103.php
reporting/rep104.php
reporting/rep105.php
reporting/rep108.php
reporting/rep201.php
reporting/rep202.php
reporting/rep203.php
reporting/rep204.php
reporting/rep301.php
reporting/rep302.php
reporting/rep303.php
reporting/rep304.php
reporting/rep409.php
reporting/rep601.php
reporting/rep702.php
reporting/rep704.php
reporting/rep709.php
reporting/rep710.php
sales/allocations/customer_allocate.php
sales/allocations/customer_allocation_main.php
sales/create_recurrent_invoices.php
sales/credit_note_entry.php
sales/customer_credit_invoice.php
sales/customer_delivery.php
sales/customer_invoice.php
sales/customer_payments.php
sales/includes/cart_class.inc
sales/includes/db/cust_trans_db.inc
sales/includes/db/custalloc_db.inc
sales/includes/db/payment_db.inc
sales/includes/db/sales_credit_db.inc
sales/includes/db/sales_delivery_db.inc
sales/includes/db/sales_invoice_db.inc
sales/includes/db/sales_order_db.inc
sales/includes/sales_db.inc
sales/includes/ui/sales_credit_ui.inc
sales/includes/ui/sales_order_ui.inc
sales/inquiry/customer_allocation_inquiry.php
sales/inquiry/customer_inquiry.php
sales/inquiry/sales_deliveries_view.php
sales/inquiry/sales_orders_view.php
sales/manage/customers.php
sales/sales_order_entry.php
sales/view/view_credit.php
sales/view/view_dispatch.php
sales/view/view_invoice.php
sales/view/view_receipt.php
taxes/tax_groups.php

index cb433def442527e3682e50edd33c60d4ca8aef87..e8a3f14fdbd69966320d72b9a47509b40a06022c 100644 (file)
@@ -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;
        }
index 407952857ce5d848cafc19eb63f70c1b7c64cab9..2581b2590e3ebf38c2d26d11482e09e18433532a 100644 (file)
@@ -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');   
index cc5c002915604aca01d177faaacb0e9defa87a6f..e7a2ff7454ac754ef66276f63ae729f1639da0db 100644 (file)
@@ -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'";
index 33982b1e4c7cd48f0b06b4255a4a69d09454bca0..bb21dc368456d6e59fe25436ad136aa6acd27351 100644 (file)
@@ -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);
index 93ae00cd3ec97136e570cdbcb921c25f1ae58789..aca82ee8df6fe60ed8d731f4198fcff865384412 100644 (file)
@@ -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(
                        _("#"), 
index c28c916b48ea15d7b70639f9ccb21c4393081061..23cb4237f3e0699ca84103f39b70f95bafb54478 100644 (file)
@@ -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;
        }
index 91904b53034a90d738630c021a69d9655ffe597d..7b9bcb3791ceb475581dc3a87287c7ed71b480c8 100644 (file)
@@ -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);
 
index 4013e4ebe070ca825faf4ad2449f5b0855416798..2a89b59643b1551d7c8856bb5471ba022e95ab78 100644 (file)
@@ -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();
 }
index eaf74c1988f825fac739dd68099147b2082aa503..ffb1e6128ca415372df6519abe4f580c8d115cf4 100644 (file)
@@ -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)
index 9dfc01e867e184be993ad44104da45cc7185689f..bc0cdf5cf2a3361f3b0b9cdc7078cb78a807391e 100644 (file)
@@ -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();
 
index ffd9c7f56f27ccb6cbcbeb07a6bce3867c5f55f9..033c99283758f9f537cb096323221779ad7b69f2 100644 (file)
@@ -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");
                                }
                        }       
index 1810b6417c9ddcaa92b94db153ceead6fd45d157..1bc6530068c478de56579cc966c6c84ea4974ac0 100644 (file)
@@ -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;
index b7c7fcc5ef56ded16bb071e9b575b58cf4de588c..893fabea478d9f018b631c7ed34210fde343a929 100644 (file)
@@ -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');
index aff95cb3c9e76c74d96f6fdd564eb81bfeabf9fa..1e5718b514060c1854ebef6e3aabab340c2f6a4f 100644 (file)
@@ -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 "<td>";
-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 "</td>";
@@ -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();
index 33431822af054efd0163e5657033bf339fc0909d..9cfc933295e1bc2b2d7f83da92d8e9589e6f9bf8 100644 (file)
@@ -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');
index e73e1e3ac877aab3f5fa7020f5c95cdba0f50893..cc028ac75e0314469ab85a5d6a7aa873595b8814 100644 (file)
@@ -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();
index 111d4e331a8a579f899cc6dac0e54d0fc19f5dca..723ea087aa1634c69d93fd3c519b549767718423 100644 (file)
@@ -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);
        }
 
index f42e8e36b96dcd94b71e4cce443daa823880c529..48c823923774d0b6fbbe82a1c84f63d5005b674b 100644 (file)
@@ -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'] =
index e287d77bfcad714654a60b0ba8a64fae550c30cd..ec98d993db5186b332f4b3cab465ba3deb9ebcca 100644 (file)
@@ -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();
 
index 17a889075211ed8a028c70609ac125b7edae04b8..3c415566d36937102ecfd4a73f02337dc634fd72 100644 (file)
@@ -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_']);
index 6cfd3cccd20deb2fd484357651e895ca1c2b0340..fee17602ebda89e9532a7dd8cd838fc4dbe2b934 100644 (file)
@@ -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) 
index a04d3c1ed4c989f77fe02192e0a7ca370e78326f..c70fc9e9aa14059b2eb01496ce2ccecb1da118f1 100644 (file)
@@ -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 
 {
index fd7d92ab700386ca146d0a31954c8e5f11c3d6f4..128438433276e087f16fd4f1495e01dbbfac17c7 100644 (file)
@@ -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 = "";
        } 
index 36932c3ea69ac03cd66193fd32661906847fabaf..3ae52d961c102edf709e62a37100106d0192a026 100644 (file)
@@ -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 "<br>";
 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
index 52c01e019ae8106c7c8025ff609b20aa4a2d8bf1..04232dd7cc4df1ffa54154afe5aad36d83e40a1e 100644 (file)
@@ -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)
 {
index b386c5c6afb4dfcab4e2d3f39e9e49b7c0b86861..e71e3dff2105011132771afda156686aaab1392e 100644 (file)
@@ -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)
 {
index 3ebedfa6ce1338acbc7249aedb5f5a020e60adc4..c48ed8199fe1df999846657a7e491a11993df356 100644 (file)
@@ -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 "<p><center>" . _("No general ledger transactions have been created for") . " " .systypes::name($_GET['type_id'])." " . _("number") . " " . $_GET['trans_no'] . "</center></p><br><br>";
+    echo "<p><center>" . _("No general ledger transactions have been created for") . " " .$systypes_array$_GET['type_id']]." " . _("number") . " " . $_GET['trans_no'] . "</center></p><br><br>";
        end_page(true);
        exit;
 }
index 662b528bbb6c019a2b336e066fecc11831fb3f3e..3de3713f5494d0ed8a344410d4412de8deaa990b 100644 (file)
@@ -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');
index ba8a39c79ac937cb05cc0786b75305b75f43058e..bfaf0f33b986a957604e2ea714f35fa5a20f430c 100644 (file)
@@ -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);
         }
        }
 }
index b51110694fb70eab1face682d684a9a445a10a1b..ae2e25c709574014170217d6793756f780e25e58 100644 (file)
 
 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));
        }
 }
 
index dee7ef70f6af6cccea7ba99d41925e1a1129f2dc..0bcdb82b80e6e12f7fb26108745cd2fa8e5f9c5a 100644 (file)
@@ -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;
index 5784453b0361fb9582c53c25527d56597bd97865..da1ceec24b43fbfb1a1c6fd52fbfd3113edf67af 100644 (file)
 
 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
index 8812438e47363d5881a078394ef9cd40eb205474..a8a7481aa5d43a86108edc9fb7133b60b50bdab3 100644 (file)
@@ -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%");
 
index 6f3d307eb5655e7b46e57e3b2ffd5feffcf4c61f..33df8fde7b33981b799ea296124574f1aaebf9c5 100644 (file)
@@ -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);
 
index e3526e9bcd9a1a1cf23f4b5b214d59d0e626b54c..bf80e27a6688085baa596c9ef2750bb595f988e2 100644 (file)
@@ -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 = "";
index e54ff3cb4d1606a12f6b15aa85584109038be017..5f75844fca8e536ddde2d7f5ce7aae2a6a8573ed 100644 (file)
@@ -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) 
index 77fbc2f84b0d4530d5caf44623f3fb446e80955f..e8e995a8d084770a6638cbff87a2f648f960deb3 100644 (file)
@@ -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');
index cd6575b92229d144df3df08052951c1fe3b7f55e..1db792698fc8e7ed34d7a0c610a5f3b123f84393 100644 (file)
@@ -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
index 0c448712919feff4400379e51affc2886e935523..85c0ae85d4699bc3585bbcd1df3fb3be2fd7f476 100644 (file)
@@ -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 "<br>";
 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
index 9fbbfb69c299e6e549fe0d3036ffdcb90c224c54..d9361bda8bf77d2c24717328730276f50ae966be 100644 (file)
@@ -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();
index 6676549cafa82f62717bc17b686a7848ed6fe3df..695e696df33a3c2c00a46572927507118b203826 100644 (file)
@@ -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();
index f0ce31a59680381a7c8e49a56e6e0a04f0f1e3cf..122179f0c0954fc757a2fc6bc26007aaf9cceaee 100644 (file)
@@ -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);
index dc6c03ed64c570f41cdbcdebfefb7df76a2d5892..455f918e0b43b68e4a5cf597ce5ff55694f15faf 100644 (file)
 
 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);
 }
 
index e5eaf8ccf3fdf439fce442b932507adc1fb51704..426356d9c61a4efa053edd055dba260cb2717772 100644 (file)
@@ -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();
 
index dad39a9ce849605776ddc38efe3ebd2bc2ad7a07..5924f2ccdd20a65424dc18d24bdb4f6e1f080aa2 100644 (file)
@@ -145,9 +145,11 @@ function issue_edit_item_controls(&$order, $line_no=-1)
 
 function issue_options_controls()
 {
+       global $Refs;
+
        echo "<br>";
        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;
index e03538b5508a3fa13330c920c86625b847b28ab3..353c3be6e459a0ea6a37e5bbbaa6478bb9dd03a1 100644 (file)
@@ -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)
index 7b49484e1a4e7a006082cc9d2b864ab7b3343f3b..9f0a8d7e0ac5c7c7385f3d6adb4cdfd7bde3de30 100644 (file)
@@ -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);
 
index 28a4c7aea425a1efc090b0a2973e6112ca0bc6d0..f3690b5eb336e4f51441f8b4379d7b59266b93cf 100644 (file)
@@ -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);
 
index 2c12edc88fa8a3a6d6a00ca9a42e3e939dddba36..62b3df66b715f04213b3361ee964ce1aaf95aac5 100644 (file)
@@ -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 "<br><table cellspacing=7><tr valign=top><td>";
        display_heading2(_("Issues"));
@@ -79,7 +79,7 @@ else
 
 echo "<br></center>";
 
-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);
 
index 8ba7fd6e0942c1e98a3efdb41d904d4c130a9ca1..c61f19bbad2c952e5b95615e628301ec13b93faa 100644 (file)
@@ -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;
index b6f6ba237d74fdad8d0810fa728bb221d575b3d5..7ce5e811c67bde915492f986b2564dd0bfe31848 100644 (file)
@@ -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();   
 
index a278e1e6a2e7a84555ed313435808e846ddc63d5..7e06ea45d2c0355caaf680c8070a09dcdde89b5e 100644 (file)
@@ -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
 {
index 775527aabf9c1b942980d48028d970d7c17484ec..e0349bb8c0ce3cd440146bde1f04c01d3026644a 100644 (file)
@@ -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');
index ca72da7c980e73540e91d7dd0133827cbf6e106e..eee4ed95d1ed96e49e5777404b0ed552cedad289 100644 (file)
@@ -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"));
 
index 4a4b85a829058ba2b3e4957fe0141d8f5c436262..4997b2de51255889b3770ad0f853f4a857e641c6 100644 (file)
@@ -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);
 
index 78b0b66059704369dddce0305e97b39abaad3162..69d342fa9996f31e619e78252432bf3b566cc636 100644 (file)
@@ -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)
index 7e7d5510bb890cdd7398273d9480492f2b1a08be..3a9e45955515ffca5dbc8f67e97b680160807871 100644 (file)
@@ -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_);
 
index ab817cf9a65ccea93f446b8ca0b03c4a4c7a6d0e..bca0bd2fe5c989f7ca2471ed6259c189aa9ecb11 100644 (file)
@@ -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);
 
                                ///////////////////////////////////////////////////////////////////////////
                        }
index 8a92e8bbddabea53935488f641d97c65bba666c2..1f5f57504a17fae58880bfdb6bb0b057a06a3804 100644 (file)
@@ -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();
 
index c44c8140b2b6a50e31ebb3b856e1fb940e3dc006..d4dc4706ea3f02d9000648176f08867c8db7888c 100644 (file)
@@ -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();
 
index 91b533964c02176e029a3fb2f1c4489b304bacc5..1c0f16eb8da44d7f76b6f6f46a06a52bab08b14f 100644 (file)
@@ -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);
                //////////////////////
        }
 
index dc9ceccd20293ae65ef70634d37428d1daf61ee3..89b7533e849fa6eda1da77c141d5b703af66c6a5 100644 (file)
@@ -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);
 }
 
 //----------------------------------------------------------------------------------------
index 539fc5f38e6bce953635721f7a7b894bf63e120a..81bd8617153be72374c5174a09af7efcbf9189c0 100644 (file)
@@ -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']))
index a3a599cb81cdbe889f66ad43a7b32adf7a2181f1..75c8a24f304bb923ee9b2bda717d9794484e43b2 100644 (file)
@@ -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"]));
index 9ca5cda89c00800416c9b2b47479eeb7ba08a628..237d34b10c9d689af55e44ec0bc4fc00085ff66d 100644 (file)
@@ -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();
index 5638582be597b1ad1c1948e4696e6e8f8ddf83c2..e8f9f0c6318abb12c5529181cd6eb9c5e5a67b9c 100644 (file)
@@ -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) 
index 7f014d8c8a0a4366ec3e2d5c7bdf4c68eda36f6c..f13c95fdf3d920bebb57cec6cf27a4ba1ae3c14a 100644 (file)
@@ -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'] . "' ";
        }
index 30b11bfbc08c35a45a83aac5ce95c01a414bf38c..b0d9d51b1d71b8c258149276af5969dd4942bc3e 100644 (file)
@@ -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';
 }
index 7de2319c5402ec106ec5c2165f804458ab0980fd..38508f71ea5fec9141509a9f51b11084d99e1d6b 100644 (file)
@@ -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';
index 09fc0663bb9c47ba6082d83e52c538ed2d268924..a5f4b7d59e9f2e7919a03b134c18b71b0bbe067b 100644 (file)
@@ -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');
index cec4715f05c66b0224c93e0486f47fdbd9469bac..5059807be0e433350209e5934cefe5c7501729c8 100644 (file)
@@ -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() ."%)."
                . "<br>" .
                _("Modify the ordered items on the purchase order if you wish to increase the quantities."));
        return false;
index 102184b03b48fd3364f2f9414dafd5a8ca374f6e..25c24e3b0afdf31771954d07b0ede86581ad817f 100644 (file)
@@ -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');
index 5302ee670e774011182c69145e0670d2f8304802..33c745a1c60c453ba577bc92b6871da328d25718 100644 (file)
@@ -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;
                }
index 423a97cc439efc3a75a882f398e8595037576e99..ee0b81a6538434ec35a4662a88666824228e7f9b 100644 (file)
@@ -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);
 
index 9a81bec19ee5d8acfd913083524f9a471cf118f3..60fa7f41b52b334e2b95b66fea9b7ec2c1042e3f 100644 (file)
@@ -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);
index c7da2a5669f7c7fa7679e331d18711e9365b7156..7ee909784aed83c89daadb8b35be95a2ef1bc124 100644 (file)
@@ -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);
index 90cf3b63f5636866a97a62695333bb7b782517e8..5755b627e984e118903b552788c061cc9314c537 100644 (file)
@@ -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;
                        $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');
index 7fa0c122ad1d9754951e5be3be79da37f35d6f5b..9df4942975e2d1850605f5193d7aa05a5136b546 100644 (file)
@@ -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(
index 2b1c6d5557965eff7dd4f7b507545084de3fd678..9ed5a4ab11d99e20f1c2821cd098dbd1ebf03a9e 100644 (file)
@@ -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 = "<select name='$name'>";
        if ($all_option == true)
        {
-               $reserved_word = reserved_words::get_all_numeric();
+               $reserved_word = ALL_NUMERIC;
        if ($reserved_word == $selected_id)
             $st .= "<option selected value='" . $reserved_word . "'>" . $all_option_name . "</option>\n";
        else
index 633ef3e9971b893ba5502f82621ecb80a34f165b..95a092810e0ce6f8678d7db98e0d19d5461b7bb9 100644 (file)
@@ -90,7 +90,7 @@ function get_transactions($debtorno, $from, $to)
 
 function print_customer_balances()
 {
-    global $path_to_root;
+    global $path_to_root, $systypes_array;
 
     $from = $_POST['PARAM_0'];
     $to = $_POST['PARAM_1'];
@@ -103,13 +103,13 @@ function print_customer_balances()
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
-       if ($fromcust == reserved_words::get_all_numeric())
+       if ($fromcust == ALL_NUMERIC)
                $cust = _('All');
        else
                $cust = get_customer_name($fromcust);
     $dec = user_price_dec();
 
-       if ($currency == reserved_words::get_all())
+       if ($currency == ALL_TEXT)
        {
                $convert = true;
                $currency = _('Balances in Home Currency');
@@ -138,7 +138,7 @@ function print_customer_balances()
        $grandtotal = array(0,0,0,0);
 
        $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master ";
-       if ($fromcust != reserved_words::get_all_numeric())
+       if ($fromcust != ALL_NUMERIC)
                $sql .= "WHERE debtor_no=$fromcust ";
        $sql .= "ORDER BY name";
        $result = db_query($sql, "The customers could not be retrieved");
@@ -177,7 +177,7 @@ function print_customer_balances()
                while ($trans = db_fetch($res))
                {
                        $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1, systypes::name($trans['type']));
+                       $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
                        $rep->TextCol(1, 2,     $trans['reference']);
                        $rep->DateCol(2, 3,     $trans['tran_date'], true);
                        if ($trans['type'] == 10)
index 7ce89ad28937bd1f49bd2355d4041a371dd30da3..f8a2a52dfa44715b943e022edb2297ac08afda70 100644 (file)
@@ -64,7 +64,7 @@ function get_invoices($costomer_id, $to)
 
 function print_aged_customer_analysis()
 {
-    global $comp_path, $path_to_root;
+    global $comp_path, $path_to_root, $systypes_array;
 
     $to = $_POST['PARAM_0'];
     $fromcust = $_POST['PARAM_1'];
@@ -83,7 +83,7 @@ function print_aged_customer_analysis()
                $pg = new graph();
        }
 
-       if ($fromcust == reserved_words::get_all_numeric())
+       if ($fromcust == ALL_NUMERIC)
                $from = _('All');
        else
                $from = get_customer_name($fromcust);
@@ -93,7 +93,7 @@ function print_aged_customer_analysis()
                $summary = _('Summary Only');
        else
                $summary = _('Detailed Report');
-       if ($currency == reserved_words::get_all())
+       if ($currency == ALL_TEXT)
        {
                $convert = true;
                $currency = _('Balances in Home Currency');
@@ -130,7 +130,7 @@ function print_aged_customer_analysis()
        $total = array(0,0,0,0, 0);
 
        $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master ";
-       if ($fromcust != reserved_words::get_all_numeric())
+       if ($fromcust != ALL_NUMERIC)
                $sql .= "WHERE debtor_no=$fromcust ";
        $sql .= "ORDER BY name";
        $result = db_query($sql, "The customers could not be retrieved");
@@ -174,7 +174,7 @@ function print_aged_customer_analysis()
                        while ($trans=db_fetch($res))
                        {
                                $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     systypes::name($trans['type']), -2);
+                       $rep->TextCol(0, 1, $systypes_array[$trans['type']], -2);
                                $rep->TextCol(1, 2,     $trans['reference'], -2);
                                $rep->DateCol(2, 3, $trans['tran_date'], true, -2);
                                if ($trans['type'] == 11 || $trans['type'] == 12 || $trans['type'] == 2)
index ead177fdf37c9b54b037b1eb2a26131dc41d161d..e8a418910daab345965c7e506fd7b37321f3a28e 100644 (file)
@@ -109,9 +109,9 @@ function print_customer_details_listing()
     
     $dec = 0;
 
-       if ($area == reserved_words::get_all_numeric())
+       if ($area == ALL_NUMERIC)
                $area = 0;
-       if ($folk == reserved_words::get_all_numeric())
+       if ($folk == ALL_NUMERIC)
                $folk = 0;
 
        if ($area == 0)
index e1cbdefc0ab145009abb72869b9be6e82aeff839..53d8fea1df6d438c4bfdd79e1fa27afdd993d297 100644 (file)
@@ -83,13 +83,13 @@ function print_price_listing()
     $dec = user_price_dec();
 
        $home_curr = get_company_pref('curr_default');
-       if ($currency == reserved_words::get_all())
+       if ($currency == ALL_TEXT)
                $currency = $home_curr;
        $curr = get_currency($currency);
        $curr_sel = $currency . " - " . $curr['currency'];
-       if ($category == reserved_words::get_all_numeric())
+       if ($category == ALL_NUMERIC)
                $category = 0;
-       if ($salestype == reserved_words::get_all_numeric())
+       if ($salestype == ALL_NUMERIC)
                $salestype = 0;
        if ($category == 0)
                $cat = _('All');
index 3af56221bb43ea155ef02ca1734dbca32e5ea938..d4916ca8428ca7849173749af2ea9c1fa5a7cbda 100644 (file)
@@ -85,9 +85,9 @@ function print_order_status_list()
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
-       if ($category == reserved_words::get_all_numeric())
+       if ($category == ALL_NUMERIC)
                $category = 0;
-       if ($location == reserved_words::get_all())
+       if ($location == ALL_TEXT)
                $location = null;
        if ($category == 0)
                $cat = _('All');
index b5232a1286584e3435d072f050180722360d2bc0..0fcfb6e40061af1e79bae48a93bfad6e36ff773b 100644 (file)
@@ -48,7 +48,7 @@ function getTransactions($debtorno, $date)
 
 function print_statements()
 {
-       global $path_to_root;
+       global $path_to_root, $systypes_array;
 
        include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
@@ -84,7 +84,7 @@ function print_statements()
        }
 
        $sql = "SELECT debtor_no, name AS DebtorName, address, tax_id, email, curr_code, curdate() AS tran_date, payment_terms FROM ".TB_PREF."debtors_master";
-       if ($customer != reserved_words::get_all_numeric())
+       if ($customer != ALL_NUMERIC)
                $sql .= " WHERE debtor_no = $customer";
        else
                $sql .= " ORDER by name";
@@ -130,7 +130,7 @@ function print_statements()
                        $DisplayAlloc = number_format2($myrow2["Allocated"],$dec);
                        $DisplayNet = number_format2($myrow2["TotalAmount"] - $myrow2["Allocated"],$dec);
 
-                       $rep->TextCol(0, 1,     systypes::name($myrow2['type']), -2);
+                       $rep->TextCol(0, 1, $systypes_array[$myrow2['type']], -2);
                        $rep->TextCol(1, 2,     $myrow2['reference'], -2);
                        $rep->TextCol(2, 3,     sql2date($myrow2['tran_date']), -2);
                        if ($myrow2['type'] == 10)
index fce973821f9303f2c82789854b31da7546f0feca..61048e871f6762c7cdcc1a810927f6ad6915fcd3 100644 (file)
@@ -82,7 +82,7 @@ function getTransactions($supplier_id, $from, $to)
 
 function print_supplier_balances()
 {
-    global $path_to_root;
+    global $path_to_root, $systypes_array;
 
     $from = $_POST['PARAM_0'];
     $to = $_POST['PARAM_1'];
@@ -95,13 +95,13 @@ function print_supplier_balances()
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
-       if ($fromsupp == reserved_words::get_all_numeric())
+       if ($fromsupp == ALL_NUMERIC)
                $supp = _('All');
        else
                $supp = get_supplier_name($fromsupp);
     $dec = user_price_dec();
 
-       if ($currency == reserved_words::get_all())
+       if ($currency == ALL_TEXT)
        {
                $convert = true;
                $currency = _('Balances in Home currency');
@@ -131,7 +131,7 @@ function print_supplier_balances()
        $grandtotal = array(0,0,0,0);
 
        $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers ";
-       if ($fromsupp != reserved_words::get_all_numeric())
+       if ($fromsupp != ALL_NUMERIC)
                $sql .= "WHERE supplier_id=$fromsupp ";
        $sql .= "ORDER BY supp_name";
        $result = db_query($sql, "The customers could not be retrieved");
@@ -170,7 +170,7 @@ function print_supplier_balances()
                while ($trans=db_fetch($res))
                {
                        $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     systypes::name($trans['type']));
+                       $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
                        $rep->TextCol(1, 2,     $trans['reference']);
                        $rep->DateCol(2, 3,     $trans['tran_date'], true);
                        if ($trans['type'] == 20)
index ba15545c846e4b3e6a63dff9e95afd627b630cd1..2245ae01ca0bab5d52d2163da985b3e0094dbf8a 100644 (file)
@@ -65,7 +65,7 @@ function get_invoices($supplier_id, $to)
 
 function print_aged_supplier_analysis()
 {
-    global $comp_path, $path_to_root;
+    global $comp_path, $path_to_root, $systypes_array;
 
     $to = $_POST['PARAM_0'];
     $fromsupp = $_POST['PARAM_1'];
@@ -84,7 +84,7 @@ function print_aged_supplier_analysis()
                $pg = new graph();
        }
 
-       if ($fromsupp == reserved_words::get_all_numeric())
+       if ($fromsupp == ALL_NUMERIC)
                $from = _('All');
        else
                $from = get_supplier_name($fromsupp);
@@ -94,7 +94,7 @@ function print_aged_supplier_analysis()
                $summary = _('Summary Only');
        else
                $summary = _('Detailed Report');
-       if ($currency == reserved_words::get_all())
+       if ($currency == ALL_TEXT)
        {
                $convert = true;
                $currency = _('Balances in Home Currency');
@@ -138,7 +138,7 @@ function print_aged_supplier_analysis()
        $pastdue2 = _('Over') . " " . $PastDueDays2 . " " . _('Days');
 
        $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers ";
-       if ($fromsupp != reserved_words::get_all_numeric())
+       if ($fromsupp != ALL_NUMERIC)
                $sql .= "WHERE supplier_id=$fromsupp ";
        $sql .= "ORDER BY supp_name";
        $result = db_query($sql, "The suppliers could not be retrieved");
@@ -182,7 +182,7 @@ function print_aged_supplier_analysis()
                        while ($trans=db_fetch($res))
                        {
                                $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     systypes::name($trans['type']), -2);
+                       $rep->TextCol(0, 1, $systypes_array[$trans['type']], -2);
                                $rep->TextCol(1, 2,     $trans['reference'], -2);
                                $rep->TextCol(2, 3,     sql2date($trans['tran_date']), -2);
                                foreach ($trans as $i => $value)
index 3ad684adc96085c7afd7b27bdb3a8c530d900437..ffe28416f75f70167b43550c00872677e3a630e3 100644 (file)
@@ -53,7 +53,7 @@ function getTransactions($supplier, $date)
 
 function print_payment_report()
 {
-    global $path_to_root;
+    global $path_to_root, $systypes_array;
 
     $to = $_POST['PARAM_0'];
     $fromsupp = $_POST['PARAM_1'];
@@ -65,14 +65,14 @@ function print_payment_report()
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
-       if ($fromsupp == reserved_words::get_all_numeric())
+       if ($fromsupp == ALL_NUMERIC)
                $from = _('All');
        else
                $from = get_supplier_name($fromsupp);
 
     $dec = user_price_dec();
 
-       if ($currency == reserved_words::get_all())
+       if ($currency == ALL_TEXT)
        {
                $convert = true;
                $currency = _('Balances in Home Currency');
@@ -103,7 +103,7 @@ function print_payment_report()
 
        $sql = "SELECT supplier_id, supp_name AS name, curr_code, ".TB_PREF."payment_terms.terms FROM ".TB_PREF."suppliers, ".TB_PREF."payment_terms
                WHERE ";
-       if ($fromsupp != reserved_words::get_all_numeric())
+       if ($fromsupp != ALL_NUMERIC)
                $sql .= "supplier_id=$fromsupp AND ";
        $sql .= "".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator
                ORDER BY supp_name";
@@ -131,7 +131,7 @@ function print_payment_report()
                        else
                                $rate = 1.0;
                        $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     systypes::name($trans['type']));
+                       $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
                        $rep->TextCol(1, 2,     $trans['supp_reference']);
                        if ($trans['type'] == 20)
                                $rep->DateCol(2, 3,     $trans['due_date'], true);
index 5dd8d29f66d1b57a3f54fa154941335cd2546639..5521c7450e40eec5673b46c28e685fbadcbc07a6 100644 (file)
@@ -48,7 +48,7 @@ function getTransactions($fromsupp)
                AND ".TB_PREF."grn_batch.id = ".TB_PREF."grn_items.grn_batch_id
                AND ".TB_PREF."grn_items.po_detail_item = ".TB_PREF."purch_order_details.po_detail_item
                AND qty_recd-quantity_inv <>0 ";
-       if ($fromsupp != reserved_words::get_all_numeric())
+       if ($fromsupp != ALL_NUMERIC)
                $sql .= "AND ".TB_PREF."grn_batch.supplier_id ='" . $fromsupp . "' ";
        $sql .= "ORDER BY ".TB_PREF."grn_batch.supplier_id,
                        ".TB_PREF."grn_batch.id";
@@ -70,7 +70,7 @@ function print_outstanding_GRN()
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
-       if ($fromsupp == reserved_words::get_all_numeric())
+       if ($fromsupp == ALL_NUMERIC)
                $from = _('All');
        else
                $from = get_supplier_name($fromsupp);
index dede52077f64ff7032ed17bf5299d0b8ca41919a..d476ec9a98cd2f3e568a27f763501c4cb9db2ccc 100644 (file)
@@ -79,14 +79,14 @@ function print_inventory_valuation_report()
 
     $dec = user_price_dec();
 
-       if ($category == reserved_words::get_all_numeric())
+       if ($category == ALL_NUMERIC)
                $category = 0;
        if ($category == 0)
                $cat = _('All');
        else
                $cat = get_category_name($category);
 
-       if ($location == reserved_words::get_all())
+       if ($location == ALL_TEXT)
                $location = 'all';
        if ($location == 'all')
                $loc = _('All');
index 1678b2ab5b4b94491269aebb61e57fde3183d506..611e214b0aa98da3779a6c4c5aa405504ba8ecf7 100644 (file)
@@ -97,14 +97,14 @@ function print_inventory_planning()
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
-       if ($category == reserved_words::get_all_numeric())
+       if ($category == ALL_NUMERIC)
                $category = 0;
        if ($category == 0)
                $cat = _('All');
        else
                $cat = get_category_name($category);
 
-       if ($location == reserved_words::get_all())
+       if ($location == ALL_TEXT)
                $location = 'all';
        if ($location == 'all')
                $loc = _('All');
index 85bb02d8cec888c0d516017ad55ee994dc617701..2ac79f8d739f2e2e0c012fab2f95edfe1e608368 100644 (file)
@@ -75,14 +75,14 @@ function print_stock_check()
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
-       if ($category == reserved_words::get_all_numeric())
+       if ($category == ALL_NUMERIC)
                $category = 0;
        if ($category == 0)
                $cat = _('All');
        else
                $cat = get_category_name($category);
 
-       if ($location == reserved_words::get_all())
+       if ($location == ALL_TEXT)
                $location = 'all';
        if ($location == 'all')
                $loc = _('All');
index 40b875844a912dfe883d8c92e640ce0d8b5655d2..7dbe339afbeef53b8743aae6f60130e9c96dbcad 100644 (file)
@@ -90,21 +90,21 @@ function print_inventory_sales()
 
     $dec = user_price_dec();
 
-       if ($category == reserved_words::get_all_numeric())
+       if ($category == ALL_NUMERIC)
                $category = 0;
        if ($category == 0)
                $cat = _('All');
        else
                $cat = get_category_name($category);
 
-       if ($location == reserved_words::get_all())
+       if ($location == ALL_TEXT)
                $location = 'all';
        if ($location == 'all')
                $loc = _('All');
        else
                $loc = get_location_name($location);
 
-       if ($fromcust == reserved_words::get_all_numeric())
+       if ($fromcust == ALL_NUMERIC)
                $fromc = _('All');
        else
                $fromc = get_customer_name($fromcust);
@@ -112,7 +112,7 @@ function print_inventory_sales()
        $cols = array(0, 75, 175, 250, 300, 375, 450,   515);
 
        $headers = array(_('Category'), _('Description'), _('Customer'), _('Qty'), _('Sales'), _('Cost'), _('Contribution'));
-       if ($fromcust != reserved_words::get_all_numeric())
+       if ($fromcust != ALL_NUMERIC)
                $headers[2] = '';       
 
        $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right');
@@ -163,7 +163,7 @@ function print_inventory_sales()
                $rep->NewLine();
                $rep->fontsize -= 2;
                $rep->TextCol(0, 1, $trans['stock_id']);
-               if ($fromcust == reserved_words::get_all_numeric())
+               if ($fromcust == ALL_NUMERIC)
                {
                        $rep->TextCol(1, 2, $trans['description']);
                        $rep->TextCol(2, 3, $trans['debtor_name']);
index 7140ee23d084ed436d44e54fa0d28066de44ac45..07e76f38486a8bf5bd5e2b90290931c0207923a8 100644 (file)
@@ -33,7 +33,7 @@ print_workorders();
 
 function print_workorders()
 {
-       global $path_to_root;
+       global $path_to_root, $SysPrefs;
 
        include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
@@ -103,7 +103,7 @@ function print_workorders()
                                $qoh = get_qoh_on_date($myrow2["stock_id"], $myrow2["loc_code"], $date_);
 
                        if ($show_qoh && ($myrow2["units_req"] * $myrow["units_issued"] > $qoh) &&
-                               !sys_prefs::allow_negative_stock())
+                               !$SysPrefs->allow_negative_stock())
                        {
                                // oops, we don't have enough of one of the component items
                                $has_marked = true;
index b5ed420a32b14a524cb69e8b3c2bd6e8d4540aac..893c8d9d29daae54f64af6ab9c263d1c469d1382 100644 (file)
@@ -54,7 +54,7 @@ function get_bank_transactions($from, $to, $account)
 
 function print_bank_transactions()
 {
-       global $path_to_root;
+       global $path_to_root, $systypes_array;
 
        $acc = $_POST['PARAM_0'];
        $from = $_POST['PARAM_1'];
@@ -110,11 +110,11 @@ function print_bank_transactions()
                        {
                                $total += $myrow['amount'];
 
-                               $rep->TextCol(0, 1,     systypes::name($myrow["type"]));
+                               $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
                                $rep->TextCol(1, 2,     $myrow['trans_no']);
                                $rep->TextCol(2, 3,     $myrow['ref']);
                                $rep->DateCol(3, 4,     $myrow["trans_date"], true);
-                               $rep->TextCol(4, 5,     payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false));
+                               $rep->TextCol(4, 5,     payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
                                if ($myrow['amount'] > 0.0)
                                        $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
                                else
index 478770f28a5f2ef259301136752fc0f5c545e7e2..c47fb2ebe10031b6fc0f5119b3df79920df21e3b 100644 (file)
@@ -32,7 +32,7 @@ print_list_of_journal_entries();
 
 function print_list_of_journal_entries()
 {
-    global $path_to_root;
+    global $path_to_root, $systypes_array;
 
     $from = $_POST['PARAM_0'];
     $to = $_POST['PARAM_1'];
@@ -55,7 +55,7 @@ function print_list_of_journal_entries()
 
     $params =   array(         0 => $comments,
                                    1 => array('text' => _('Period'), 'from' => $from,'to' => $to),
-                       2 => array('text' => _('Type'), 'from' => systypes::name($systype),
+                       2 => array('text' => _('Type'), 'from' => $systypes_array[$systype],
                             'to' => ''));
 
     $rep = new FrontReport(_('List of Journal Entries'), "JournalEntries", user_pagesize());
@@ -81,11 +81,11 @@ function print_list_of_journal_entries()
             }
             $typeno = $myrow['type_no'];
             $type = $myrow['type'];
-            $TransName = systypes::name($myrow['type']);
+            $TransName = $systypes_array[$myrow['type']];
             $rep->TextCol(0, 1, $TransName . " # " . $myrow['type_no']);
             $rep->TextCol(1, 2, get_reference($myrow['type'], $myrow['type_no']));
             $rep->DateCol(2, 3, $myrow['tran_date'], true);
-            $coms =  payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]);
+            $coms =  payment_person_name($myrow["person_type_id"],$myrow["person_id"]);
             $memo = get_comments_string($myrow['type'], $myrow['type_no']);
             if ($memo != '')
             {
index ffa888fdaad9b2e091f85635fcc0a1854402244b..f69d43547c8bc7982178fde55ec932a0cdbe80ea 100644 (file)
@@ -31,7 +31,7 @@ print_GL_transactions();
 
 function print_GL_transactions()
 {
-       global $path_to_root;
+       global $path_to_root, $systypes_array;
 
        $dim = get_company_pref('use_dimension');
        $dimension = $dimension2 = 0;
@@ -147,14 +147,14 @@ function print_GL_transactions()
                        {
                                $total += $myrow['amount'];
 
-                               $rep->TextCol(0, 1,     systypes::name($myrow["type"]));
+                               $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
                                $rep->TextCol(1, 2,     $myrow['type_no']);
                                $rep->DateCol(2, 3,     $myrow["tran_date"], true);
                                if ($dim >= 1)
                                        $rep->TextCol(3, 4,     get_dimension_string($myrow['dimension_id']));
                                if ($dim > 1)
                                        $rep->TextCol(4, 5,     get_dimension_string($myrow['dimension2_id']));
-                               $rep->TextCol(5, 6,     payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false));
+                               $rep->TextCol(5, 6,     payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
                                if ($myrow['amount'] > 0.0)
                                        $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
                                else
index 9b762ddc4a084e0ea992bb7f6819cf83362e2599..f20e48e0692c23a0d2e7f5f35d73f3d216d4841d 100644 (file)
@@ -71,7 +71,7 @@ function getTaxInfo($id)
 
 function print_tax_report()
 {
-       global $path_to_root, $trans_dir, $Hooks;
+       global $path_to_root, $trans_dir, $Hooks, $systypes_array;
        
        $from = $_POST['PARAM_0'];
        $to = $_POST['PARAM_1'];
@@ -123,7 +123,7 @@ function print_tax_report()
                
                if (!$summaryOnly)
                {
-                       $rep->TextCol(0, 1,     systypes::name($trans['trans_type']));
+                       $rep->TextCol(0, 1, $systypes_array[$trans['trans_type']]);
                        if ($trans['memo'] == '')
                                $trans['memo'] = get_reference($trans['trans_type'], $trans['trans_no']);
                        $rep->TextCol(1, 2,     $trans['memo']);
index 1c2e86ecfd2e62d57f292a1668b6abd6eac4f0a3..0efb023f7847a38b85066204594f60b00d3c3949 100644 (file)
@@ -55,7 +55,7 @@ function getTransactions($from, $to, $type, $user)
 
 function print_audit_trail()
 {
-    global $path_to_root;
+    global $path_to_root, $systypes_array;
 
     $from = $_POST['PARAM_0'];
     $to = $_POST['PARAM_1'];
@@ -81,7 +81,7 @@ function print_audit_trail()
        $user_id = $usr['user_id'];
     $params =   array(         0 => $comments,
                                    1 => array('text' => _('Period'), 'from' => $from,'to' => $to),
-                       2 => array('text' => _('Type'), 'from' => ($systype != -1 ? systypes::name($systype) : _('All')), 'to' => ''),
+                       2 => array('text' => _('Type'), 'from' => ($systype != -1 ? $systypes_array[$systype] : _('All')), 'to' => ''),
                        3 => array('text' => _('User'), 'from' => ($user != -1 ? $user_id : _('All')), 'to' => ''));
 
     $rep = new FrontReport(_('Audit Trail'), "AuditTrail", user_pagesize());
@@ -101,7 +101,7 @@ function print_audit_trail()
                $rep->TextCol(1, 2, date("H:i:s", $myrow['unix_stamp']));
         $rep->TextCol(2, 3, $myrow['user_id']);
         $rep->TextCol(3, 4, sql2date($myrow['gl_date']));
-        $rep->TextCol(4, 5, systypes::name($myrow['type']));
+        $rep->TextCol(4, 5, $systypes_array[$myrow['type']]);
         $rep->TextCol(5, 6, $myrow['trans_no']);
         if ($myrow['gl_seq'] == null)
                $action = _('Changed');
index 411ee7bd7cffecad91b89eb5b0745e2fe8255d83..6b0357e0db267db9454cce0c4695a974cb072f01 100644 (file)
@@ -62,8 +62,10 @@ if (isset($_POST['Cancel']))
 
 function edit_allocations_for_transaction($type, $trans_no)
 {
+       global $systypes_array;
 
-    display_heading(sprintf(_("Allocation of %s # %d"), systypes::name($_SESSION['alloc']->type),$_SESSION['alloc']->trans_no));
+    display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$_SESSION['alloc']->type],
+       $_SESSION['alloc']->trans_no));
 
     display_heading($_SESSION['alloc']->person_name);
 
index 4bc5cef61f31d7e617292f5da95a0c51db8bb8f9..80783de48c3c90a6d573abea0bc5ce4e3106799c 100644 (file)
@@ -42,7 +42,7 @@ start_form();
 
        set_global_customer($_POST['customer_id']);
 
-       if (isset($_POST['customer_id']) && ($_POST['customer_id'] == reserved_words::get_all()))
+       if (isset($_POST['customer_id']) && ($_POST['customer_id'] == ALL_TEXT))
        {
                unset($_POST['customer_id']);
        }
@@ -64,7 +64,9 @@ start_form();
 //--------------------------------------------------------------------------------
 function systype_name($dummy, $type)
 {
-       return systypes::name($type);
+       global $systypes_array;
+
+       return $systypes_array[$type];
 }
 
 function trans_view($trans)
index 8cdf543b606cc03033681997943b99a3dcfa7142..644f60b203e83016594aa3c78bd82706840c559e 100644 (file)
@@ -29,9 +29,11 @@ function set_last_sent($id, $date)
        $sql = "UPDATE ".TB_PREF."recurrent_invoices SET last_sent='$date' WHERE id=$id";
        db_query($sql,"The recurrent invoice could not be updated or added");
 }      
-       
+
 function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no)
 {
+       global $Refs;
+
        $doc = new Cart(30, array($order_no));
 
        get_customer_details_to_order($doc, $customer_id, $branch_id);
@@ -41,7 +43,7 @@ function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no
        $doc->document_date = Today(); // 2006-06-15. Added so Invoices and Deliveries get current day
 
        $doc->due_date = get_invoice_duedate($doc->customer_id, $doc->document_date);
-       $doc->reference = references::get_next($doc->trans_type);
+       $doc->reference = $Refs->get_next($doc->trans_type);
        //$doc->Comments='';
 
        foreach ($doc->line_items as $line_no=>$item) {
@@ -51,7 +53,7 @@ function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no
        }       
        $cart = $doc;
        $cart->trans_type = 10;
-       $cart->reference = references::get_next($cart->trans_type);
+       $cart->reference = $Refs->get_next($cart->trans_type);
        $invno = $cart->write(1);
        set_last_sent($tmpl_no, $cart->document_date);
        return $invno;
index 18e945c298f154f54641abe2ddae6fe5a2fd4d9c..7dcc461dd3c132541447de6df5d96c1451bf58c0 100644 (file)
@@ -132,13 +132,14 @@ function handle_new_credit($trans_no)
 
 function can_process()
 {
+       global $Refs;
 
        $input_error = 0;
 
        if ($_SESSION['Items']->count_items() == 0 && (!check_num('ChargeFreightCost',0)))
                return false;
        if($_SESSION['Items']->trans_no == 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;
index d6bb4057d9d04c93941735b99133e0d7548e1dc2..d6dd0fb78b236e9b8b6d1750675422f106e798dd 100644 (file)
@@ -81,6 +81,8 @@ if (isset($_GET['AddedID'])) {
 
 function can_process()
 {
+       global $Refs;
+
        if (!is_date($_POST['CreditDate'])) {
                display_error(_("The entered date is invalid."));;
                set_focus('CreditDate');
@@ -92,7 +94,7 @@ function can_process()
        }
 
     if ($_SESSION['Items']->trans_no==0) {
-               if (!references::is_valid($_POST['ref'])) {
+               if (!$Refs->is_valid($_POST['ref'])) {
                        display_error(_("You must enter a reference."));;
                        set_focus('ref');
                        return false;
@@ -127,7 +129,7 @@ if (isset($_GET['InvoiceNumber']) && $_GET['InvoiceNumber'] > 0) {
     $ci->src_date = $ci->document_date;
     $ci->trans_no = 0;
     $ci->document_date = new_doc_date();
-    $ci->reference = references::get_next(11);
+    $ci->reference = $Refs->get_next(11);
 
     for ($line_no=0; $line_no<count($ci->line_items); $line_no++) {
        $ci->line_items[$line_no]->qty_dispatched = '0';
@@ -248,7 +250,7 @@ function display_credit_items()
     start_row();
 
 //     if (!isset($_POST['ref']))
-//             $_POST['ref'] = references::get_next(11);
+//             $_POST['ref'] = $Refs->get_next(11);
 
     if ($_SESSION['Items']->trans_no==0) {
                ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
index cbc5e08107c4e9909dbcc2abd51b9376b3358caa..366d9a29fe9b4df3bba2efbe9c0f558e7287ebab 100644 (file)
@@ -96,7 +96,7 @@ if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) {
        $ord->src_docs = $ord->trans_no;
        $ord->order_no = key($ord->trans_no);
        $ord->trans_no = 0;
-       $ord->reference = references::get_next(13);
+       $ord->reference = $Refs->get_next(13);
        $ord->document_date = new_doc_date();
        $_SESSION['Items'] = $ord;
        copy_from_cart();
@@ -140,6 +140,8 @@ if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) {
 
 function check_data()
 {
+       global $Refs;
+
        if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) {
                display_error(_("The entered date of delivery is invalid."));
                set_focus('DispatchDate');
@@ -159,7 +161,7 @@ function check_data()
        }
 
        if ($_SESSION['Items']->trans_no==0) {
-               if (!references::is_valid($_POST['ref'])) {
+               if (!$Refs->is_valid($_POST['ref'])) {
                        display_error(_("You must enter a reference."));
                        set_focus('ref');
                        return false;
@@ -264,7 +266,9 @@ function check_quantities()
 
 function check_qoh()
 {
-       if (!sys_prefs::allow_negative_stock()) {
+       global $SysPrefs;
+
+       if (!$SysPrefs->allow_negative_stock()) {
                foreach ($_SESSION['Items']->line_items as $itm) {
 
                        if ($itm->qty_dispatched && has_stock_holding($itm->mb_flag)) {
@@ -324,7 +328,7 @@ end_row();
 start_row();
 
 //if (!isset($_POST['ref']))
-//     $_POST['ref'] = references::get_next(13);
+//     $_POST['ref'] = $Refs->get_next(13);
 
 if ($_SESSION['Items']->trans_no==0) {
        ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
@@ -332,7 +336,7 @@ if ($_SESSION['Items']->trans_no==0) {
        label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'");
 }
 
-label_cells(_("For Sales Order"), get_customer_trans_view_str(systypes::sales_order(), $_SESSION['Items']->order_no), "class='tableheader2'");
+label_cells(_("For Sales Order"), get_customer_trans_view_str(ST_SALESORDER, $_SESSION['Items']->order_no), "class='tableheader2'");
 
 label_cells(_("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'");
 end_row();
@@ -398,7 +402,7 @@ foreach ($_SESSION['Items']->line_items as $line=>$ln_itm) {
        }
        // if it's a non-stock item (eg. service) don't show qoh
        $show_qoh = true;
-       if (sys_prefs::allow_negative_stock() || !has_stock_holding($ln_itm->mb_flag) ||
+       if ($SysPrefs->allow_negative_stock() || !has_stock_holding($ln_itm->mb_flag) ||
                $ln_itm->qty_dispatched == 0) {
                $show_qoh = false;
        }
index c6a045823d1f4d775689edfd6159ed1cab90e4d0..a943b099c755419f8a1b682700aada2b87ed7a12 100644 (file)
@@ -120,7 +120,7 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) )
        $dn->trans_type = 10;
        $dn->src_docs = $dn->trans_no;
        $dn->trans_no = 0;
-       $dn->reference = references::get_next(10);
+       $dn->reference = $Refs->get_next(10);
        $dn->due_date = get_invoice_duedate($dn->customer_id, $dn->document_date);
 
        $_SESSION['Items'] = $dn;
@@ -242,6 +242,8 @@ function copy_from_cart()
 
 function check_data()
 {
+       global $Refs;
+
        if (!isset($_POST['InvoiceDate']) || !is_date($_POST['InvoiceDate'])) {
                display_error(_("The entered invoice date is invalid."));
                set_focus('InvoiceDate');
@@ -261,7 +263,7 @@ function check_data()
        }
 
        if ($_SESSION['Items']->trans_no == 0) {
-               if (!references::is_valid($_POST['ref'])) {
+               if (!$Refs->is_valid($_POST['ref'])) {
                        display_error(_("You must enter a reference."));
                        set_focus('ref');
                        return false;
@@ -358,7 +360,7 @@ if ($_SESSION['Items']->trans_no == 0) {
 }
 
 label_cells(_("Delivery Notes:"),
-get_customer_trans_view_str(systypes::cust_dispatch(), array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'");
+get_customer_trans_view_str(ST_CUSTDELIVERY, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'");
 
 label_cells(_("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'");
 
index c029cff3d51001dfa7918630f6d9c7fd23ae0428..53f92be50d40505e54c1f312fd2a980bcb0f1b23 100644 (file)
@@ -74,6 +74,8 @@ if (isset($_GET['AddedID'])) {
 
 function can_process()
 {
+       global $Refs;
+
        if (!isset($_POST['DateBanked']) || !is_date($_POST['DateBanked'])) {
                display_error(_("The entered date is invalid. Please enter a valid date for the payment."));
                set_focus('DateBanked');
@@ -84,7 +86,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');
                return false;
@@ -190,6 +192,8 @@ if (isset($_POST['AddPaymentItem'])) {
 
 function read_customer_data()
 {
+       global $Refs;
+
        $sql = "SELECT ".TB_PREF."debtors_master.pymt_discount,
                ".TB_PREF."credit_status.dissallow_invoices
                FROM ".TB_PREF."debtors_master, ".TB_PREF."credit_status
@@ -202,7 +206,7 @@ function read_customer_data()
 
        $_POST['HoldAccount'] = $myrow["dissallow_invoices"];
        $_POST['pymt_discount'] = $myrow["pymt_discount"];
-       $_POST['ref'] = references::get_next(12);
+       $_POST['ref'] = $Refs->get_next(12);
 }
 
 //----------------------------------------------------------------------------------------------
@@ -219,7 +223,7 @@ start_form();
        if (db_customer_has_branches($_POST['customer_id'])) {
                customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
        } else {
-               hidden('BranchID', reserved_words::get_any_numeric());
+               hidden('BranchID', ANY_NUMERIC);
        }
 
        read_customer_data();
index e865b24556a998cb800b27bf90284fb259dcf814..3f22e4f359a628858bd4d568c8282c17e8d96d3b 100644 (file)
@@ -97,6 +97,8 @@ class cart
        //
        function read($type, $trans_no = 0, $view=false ) {
 
+               global $SysPrefs, $Refs;
+
                if (!is_array($trans_no)) $trans_no = array($trans_no);
                if ($trans_no[0]) {
                        if ($type == 30 || $type == 32) { // sales order || sales quotation
@@ -150,14 +152,14 @@ class cart
                                $this->trans_type = $type;
                                $this->trans_no = 0;
                                // set new sales document defaults here
-                               if (get_global_customer() != reserved_words::get_all())
+                               if (get_global_customer() != ALL_TEXT)
                                  $this->customer_id = get_global_customer();
                                else
                                  $this->customer_id = '';
                                $this->document_date =  new_doc_date();
                                if (!is_date_in_fiscalyear($this->document_date))
                                        $this->document_date = end_fiscalyear();
-                               $this->reference = references::get_next($this->trans_type);
+                               $this->reference = $Refs->get_next($this->trans_type);
                                if ($type != 30 && $type != 32) // Added 2.1 Joe Hunt 2008-11-12
                                {
                                        $dim = get_company_pref('use_dimension');
@@ -197,7 +199,7 @@ class cart
                                }
                                } else
                                  $this->due_date =
-                                       add_days($this->document_date, sys_prefs::default_delivery_required_by());
+                                       add_days($this->document_date, $SysPrefs->default_delivery_required_by());
                        }
        }
 
index 2e681f7f7e11e464b9fb286555fccabc68436b39..e3e220063acb34495fe4ec999becfdb3aa14f1e3 100644 (file)
@@ -102,7 +102,7 @@ function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo,
        else
                $SQLDueDate = date2sql($due_date);
        
-       if ($trans_type == systypes::bank_payment())
+       if ($trans_type == ST_BANKPAYMENT)
                $Total = -$Total;
 
        if ($new) {
@@ -151,7 +151,7 @@ function get_customer_trans($trans_id, $trans_type)
                ".TB_PREF."debtors_master.name AS DebtorName, ".TB_PREF."debtors_master.address, ".TB_PREF."debtors_master.email AS email2,
                ".TB_PREF."debtors_master.curr_code, ".TB_PREF."debtors_master.tax_id, ".TB_PREF."debtors_master.payment_terms ";
 
-       if ($trans_type == systypes::cust_payment()) {
+       if ($trans_type == ST_CUSTPAYMENT) {
                // it's a payment so also get the bank account
                $sql .= ", ".TB_PREF."bank_accounts.bank_name, ".TB_PREF."bank_accounts.bank_account_name,
                        ".TB_PREF."bank_accounts.account_type AS BankTransType ";
@@ -171,7 +171,7 @@ function get_customer_trans($trans_id, $trans_type)
 
        $sql .= " FROM ".TB_PREF."debtor_trans, ".TB_PREF."debtors_master ";
 
-       if ($trans_type == systypes::cust_payment()) {
+       if ($trans_type == ST_CUSTPAYMENT) {
                // it's a payment so also get the bank account
                $sql .= ", ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts";
        }
@@ -185,7 +185,7 @@ function get_customer_trans($trans_id, $trans_type)
                AND ".TB_PREF."debtor_trans.type=$trans_type
                AND ".TB_PREF."debtor_trans.debtor_no=".TB_PREF."debtors_master.debtor_no";
 
-       if ($trans_type == systypes::cust_payment()) {
+       if ($trans_type == ST_CUSTPAYMENT) {
                // it's a payment so also get the bank account
                $sql .= " AND ".TB_PREF."bank_trans.trans_no =$trans_id
                        AND ".TB_PREF."bank_trans.type=$trans_type
index e9695bbcd3f9bbde574ca4078ca4ec5fe350f4c4..addb867e50d1f04b9c61d8ad1c1b10c0c0fa46f3 100644 (file)
@@ -79,7 +79,7 @@ function clear_cust_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::customer(), true);
+                               $row['amt'], PT_CUSTOMER, true);
                //////////////////////
        }
 
@@ -160,8 +160,8 @@ function get_allocatable_to_cust_transactions($customer_id, $trans_no=null, $typ
        else
        {
                $sql = get_alloc_trans_sql(null, "round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) > 0
-                       AND trans.type != " . systypes::cust_payment() . "
-                       AND trans.type != " . systypes::bank_deposit() . "
+                       AND trans.type != " . ST_CUSTPAYMENT . "
+                       AND trans.type != " . ST_BANKDEPOSIT . "
                        AND trans.type != 11
                        AND trans.type != 13
                        AND trans.debtor_no=$customer_id");
index e88bf4d630431be8b33dbb29ddc8aa07182a760b..f7e56866f8950b6974621530008867d1ec002c1e 100644 (file)
@@ -15,6 +15,8 @@
 function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_account,
        $date_, $ref, $amount, $discount, $memo_, $rate=0, $charge=0)
 {
+       global $Refs;
+
        begin_transaction();
 
        $company_record = get_company_prefs();
@@ -36,7 +38,7 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou
                $bank_gl_account, 0, 0, $amount - $charge,  $customer_id,
                "Cannot insert a GL transaction for the bank account debit", $rate);
 
-       if ($branch_id != reserved_words::get_any_numeric()) {
+       if ($branch_id != ANY_NUMERIC) {
 
                $branch_data = get_branch_accounts($branch_id);
 
@@ -69,16 +71,16 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou
                        "Cannot insert a GL transaction for the payment bank charge debit", $rate);
        }
        /*Post a balance post if $total != 0 */
-       add_gl_balance(12, $payment_no, $date_, -$total, payment_person_types::customer(), $customer_id);       
+       add_gl_balance(12, $payment_no, $date_, -$total, PT_CUSTOMER, $customer_id);    
 
        /*now enter the bank_trans entry */
        add_bank_trans(12, $payment_no, $bank_account, $ref,
-               $date_, $amount - $charge, payment_person_types::customer(), $customer_id,
+               $date_, $amount - $charge, PT_CUSTOMER, $customer_id,
                get_customer_currency($customer_id), "", $rate);
 
        add_comments(12, $payment_no, $date_, $memo_);
 
-       references::save(12, $payment_no, $ref);
+       $Refs->save(12, $payment_no, $ref);
 
        commit_transaction();
 
index 8e3cd494b47c9a7992d0cd9db23f6f5285e19cb0..caff001fa196df7ce629c80bcf5d3e69707605b1 100644 (file)
@@ -15,6 +15,8 @@
 //
 function write_credit_note($credit_note, $write_off_acc)
 {
+       global $Refs;
+
        $credit_invoice =       is_array($credit_note->src_docs) ?
                 reset(array_keys($credit_note->src_docs)) : $credit_note->src_docs;
 
@@ -100,7 +102,7 @@ function write_credit_note($credit_note, $write_off_acc)
                                // Exchange Variations Joe Hunt 2008-09-20 ////////////////////////////////////////
 
                                exchange_variation(11, $credit_no, 10, $credit_invoice, $credit_date,
-                                       $allocate_amount, payment_person_types::customer());
+                                       $allocate_amount, PT_CUSTOMER);
 
                                ///////////////////////////////////////////////////////////////////////////
 
@@ -166,12 +168,12 @@ function write_credit_note($credit_note, $write_off_acc)
                }
        }
        /*Post a balance post if $total != 0 */
-       add_gl_balance(11, $credit_no, $credit_date, -$total, payment_person_types::customer(), $credit_note->customer_id);     
+       add_gl_balance(11, $credit_no, $credit_date, -$total, PT_CUSTOMER, $credit_note->customer_id);  
 
        add_comments(11, $credit_no, $credit_date, $credit_note->Comments);
 
        if ($trans_no == 0) {
-               references::save(11, $credit_no, $credit_note->reference);
+               $Refs->save(11, $credit_no, $credit_note->reference);
        }
 
        commit_transaction();
@@ -237,7 +239,7 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_,
 
                $total += add_gl_trans_std_cost(11, $credit_no, $date_, $stock_gl_codes["cogs_account"],
                        $dim, $dim2, "", -($standard_cost * $order_line->qty_dispatched),
-                       payment_person_types::customer(), $order->customer_id,
+                       PT_CUSTOMER, $order->customer_id,
                        "The cost of sales GL posting could not be inserted");
 
                /*now the stock entry*/
@@ -250,7 +252,7 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_,
 
                $total += add_gl_trans_std_cost(11, $credit_no, $date_, $stock_entry_account, 0, 0,
                        "", ($standard_cost * $order_line->qty_dispatched),
-                       payment_person_types::customer(), $order->customer_id,
+                       PT_CUSTOMER, $order->customer_id,
                        "The stock side (or write off) of the cost of sales GL posting could not be inserted");
 
        } /* end of if GL and stock integrated and standard cost !=0 */
index 17affbe754eb7616a399ac9e3cc25f52f664c360..4b38c28c6dd3c861e9e8c6589462d0056fbaed81 100644 (file)
@@ -14,6 +14,7 @@
 //
 function write_sales_delivery(&$delivery,$bo_policy)
 {
+       global $Refs;
 
        $trans_no = $delivery->trans_no;
        if (is_array($trans_no)) $trans_no = key($trans_no);
@@ -100,7 +101,7 @@ function write_sales_delivery(&$delivery,$bo_policy)
                                add_gl_trans_std_cost(13, $delivery_no,
                                        $delivery->document_date, $stock_gl_code["cogs_account"], $dim, $dim2, "",
                                        $delivery_line->standard_cost * $delivery_line->qty_dispatched,
-                                       payment_person_types::customer(), $delivery->customer_id,
+                                       PT_CUSTOMER, $delivery->customer_id,
                                        "The cost of sales GL posting could not be inserted");
 
                                /*now the stock entry*/
@@ -109,7 +110,7 @@ function write_sales_delivery(&$delivery,$bo_policy)
                                add_gl_trans_std_cost(13, $delivery_no, $delivery->document_date,
                                        $stock_gl_code["inventory_account"], 0, 0, "",
                                        (-$delivery_line->standard_cost * $delivery_line->qty_dispatched),
-                                       payment_person_types::customer(), $delivery->customer_id,
+                                       PT_CUSTOMER, $delivery->customer_id,
                                        "The stock side of the cost of sales GL posting could not be inserted");
 
                        } /* end of if GL and stock integrated and standard cost !=0 */
@@ -135,7 +136,7 @@ function write_sales_delivery(&$delivery,$bo_policy)
        add_comments(13, $delivery_no, $delivery->document_date, $delivery->Comments);
 
        if ($trans_no == 0) {
-                       references::save(13, $delivery_no, $delivery->reference);
+                       $Refs->save(13, $delivery_no, $delivery->reference);
        }
 
        commit_transaction();
index 71db48b73560f55155f47eb8334f6618554689ee..d5e129bb03ef2aa3efea18ead4d8258ad64aae2d 100644 (file)
@@ -14,6 +14,7 @@
 //
 function write_sales_invoice(&$invoice)
 {
+       global $Refs;
 
        $trans_no = $invoice->trans_no;
        if (is_array($trans_no))
@@ -161,12 +162,12 @@ function write_sales_invoice(&$invoice)
        }
 
        /*Post a balance post if $total != 0 */
-       add_gl_balance(10, $invoice_no, $date_, -$total, payment_person_types::customer(), $invoice->customer_id);      
+       add_gl_balance(10, $invoice_no, $date_, -$total, PT_CUSTOMER, $invoice->customer_id);   
 
        add_comments(10, $invoice_no, $date_, $invoice->Comments);
 
        if ($trans_no == 0) {
-               references::save(10, $invoice_no, $invoice->reference);
+               $Refs->save(10, $invoice_no, $invoice->reference);
                if ($invoice->cash) {
                        $amount = $items_total + $items_added_tax + $invoice->freight_cost 
                                + $freight_added_tax;
@@ -177,7 +178,7 @@ function write_sales_invoice(&$invoice)
                        $discount = 0; // $invoice->cash_discount*$amount;
                        $pmtno = write_customer_payment(0, $invoice->customer_id, 
                                $invoice->Branch, $invoice->cash_account, $date_,
-                               references::get_next(12), $amount-$discount, $discount,
+                               $Refs->get_next(12), $amount-$discount, $discount,
                                _('Cash invoice').' '.$invoice_no);
                        add_cust_allocation($amount, 12, $pmtno, 10, $invoice_no);
 
index f51ba11ab17b0a885ddda3039629070d0b680453..952587c5beb00c63fb60b2f8d9d325d7df43d371 100644 (file)
@@ -12,7 +12,7 @@
 //----------------------------------------------------------------------------------------
 function add_sales_order(&$order)
 {
-       global $loc_notification, $path_to_root;
+       global $loc_notification, $path_to_root, $Refs;
 
        begin_transaction();
 
@@ -88,7 +88,7 @@ function add_sales_order(&$order)
        } /* inserted line items into sales order details */
 
        add_audit_trail($order->trans_type, $order_no, $order->document_date);
-       references::save($order->trans_type, $order_no, $order->reference);
+       $Refs->save($order->trans_type, $order_no, $order->reference);
        commit_transaction();
 
        if ($loc_notification == 1 && count($st_ids) > 0)
@@ -144,7 +144,7 @@ function update_sales_order_version($order)
 
 function update_sales_order($order)
 {
-       global $loc_notification, $path_to_root;
+       global $loc_notification, $path_to_root, $Refs;
 
        $del_date = date2sql($order->due_date);
        $ord_date = date2sql($order->document_date);
@@ -232,8 +232,8 @@ function update_sales_order($order)
        } /* inserted line items into sales order details */
 
        add_audit_trail($order->trans_type, $order_no, $order->document_date, _("Updated."));
-       references::delete($order->trans_type, $order_no);
-       references::save($order->trans_type, $order_no, $order->reference);
+       $Refs->delete($order->trans_type, $order_no);
+       $Refs->save($order->trans_type, $order_no, $order->reference);
        commit_transaction();
        if ($loc_notification == 1 && count($st_ids) > 0)
        {
index de98c3b0ffbc6d4a97e2f05296b78c72c493a3c0..7f8b5e21cfb5eef85ab14eb5f663b7d1eb5a074f 100644 (file)
@@ -52,7 +52,7 @@ function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $d
 
        return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, "", $amount,
                get_customer_currency($customer_id),
-               payment_person_types::customer(), $customer_id, $err_msg, $rate);
+               PT_CUSTOMER, $customer_id, $err_msg, $rate);
 }
 
 //----------------------------------------------------------------------------------------
index 6adfa4ceeeecd0b1577efb870b7c35c0e368cf36..73a5894f0da52d6713af96b1ac4b1418d887c7e4 100644 (file)
@@ -15,7 +15,7 @@ include_once($path_to_root . "/includes/ui.inc");
 
 function display_credit_header(&$order)
 {
-       global $table_style, $Ajax;
+       global $table_style, $Ajax, $Refs;
 
        start_outer_table("width=80% $table_style");
        table_section(1);
@@ -23,7 +23,7 @@ function display_credit_header(&$order)
        $customer_error = "";
        $change_prices = 0;
 
-    if (!isset($_POST['customer_id']) && (get_global_customer() != reserved_words::get_all()))
+    if (!isset($_POST['customer_id']) && (get_global_customer() != ALL_TEXT))
        $_POST['customer_id'] = get_global_customer();
 
        customer_list_row(_("Customer:"), 'customer_id', null, false, true, false, true);
@@ -80,7 +80,7 @@ function display_credit_header(&$order)
        set_global_customer($_POST['customer_id']);
 
        if (!isset($_POST['ref']))
-               $_POST['ref'] = references::get_next(11);
+               $_POST['ref'] = $Refs->get_next(11);
        if ($order->trans_no==0)
            ref_row(_("Reference").':', 'ref');
        else
index 1b98e41ea6c3742e95ca1c0ff90594e18d86833f..0731752d8fcd5e9ea72def7cbc0f783ff3d225bf 100644 (file)
@@ -131,7 +131,7 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id)
 
 function display_order_summary($title, &$order, $editable_items=false)
 {
-       global $table_style, $path_to_root;
+       global $table_style, $path_to_root, $SysPrefs;
 
        display_heading($title);
 
@@ -164,7 +164,7 @@ function display_order_summary($title, &$order, $editable_items=false)
                $qoh_msg = '';
                if (!$editable_items || $id != $line_no)
                {
-                       if (!sys_prefs::allow_negative_stock() && is_inventory_item($stock_item->stock_id)) {
+                       if (!$SysPrefs->allow_negative_stock() && is_inventory_item($stock_item->stock_id)) {
                                $qoh = get_qoh_on_date($stock_item->stock_id, 
                                        $_POST['Location'], $_POST['OrderDate']);
                                if ($stock_item->qty_dispatched > $qoh) 
@@ -223,7 +223,7 @@ function display_order_summary($title, &$order, $editable_items=false)
        end_table();
        if ($has_marked) {
                display_note(_("Marked items have insufficient quantities in stock as on day of delivery."), 0, 1, "class='stockmankofg'");
-               if ($order->trans_type!=30 && !sys_prefs::allow_negative_stock())
+               if ($order->trans_type!=30 && !$SysPrefs->allow_negative_stock())
                        display_error(_("The delivery cannot be processed because there is an insufficient quantity for item:")
                                . '<br>'. $qoh_msg);
        }
@@ -234,7 +234,7 @@ function display_order_summary($title, &$order, $editable_items=false)
 
 function display_order_header(&$order, $editable, $date_text, $display_tax_group=false)
 {
-       global $table_style, $Ajax;
+       global $table_style, $Ajax, $SysPrefs;
 
        start_outer_table("width=80% $table_style");
 
@@ -405,7 +405,7 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group
                        if ($order->trans_type == 10) {
                                $_POST['delivery_date'] = get_invoice_duedate(get_post('customer_id'), get_post('OrderDate'));
                        } else 
-                               $_POST['delivery_date'] = add_days(get_post('OrderDate'), sys_prefs::default_delivery_required_by());
+                               $_POST['delivery_date'] = add_days(get_post('OrderDate'), $SysPrefs->default_delivery_required_by());
                        $Ajax->activate('items_table');
                        $Ajax->activate('delivery_date');
                }
index 6d09615f50f850a07dcce5b608263cba999b9b5e..51749f2cc1c50c7d70df628e167b1683c15f72af 100644 (file)
@@ -65,13 +65,15 @@ function check_overdue($row)
 function order_link($row)
 {
        return $row['order_']>0 ?
-               get_customer_trans_view_str(systypes::sales_order(), $row['order_'])
+               get_customer_trans_view_str(ST_SALESORDER, $row['order_'])
                : "";
 }
 
 function systype_name($dummy, $type)
 {
-       return systypes::name($type);
+       global $systypes_array;
+
+       return $systypes_array[$type];
 }
 
 function view_link($trans)
@@ -101,13 +103,13 @@ function alloc_link($row)
                /*its a credit note which could have an allocation */
                return $link;
        }
-       elseif (($row["type"] == systypes::cust_payment() || $row["type"] == systypes::bank_deposit()) &&
+       elseif (($row["type"] == ST_CUSTPAYMENT || $row["type"] == ST_BANKDEPOSIT) &&
                ($row['TotalAmount'] - $row['Allocated']) > 0)
        {
                /*its a receipt  which could have an allocation*/
                return $link;
        }
-       elseif ($row["type"] == systypes::cust_payment() && $row['TotalAmount'] < 0)
+       elseif ($row["type"] == ST_CUSTPAYMENT && $row['TotalAmount'] < 0)
        {
                /*its a negative receipt */
                return '';
@@ -158,10 +160,10 @@ function fmt_credit($row)
                AND trans.tran_date >= '$data_after'
                AND trans.tran_date <= '$date_to'";
 
-       if ($_POST['customer_id'] != reserved_words::get_all())
+       if ($_POST['customer_id'] != ALL_TEXT)
                $sql .= " AND trans.debtor_no = '" . $_POST['customer_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')
                {
@@ -169,7 +171,7 @@ function fmt_credit($row)
                }
                elseif ($_POST['filterType'] == '3')
                {
-                       $sql .= " AND trans.type = " . systypes::cust_payment();
+                       $sql .= " AND trans.type = " . ST_CUSTPAYMENT;
                }
                elseif ($_POST['filterType'] == '4')
                {
@@ -214,7 +216,7 @@ $cols = array(
        array('insert'=>true, 'fun'=>'alloc_link')
        );
 
-if ($_POST['customer_id'] != reserved_words::get_all()) {
+if ($_POST['customer_id'] != ALL_TEXT) {
        $cols[_("Customer")] = 'skip';
        $cols[_("Currency")] = 'skip';
 }
index aba3613593850c49b649cd2bedaf33d94c68b9b3..5602fed553b93f5013e1f3d2b5112fa5f50d8e49 100644 (file)
@@ -94,7 +94,7 @@ function display_customer_summary($customer_record)
 //------------------------------------------------------------------------------------------------
 
 div_start('totals_tbl');
-if ($_POST['customer_id'] != "" && $_POST['customer_id'] != reserved_words::get_all())
+if ($_POST['customer_id'] != "" && $_POST['customer_id'] != ALL_TEXT)
 {
        $customer_record = get_customer_details($_POST['customer_id'], $_POST['TransToDate']);
     display_customer_summary($customer_record);
@@ -110,13 +110,15 @@ if(get_post('RefreshInquiry'))
 
 function systype_name($dummy, $type)
 {
-       return systypes::name($type);
+       global $systypes_array;
+
+       return $systypes_array[$type];
 }
 
 function order_view($row)
 {
        return $row['order_']>0 ?
-               get_customer_trans_view_str(systypes::sales_order(), $row['order_'])
+               get_customer_trans_view_str(ST_SALESORDER, $row['order_'])
                : "";
 }
 
@@ -228,10 +230,10 @@ function check_overdue($row)
                        AND trans.tran_date <= '$date_to'
                        AND trans.branch_code = branch.branch_code";
 
-       if ($_POST['customer_id'] != reserved_words::get_all())
+       if ($_POST['customer_id'] != ALL_TEXT)
                $sql .= " AND trans.debtor_no = '" . $_POST['customer_id'] . "'";
 
-       if ($_POST['filterType'] != reserved_words::get_all())
+       if ($_POST['filterType'] != ALL_TEXT)
        {
                if ($_POST['filterType'] == '1')
                {
@@ -243,7 +245,7 @@ function check_overdue($row)
                }
                elseif ($_POST['filterType'] == '3')
                {
-                       $sql .= " AND (trans.type = " . systypes::cust_payment() 
+                       $sql .= " AND (trans.type = " . ST_CUSTPAYMENT 
                                        ." OR trans.type = 2) ";
                }
                elseif ($_POST['filterType'] == '4')
@@ -284,7 +286,7 @@ $cols = array(
                array('insert'=>true, 'fun'=>'prt_link')
        );
 
-if ($_POST['customer_id'] != reserved_words::get_all()) {
+if ($_POST['customer_id'] != ALL_TEXT) {
        $cols[_("Customer")] = 'skip';
        $cols[_("Currency")] = 'skip';
 }
index 1c5f342d4cd653287e5ab7d6690ba2a7e1fdbf28..d9a7af5aaf5af456279f990d2ce3133556c5b6d4 100644 (file)
@@ -119,7 +119,7 @@ end_form();
 //---------------------------------------------------------------------------------------------
 
 if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") &&
-       ($_POST['SelectStockFromList'] != reserved_words::get_all()))
+       ($_POST['SelectStockFromList'] != ALL_TEXT))
 {
        $selected_stock_item = $_POST['SelectStockFromList'];
 }
@@ -218,7 +218,7 @@ else
        if (isset($selected_stock_item))
                $sql .= " AND line.stock_id='". $selected_stock_item ."' ";
 
-       if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all())
+       if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != ALL_TEXT)
                $sql .= " AND sorder.from_stk_loc = '". $_POST['StockLocation'] . "' ";
 
        $sql .= " GROUP BY trans.trans_no ";
index c2940d082504d232f8c44d097df3e780217370f9..7ebcb822de408fc2fcf5d108d6f320c98067ab1e 100644 (file)
@@ -73,7 +73,7 @@ else
 //---------------------------------------------------------------------------------------------
 
 if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") &&
-       ($_POST['SelectStockFromList'] != reserved_words::get_all()))
+       ($_POST['SelectStockFromList'] != ALL_TEXT))
 {
        $selected_stock_item = $_POST['SelectStockFromList'];
 }
@@ -288,7 +288,7 @@ else        // ... or select inquiry constraints
        if (isset($selected_stock_item))
                $sql .= " AND line.stk_code='". $selected_stock_item ."'";
 
-       if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all())
+       if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != ALL_TEXT)
                $sql .= " AND sorder.from_stk_loc = '". $_POST['StockLocation'] . "' ";
 
        if ($_POST['order_view_mode']=='OutstandingOnly')
index a2b79cb9de92211f963c1c47315d3fd502515dfe..5120916ea0f108f6135ea4167bcbbbdcf608a74c 100644 (file)
@@ -222,7 +222,7 @@ if ($new_customer)
        $_POST['credit_status']  = -1;
        $_POST['payment_terms']  = '';
        $_POST['discount']  = $_POST['pymt_discount'] = percent_format(0);
-       $_POST['credit_limit']  = price_format(sys_prefs::default_credit_limit());
+       $_POST['credit_limit']  = price_format($SysPrefs->default_credit_limit());
        $_POST['inactive'] = 0;
 } 
 else 
index fccbc3a33c6089581268741ae38b4988f83e3c13..e15543e57f1d9d94071c71430b8319e00879e765 100644 (file)
@@ -288,6 +288,8 @@ function line_start_focus() {
 
 //--------------------------------------------------------------------------------
 function can_process() {
+       global $Refs;
+
        if (!is_date($_POST['OrderDate'])) {
                display_error(_("The entered date is invalid."));
                set_focus('OrderDate');
@@ -342,7 +344,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');
                return false;
@@ -386,6 +388,8 @@ if (isset($_POST['ProcessOrder']) && can_process()) {
 
 function check_item_data()
 {
+       global $SysPrefs;
+
        if (!check_num('qty', 0) || !check_num('Disc', 0, 100)) {
                display_error( _("The item could not be updated because you are attempting to set the quantity ordered to less than 0, or the discount percent to more than 100."));
                set_focus('qty');
@@ -401,7 +405,7 @@ function check_item_data()
                display_error(_("You attempting to make the quantity ordered a quantity less than has already been delivered. The quantity delivered cannot be modified retrospectively."));
                return false;
        } // Joe Hunt added 2008-09-22 -------------------------
-       elseif ($_SESSION['Items']->trans_type!=30 && $_SESSION['Items']->trans_type!=32 && !sys_prefs::allow_negative_stock() &&
+       elseif ($_SESSION['Items']->trans_type!=30 && $_SESSION['Items']->trans_type!=32 && !$SysPrefs->allow_negative_stock() &&
                is_inventory_item($_POST['stock_id']))
        {
                $qoh = get_qoh_on_date($_POST['stock_id'], $_POST['Location'], $_POST['OrderDate']);
@@ -503,6 +507,8 @@ function  handle_cancel_order()
 
 function create_cart($type, $trans_no)
 { 
+       global $Refs;
+
        processing_start();
        $doc_type = $type;
 
@@ -512,7 +518,7 @@ function create_cart($type, $trans_no)
                $doc = new Cart(32, $trans_no);
                $doc->trans_no = 0;
                $doc->trans_type = 30;
-               $doc->reference = references::get_next($doc->trans_type);
+               $doc->reference = $Refs->get_next($doc->trans_type);
                $doc->document_date = $doc->due_date = new_doc_date();
                $doc->Comments = _("Sales Quotation") . " # " . $trans_no;
                $_SESSION['Items'] = $doc;
@@ -535,7 +541,7 @@ function create_cart($type, $trans_no)
                                $doc->cash = date_diff2($doc->due_date, Today(), 'd')<2;
                } else
                        $doc->due_date = $doc->document_date;
-               $doc->reference = references::get_next($doc->trans_type);
+               $doc->reference = $Refs->get_next($doc->trans_type);
                //$doc->Comments='';
                foreach($doc->line_items as $line_no => $line) {
                        $doc->line_items[$line_no]->qty_done = 0;
index d36df28296a499e8c0dc38610185f9211fd968ff..85cd1de3fe53704ba2067c6729918b5621a1a6f8 100644 (file)
@@ -147,7 +147,7 @@ end_table(1);
 $voided = is_voided_display(11, $trans_id, _("This credit note has been voided."));
 
 if (!$voided)
-       display_allocations_from(payment_person_types::customer(),
+       display_allocations_from(PT_CUSTOMER,
                $myrow['debtor_no'], 11, $trans_id, $credit_total);
 
 /* end of check to see that there was an invoice record to print */
index 9e499eda7474c13d6d7f61ec76974ec81be12226..db73299b3f9a53f500aa0b8d8bcb22b3c2cb6a58 100644 (file)
@@ -85,7 +85,7 @@ start_row();
 label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'");
 label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'");
 label_cells(_("Our Order No"),
-       get_customer_trans_view_str(systypes::sales_order(),$sales_order["order_no"]), "class='tableheader2'");
+       get_customer_trans_view_str(ST_SALESORDER,$sales_order["order_no"]), "class='tableheader2'");
 end_row();
 start_row();
 label_cells(_("Customer Order Ref."), $sales_order["customer_ref"], "class='tableheader2'");
index 410629a030cf2b62f7b9b55aca6eaa1fd37426f4..aa2bbe78ca7a2ad5dc3e90b2f23a73a2f9b0402b 100644 (file)
@@ -85,7 +85,7 @@ start_row();
 label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'");
 label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'");
 label_cells(_("Our Order No"),
-       get_customer_trans_view_str(systypes::sales_order(),$sales_order["order_no"]), "class='tableheader2'");
+       get_customer_trans_view_str(ST_SALESORDER,$sales_order["order_no"]), "class='tableheader2'");
 end_row();
 start_row();
 label_cells(_("Customer Order Ref."), $sales_order["customer_ref"], "class='tableheader2'");
@@ -95,7 +95,7 @@ end_row();
 start_row();
 label_cells(_("Invoice Date"), sql2date($myrow["tran_date"]), "class='tableheader2'", "nowrap");
 label_cells(_("Due Date"), sql2date($myrow["due_date"]), "class='tableheader2'", "nowrap");
-label_cells(_("Deliveries"), get_customer_trans_view_str(systypes::cust_dispatch()
+label_cells(_("Deliveries"), get_customer_trans_view_str(ST_CUSTDELIVERY
        get_parent_trans(10,$trans_id)), "class='tableheader2'");
 end_row();
 comments_display_row(10, $trans_id);
index 9127b112cd91307392547bf26f268c1a434dbce8..b2dd53ba14ce92e2c39c32ccbf191a70614cd945 100644 (file)
@@ -28,7 +28,7 @@ if (isset($_GET["trans_no"]))
        $trans_id = $_GET["trans_no"];
 }
 
-$receipt = get_customer_trans($trans_id, systypes::cust_payment());
+$receipt = get_customer_trans($trans_id, ST_CUSTPAYMENT);
 
 display_heading(sprintf(_("Customer Payment #%d"),$trans_id));
 
@@ -46,18 +46,18 @@ label_cells(_("Discount"), price_format($receipt['ov_discount']), "class='tableh
 end_row();
 start_row();
 label_cells(_("Payment Type"), 
-       bank_account_types::transfer_type($receipt['BankTransType']), "class='tableheader2'");
+       $bank_transfer_types[$receipt['BankTransType']], "class='tableheader2'");
 label_cells(_("Reference"), $receipt['reference'], "class='tableheader2'", "colspan=4");
 end_row();
-comments_display_row(systypes::cust_payment(), $trans_id);
+comments_display_row(ST_CUSTPAYMENT, $trans_id);
 
 end_table(1);
 
-$voided = is_voided_display(systypes::cust_payment(), $trans_id, _("This customer payment has been voided."));
+$voided = is_voided_display(ST_CUSTPAYMENT, $trans_id, _("This customer payment has been voided."));
 
 if (!$voided)
 {
-       display_allocations_from(payment_person_types::customer(), $receipt['debtor_no'], systypes::cust_payment(), $trans_id, $receipt['Total']);
+       display_allocations_from(PT_CUSTOMER, $receipt['debtor_no'], ST_CUSTPAYMENT, $trans_id, $receipt['Total']);
 }
 
 end_page(true);
index c633c556de77bd6be2b1bc9ae666803bce03fb39..7a5aabd1d04c5ab4f1ade112d5643f3e589cb7b1 100644 (file)
@@ -46,7 +46,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
        for ($i = 0; $i < 5; $i++) 
        {
                if (isset($_POST['tax_type_id' . $i]) && 
-                       $_POST['tax_type_id' . $i] != reserved_words::get_all_numeric() && 
+                       $_POST['tax_type_id' . $i] != ALL_NUMERIC       && 
                        !check_num('rate' . $i, 0))
                {
                        display_error( _("An entered tax rate is invalid or less than zero."));
@@ -67,7 +67,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
        for ($i = 0; $i < 5; $i++) 
        {
                if (isset($_POST['tax_type_id' . $i]) &&
-                               $_POST['tax_type_id' . $i] != reserved_words::get_any_numeric()
+                               $_POST['tax_type_id' . $i] != ANY_NUMERIC
                        {
                        $taxes[] = $_POST['tax_type_id' . $i];
                        $rates[] = input_num('rate' . $i);
@@ -162,7 +162,7 @@ while ($myrow = db_fetch($result))
                label_cell(_("No"));
 
        /*for ($i=0; $i< 5; $i++)
-               if ($myrow["type" . $i] != reserved_words::get_all_numeric())
+               if ($myrow["type" . $i] != ALL_NUMERIC)
                        echo "<td>" . $myrow["type" . $i] . "</td>";*/
 
        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]);