From 80dd97a37f674cc3691fa04af4c29607067566b2 Mon Sep 17 00:00:00 2001
From: Janusz Dobrowolski ";
-display_gl_items($_SESSION['pay_items']->trans_type==systypes::bank_payment() ?
+display_gl_items($_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ?
_("Payment Items"):_("Deposit Items"), $_SESSION['pay_items']);
gl_options_controls();
echo " ";
@@ -275,7 +275,7 @@ end_row();
end_table(1);
submit_center_first('Update', _("Update"), '', null);
-submit_center_last('Process', $_SESSION['pay_items']->trans_type==systypes::bank_payment() ?
+submit_center_last('Process', $_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ?
_("Process Payment"):_("Process Deposit"), '', 'default');
end_form();
diff --git a/gl/gl_journal.php b/gl/gl_journal.php
index 33431822..9cfc9332 100644
--- a/gl/gl_journal.php
+++ b/gl/gl_journal.php
@@ -49,7 +49,7 @@ function line_start_focus() {
if (isset($_GET['AddedID']))
{
$trans_no = $_GET['AddedID'];
- $trans_type = systypes::journal_entry();
+ $trans_type = ST_JOURNAL;
display_notification_centered( _("Journal entry has been entered") . " #$trans_no");
@@ -62,7 +62,7 @@ if (isset($_GET['AddedID']))
} elseif (isset($_GET['UpdatedID']))
{
$trans_no = $_GET['UpdatedID'];
- $trans_type = systypes::journal_entry();
+ $trans_type = ST_JOURNAL;
display_notification_centered( _("Journal entry has been updated") . " #$trans_no");
@@ -90,6 +90,8 @@ elseif (isset($_GET['ModifyGL']))
function create_cart($type=0, $trans_no=0)
{
+ global $Refs;
+
if (isset($_SESSION['journal_items']))
{
unset ($_SESSION['journal_items']);
@@ -111,9 +113,9 @@ function create_cart($type=0, $trans_no=0)
}
$cart->memo_ = get_comments_string($type, $trans_no);
$cart->tran_date = sql2date($date);
- $cart->reference = references::get($type, $trans_no);
+ $cart->reference = $Refs->get($type, $trans_no);
} else {
- $cart->reference = references::get_next(0);
+ $cart->reference = $Refs->get_next(0);
$cart->tran_date = new_doc_date();
}
if (!is_date_in_fiscalyear($cart->tran_date))
@@ -158,13 +160,13 @@ if (isset($_POST['Process']))
$input_error = 1;
}
if ($_SESSION['journal_items']->order_id == 0) {
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error( _("You must enter a reference."));
set_focus('ref');
$input_error = 1;
}
- elseif (references::exists(systypes::journal_entry(), $_POST['ref']))
+ elseif ($Refs->exists(ST_JOURNAL, $_POST['ref']))
{
display_error( _("The entered reference is already in use."));
set_focus('ref');
diff --git a/gl/includes/db/gl_db_banking.inc b/gl/includes/db/gl_db_banking.inc
index e73e1e3a..cc028ac7 100644
--- a/gl/includes/db/gl_db_banking.inc
+++ b/gl/includes/db/gl_db_banking.inc
@@ -27,11 +27,11 @@ function add_exchange_variation($trans_type, $trans_no, $date_, $acc_id, $accoun
if ($diff != 0)
{
if ($trans_type == null)
- $trans_type = systypes::journal_entry();
+ $trans_type = ST_JOURNAL;
if ($trans_no == null)
$trans_no = get_next_trans_no($trans_type);
if ($person_type_id == null)
- $person_type_id = payment_person_types::misc();
+ $person_type_id = PT_MISC;
add_gl_trans($trans_type, $trans_no, $date_, $account, 0, 0, _("Exchange Variance"),
-$diff, null, $person_type_id, $person_id);
add_gl_trans($trans_type, $trans_no, $date_, get_company_pref('exchange_diff_act'), 0, 0,
@@ -58,9 +58,11 @@ function add_exchange_variation_all()
function add_bank_transfer($from_account, $to_account, $date_,
$amount, $ref, $memo_, $charge=0)
{
+ global $Refs;
+
begin_transaction();
- $trans_type = systypes::bank_transfer();
+ $trans_type = ST_BANKTRANSFER;
$currency = get_bank_account_currency($from_account);
@@ -76,11 +78,11 @@ function add_bank_transfer($from_account, $to_account, $date_,
add_bank_trans($trans_type, $trans_no, $from_account, $ref,
$date_, -($amount + $charge),
- payment_person_types::misc(), "", $currency,
+ PT_MISC, "", $currency,
"Cannot insert a source bank transaction");
add_exchange_variation($trans_type, $trans_no, $date_, $from_account, $from_gl_account,
- $currency, payment_person_types::misc(), "");
+ $currency, PT_MISC, "");
if ($charge != 0)
{
@@ -97,15 +99,15 @@ function add_bank_transfer($from_account, $to_account, $date_,
add_gl_balance($trans_type, $trans_no, $date_, -$total);
add_bank_trans($trans_type, $trans_no, $to_account, $ref,
- $date_, $amount, payment_person_types::misc(), "",
+ $date_, $amount, PT_MISC, "",
$currency, "Cannot insert a destination bank transaction");
add_exchange_variation($trans_type, $trans_no, $date_, $from_account, $from_gl_account,
- $currency, payment_person_types::misc(), "");
+ $currency, PT_MISC, "");
add_comments($trans_type, $trans_no, $date_, $memo_);
- references::save($trans_type, $trans_no, $ref);
+ $Refs->save($trans_type, $trans_no, $ref);
add_audit_trail($trans_type, $trans_no, $date_);
commit_transaction();
@@ -127,8 +129,10 @@ function add_bank_transfer($from_account, $to_account, $date_,
function add_bank_transaction($trans_type, $from_account, $items, $date_,
$person_type_id, $person_id, $person_detail_id, $ref, $memo_)
{
+ global $Refs;
+
// we can only handle type 1 (payment)and type 2 (deposit)
- if ($trans_type != systypes::bank_payment() && $trans_type != systypes::bank_deposit())
+ if ($trans_type != ST_BANKPAYMENT && $trans_type != ST_BANKDEPOSIT)
display_db_error("Invalid type ($trans_type) sent to add_bank_transaction");
$do_exchange_variance = false;
@@ -141,7 +145,7 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_,
// the gl items are already inversed/negated for type 2 (deposit)
$total_amount = $items->gl_items_total();
- if ($person_type_id == payment_person_types::customer())
+ if ($person_type_id == PT_CUSTOMER)
{
// we need to add a customer transaction record
@@ -154,7 +158,7 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_,
$ref, $cust_amount);
}
- elseif ($person_type_id == payment_person_types::supplier())
+ elseif ($person_type_id == PT_SUPPLIER)
{
// we need to add a supplier transaction record
// convert to supp currency
@@ -225,7 +229,7 @@ function add_bank_transaction($trans_type, $from_account, $items, $date_,
add_comments($trans_type, $trans_no, $date_, $memo_);
- references::save($trans_type, $trans_no, $ref);
+ $Refs->save($trans_type, $trans_no, $ref);
add_audit_trail($trans_type, $trans_no, $date_);
commit_transaction();
diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc
index 111d4e33..723ea087 100644
--- a/gl/includes/db/gl_db_trans.inc
+++ b/gl/includes/db/gl_db_trans.inc
@@ -142,8 +142,8 @@ function get_gl_wo_cost_trans($trans_id, $person_id=-1)
{
$sql = "SELECT ".TB_PREF."gl_trans.*, ".TB_PREF."chart_master.account_name FROM ".TB_PREF."gl_trans, ".TB_PREF."chart_master
WHERE ".TB_PREF."chart_master.account_code=".TB_PREF."gl_trans.account
- AND ".TB_PREF."gl_trans.type=".systypes::work_order()." AND ".TB_PREF."gl_trans.type_no=$trans_id
- AND ".TB_PREF."gl_trans.person_type_id=".payment_person_types::WorkOrder();
+ AND ".TB_PREF."gl_trans.type=".ST_WORKORDER." AND ".TB_PREF."gl_trans.type_no=$trans_id
+ AND ".TB_PREF."gl_trans.person_type_id=".PT_WORKORDER;
if ($person_id != -1)
$sql .= " AND ".TB_PREF."gl_trans.person_id=$person_id";
$sql .= " AND amount < 0";
@@ -356,6 +356,8 @@ function get_tax_summary($from, $to)
//
function write_journal_entries(&$cart, $reverse)
{
+ global $Refs;
+
$date_ = $cart->tran_date;
$ref = $cart->reference;
$memo_ = $cart->memo_;
@@ -393,7 +395,7 @@ function write_journal_entries(&$cart, $reverse)
if ($new) {
add_comments($trans_type, $trans_id, $date_, $memo_);
- references::save($trans_type, $trans_id, $ref);
+ $Refs->save($trans_type, $trans_id, $ref);
} else
update_comments($trans_type, $trans_id, null, $memo_);
@@ -430,7 +432,7 @@ function write_journal_entries(&$cart, $reverse)
add_comments($trans_type, $trans_id_reverse, $reversingDate, $memo_);
- references::save($trans_type, $trans_id_reverse, $ref);
+ $Refs->save($trans_type, $trans_id_reverse, $ref);
add_audit_trail($trans_type, $trans_id_reverse, $reversingDate);
}
diff --git a/gl/includes/ui/gl_bank_ui.inc b/gl/includes/ui/gl_bank_ui.inc
index f42e8e36..48c82392 100644
--- a/gl/includes/ui/gl_bank_ui.inc
+++ b/gl/includes/ui/gl_bank_ui.inc
@@ -11,8 +11,8 @@
***********************************************************************/
function display_bank_header(&$order)
{
- global $table_style2, $Ajax;
- $payment = $order->trans_type == systypes::bank_payment();
+ global $table_style2, $Ajax, $Refs;
+ $payment = $order->trans_type == ST_BANKPAYMENT;
div_start('pmt_header');
@@ -51,17 +51,17 @@ function display_bank_header(&$order)
'PayType', $_POST['PayType'], true);
switch ($_POST['PayType'])
{
- case payment_person_types::misc() :
+ case PT_MISC :
text_row_ex($payment ?_("To the Order of:"):_("Name:"),
'person_id', 40, 50);
break;
- //case payment_person_types::WorkOrder() :
+ //case PT_WORKORDER :
// workorders_list_row(_("Work Order:"), 'person_id', null);
// break;
- case payment_person_types::supplier() :
+ case PT_SUPPLIER :
supplier_list_row(_("Supplier:"), 'person_id', null, false, true, false, true);
break;
- case payment_person_types::customer() :
+ case PT_CUSTOMER :
customer_list_row(_("Customer:"), 'person_id', null, false, true, false, true);
if (db_customer_has_branches($_POST['person_id']))
@@ -71,12 +71,12 @@ function display_bank_header(&$order)
}
else
{
- $_POST['PersonDetailID'] = reserved_words::get_any_numeric();
+ $_POST['PersonDetailID'] = ANY_NUMERIC;
hidden('PersonDetailID');
}
break;
- case payment_person_types::QuickEntry() :
+ case PT_QUICKENTRY :
quick_entries_list_row(_("Type").":", 'person_id', null, ($payment ? QE_PAYMENT : QE_DEPOSIT), true);
$qid = get_quick_entry(get_post('person_id'));
if (list_updated('person_id')) {
@@ -91,7 +91,7 @@ function display_bank_header(&$order)
// break;
}
- $person_currency = payment_person_types::person_currency($_POST['PayType'], $_POST['person_id']);
+ $person_currency = payment_person_currency($_POST['PayType'], $_POST['person_id']);
$bank_currency = get_bank_account_currency($_POST['bank_account']);
exchange_rate_display($bank_currency, $person_currency, $_POST['date_']);
@@ -99,9 +99,9 @@ function display_bank_header(&$order)
table_section(3, "33%");
if (isset($_GET['NewPayment']))
- ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_payment()));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKPAYMENT));
else
- ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_deposit()));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKDEPOSIT));
end_outer_table(1); // outer table
@@ -149,7 +149,7 @@ function display_gl_items($title, &$order)
if ($dim > 1)
label_cell(get_dimension_string($item->dimension2_id, true));
//amount_cell(abs($item->amount));
- if ($order->trans_type == systypes::bank_deposit())
+ if ($order->trans_type == ST_BANKDEPOSIT)
amount_cell(-$item->amount);
else
amount_cell($item->amount);
@@ -182,7 +182,7 @@ function display_gl_items($title, &$order)
function gl_edit_item_controls(&$order, $dim, $Index=null)
{
global $Ajax;
- $payment = $order->trans_type == systypes::bank_payment();
+ $payment = $order->trans_type == ST_BANKPAYMENT;
start_row();
$id = find_submit('Edit');
@@ -216,17 +216,17 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
$Ajax->activate('code_id');
}
- if ($_POST['PayType'] == payment_person_types::customer())
+ if ($_POST['PayType'] == PT_CUSTOMER)
{
$acc = get_branch_accounts($_POST['PersonDetailID']);
$_POST['code_id'] = $acc['receivables_account'];
}
- elseif ($_POST['PayType'] == payment_person_types::supplier())
+ elseif ($_POST['PayType'] == PT_SUPPLIER)
{
$acc = get_supplier_accounts($_POST['person_id']);
$_POST['code_id'] = $acc['payable_account'];
}
- //elseif ($_POST['PayType'] == payment_person_types::WorkOrder())
+ //elseif ($_POST['PayType'] == PT_WORKORDER)
// $_POST['code_id'] = get_company_pref('default_assembly_act');
else {
$_POST['code_id'] =
diff --git a/gl/inquiry/bank_inquiry.php b/gl/inquiry/bank_inquiry.php
index e287d77b..ec98d993 100644
--- a/gl/inquiry/bank_inquiry.php
+++ b/gl/inquiry/bank_inquiry.php
@@ -100,13 +100,13 @@ while ($myrow = db_fetch($result))
$running_total += $myrow["amount"];
$trandate = sql2date($myrow["trans_date"]);
- label_cell(systypes::name($myrow["type"]));
+ label_cell($systypes_array[$myrow["type"]]);
label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"]));
label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"],$myrow['ref']));
label_cell($trandate);
display_debit_or_credit_cells($myrow["amount"]);
amount_cell($running_total);
- label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]));
+ label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
end_row();
diff --git a/gl/inquiry/gl_account_inquiry.php b/gl/inquiry/gl_account_inquiry.php
index 17a88907..3c415566 100644
--- a/gl/inquiry/gl_account_inquiry.php
+++ b/gl/inquiry/gl_account_inquiry.php
@@ -82,7 +82,7 @@ function gl_inquiry_controls()
function show_results()
{
- global $path_to_root, $table_style;
+ global $path_to_root, $table_style, $systypes_array;
if (!isset($_POST["account"]) || $_POST["account"] == "")
return;
@@ -145,14 +145,14 @@ function show_results()
$trandate = sql2date($myrow["tran_date"]);
- label_cell(systypes::name($myrow["type"]));
+ label_cell($systypes_array[$myrow["type"]]);
label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true));
label_cell($trandate);
if ($dim >= 1)
label_cell(get_dimension_string($myrow['dimension_id'], true));
if ($dim > 1)
label_cell(get_dimension_string($myrow['dimension2_id'], true));
- label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]));
+ label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
display_debit_or_credit_cells($myrow["amount"]);
amount_cell($running_total);
label_cell($myrow['memo_']);
diff --git a/gl/inquiry/journal_inquiry.php b/gl/inquiry/journal_inquiry.php
index 6cfd3ccc..fee17602 100644
--- a/gl/inquiry/journal_inquiry.php
+++ b/gl/inquiry/journal_inquiry.php
@@ -64,7 +64,9 @@ function journal_pos($row)
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+
+ return $systypes_array[$type];
}
function view_link($row)
diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php
index a04d3c1e..c70fc9e9 100644
--- a/gl/manage/bank_accounts.php
+++ b/gl/manage/bank_accounts.php
@@ -123,7 +123,7 @@ while ($myrow = db_fetch($result))
alt_table_row_color($k);
label_cell($myrow["bank_account_name"], "nowrap");
- label_cell(bank_account_types::name($myrow["account_type"]), "nowrap");
+ label_cell($bank_account_types[$myrow["account_type"]], "nowrap");
label_cell($myrow["bank_curr_code"], "nowrap");
label_cell($myrow["account_code"] . " " . $myrow["account_name"], "nowrap");
label_cell($myrow["bank_name"], "nowrap");
@@ -166,7 +166,7 @@ text_row(_("Bank Account Name:"), 'bank_account_name', null, 50, 100);
if ($is_editing)
{
- label_row(_("Account Type:"), bank_account_types::name($_POST['account_type']));
+ label_row(_("Account Type:"), $bank_account_types[$_POST['account_type']]);
}
else
{
diff --git a/gl/manage/gl_account_types.php b/gl/manage/gl_account_types.php
index fd7d92ab..12843843 100644
--- a/gl/manage/gl_account_types.php
+++ b/gl/manage/gl_account_types.php
@@ -137,7 +137,7 @@ while ($myrow = db_fetch($result))
$bs_text = get_account_class_name($myrow["class_id"]);
- if ($myrow["parent"] == reserved_words::get_any_numeric())
+ if ($myrow["parent"] == ANY_NUMERIC)
{
$parent_text = "";
}
diff --git a/gl/view/bank_transfer_view.php b/gl/view/bank_transfer_view.php
index 36932c3e..3ae52d96 100644
--- a/gl/view/bank_transfer_view.php
+++ b/gl/view/bank_transfer_view.php
@@ -25,7 +25,7 @@ if (isset($_GET["trans_no"])){
$trans_no = $_GET["trans_no"];
}
-$result = get_bank_trans(systypes::bank_transfer(), $trans_no);
+$result = get_bank_trans(ST_BANKTRANSFER, $trans_no);
if (db_num_rows($result) != 2)
display_db_error("Bank transfer does not contain two records", $sql);
@@ -58,7 +58,7 @@ if ($from_trans['bank_curr_code'] != $to_trans['bank_curr_code'])
$show_both_amounts = true;
}
-display_heading(systypes::name(systypes::bank_transfer()) . " #$trans_no");
+display_heading($systypes_array[ST_BANKTRANSFER] . " #$trans_no");
echo "
";
start_table("$table_style width=80%");
@@ -81,14 +81,15 @@ if ($show_both_amounts)
end_row();
start_row();
label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
-label_cells(_("Transfer Type"), bank_account_types::transfer_type($from_trans['account_type']), "class='tableheader2'");
+label_cells(_("Transfer Type"), $bank_transfer_types[$from_trans['account_type']],
+ "class='tableheader2'");
label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'");
end_row();
-comments_display_row(systypes::bank_transfer(), $trans_no);
+comments_display_row(ST_BANKTRANSFER, $trans_no);
end_table(1);
-is_voided_display(systypes::bank_transfer(), $trans_no, _("This transfer has been voided."));
+is_voided_display(ST_BANKTRANSFER, $trans_no, _("This transfer has been voided."));
end_page(true);
?>
\ No newline at end of file
diff --git a/gl/view/gl_deposit_view.php b/gl/view/gl_deposit_view.php
index 52c01e01..04232dd7 100644
--- a/gl/view/gl_deposit_view.php
+++ b/gl/view/gl_deposit_view.php
@@ -27,7 +27,7 @@ if (isset($_GET["trans_no"]))
}
// get the pay-to bank payment info
-$result = get_bank_trans(systypes::bank_deposit(), $trans_no);
+$result = get_bank_trans(ST_BANKDEPOSIT, $trans_no);
if (db_num_rows($result) != 1)
display_db_error("duplicate payment bank transaction found", "");
@@ -68,19 +68,19 @@ label_cells(_("Amount"), number_format2($to_trans['amount'], user_price_dec()),
label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
-label_cells(_("From"), payment_person_types::person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
-label_cells(_("Deposit Type"), bank_account_types::transfer_type($to_trans['account_type']), "class='tableheader2'");
+label_cells(_("From"), payment_person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
+label_cells(_("Deposit Type"), $bank_transfer_types[$to_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan=$colspan2");
end_row();
-comments_display_row(systypes::bank_deposit(), $trans_no);
+comments_display_row(ST_BANKDEPOSIT, $trans_no);
end_table(1);
-is_voided_display(systypes::bank_deposit(), $trans_no, _("This deposit has been voided."));
+is_voided_display(ST_BANKDEPOSIT, $trans_no, _("This deposit has been voided."));
-$items = get_gl_trans(systypes::bank_deposit(), $trans_no);
+$items = get_gl_trans(ST_BANKDEPOSIT, $trans_no);
if (db_num_rows($items) == 0)
{
diff --git a/gl/view/gl_payment_view.php b/gl/view/gl_payment_view.php
index b386c5c6..e71e3dff 100644
--- a/gl/view/gl_payment_view.php
+++ b/gl/view/gl_payment_view.php
@@ -27,7 +27,7 @@ if (isset($_GET["trans_no"]))
}
// get the pay-from bank payment info
-$result = get_bank_trans(systypes::bank_payment(), $trans_no);
+$result = get_bank_trans(ST_BANKPAYMENT, $trans_no);
if (db_num_rows($result) != 1)
display_db_error("duplicate payment bank transaction found", "");
@@ -66,19 +66,19 @@ label_cells(_("Amount"), number_format2(-$from_trans['amount'], user_price_dec()
label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
-label_cells(_("Pay To"), payment_person_types::person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
-label_cells(_("Payment Type"),bank_account_types::transfer_type($from_trans['account_type']), "class='tableheader2'");
+label_cells(_("Pay To"), payment_person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
+label_cells(_("Payment Type"), $bank_transfer_types[$from_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan=$colspan2");
end_row();
-comments_display_row(systypes::bank_payment(), $trans_no);
+comments_display_row(ST_BANKPAYMENT, $trans_no);
end_table(1);
-$voided = is_voided_display(systypes::bank_payment(), $trans_no, _("This payment has been voided."));
+$voided = is_voided_display(ST_BANKPAYMENT, $trans_no, _("This payment has been voided."));
-$items = get_gl_trans(systypes::bank_payment(), $trans_no);
+$items = get_gl_trans(ST_BANKPAYMENT, $trans_no);
if (db_num_rows($items)==0)
{
diff --git a/gl/view/gl_trans_view.php b/gl/view/gl_trans_view.php
index 3ebedfa6..c48ed819 100644
--- a/gl/view/gl_trans_view.php
+++ b/gl/view/gl_trans_view.php
@@ -29,8 +29,8 @@ if (!isset($_GET['type_id']) || !isset($_GET['trans_no']))
function display_gl_heading($myrow)
{
- global $table_style;
- $trans_name = systypes::name($_GET['type_id']);
+ global $table_style, $systypes_array;
+ $trans_name = $systypes_array[$_GET['type_id']];
start_table("$table_style width=95%");
$th = array(_("General Ledger Transaction Details"),
_("Date"), _("Person/Item"));
@@ -38,7 +38,7 @@ function display_gl_heading($myrow)
start_row();
label_cell("$trans_name #" . $_GET['trans_no']);
label_cell(sql2date($myrow["tran_date"]));
- label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]));
+ label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
end_row();
@@ -53,7 +53,7 @@ $result = db_query($sql,"could not get transactions");
if (db_num_rows($result) == 0)
{
- echo "
";
display_heading2(_("Issues"));
@@ -79,7 +79,7 @@ else
echo " "; -is_voided_display(systypes::work_order(), $woid, _("This work order has been voided.")); +is_voided_display(ST_WORKORDER, $woid, _("This work order has been voided.")); end_page(true); diff --git a/manufacturing/work_order_add_finished.php b/manufacturing/work_order_add_finished.php index 8ba7fd6e..c61f19bb 100644 --- a/manufacturing/work_order_add_finished.php +++ b/manufacturing/work_order_add_finished.php @@ -39,7 +39,7 @@ if (isset($_GET['AddedID'])) { include_once($path_to_root . "/reporting/includes/reporting.inc"); $id = $_GET['AddedID']; - $stype = systypes::work_order(); + $stype = ST_WORKORDER; display_notification(_("The manufacturing process has been entered.")); @@ -69,9 +69,9 @@ if (strlen($wo_details[0]) == 0) function can_process() { - global $wo_details; + global $wo_details, $SysPrefs, $Refs; - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); @@ -112,7 +112,7 @@ function can_process() } // if unassembling we need to check the qoh - if (($_POST['ProductionType'] == 0) && !sys_prefs::allow_negative_stock()) + if (($_POST['ProductionType'] == 0) && !$SysPrefs->allow_negative_stock()) { $wo_details = get_work_order($_POST['selected_id']); @@ -126,7 +126,7 @@ function can_process() } // if production we need to check the qoh of the wo requirements - if (($_POST['ProductionType'] == 1) && !sys_prefs::allow_negative_stock()) + if (($_POST['ProductionType'] == 1) && !$SysPrefs->allow_negative_stock()) { $err = false; $result = get_wo_requirements($_POST['selected_id']); @@ -189,7 +189,7 @@ if (!isset($_POST['quantity']) || $_POST['quantity'] == '') start_table($table_style2); br(); -ref_row(_("Reference:"), 'ref', '', references::get_next(29)); +ref_row(_("Reference:"), 'ref', '', $Refs->get_next(29)); if (!isset($_POST['ProductionType'])) $_POST['ProductionType'] = 1; diff --git a/manufacturing/work_order_costs.php b/manufacturing/work_order_costs.php index b6f6ba23..7ce5e811 100644 --- a/manufacturing/work_order_costs.php +++ b/manufacturing/work_order_costs.php @@ -38,7 +38,7 @@ if (isset($_GET['trans_no']) && $_GET['trans_no'] != "") if (isset($_GET['AddedID'])) { $id = $_GET['AddedID']; - $stype = systypes::work_order(); + $stype = ST_WORKORDER; display_notification(_("The additional cost has been entered.")); @@ -104,18 +104,18 @@ function can_process() if (isset($_POST['process']) && can_process() == true) { begin_transaction(); - add_gl_trans_std_cost(systypes::work_order(), $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'], - 0, 0, $wo_cost_types[$_POST['PaymentType']], -input_num('costs'), payment_person_types::WorkOrder(), $_POST['PaymentType']); + add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'], + 0, 0, $wo_cost_types[$_POST['PaymentType']], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType']); $is_bank_to = is_bank_account($_POST['cr_acc']); if ($is_bank_to) { - add_bank_trans(systypes::work_order(), $_POST['selected_id'], $is_bank_to, "", - $_POST['date_'], -input_num('costs'), payment_person_types::WorkOrder(), $_POST['PaymentType'], get_company_currency(), + add_bank_trans(ST_WORKORDER, $_POST['selected_id'], $is_bank_to, "", + $_POST['date_'], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType'], get_company_currency(), "Cannot insert a destination bank transaction"); } - add_gl_trans_std_cost(systypes::work_order(), $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'], - $_POST['dim1'], $_POST['dim2'], $wo_cost_types[$_POST['PaymentType']], input_num('costs'), payment_person_types::WorkOrder(), + add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'], + $_POST['dim1'], $_POST['dim2'], $wo_cost_types[$_POST['PaymentType']], input_num('costs'), PT_WORKORDER, $_POST['PaymentType']); commit_transaction(); diff --git a/manufacturing/work_order_entry.php b/manufacturing/work_order_entry.php index a278e1e6..7e06ea45 100644 --- a/manufacturing/work_order_entry.php +++ b/manufacturing/work_order_entry.php @@ -49,13 +49,13 @@ elseif(isset($_POST['selected_id'])) if (isset($_GET['AddedID'])) { $id = $_GET['AddedID']; - $stype = systypes::work_order(); + $stype = ST_WORKORDER; display_notification_centered(_("The work order been added.")); display_note(get_trans_view_str($stype, $id, _("View this Work Order"))); - if ($_GET['type'] != wo_types::advanced()) + if ($_GET['type'] != WO_ADVANCED) { include_once($path_to_root . "/reporting/includes/reporting.inc"); $ar = array('PARAM_0' => $id, 'PARAM_1' => $id, 'PARAM_2' => 0); @@ -122,18 +122,18 @@ if (!isset($_POST['date_'])) function can_process() { - global $selected_id; + global $selected_id, $SysPrefs, $Refs; if (!isset($selected_id)) { - if (!references::is_valid($_POST['wo_ref'])) + if (!$Refs->is_valid($_POST['wo_ref'])) { display_error(_("You must enter a reference.")); set_focus('wo_ref'); return false; } - if (!is_new_reference($_POST['wo_ref'], systypes::work_order())) + if (!is_new_reference($_POST['wo_ref'], ST_WORKORDER)) { display_error(_("The entered reference is already in use.")); set_focus('wo_ref'); @@ -161,7 +161,7 @@ function can_process() return false; } // only check bom and quantites if quick assembly - if (!($_POST['type'] == wo_types::advanced())) + if (!($_POST['type'] == WO_ADVANCED)) { if (!has_bom($_POST['stock_id'])) { @@ -187,9 +187,9 @@ function can_process() return false; } - if (!sys_prefs::allow_negative_stock()) + if (!$SysPrefs->allow_negative_stock()) { - if ($_POST['type'] == wo_types::assemble()) + if ($_POST['type'] == WO_ASSEMBLY) { // check bom if assembling $result = get_bom($_POST['stock_id']); @@ -213,7 +213,7 @@ function can_process() } } } - elseif ($_POST['type'] == wo_types::unassemble()) + elseif ($_POST['type'] == WO_UNASSEMBLY) { // if unassembling, check item to unassemble $qoh = get_qoh_on_date($_POST['stock_id'], $_POST['StockLocation'], $_POST['date_']); @@ -363,7 +363,7 @@ if (isset($selected_id)) $_POST['units_issued'] = $myrow["units_issued"]; $_POST['Costs'] = price_format($myrow["additional_costs"]); - $_POST['memo_'] = get_comments_string(systypes::work_order(), $selected_id); + $_POST['memo_'] = get_comments_string(ST_WORKORDER, $selected_id); hidden('wo_ref', $_POST['wo_ref']); hidden('units_issued', $_POST['units_issued']); @@ -374,13 +374,13 @@ if (isset($selected_id)) hidden('old_stk_id', $myrow["stock_id"]); label_row(_("Reference:"), $_POST['wo_ref']); - label_row(_("Type:"), wo_types::name($_POST['type'])); + label_row(_("Type:"), $wo_types_array[$_POST['type']]); hidden('type', $myrow["type"]); } else { $_POST['units_issued'] = $_POST['released'] = 0; - ref_row(_("Reference:"), 'wo_ref', '', references::get_next(systypes::work_order())); + ref_row(_("Reference:"), 'wo_ref', '', $Refs->get_next(ST_WORKORDER)); wo_types_list_row(_("Type:"), 'type', null); } @@ -409,13 +409,13 @@ else $_POST['quantity'] = qty_format($_POST['quantity'], $_POST['stock_id'], $dec); -if (get_post('type') == wo_types::advanced()) +if (get_post('type') == WO_ADVANCED) { qty_row(_("Quantity Required:"), 'quantity', null, null, null, $dec); if ($_POST['released']) label_row(_("Quantity Manufactured:"), number_format($_POST['units_issued'], get_qty_dec($_POST['stock_id']))); date_row(_("Date") . ":", 'date_', '', true); - date_row(_("Date Required By") . ":", 'RequDate', '', null, sys_prefs::default_wo_required_by()); + date_row(_("Date Required By") . ":", 'RequDate', '', null, $SysPrefs->default_wo_required_by()); } else { diff --git a/manufacturing/work_order_issue.php b/manufacturing/work_order_issue.php index 775527aa..e0349bb8 100644 --- a/manufacturing/work_order_issue.php +++ b/manufacturing/work_order_issue.php @@ -34,7 +34,7 @@ if (isset($_GET['AddedID'])) { display_notification(_("The work order issue has been entered.")); - display_note(get_trans_view_str(systypes::work_order(), $_GET['AddedID'], _("View this Work Order"))); + display_note(get_trans_view_str(ST_WORKORDER, $_GET['AddedID'], _("View this Work Order"))); hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process")); @@ -69,6 +69,8 @@ function handle_new_order() function can_process() { + global $Refs; + if (!is_date($_POST['date_'])) { display_error(_("The entered date for the issue is invalid.")); @@ -81,7 +83,7 @@ function can_process() set_focus('date_'); return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); diff --git a/manufacturing/work_order_release.php b/manufacturing/work_order_release.php index ca72da7c..eee4ed95 100644 --- a/manufacturing/work_order_release.php +++ b/manufacturing/work_order_release.php @@ -69,7 +69,7 @@ if (isset($_POST['release'])) display_notification(_("The work order has been released to manufacturing.")); - display_note(get_trans_view_str(systypes::work_order(), $selected_id, _("View this Work Order"))); + display_note(get_trans_view_str(ST_WORKORDER, $selected_id, _("View this Work Order"))); hyperlink_no_params("search_work_orders.php", _("Select another &work order")); diff --git a/purchasing/allocations/supplier_allocate.php b/purchasing/allocations/supplier_allocate.php index 4a4b85a8..4997b2de 100644 --- a/purchasing/allocations/supplier_allocate.php +++ b/purchasing/allocations/supplier_allocate.php @@ -45,7 +45,7 @@ function edit_allocations_for_transaction($type, $trans_no) { start_form(); - display_heading(_("Allocation of") . " " . systypes::name($_SESSION['alloc']->type) . " # " . $_SESSION['alloc']->trans_no); + display_heading(_("Allocation of") . " " . $systypes_array[$_SESSION['alloc']->type] . " # " . $_SESSION['alloc']->trans_no); display_heading($_SESSION['alloc']->person_name); diff --git a/purchasing/allocations/supplier_allocation_main.php b/purchasing/allocations/supplier_allocation_main.php index 78b0b660..69d342fa 100644 --- a/purchasing/allocations/supplier_allocation_main.php +++ b/purchasing/allocations/supplier_allocation_main.php @@ -47,7 +47,7 @@ start_form(); end_form(); set_global_supplier($_POST['supplier_id']); - if (isset($_POST['supplier_id']) && ($_POST['supplier_id'] == reserved_words::get_all())) + if (isset($_POST['supplier_id']) && ($_POST['supplier_id'] == ALL_TEXT)) { unset($_POST['supplier_id']); } @@ -62,7 +62,9 @@ start_form(); //-------------------------------------------------------------------------------- function systype_name($dummy, $type) { - return systypes::name($type); + global $systypes_array; + + return $systypes_array[$type; } function trans_view($trans) diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index 7e7d5510..3a9e4595 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -53,6 +53,8 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, function add_grn(&$po, $date_, $reference, $location) { + global $Refs; + begin_transaction(); $grn = add_grn_batch($po->order_no, $po->supplier_id, $reference, $location, $date_); @@ -93,7 +95,7 @@ function add_grn(&$po, $date_, $reference, $location) } /*quantity received is != 0 */ } /*end of order_line loop */ - references::save(25, $grn, $reference); + $Refs->save(25, $grn, $reference); add_audit_trail(25, $grn, $date_); diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc index ab817cf9..bca0bd2f 100644 --- a/purchasing/includes/db/invoice_db.inc +++ b/purchasing/includes/db/invoice_db.inc @@ -118,6 +118,8 @@ function get_diff_in_home_currency($supplier, $old_date, $date, $amount1, $amoun function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref because we change locally { + global $Refs; + //$company_currency = get_company_currency(); /*Start an sql transaction */ begin_transaction(); @@ -283,11 +285,11 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b } /*Post a balance post if $total != 0 */ - add_gl_balance($trans_type, $invoice_id, $date_, -$total, payment_person_types::supplier(), $supp_trans->supplier_id); + add_gl_balance($trans_type, $invoice_id, $date_, -$total, PT_SUPPLIER, $supp_trans->supplier_id); add_comments($trans_type, $invoice_id, $date_, $supp_trans->Comments); - references::save($trans_type, $invoice_id, $supp_trans->reference); + $Refs->save($trans_type, $invoice_id, $supp_trans->reference); if ($invoice_no != 0) { @@ -309,7 +311,7 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b // Exchange Variations Joe Hunt 2008-09-20 //////////////////////////////////////// exchange_variation(21, $invoice_id, 20, $invoice_no, $date_, - $allocate_amount, payment_person_types::supplier()); + $allocate_amount, PT_SUPPLIER); /////////////////////////////////////////////////////////////////////////// } diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index 8a92e8bb..1f5f5750 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -24,6 +24,8 @@ function delete_po($po) function add_po(&$po_obj) { + global $Refs; + begin_transaction(); /*Insert to purchase order header record */ @@ -56,11 +58,11 @@ function add_po(&$po_obj) } } - references::save(systypes::po(), $po_obj->order_no, $po_obj->reference); + $Refs->save(ST_PURCHORDER, $po_obj->order_no, $po_obj->reference); - //add_comments(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); + //add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); - add_audit_trail(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date); + add_audit_trail(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date); commit_transaction(); return $po_obj->order_no; @@ -116,7 +118,7 @@ function update_po(&$po_obj) db_query($sql, "One of the purchase order detail records could not be updated"); } - //add_comments(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); + //add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); commit_transaction(); diff --git a/purchasing/includes/db/supp_payment_db.inc b/purchasing/includes/db/supp_payment_db.inc index c44c8140..d4dc4706 100644 --- a/purchasing/includes/db/supp_payment_db.inc +++ b/purchasing/includes/db/supp_payment_db.inc @@ -12,6 +12,8 @@ function add_supp_payment($supplier_id, $date_, $bank_account, $amount, $discount, $ref, $memo_, $rate=0, $charge=0) { + global $Refs; + begin_transaction(); $supplier_currency = get_supplier_currency($supplier_id); @@ -67,17 +69,17 @@ function add_supp_payment($supplier_id, $date_, $bank_account, } /*Post a balance post if $total != 0 */ - add_gl_balance($trans_type, $payment_id, $date_, -$total, payment_person_types::supplier(), $supplier_id); + add_gl_balance($trans_type, $payment_id, $date_, -$total, PT_SUPPLIER, $supplier_id); /*now enter the bank_trans entry */ add_bank_trans($trans_type, $payment_id, $bank_account, $ref, - $date_, -($amount + $supp_charge), payment_person_types::supplier(), + $date_, -($amount + $supp_charge), PT_SUPPLIER, $supplier_id, $bank_account_currency, "Could not add the supplier payment bank transaction"); add_comments($trans_type, $payment_id, $date_, $memo_); - references::save($trans_type, $payment_id, $ref); + $Refs->save($trans_type, $payment_id, $ref); commit_transaction(); diff --git a/purchasing/includes/db/suppalloc_db.inc b/purchasing/includes/db/suppalloc_db.inc index 91b53396..1c0f16eb 100644 --- a/purchasing/includes/db/suppalloc_db.inc +++ b/purchasing/includes/db/suppalloc_db.inc @@ -81,7 +81,7 @@ function clear_supp_alloctions($type, $type_no, $date="") // 2008-09-20 Joe Hunt if ($date != "") exchange_variation($type, $type_no, $row['trans_type_to'], $row['trans_no_to'], $date, - $row['amt'], payment_person_types::supplier(), true); + $row['amt'], PT_SUPPLIER, true); ////////////////////// } diff --git a/purchasing/includes/purchasing_db.inc b/purchasing/includes/purchasing_db.inc index dc9ceccd..89b7533e 100644 --- a/purchasing/includes/purchasing_db.inc +++ b/purchasing/includes/purchasing_db.inc @@ -39,7 +39,7 @@ function add_gl_trans_supplier($type, $type_no, $date_, $account, $dimension, $d return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, $memo, $amount, get_supplier_currency($supplier_id), - payment_person_types::supplier(), $supplier_id, $err_msg, $rate); + PT_SUPPLIER, $supplier_id, $err_msg, $rate); } //---------------------------------------------------------------------------------------- diff --git a/purchasing/includes/ui/grn_ui.inc b/purchasing/includes/ui/grn_ui.inc index 539fc5f3..81bd8617 100644 --- a/purchasing/includes/ui/grn_ui.inc +++ b/purchasing/includes/ui/grn_ui.inc @@ -13,7 +13,7 @@ function display_grn_summary(&$po, $editable=false) { - global $table_style2; + global $table_style2, $Refs; start_table("$table_style2 width=90%"); start_row(); @@ -22,7 +22,7 @@ function display_grn_summary(&$po, $editable=false) if (!is_company_currency($po->curr_code)) label_cells(_("Order Currency"), $po->curr_code, "class='tableheader2'"); - label_cells(_("For Purchase Order"), get_trans_view_str(systypes::po(), $po->order_no), + label_cells(_("For Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no), "class='tableheader2'"); label_cells(_("Ordered On"), $po->orig_order_date, "class='tableheader2'"); @@ -33,7 +33,7 @@ function display_grn_summary(&$po, $editable=false) if ($editable) { if (!isset($_POST['ref'])) - $_POST['ref'] = references::get_next(25); + $_POST['ref'] = $Refs->get_next(25); ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'"); if (!isset($_POST['Location'])) diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index a3a599cb..75c8a24f 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -55,7 +55,7 @@ function copy_to_trans(&$supp_trans) function invoice_header(&$supp_trans) { - global $Ajax, $table_style; + global $Ajax, $table_style, $Refs; // if vars have been lost, recopy if (!isset($_POST['tran_date'])) @@ -74,7 +74,7 @@ function invoice_header(&$supp_trans) } else { - if (!isset($_POST['supplier_id']) && (get_global_supplier() != reserved_words::get_all())) + if (!isset($_POST['supplier_id']) && (get_global_supplier() != ALL_TEXT)) $_POST['supplier_id'] = get_global_supplier(); supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true); @@ -90,9 +90,9 @@ function invoice_header(&$supp_trans) } if ($supp_trans->is_invoice) - ref_row(_("Reference:"), 'reference', '', references::get_next(20)); + ref_row(_("Reference:"), 'reference', '', $Refs->get_next(20)); else - ref_row(_("Reference:"), 'reference', '', references::get_next(21)); + ref_row(_("Reference:"), 'reference', '', $Refs->get_next(21)); if (isset($_POST['invoice_no'])) { @@ -367,7 +367,7 @@ function display_grn_items_for_selection(&$supp_trans, $k) hidden('order_price'.$n, $myrow['unit_price'], false). hidden('std_cost_unit'.$n, $myrow['std_cost_unit'], false). hidden('po_detail_item'.$n, $myrow['po_detail_item'], false)); - label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"])); + label_cell(get_trans_view_str(ST_PURCHORDER, $myrow["purch_order_no"])); label_cell($myrow["item_code"]); label_cell($myrow["description"]); label_cell(sql2date($myrow["delivery_date"])); diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index 9ca5cda8..237d34b1 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -50,7 +50,7 @@ function create_new_po() function display_po_header(&$order) { - global $table_style2, $Ajax; + global $table_style2, $Ajax, $Refs; $editable = ($order->order_no == 0); @@ -59,7 +59,7 @@ function display_po_header(&$order) table_section(1); if ($editable) { - if (!isset($_POST['supplier_id']) && (get_global_supplier() != reserved_words::get_all())) + if (!isset($_POST['supplier_id']) && (get_global_supplier() != ALL_TEXT)) $_POST['supplier_id'] = get_global_supplier(); supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true, false, true); @@ -91,7 +91,7 @@ function display_po_header(&$order) if ($editable) { - ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::po())); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_PURCHORDER)); } else { @@ -238,7 +238,7 @@ function display_po_summary(&$po, $is_self=false, $editable=false) if (!$is_self) { - label_cells(_("Purchase Order"), get_trans_view_str(systypes::po(), $po->order_no), + label_cells(_("Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no), "class='tableheader2'"); } end_row(); diff --git a/purchasing/inquiry/po_search.php b/purchasing/inquiry/po_search.php index 5638582b..e8f9f0c6 100644 --- a/purchasing/inquiry/po_search.php +++ b/purchasing/inquiry/po_search.php @@ -75,7 +75,7 @@ end_form(); //--------------------------------------------------------------------------------------------- function trans_view($trans) { - return get_trans_view_str(systypes::po(), $trans["order_no"]); + return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]); } function edit_link($row) diff --git a/purchasing/inquiry/po_search_completed.php b/purchasing/inquiry/po_search_completed.php index 7f014d8c..f13c95fd 100644 --- a/purchasing/inquiry/po_search_completed.php +++ b/purchasing/inquiry/po_search_completed.php @@ -77,7 +77,7 @@ if (isset($_POST['order_number'])) } if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") && - ($_POST['SelectStockFromList'] != reserved_words::get_all())) + ($_POST['SelectStockFromList'] != ALL_TEXT)) { $selected_stock_item = $_POST['SelectStockFromList']; } @@ -89,7 +89,7 @@ else //--------------------------------------------------------------------------------------------- function trans_view($trans) { - return get_trans_view_str(systypes::po(), $trans["order_no"]); + return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]); } function edit_link($row) @@ -137,7 +137,7 @@ else $sql .= " AND porder.ord_date >= '$data_after'"; $sql .= " AND porder.ord_date <= '$date_before'"; - if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all()) + if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != ALL_TEXT) { $sql .= " AND porder.into_stock_location = '". $_POST['StockLocation'] . "' "; } diff --git a/purchasing/inquiry/supplier_allocation_inquiry.php b/purchasing/inquiry/supplier_allocation_inquiry.php index 30b11bfb..b0d9d51b 100644 --- a/purchasing/inquiry/supplier_allocation_inquiry.php +++ b/purchasing/inquiry/supplier_allocation_inquiry.php @@ -70,7 +70,9 @@ function check_overdue($row) function systype_name($dummy, $type) { - return systypes::name($type); + global $systypes_array; + + return $systypes_array[$type]; } function view_link($trans) @@ -140,9 +142,9 @@ function fmt_credit($row) WHERE supplier.supplier_id = trans.supplier_id AND trans.tran_date >= '$date_after' AND trans.tran_date <= '$date_to'"; - if ($_POST['supplier_id'] != reserved_words::get_all()) + if ($_POST['supplier_id'] != ALL_TEXT) $sql .= " AND trans.supplier_id = '" . $_POST['supplier_id'] . "'"; - if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) + if (isset($_POST['filterType']) && $_POST['filterType'] != ALL_TEXT) { if (($_POST['filterType'] == '1') || ($_POST['filterType'] == '2')) { @@ -185,7 +187,7 @@ $cols = array( array('insert'=>true, 'fun'=>'alloc_link') ); -if ($_POST['supplier_id'] != reserved_words::get_all()) { +if ($_POST['supplier_id'] != ALL_TEXT) { $cols[_("Supplier")] = 'skip'; $cols[_("Currency")] = 'skip'; } diff --git a/purchasing/inquiry/supplier_inquiry.php b/purchasing/inquiry/supplier_inquiry.php index 7de2319c..38508f71 100644 --- a/purchasing/inquiry/supplier_inquiry.php +++ b/purchasing/inquiry/supplier_inquiry.php @@ -89,7 +89,7 @@ function display_supplier_summary($supplier_record) //------------------------------------------------------------------------------------------------ div_start('totals_tbl'); -if (($_POST['supplier_id'] != "") && ($_POST['supplier_id'] != reserved_words::get_all())) +if (($_POST['supplier_id'] != "") && ($_POST['supplier_id'] != ALL_TEXT)) { $supplier_record = get_supplier_details($_POST['supplier_id']); display_supplier_summary($supplier_record); @@ -104,7 +104,8 @@ if(get_post('RefreshInquiry')) //------------------------------------------------------------------------------------------------ function systype_name($dummy, $type) { - return systypes::name($type); + global $systypes_array; + return $systypes_array[$type]; } function trans_view($trans) @@ -177,9 +178,9 @@ function check_overdue($row) AND trans.tran_date >= '$date_after' AND trans.tran_date <= '$date_to' AND trans.ov_amount != 0"; // exclude voided transactions - if ($_POST['supplier_id'] != reserved_words::get_all()) + if ($_POST['supplier_id'] != ALL_TEXT) $sql .= " AND trans.supplier_id = '" . $_POST['supplier_id'] . "'"; - if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) + if (isset($_POST['filterType']) && $_POST['filterType'] != ALL_TEXT) { if (($_POST['filterType'] == '1')) { @@ -220,7 +221,7 @@ $cols = array( array('insert'=>true, 'fun'=>'credit_link') ); -if ($_POST['supplier_id'] != reserved_words::get_all()) +if ($_POST['supplier_id'] != ALL_TEXT) { $cols[_("Supplier")] = 'skip'; $cols[_("Currency")] = 'skip'; diff --git a/purchasing/po_entry_items.php b/purchasing/po_entry_items.php index 09fc0663..a5f4b7d5 100644 --- a/purchasing/po_entry_items.php +++ b/purchasing/po_entry_items.php @@ -42,7 +42,7 @@ check_db_has_purchasable_items(_("There are no purchasable inventory items defin if (isset($_GET['AddedID'])) { $order_no = $_GET['AddedID']; - $trans_type = systypes::po(); + $trans_type = ST_PURCHORDER; if (!isset($_GET['Updated'])) display_notification_centered(_("Purchase Order has been entered")); @@ -261,6 +261,8 @@ function handle_add_new_item() function can_commit() { + global $Refs; + if (!is_date($_POST['OrderDate'])) { display_error(_("The entered order date is invalid.")); @@ -270,14 +272,14 @@ function can_commit() if (!$_SESSION['PO']->order_no) { - if (!references::is_valid(get_post('ref'))) + if (!$Refs->is_valid(get_post('ref'))) { display_error(_("There is no reference entered for this purchase order.")); set_focus('ref'); return false; } - if (!is_new_reference(get_post('ref'), systypes::po())) + if (!is_new_reference(get_post('ref'), ST_PURCHORDER)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); diff --git a/purchasing/po_receive_items.php b/purchasing/po_receive_items.php index cec4715f..5059807b 100644 --- a/purchasing/po_receive_items.php +++ b/purchasing/po_receive_items.php @@ -158,6 +158,8 @@ function check_po_changed() function can_process() { + global $SysPrefs, $Refs; + if (count($_SESSION['PO']->line_items) <= 0) { display_error(_("There is nothing to process. Please enter valid quantities greater than zero.")); @@ -171,7 +173,7 @@ function can_process() return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); @@ -200,7 +202,7 @@ function can_process() foreach ($_SESSION['PO']->line_items as $order_line) { if ($order_line->receive_qty+$order_line->qty_received > - $order_line->quantity * (1+ (sys_prefs::over_receive_allowance() / 100))) + $order_line->quantity * (1+ ($SysPrefs->over_receive_allowance() / 100))) { $delivery_qty_too_large = 1; break; @@ -214,7 +216,7 @@ function can_process() } elseif ($delivery_qty_too_large == 1) { - display_error(_("Entered quantities cannot be greater than the quantity entered on the purchase order including the allowed over-receive percentage") . " (" . sys_prefs::over_receive_allowance() ."%)." + display_error(_("Entered quantities cannot be greater than the quantity entered on the purchase order including the allowed over-receive percentage") . " (" . $SysPrefs->over_receive_allowance() ."%)." . " " . _("Modify the ordered items on the purchase order if you wish to increase the quantities.")); return false; diff --git a/purchasing/supplier_credit.php b/purchasing/supplier_credit.php index 102184b0..25c24e3b 100644 --- a/purchasing/supplier_credit.php +++ b/purchasing/supplier_credit.php @@ -137,7 +137,7 @@ if (isset($_POST['AddGLCodeToTrans'])){ function check_data() { - global $total_grn_value, $total_gl_value; + global $total_grn_value, $total_gl_value, $Refs; if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) { @@ -146,7 +146,7 @@ function check_data() return false; } - if (!references::is_valid($_SESSION['supp_trans']->reference)) + if (!$Refs->is_valid($_SESSION['supp_trans']->reference)) { display_error(_("You must enter an credit note reference.")); set_focus('reference'); @@ -160,7 +160,7 @@ function check_data() return false; } - if (!references::is_valid($_SESSION['supp_trans']->supp_reference)) + if (!$Refs->is_valid($_SESSION['supp_trans']->supp_reference)) { display_error(_("You must enter a supplier's credit note reference.")); set_focus('supp_reference'); diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index 5302ee67..33c745a1 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -138,13 +138,15 @@ if (isset($_POST['AddGLCodeToTrans'])){ function check_data() { - If (!$_SESSION['supp_trans']->is_valid_trans_to_post()) + global $Refs; + + if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) { display_error(_("The invoice cannot be processed because the there are no items or values on the invoice. Invoices are expected to have a charge.")); return false; } - if (!references::is_valid($_SESSION['supp_trans']->reference)) + if (!$Refs->is_valid($_SESSION['supp_trans']->reference)) { display_error(_("You must enter an invoice reference.")); set_focus('reference'); @@ -158,7 +160,7 @@ function check_data() return false; } - if (!references::is_valid($_SESSION['supp_trans']->supp_reference)) + if (!$Refs->is_valid($_SESSION['supp_trans']->supp_reference)) { display_error(_("You must enter a supplier's invoice reference.")); set_focus('supp_reference'); @@ -228,7 +230,7 @@ if (isset($_POST['PostInvoice'])) function check_item_data($n) { global $check_price_charged_vs_order_price, - $check_qty_charged_vs_del_qty; + $check_qty_charged_vs_del_qty, $SysPrefs; if (!check_num('this_quantity_inv'.$n, 0) || input_num('this_quantity_inv'.$n)==0) { display_error( _("The quantity to invoice must be numeric and greater than zero.")); @@ -243,15 +245,16 @@ function check_item_data($n) return false; } + $margin = $SysPrefs->over_charge_allowance(); if ($check_price_charged_vs_order_price == True) { if ($_POST['order_price'.$n]!=input_num('ChgPrice'.$n)) { if ($_POST['order_price'.$n]==0 || input_num('ChgPrice'.$n)/$_POST['order_price'.$n] > - (1 + (sys_prefs::over_charge_allowance() / 100))) + (1 + ($margin/ 100))) { display_error(_("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") . - _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%"); + _("The over-charge percentage allowance is :") . $margin . "%"); set_focus('ChgPrice'.$n); return false; } @@ -261,10 +264,10 @@ function check_item_data($n) if ($check_qty_charged_vs_del_qty == True) { if (input_num('this_quantity_inv'.$n) / ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]) > - (1+ (sys_prefs::over_charge_allowance() / 100))) + (1+ ($margin / 100))) { display_error( _("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") - . _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%"); + . _("The over-charge percentage allowance is :") . $margin . "%"); set_focus('this_quantity_inv'.$n); return false; } diff --git a/purchasing/supplier_payment.php b/purchasing/supplier_payment.php index 423a97cc..ee0b81a6 100644 --- a/purchasing/supplier_payment.php +++ b/purchasing/supplier_payment.php @@ -82,6 +82,8 @@ if (isset($_GET['AddedID'])) function check_inputs() { + global $Refs; + if ($_POST['amount'] == "") { $_POST['amount'] = price_format(0); @@ -144,7 +146,7 @@ function check_inputs() set_focus('DatePaid'); return false; } - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); @@ -225,7 +227,7 @@ start_form(); table_section(2); - ref_row(_("Reference:"), 'ref', '', references::get_next(22)); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(22)); date_row(_("Date Paid") . ":", 'DatePaid', '', true, 0, 0, 0, null, true); diff --git a/purchasing/view/view_supp_credit.php b/purchasing/view/view_supp_credit.php index 9a81bec1..60fa7f41 100644 --- a/purchasing/view/view_supp_credit.php +++ b/purchasing/view/view_supp_credit.php @@ -72,7 +72,7 @@ $voided = is_voided_display(21, $trans_no, _("This credit note has been voided." if (!$voided) { - display_allocations_from(payment_person_types::supplier(), $supp_trans->supplier_id, 21, $trans_no, -($supp_trans->ov_amount + $supp_trans->ov_gst)); + display_allocations_from(PT_SUPPLIER, $supp_trans->supplier_id, 21, $trans_no, -($supp_trans->ov_amount + $supp_trans->ov_gst)); } end_page(true); diff --git a/purchasing/view/view_supp_payment.php b/purchasing/view/view_supp_payment.php index c7da2a56..7ee90978 100644 --- a/purchasing/view/view_supp_payment.php +++ b/purchasing/view/view_supp_payment.php @@ -58,7 +58,7 @@ start_row(); if ($show_currencies) label_cells(_("Payment Currency"), $receipt['bank_curr_code'], "class='tableheader2'"); label_cells(_("Amount"), number_format2(-$receipt['BankAmount'], user_price_dec()), "class='tableheader2'"); -label_cells(_("Payment Type"), bank_account_types::transfer_type($receipt['BankTransType']), "class='tableheader2'"); +label_cells(_("Payment Type"), $bank_transfer_typea[$receipt['BankTransType']], "class='tableheader2'"); end_row(); start_row(); if ($show_currencies) @@ -78,7 +78,7 @@ $voided = is_voided_display(22, $trans_no, _("This payment has been voided.")); // now display the allocations for this payment if (!$voided) { - display_allocations_from(payment_person_types::supplier(), $receipt['supplier_id'], 22, $trans_no, -$receipt['Total']); + display_allocations_from(PT_SUPPLIER, $receipt['supplier_id'], 22, $trans_no, -$receipt['Total']); } end_page(true); diff --git a/reporting/includes/header2.inc b/reporting/includes/header2.inc index 90cf3b63..5755b627 100644 --- a/reporting/includes/header2.inc +++ b/reporting/includes/header2.inc @@ -11,6 +11,8 @@ ***********************************************************************/ // New version (without vertical lines) + global $wo_types_array; + $this->row = $this->pageHeight - $this->topMargin; $upper = $this->row - 2 * $this->lineHeight; @@ -222,7 +224,7 @@ $this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C'); } elseif ($doctype == 26) - $this->TextWrap($col, $this->row, $width, wo_types::name($myrow["type"]), 'C'); + $this->TextWrap($col, $this->row, $width, $wo_types_array[$myrow["type"]], 'C'); $col += $width; if ($doctype == 26) $this->TextWrap($col, $this->row, $width, $myrow["StockItemName"], 'C'); diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 7fa0c122..9df49429 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -24,7 +24,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, switch ($type_no) { - case systypes::sales_quotation() : + case ST_SALESQUOTE : $rep = 111; // from, to, currency, bank acc, email, quote, comments $ar = array( @@ -35,7 +35,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, 'PARAM_4' => $email, 'PARAM_5' => ""); break; - case systypes::sales_order() : + case ST_SALESORDER : $rep = 109; // from, to, currency, bank acc, email, quote, comments $ar = array( @@ -47,7 +47,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, 'PARAM_5' => 0, 'PARAM_6' => ""); break; - case systypes::cust_dispatch() : + case ST_CUSTDELIVERY : $rep = 110; // from, to, email, comments $ar = array( @@ -70,7 +70,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, 'PARAM_6' => "", 'PARAM_7' => $type_no); break; - case systypes::po() : + case ST_PURCHORDER : $rep = 209; // from, to, currency, bank acc, email, comments $ar = array( diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index 2b1c6d55..9ed5a4ab 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -375,9 +375,9 @@ function dup_simple_codeandname_list($sql, $name, &$selected_id, if ($all_option == true) { if ($all_option_numeric) - $reserved_word = reserved_words::get_all_numeric(); + $reserved_word = ALL_NUMERIC; else - $reserved_word = reserved_words::get_all(); + $reserved_word = ALL_TEXT; if ($reserved_word == $selected_id) { @@ -437,7 +437,7 @@ function dup_systypes_list($name, &$selected_id, $all_option=false, $all_option_ $st = " |