$result = array();
if ($isList) {
foreach ($a as $v) {
- $result[] = JsHttpRequest::php2js($v);
+ $result[] = $this->php2js($v);
}
return '[ ' . join(', ', $result) . ' ]';
} else {
foreach ($a as $k => $v) {
- $result[] = JsHttpRequest::php2js($k) . ': ' . JsHttpRequest::php2js($v);
+ $result[] = $this->php2js($k) . ': ' . $this->php2js($v);
}
return '{ ' . join(', ', $result) . ' }';
}
function exchange_variation($pyt_type, $pyt_no, $type, $trans_no, $pyt_date, $amount, $person_type, $neg=false)
{
- if ($person_type == payment_person_types::customer())
+ global $systypes_array;
+
+ if ($person_type == PT_CUSTOMER)
{
$trans = get_customer_trans($trans_no, $type);
$pyt_trans = get_customer_trans($pyt_no, $pyt_type);
if ($inv_amt != $pay_amt)
{
$diff = $inv_amt - $pay_amt;
- if ($person_type == payment_person_types::supplier())
+ if ($person_type == PT_SUPPLIER)
$diff = -$diff;
if ($neg)
$diff = -$diff;
$exc_var_act = get_company_pref('exchange_diff_act');
if (date1_greater_date2($date, $pyt_date))
{
- $memo = systypes::name($pyt_type)." ".$pyt_no;
+ $memo = $systypes_array[$pyt_type]." ".$pyt_no;
add_gl_trans($type, $trans_no, $date, $ar_ap_act, 0, 0, $memo, -$diff, null, $person_type, $person_id);
add_gl_trans($type, $trans_no, $date, $exc_var_act, 0, 0, $memo, $diff, null, $person_type, $person_id);
}
else
{
- $memo = systypes::name($type)." ".$trans_no;
+ $memo = $systypes_array[$type]." ".$trans_no;
add_gl_trans($pyt_type, $pyt_no, $pyt_date, $ar_ap_act, 0, 0, $memo, -$diff, null, $person_type, $person_id);
add_gl_trans($pyt_type, $pyt_no, $pyt_date, $exc_var_act, 0, 0, $memo, $diff, null, $person_type, $person_id);
}
function error_handler($errno, $errstr, $file, $line) {
global $messages, $go_debug;
+ // skip well known warnings we don't care about.
+ // Please use restrainedly to not risk loss of important messages
+ $excluded_warnings = array('html_entity_decode', 'htmlspecialchars');
+ foreach($excluded_warnings as $ref) {
+ if (strpos($errstr, $ref) !== false) {
+ return true;
+ }
+ }
+
// error_reporting==0 when messages are set off with @
if ($errno & error_reporting())
$messages[] = array($errno, $errstr, $file, $line);
define('GETTEXT_NATIVE', 1);
define('GETTEXT_PHP', 2);
-/**
-* Generic gettext static class.
-*
-* This class allows gettext usage with php even if the gettext support is
-* not compiled in php.
-*
-* The developper can choose between the GETTEXT_NATIVE support and the
-* GETTEXT_PHP support on initialisation. If native is not supported, the
-* system will fall back to PHP support.
-*
-* On both systems, this package add a variable interpolation system so you can
-* translate entire dynamic sentences in stead of peace of sentences.
-*
-* Small example without pear error lookup :
-*
-* <?php
-* require_once "get_text.php";
-*
-* get_text::init();
-* get_text::set_language('fr_Fr'); // may throw GetText_Error
-* get_text::add_domain('myAppDomain'); // may throw GetText_Error
-* get_text::set_var('login', $login);
-* get_text::set_var('name', $name);
-*
-* // may throw GetText_Error
-* echo get_text::gettext('Welcome ${name}, you\'re connected with login ${login}');
-*
-* // should echo something like :
-* //
-* // "Bienvenue Jean-Claude, vous ĂȘtes connectĂ© en tant qu'utilisateur jcaccount"
-* //
-* // or if fr_FR translation does not exists
-* //
-* // "Welcome Jean-Claude, you're connected with login jcaccount"
-*
-* ?>
-*
-* A gettext mini-howto should be provided with this package, if you're new
-* to gettext usage, please read it to learn how to build a gettext
-* translation directory (locale).
-*
-* @todo Tools to manage gettext files in php.
-*
-* - non traducted domains / keys
-* - modification of keys
-* - domain creation, preparation, delete, ...
-* - tool to extract required messages from TOF templates
-*
-* @version 0.5
-* @author Laurent Bedubourg <laurent.bedubourg@free.fr>
-*/
-class get_text
-{
- /**
- * This method returns current gettext support class.
- *
- * @return GetText_Support
- * @static 1
- * @access private
- */
- function &_support($set=false)
- {
- static $support_obj;
- if ($set !== false)
- {
- $support_obj = $set;
- }
- elseif (!isset($support_obj))
- {
- trigger_error("get_text not initialized !". '\n'.
- "Please call get_text::init() before calling ".
- "any get_text function !" . '\n' , E_USER_ERROR);
- }
- return $support_obj;
- }
-
- /**
- * Initialize gettext package.
- *
- * This method instantiate the gettext support depending on managerType
- * value.
- *
- * GETTEXT_NATIVE try to use gettext php support and fall back to PHP
- * support if not installed.
- *
- * GETTEXT_PHP explicitely request the usage of PHP support.
- *
- * @param int $managerType
- * Gettext support type.
- *
- * @access public
- * @static 1
- */
- function init($managerType = GETTEXT_NATIVE)
- {
+function get_text_init($managerType = GETTEXT_NATIVE) {
+
+ if (!isset($_SESSION['get_text'])) {
+
if ($managerType == GETTEXT_NATIVE)
{
if (function_exists('gettext'))
{
- return get_text::_support(new gettext_native_support());
+ $_SESSION['get_text'] = new gettext_native_support();
+ return;
}
}
// fail back to php support
- return get_text::_support(new gettext_php_support());
- }
-
- /**
- * Set the language to use for traduction.
- *
- * @param string $lang_code
- * The language code usually defined as ll_CC, ll is the two letter
- * language code and CC is the two letter country code.
- *
- * @throws GetText_Error if language is not supported by your system.
- */
- function set_language($lang_code, $encoding)
- {
- $support = &get_text::_support();
- return $support->set_language($lang_code, $encoding);
- }
-
- /**
- * Add a translation domain.
- *
- * The domain name is usually the name of the .po file you wish to use.
- * For example, if you created a file 'lang/ll_CC/LC_MESSAGES/myapp.po',
- * you'll use 'myapp' as the domain name.
- *
- * @param string $domain
- * The domain name.
- *
- * @param string $path optional
- * The path to the locale directory (ie: /path/to/locale/) which
- * contains ll_CC directories.
- */
- function add_domain($domain, $path=false)
- {
- $support =& get_text::_support();
- return $support->add_domain($domain, $path);
- }
-
- /**
- * Retrieve the translation for specified key.
- *
- * @param string $key
- * String to translate using gettext support.
- */
- function gettext($key)
- {
- $support = &get_text::_support();
- return $support->gettext($key);
- }
-
- /**
- * Add a variable to gettext interpolation system.
- *
- * @param string $key
- * The variable name.
- *
- * @param string $value
- * The variable value.
- */
- function set_var($key, $value)
- {
- $support =& get_text::_support();
- return $support->set_var($key, $value);
- }
-
- /**
- * Add an hashtable of variables.
- *
- * @param hashtable $hash
- * PHP associative array of variables.
- */
- function set_vars($hash)
- {
- $support =& get_text::_support();
- return $support->set_vars($hash);
- }
-
- /**
- * Reset interpolation variables.
- */
- function reset()
- {
- $support =& get_text::_support();
- return $support->reset();
- }
+ $_SESSION['get_text'] = new gettext_php_support();
+ }
}
function raise_error($str) {
putenv("LANG=$lang_code");
putenv("LC_ALL=$lang_code");
putenv("LANGUAGE=$lang_code");
-
+
//$set = setlocale(LC_ALL, "$lang_code");
//$set = setlocale(LC_ALL, "$encoding");
$set = setlocale(LC_ALL, $lang_code.".".$encoding);
// check id file exists only once for session
$_SESSION['language']->is_locale_file = file_exists($locale);
}
-
$lang = $_SESSION['language'];
- get_text::set_language($lang->code, $lang->encoding);
- get_text::add_domain($lang->code, $path_to_root . "/lang");
+ $_SESSION['get_text']->set_language($lang->code, $lang->encoding);
+ $_SESSION['get_text']->add_domain($lang->code, $path_to_root . "/lang");
// Necessary for ajax calls. Due to bug in php 4.3.10 for this
// version set globally in php.ini
if (isset($_SESSION['App']) && $changed)
$_SESSION['App']->init(); // refresh menu
}
-
+}
/**
* This method loads an array of language objects into a session variable
* called $_SESSIONS['languages']. Only supported languages are added.
$_SESSION['language'] = $_SESSION['languages'][$dflt_lang];
}
-}
-
function _set($key,$value)
{
- get_text::set_var($key,$value);
+ $_SESSION['get_text']->set_var($key,$value);
}
if (!function_exists("_"))
{
function _($text)
{
- $retVal = get_text::gettext($text);
+ $retVal = $_SESSION['get_text']->gettext($text);
if ($retVal == "")
return $text;
return $retVal;
***********************************************************************/
include_once($path_to_root . "/includes/db/connect_db.inc");
-include_once($path_to_root . "/includes/reserved.inc");
include_once($path_to_root . "/includes/errors.inc");
include_once($path_to_root . "/includes/types.inc");
include_once($path_to_root . "/includes/systypes.inc");
$rend = new renderer();
$rend->menu_footer($no_menu, $is_index);
- $edits = "editors = ".JsHttpRequest::php2js($Editors).";";
+ $edits = "editors = ".$Ajax->php2js($Editors).";";
$Ajax->addScript('editors', $edits);
echo "<script>
_focus = '" . get_post('_focus') . "';
- _validate = " . JsHttpRequest::php2js($Validate).";
+ _validate = " . $Ajax->php2js($Validate).";
var $edits
</script>";
function default_delivery_required_by()
{
return get_company_pref('default_delivery_required');
- return 1;
}
function default_dimension_required_by()
} else {
$this->language = $user["language"];
- language::set_language($this->language);
+ $_SESSION['language']->set_language($this->language);
$this->qty_dec = $user["qty_dec"];
$this->price_dec = $user["prices_dec"];
{
add_reference($type, $id, $reference);
if ($reference != 'auto')
- references::save_last($reference, $type);
+ $this->save_last($reference, $type);
}
function get($type, $id)
function save_last($reference, $type)
{
- $next = references::increment($reference);
+ $next = $this->increment($reference);
save_next_reference($type, $next);
}
+++ /dev/null
-<?php
-/**********************************************************************
- Copyright (C) FrontAccounting, LLC.
- Released under the terms of the GNU General Public License, GPL,
- as published by the Free Software Foundation, either version 3
- of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
-***********************************************************************/
-// always use capitals in reserved words (for is_reserved_word comparisons)
-
-$any_item = 'AN';
-$any_number = -1;
-$all_option = '';
-$all_option_numeric = -1;
-
-class reserved_words
-{
-
- function get_any()
- {
- global $any_item;
- return $any_item;
- }
-
- function get_any_numeric()
- {
- global $any_number;
- return $any_number;
- }
-
- function get_all()
- {
- global $all_option;
- return $all_option;
- }
-
- function get_all_numeric()
- {
- global $all_option_numeric;
- return $all_option_numeric;
- }
-
- function is_reserved_word($str)
- {
- $str = strtoupper($str);
- if ($str == get_any())
- return true;
- if ($str == get_all())
- return true;
- return false;
- }
-
-}
-
-?>
\ No newline at end of file
// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks
header("Cache-control: private");
-get_text::init();
+get_text_init();
// Page Initialisation
if (!isset($_SESSION['languages']))
{
- language::load_languages(); // sets also default $_SESSION['language']
+ load_languages(); // sets also default $_SESSION['language']
}
-language::set_language($_SESSION['language']->code);
+$_SESSION['language']->set_language($_SESSION['language']->code);
// include $Hooks object if locale file exists
if(@include_once($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc"))
// page help. Currently help for function keys.
$Pagehelp = array();
+$SysPrefs = new sys_prefs();
+
+$Refs = new references();
+
// intercept all output to destroy it in case of ajax call
register_shutdown_function('end_flush');
ob_start('output_html',0);
// Incorrect password
login_fail();
}
- $lang = $_SESSION['language'];
- language::set_language($_SESSION['language']->code);
+ $lang = &$_SESSION['language'];
+ $lang->set_language($_SESSION['language']->code);
}
}
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
//----------------------------------------------------------------------------------
+define('ST_JOURNAL', 0);
+
+define('ST_BANKPAYMENT', 1);
+define('ST_BANKDEPOSIT', 2);
+define('ST_BANKTRANSFER', 4);
+
+define('ST_SALESINVOICE', 10);
+define('ST_CUSTCREDIT', 11);
+define('ST_CUSTPAYMENT', 12);
+define('ST_CUSTDELIVERY', 13);
+define('ST_LOCTRANSFER', 16);
+define('ST_INVADJUST', 17);
+define('ST_PURCHORDER', 18);
+define('ST_SUPPINVOICE', 20);
+define('ST_SUPPCREDIT', 21);
+define('ST_SUPPAYMENT', 22);
+define('ST_SUPPRECEIVE', 25);
+
+define('ST_WORKORDER', 26);
+
+define('ST_SALESORDER', 30);
+define('ST_SALESQUOTE', 32);
+define('ST_COSTUPDATE', 35);
+define('ST_DIMENSION', 40);
+
+define('ST_MANUISSUE', 28);
+define('ST_MANURECEIVE', 29);
$systypes_array = array (
- 0=> array ('name' => _("Journal Entry")),
- 1=> array ('name' => _("Bank Payment")),
- 2=> array ('name' => _("Bank Deposit")),
- 4=> array ('name' => _("Funds Transfer")),
- 10=> array ('name' => _("Sales Invoice")),
- 11=> array ('name' => _("Customer Credit Note")),
- 12=> array ('name' => _("Customer Payment")),
- 13=> array ('name' => _("Delivery Note")),
- 16=> array ('name' => _("Location Transfer")),
- 17=> array ('name' => _("Inventory Adjustment")),
- 18=> array ('name' => _("Purchase Order")),
- 20=> array ('name' => _("Supplier Invoice")),
- 21=> array ('name' => _("Supplier Credit Note")),
- 22=> array ('name' => _("Supplier Payment")),
- 25=> array ('name' => _("Purchase Order Delivery")),
- 26=> array ('name' => _("Work Order")),
- 28=> array ('name' => _("Work Order Issue")),
- 29=> array ('name' => _("Work Order Production")),
- 30=> array ('name' => _("Sales Order")),
- 32=> array ('name' => _("Sales Quotation")),
- 35=> array ('name' => _("Cost Update")),
- 40=> array ('name' => _("Dimension"))
- );
-class systypes
-{
-
- function journal_entry()
- {
- return 0;
- }
-
- function bank_payment()
- {
- return 1;
- }
-
- function bank_deposit()
- {
- return 2;
- }
-
- function bank_transfer()
- {
- return 4;
- }
-
- function cust_payment()
- {
- return 12;
- }
-
- function cust_dispatch()
- {
- return 13;
- }
-
- function location_transfer()
- {
- return 16;
- }
-
- function inventory_adjustment()
- {
- return 17;
- }
-
- function po()
- {
- return 18;
- }
-
- function supp_payment()
- {
- return 22;
- }
-
- function work_order()
- {
- return 26;
- }
-
- function sales_order()
- {
- return 30;
- }
-
- function sales_quotation()
- {
- return 32;
- }
-
- function cost_update()
- {
- return 35;
- }
-
- function dimension()
- {
- return 40;
- }
-
- function name($index)
- {
- global $systypes_array;
- if ($index < 0)
- return '';
- return $systypes_array[$index]['name'];
- }
-}
+ ST_JOURNAL => _("Journal Entry"),
+ ST_BANKPAYMENT => _("Bank Payment"),
+ ST_BANKDEPOSIT => _("Bank Deposit"),
+ ST_BANKTRANSFER => _("Funds Transfer"),
+ ST_SALESINVOICE => _("Sales Invoice"),
+ ST_CUSTCREDIT => _("Customer Credit Note"),
+ ST_CUSTPAYMENT => _("Customer Payment"),
+ ST_CUSTDELIVERY => _("Delivery Note"),
+ ST_LOCTRANSFER => _("Location Transfer"),
+ ST_INVADJUST => _("Inventory Adjustment"),
+ ST_PURCHORDER => _("Purchase Order"),
+ ST_SUPPINVOICE => _("Supplier Invoice"),
+ ST_SUPPCREDIT => _("Supplier Credit Note"),
+ ST_SUPPAYMENT => _("Supplier Payment"),
+ ST_SUPPRECEIVE => _("Purchase Order Delivery"),
+ ST_WORKORDER => _("Work Order"),
+ ST_MANUISSUE => _("Work Order Issue"),
+ ST_MANURECEIVE => _("Work Order Production"),
+ ST_SALESORDER => _("Sales Order"),
+ ST_SALESQUOTE => _("Sales Quotation"),
+ ST_COSTUPDATE => _("Cost Update"),
+ ST_DIMENSION => _("Dimension")
+ );
//----------------------------------------------------------------------------------
-
-$bank_account_types_array = array (
- 0=> array ('id' => 0, 'name' => _("Savings Account"), 'ptype' => _("Transfer")),
- 1=> array ('id' => 1, 'name' => _("Chequing Account"),'ptype' => _("Cheque")),
- 2=> array ('id' => 2, 'name' => _("Credit Account"), 'ptype' => _("Credit")),
- 3=> array ('id' => 3, 'name' => _("Cash Account"), 'ptype' => _("Cash"))
+define('BT_TRANSFER', 0);
+define('BT_CHEQUE', 1);
+define('BT_CREDIT', 2);
+define('BT_CASH', 3);
+
+$bank_account_types = array (
+ BT_TRANSFER => _("Savings Account"),
+ _("Chequing Account"),
+ _("Credit Account"),
+ _("Cash Account")
);
-class bank_account_types
-{
-
- function get_all()
- {
- global $bank_account_types_array;
- return $bank_account_types_array;;
- }
-
- function name($index)
- {
- global $bank_account_types_array;
- return $bank_account_types_array[$index]['name'];
- }
-
- function transfer_type($index)
- {
- global $bank_account_types_array;
- return $bank_account_types_array[$index]['ptype'];
- }
-}
+$bank_transfer_types = array(
+ BT_TRANSFER => _("Transfer"),
+ _("Cheque"),
+ _("Credit"),
+ _("Cash")
+ );
+//----------------------------------------------------------------------------------
/* Menu tabs */
$tabs = array('orders'=>_("Sales"), 'AP'=>_("Purchases"), 'stock'=>_("Items and Inventory"), 'manuf'=>_("Manufacturing"),
'proj'=>_("Dimensions"), 'GL'=>_("Banking and General Ledger"), 'system'=>_("Setup"));
include_once($path_to_root . "/sales/includes/sales_db.inc");
include_once($path_to_root . "/dimensions/includes/dimensions_db.inc");
-$payment_person_types_array = array (
- 0=> array ('id' => 0, 'name' => _("Miscellaneous")),
- 1=> array ('id' => 1, 'name' => _("Work Order")),
- 2=> array ('id' => 2, 'name' => _("Customer")),
- 3=> array ('id' => 3, 'name' => _("Supplier")),
- 4=> array ('id' => 4, 'name' => _("Quick Entry"))
- );
+define('PT_MISC', 0);
+define('PT_WORKORDER', 1);
+define('PT_CUSTOMER', 2);
+define('PT_SUPPLIER', 3);
+define('PT_QUICKENTRY', 4);
+define('PT_DIMESION', 5);
+
+$payment_person_types = array (
+ PT_MISC => _("Miscellaneous"),
+ _("Work Order"),
+ _("Customer"),
+ _("Supplier"),
+ _("Quick Entry")
+ );
-class payment_person_types
-{
- function get_all()
+function payment_person_currency($type, $person_id) {
+ switch ($type)
{
- global $payment_person_types_array;
- return $payment_person_types_array;
- }
+ case PT_MISC :
+ case PT_QUICKENTRY :
+ case PT_WORKORDER :
+ return get_company_currency();
- function misc()
- {
- return 0;
- }
-
- function WorkOrder()
- {
- return 1;
- }
-
- function customer()
- {
- return 2;
- }
-
- function supplier()
- {
- return 3;
- }
-
- function QuickEntry()
- {
- return 4;
- }
-
- function dimension()
- {
- return 5;
- }
-
- function type_name($type)
- {
- global $payment_person_types_array;
- return $payment_person_types_array[$type]['name'];
- }
-
- function person_name($type, $person_id, $full=true)
- {
- switch ($type)
- {
- case payment_person_types::misc() :
- return $person_id;
- case payment_person_types::QuickEntry() :
- $qe = get_quick_entry($person_id);
- return ($full?payment_person_types::type_name($type) . " ":"") . $qe["description"];
- case payment_person_types::WorkOrder() :
- global $wo_cost_types;
- return $wo_cost_types[$person_id];
- case payment_person_types::customer() :
- return ($full?payment_person_types::type_name($type) . " ":"") . get_customer_name($person_id);
- case payment_person_types::supplier() :
- return ($full?payment_person_types::type_name($type) . " ":"") . get_supplier_name($person_id);
- default :
- //DisplayDBerror("Invalid type sent to person_name");
- //return;
- return '';
- }
- }
-
- function person_currency($type, $person_id)
- {
- switch ($type)
- {
- case payment_person_types::misc() :
- case payment_person_types::QuickEntry() :
- case payment_person_types::WorkOrder() :
- return get_company_currency();
-
- case payment_person_types::customer() :
- return get_customer_currency($person_id);
-
- case payment_person_types::supplier() :
- return get_supplier_currency($person_id);
-
- default :
- return get_company_currency();
- }
- }
-
- function has_items($type)
- {
- switch ($type)
- {
- case payment_person_types::misc() :
- return true;
- case payment_person_types::QuickEntry() :
- return db_has_quick_entries();
- case payment_person_types::WorkOrder() : // 070305 changed to open workorders JH
- return db_has_open_workorders();
- case payment_person_types::customer() :
- return db_has_customers();
- case payment_person_types::supplier() :
- return db_has_suppliers();
- default :
- display_db_error("Invalid type sent to has_items", "");
- return false;
- }
- }
-}
-
-//----------------------------------------------------------------------------------
+ case PT_CUSTOMER :
+ return get_customer_currency($person_id);
-$wo_types_array = array (
- 0=> array ('id' => 0, 'name' => _("Assemble")),
- 1=> array ('id' => 1, 'name' => _("Unassemble")),
- 2=> array ('id' => 2, 'name' => _("Advanced Manufacture"))
- );
-
-class wo_types
-{
+ case PT_SUPPLIER :
+ return get_supplier_currency($person_id);
- function assemble()
- {
- return 0;
+ default :
+ return get_company_currency();
}
+}
- function unassemble()
- {
- return 1;
- }
+function payment_person_name($type, $person_id, $full=true) {
+ global $payment_person_types;
- function advanced()
- {
- return 2;
- }
-
- function get_all()
+ switch ($type)
{
- global $wo_types_array;
- return $wo_types_array;;
+ case PT_MISC :
+ return $person_id;
+ case PT_QUICKENTRY :
+ $qe = get_quick_entry($person_id);
+ return ($full ? $payment_person_types[$type] . " ":"") . $qe["description"];
+ case PT_WORKORDER :
+ global $wo_cost_types;
+ return $wo_cost_types[$person_id];
+ case PT_CUSTOMER :
+ return ($full ?$payment_person_types[$type] . " ":"") . get_customer_name($person_id);
+ case PT_SUPPLIER :
+ return ($full ? $payment_person_types[$type] . " ":"") . get_supplier_name($person_id);
+ default :
+ //DisplayDBerror("Invalid type sent to person_name");
+ //return;
+ return '';
}
+}
- function name($index)
+function payment_person_has_items($type) {
+ switch ($type)
{
- global $wo_types_array;
- return $wo_types_array[$index]['name'];
+ case PT_MISC :
+ return true;
+ case PT_QUICKENTRY :
+ return db_has_quick_entries();
+ case PT_WORKORDER : // 070305 changed to open workorders JH
+ return db_has_open_workorders();
+ case PT_CUSTOMER :
+ return db_has_customers();
+ case PT_SUPPLIER :
+ return db_has_suppliers();
+ default :
+ display_db_error("Invalid type sent to has_items", "");
+ return false;
}
}
+//----------------------------------------------------------------------------------
+
+define('WO_ASSEMBLY', 0);
+define('WO_UNASSEMBLY', 1);
+define('WO_ADVANCED', 2);
+
+$wo_types_array = array (
+ WO_ASSEMBLY => _("Assemble"),
+ WO_UNASSEMBLY => _("Unassemble"),
+ WO_ADVANCED => _("Advanced Manufacture")
+ );
+
+//----------------------------------------------------------------------------------
+
define('CL_NONE', 0); // for backward compatibility
define('CL_ASSETS', 1);
define('CL_LIABILITIES', 2);
'B' => _("Purchased"),
'D' => _("Service")
);
+
+/*
+ Special option values for various list selectors.
+*/
+define('ANY_TEXT', '');
+define('ANY_NUMERIC', -1);
+define('ALL_TEXT', '');
+define('ALL_NUMERIC', -1);
+
?>
\ No newline at end of file
exchange_variation($this->type, $this->trans_no,
$alloc_item->type, $alloc_item->type_no, $this->date_,
$alloc_item->current_allocated,
- $sup ? payment_person_types::supplier()
- : payment_person_types::customer());
+ $sup ? PT_SUPPLIER
+ : PT_CUSTOMER);
//////////////////////////////////////////////////////////////
function show_allocatable($show_totals) {
- global $table_style;
+ global $table_style, $systypes_array;
$k = $counter = $total_allocated = 0;
foreach ($_SESSION['alloc']->allocs as $alloc_item)
{
alt_table_row_color($k);
- label_cell(systypes::name($alloc_item->type));
+ label_cell($systypes_array[$alloc_item->type]);
label_cell(get_trans_view_str($alloc_item->type, $alloc_item->type_no));
label_cell($alloc_item->date_, "align=right");
label_cell($alloc_item->due_date, "align=right");
function check_allocations()
{
+ global $SysPrefs;
+
$total_allocated = 0;
for ($counter = 0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++)
if ($_SESSION['alloc']->type == 21 || $_SESSION['alloc']->type == 22)
$amount = -$amount;
- if ($total_allocated - ($amount + input_num('discount')) > sys_prefs::allocation_settled_allowance())
+ if ($total_allocated - ($amount + input_num('discount')) > $SysPrefs->allocation_settled_allowance())
{
display_error(_("These allocations cannot be processed because the amount allocated is more than the total amount left to allocate."));
return false;
function check_qoh($location, $date_, $reverse)
{
- if (!sys_prefs::allow_negative_stock())
+ global $SysPrefs;
+
+ if (!$SysPrefs->allow_negative_stock())
{
if (has_stock_holding($this->mb_flag))
{
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
-include_once($path_to_root . "/includes/reserved.inc");
+//include_once($path_to_root . "/includes/reserved.inc");
function set_global_supplier($supplier_id)
{
function get_global_supplier($return_all=true)
{
if (!isset($_SESSION['wa_global_supplier_id']) ||
- ($return_all == false && $_SESSION['wa_global_supplier_id'] == reserved_words::get_all()))
+ ($return_all == false && $_SESSION['wa_global_supplier_id'] == ALL_TEXT))
return "";
return $_SESSION['wa_global_supplier_id'];
}
function get_global_stock_item($return_all=true)
{
if (!isset($_SESSION['wa_global_stock_id']) ||
- ($return_all == false && $_SESSION['wa_global_stock_id'] == reserved_words::get_all()))
+ ($return_all == false && $_SESSION['wa_global_stock_id'] == ALL_TEXT))
return "";
return $_SESSION['wa_global_stock_id'];
}
function get_global_customer($return_all=true)
{
if (!isset($_SESSION['wa_global_customer_id']) ||
- ($return_all == false && $_SESSION['wa_global_customer_id'] == reserved_words::get_all()))
+ ($return_all == false && $_SESSION['wa_global_customer_id'] == ALL_TEXT))
return "";
return $_SESSION['wa_global_customer_id'];
}
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
include_once($path_to_root . "/includes/banking.inc");
-include_once($path_to_root . "/includes/reserved.inc");
include_once($path_to_root . "/includes/types.inc");
include_once($path_to_root . "/includes/current_user.inc");
$_select_button = "<input %s type='submit' class='combo_select' style='border:0;background:url($path_to_root/themes/"
."%s/images/button_ok.png) no-repeat;%s' aspect='fallback' name='%s' value=' ' title='"._("Select")."'> ";
-$all_items = reserved_words::get_all();
+$all_items = ALL_TEXT;
//----------------------------------------------------------------------------
// Universal sql combo generator
return combo_input($name, $selected_id, $sql, 'supplier_id', 'supp_name',
array(
'format' => '_format_add_curr',
+ 'order' => array('supp_ref'),
'search_box' => $mode!=0,
'type' => 1,
'spec_option' => $spec_option === true ? _("All Suppliers") : $spec_option,
return combo_input($name, $selected_id, $sql, 'debtor_no', 'name',
array(
'format' => '_format_add_curr',
+ 'order' => array('debtor_ref'),
'search_box' => $mode!=0,
'type' => 1,
'size' => 20,
return combo_input($name, $selected_id, $sql, 'branch_code', 'br_name',
array(
'where' => $where,
+ 'order' => array('branch_ref'),
'spec_option' => $spec_option === true ? _('All branches') : $spec_option,
'spec_id' => $all_items,
'select_submit'=> $submit_on_change,
return combo_input($name, $selected_id, $sql, 'id', 'name',
array(
'spec_option' => $none_option,
- 'spec_id' => reserved_words::get_all_numeric(),
+ 'spec_id' => ALL_NUMERIC,
'select_submit'=> $submit_on_change,
'async' => false,
) );
array(
'order' => 'id',
'spec_option' => $none_option,
- 'spec_id' => reserved_words::get_all_numeric(),
+ 'spec_id' => ALL_NUMERIC,
'select_submit'=> $submit_on_change,
'async' => false,
) );
function shippers_list($name, $selected_id=null)
{
$sql = "SELECT shipper_id, shipper_name, inactive FROM ".TB_PREF."shippers";
- combo_input($name, $selected_id, $sql, 'shipper_id', 'shipper_name', array());
+ combo_input($name, $selected_id, $sql, 'shipper_id', 'shipper_name',
+ array('order'=>array('shipper_name')));
}
function shippers_list_cells($label, $name, $selected_id=null)
function sales_persons_list($name, $selected_id=null)
{
$sql = "SELECT salesman_code, salesman_name, inactive FROM ".TB_PREF."salesman";
- combo_input($name, $selected_id, $sql, 'salesman_code', 'salesman_name', array());
+ combo_input($name, $selected_id, $sql, 'salesman_code', 'salesman_name',
+ array('order'=>array('salesman_name')));
}
function sales_persons_list_cells($label, $name, $selected_id=null)
'async' => true,
'spec_option' =>$spec_option,
'spec_id' => -1,
+ 'order'=> array('pos_name')
) );
echo "</td></tr>\n";
function bank_account_types_list($name, $selected_id=null)
{
- $types = bank_account_types::get_all();
+ global $bank_account_types;
- $items = array();
- foreach ($types as $type)
- {
- $items[$type['id']] = $type['name'];
- }
-
- return array_selector($name, $selected_id, $items );
+ return array_selector($name, $selected_id, $bank_account_types);
}
function bank_account_types_list_cells($label, $name, $selected_id=null)
//------------------------------------------------------------------------------------------------
function payment_person_types_list($name, $selected_id=null, $submit_on_change=false)
{
- $types = payment_person_types::get_all();
+ global $payment_person_types;
- $items = array();
- foreach ($types as $type)
- {
- if (payment_person_types::has_items($type['id']))
- {
- if ($type['id'] != payment_person_types::WorkOrder())
- $items[$type['id']] = $type['name'];
- }
- }
-
- return array_selector($name, $selected_id, $items,
+ return array_selector($name, $selected_id, $payment_person_types,
array( 'select_submit'=> $submit_on_change ) );
}
function wo_types_list($name, $selected_id=null)
{
- $types = wo_types::get_all();
-
- $items = array();
- foreach ($types as $type)
- $items[$type['id']] = $type['name'];
+ global $wo_types_array;
- return array_selector($name, $selected_id, $items,
+ return array_selector($name, $selected_id, $wo_types_array,
array( 'select_submit'=> true, 'async' => true ) );
}
return array_selector($name, $selected, $items,
array( 'spec_option' => $no_option,
- 'spec_id' => reserved_words::get_all_numeric()) );
+ 'spec_id' => ALL_NUMERIC) );
}
function number_list_cells($label, $name, $selected, $from, $to, $no_option=false)
$class='', $id='')
{
$viewer = "purchasing/view/";
- if ($type == systypes::po())
+ if ($type == ST_PURCHORDER)
$viewer .= "view_po.php";
elseif ($type == 20)
$viewer .= "view_supp_invoice.php";
{
$viewer = "inventory/view/";
- if ($type == systypes::inventory_adjustment())
+ if ($type == ST_INVADJUST)
$viewer .= "view_adjustment.php";
- elseif ($type == systypes::location_transfer())
+ elseif ($type == ST_LOCTRANSFER)
$viewer .= "view_transfer.php";
else
return null;
$viewer .= "wo_issue_view.php";
elseif ($type == 29)
$viewer .= "wo_production_view.php";
- elseif ($type == systypes::work_order())
+ elseif ($type == ST_WORKORDER)
$viewer .= "work_order_view.php";
else
return null;
function display_allocations($alloc_result, $total)
{
- global $table_style;
+ global $table_style, $systypes_array;
if (!$alloc_result || db_num_rows($alloc_result) == 0)
return;
alt_table_row_color($k);
- label_cell(systypes::name($alloc_row['type']));
+ label_cell($systypes_array[$alloc_row['type']]);
label_cell(get_trans_view_str($alloc_row['type'],$alloc_row['trans_no']));
label_cell(sql2date($alloc_row['tran_date']));
$alloc_row['Total'] = round2($alloc_row['Total'], user_price_dec());
{
switch ($person_type)
{
- case payment_person_types::customer() :
+ case PT_CUSTOMER :
$alloc_result = get_allocatable_to_cust_transactions($person_id, $type_no, $type);
display_allocations($alloc_result, $total);
return;
- case payment_person_types::supplier() :
+ case PT_SUPPLIER :
$alloc_result = get_allocatable_to_supp_transactions($person_id, $type_no, $type);
display_allocations($alloc_result, $total);
return;