}
</script>";
add_js_file('login.js');
- // Display demo user name and password within login form if "$allow_demo_mode" is true
- if ($allow_demo_mode == true)
+ // Display demo user name and password within login form if allow_demo_mode option is true
+ if ($SysPrefs->allow_demo_mode == true)
{
$demo_text = _("Login as user: demouser and password: password");
}
else
{
$demo_text = _("Please login here");
- if (@$allow_password_reset) {
+ if (@$SysPrefs->allow_password_reset) {
$demo_text .= " "._("or")." <a href='$path_to_root/index.php?reset=1'>"._("request new password")."</a>";
}
}
$js .= "<script>setTimeout(function() {
document.getElementsByName('SubmitUser')[0].disabled=0;
- document.getElementById('log_msg').innerHTML='$demo_text'}, 1000*$login_delay);</script>";
+ document.getElementById('log_msg').innerHTML='$demo_text'}, 1000*".$SysPrefs->login_delay.");</script>";
$demo_text = $blocked_msg;
}
flush_dir(user_js_cache());
$login_timeout = $_SESSION["wa_current_user"]->last_act;
- $title = $login_timeout ? _('Authorization timeout') : $app_title." ".$version." - "._("Login");
+ $title = $login_timeout ? _('Authorization timeout') : $SysPrefs->app_title." ".$version." - "._("Login");
$encoding = isset($_SESSION['language']->encoding) ? $_SESSION['language']->encoding : "iso-8859-1";
$rtl = isset($_SESSION['language']->dir) ? $_SESSION['language']->dir : "ltr";
$onload = !$login_timeout ? "onload='defaultCompany()'" : "";
start_row();
echo "<td align='center' colspan=2>";
if (!$login_timeout) { // FA logo
- echo "<a target='_blank' href='$power_url'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>";
+ echo "<a target='_blank' href='".$SysPrefs->power_url."'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>";
} else {
echo "<font size=5>"._('Authorization timeout')."</font>";
}
echo "<input type='hidden' id=ui_mode name='ui_mode' value='".$_SESSION["wa_current_user"]->ui_mode."' />\n";
if (!$login_timeout)
- table_section_title(_("Version")." $version Build $build_version - "._("Login"));
- $value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($allow_demo_mode ? "demouser":"");
+ table_section_title(_("Version")." $version Build ".$SysPrefs->build_version." - "._("Login"));
+ $value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($SysPrefs->allow_demo_mode ? "demouser":"");
text_row(_("User name"), "user_name_entry_field", $value, 20, 30);
- $password = $allow_demo_mode ? "password":"";
+ $password = $SysPrefs->allow_demo_mode ? "password":"";
password_row(_("Password:"), 'password', $password);
$coy = $_SESSION['wa_current_user']->company;
else
$coy = $def_coy;
- if (!@$text_company_selection) {
+ if (!@$SysPrefs->text_company_selection) {
echo "<tr><td>"._("Company")."</td><td><select name='company_login_name'>\n";
for ($i = 0; $i < count($db_connections); $i++)
echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>";
echo "</tr></table>\n";
echo "<table class='footer'>\n";
echo "<tr>\n";
- echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$app_title $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n";
+ echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->app_title." $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n";
echo "</tr>\n";
echo "<tr>\n";
- echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$power_by</a></td>\n";
+ echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->power_by."</a></td>\n";
echo "</tr>\n";
echo "</table><br><br>\n";
echo "</body></html>\n";
<td><div align='center'><font size=2>";
echo _("Thank you for using") . " ";
-echo "<strong>$app_title $version</strong>";
+echo "<strong>".$SysPrefs->app_title." $version</strong>";
echo "</font></div></td>
</tr>
$login_timeout = $_SESSION["wa_current_user"]->last_act;
- $title = $app_title." ".$version." - "._("Password reset");
+ $title = $SysPrefs->app_title." ".$version." - "._("Password reset");
$encoding = isset($_SESSION['language']->encoding) ? $_SESSION['language']->encoding : "iso-8859-1";
$rtl = isset($_SESSION['language']->dir) ? $_SESSION['language']->dir : "ltr";
$onload = !$login_timeout ? "onload='defaultCompany()'" : "";
start_table(false, "class='login'");
start_row();
echo "<td align='center' colspan=2>";
- echo "<a target='_blank' href='$power_url'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>";
+ echo "<a target='_blank' href='".$SysPrefs->power_url."'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>";
echo "</td>\n";
end_row();
echo "<input type='hidden' id=ui_mode name='ui_mode' value='".$_SESSION["wa_current_user"]->ui_mode."' />\n";
- table_section_title(_("Version")." $version Build $build_version - "._("Password reset"));
+ table_section_title(_("Version")." $version Build ".$SysPrefs->build_version." - "._("Password reset"));
text_row(_("Email"), "email_entry_field", "", 20, 30);
$coy = $_SESSION['wa_current_user']->company;
else
$coy = $def_coy;
- if (!@$text_company_selection) {
+ if (!@$SysPrefs->text_company_selection) {
echo "<tr><td>"._("Company")."</td><td><select name='company_login_name'>\n";
for ($i = 0; $i < count($db_connections); $i++)
echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>";
echo "</tr></table>\n";
echo "<table class='footer'>\n";
echo "<tr>\n";
- echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$app_title $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n";
+ echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->app_title." $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n";
echo "</tr>\n";
echo "<tr>\n";
- echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$power_by</a></td>\n";
+ echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->power_by."</a></td>\n";
echo "</tr>\n";
echo "</table><br><br>\n";
echo "</body></html>\n";
}
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
page(_($help_context = "Attach Documents"), false, false, "", $js);
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/admin/db/maintenance_db.inc");
+define("BACKUP_PATH", $SysPrefs->comp_path.'/'.user_company()."/backup/");
+
if (get_post('view')) {
if (!get_post('backups')) {
display_error(_('Select backup file first.'));
function generate_backup($conn, $ext='no', $comm='')
{
- $filename = db_backup($conn, $ext, $comm);
+ $filename = db_backup($conn, $ext, $comm, BACKUP_PATH);
if ($filename)
display_notification(_("Backup successfully generated."). ' '
. _("Filename") . ": " . $filename);
if (can_process())
{
- if ($allow_demo_mode) {
+ if ($SysPrefs->allow_demo_mode) {
display_warning(_("Password cannot be changed in demo mode."));
} else {
update_user_password($_SESSION["wa_current_user"]->user,
display_error(_('Only jpg and png files are supported - a file extension of .jpg or .png is expected'));
$input_error = 1;
}
- elseif ( $_FILES['pic']['size'] > ($max_image_size * 1024))
+ elseif ( $_FILES['pic']['size'] > ($SysPrefs->max_image_size * 1024))
{ //File Size Check
- display_error(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $max_image_size);
+ display_error(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $SysPrefs->max_image_size);
$input_error = 1;
}
elseif ( $_FILES['pic']['type'] == "text/plain" )
if (!isset($_SESSION['SysPrefs']->prefs)) { // cached preferences
- $_SESSION['SysPrefs'] = new sys_prefs();
+// $_SESSION['SysPrefs'] = new sys_prefs();
$sql = "SELECT name, value FROM ".TB_PREF."sys_prefs";
$result = @db_query($sql); // supress errors before 2.3 db structure upgrade
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function get_current_fiscalyear()
{
- global $path_to_root;
- include_once($path_to_root . "/admin/db/company_db.inc");
$year = get_company_pref('f_year');
$sql = "SELECT * FROM ".TB_PREF."fiscal_year WHERE id=".db_escape($year);
*/
function db_import($filename, $connection, $force=true, $init=true, $protect=false, $return_errors=false)
{
- global $db, $go_debug, $sql_trail;
+ global $db, $SysPrefs;
- $sql_trail = false;
+ $trail = $SysPrefs->sql_trail;
+ $SysPrefs->sql_trail = false;
$allowed_commands = array(
"create" => 'table_queries',
/*/
if ($return_errors)
{ // prevent errors display
- $save_debug = $go_debug;
- $go_debug = 0;
+ $save_debug = $SysPrefs->go_debug;
+ $SysPrefs->go_debug = 0;
}
// execute drop tables if exists queries
if (is_array($drop_queries))
}
if ($return_errors)
- $go_debug = $save_debug;
+ $SysPrefs->go_debug = $save_debug;
+
+ $SysPrefs->sql_trail = $trail;
db_query("SET foreign_key_checks=1");
if ($delimiter != ';') db_query("delimiter ;"); // just for any case
return explode("\n", $file_data);
}
-function db_backup($conn, $ext='no', $comm='', $path=null)
+function db_backup($conn, $ext='no', $comm='', $path='')
{
if ($conn['tbpref'] != "")
$filename = $conn['dbname'] . "_" . $conn['tbpref'] . date("Ymd_Hi") . ".sql";
else
$filename = $conn['dbname'] . "_" . date("Ymd_Hi") . ".sql";
- if (!isset($path))
- $path = BACKUP_PATH;
-
return db_export($conn, $path . clean_file_name($filename), $ext, $comm);
}
//
function db_export($conn, $filename, $zip='no', $comment='')
{
- global $app_title, $version, $power_url, $path_to_root;
+ global $SysPrefs, $version;
$error = false;
// set max string size before writing to file
//create comment
$out="# MySQL dump of database '".$conn["dbname"]."' on host '".$conn["host"]."'\n";
$out.="# Backup Date and Time: ".date("Y-m-d H:i")."\n";
- $out.="# Built by " . $app_title . " " . $version ."\n";
- $out.="# ".$power_url."\n";
+ $out.="# Built by " . $SysPrefs->app_title . " " . $version ."\n";
+ $out.="# ".$SysPrefs->power_url."\n";
$out.="# Company: ". @html_entity_decode($company, ENT_QUOTES, $_SESSION['language']->encoding)."\n";
$out.="# User: ".$_SESSION["wa_current_user"]->name."\n\n";
$out.="# Compatibility: ".get_company_pref('version_id')."\n\n";
// returns backup file name if name has changed (zip), else TRUE. If saving failed, return value is FALSE
function save_to_file($path, $zip, $fileData)
{
- global $path_to_root;
$backupfile = basename($path);
//-----------------------------------------------------------------------------------------------
function show_users_online()
{
- global $show_users_online, $db, $GetText;
-
- if (!isset($show_users_online) || $show_users_online == 0 || !defined('TB_PREF') ||
+ global $db, $GetText, $SysPrefs;
+
+ if (!isset($SysPrefs->show_users_online) || $SysPrefs->show_users_online == 0 || !defined('TB_PREF') ||
!isset($GetText) || !isset($db))
return "";
$result = db_query("SHOW TABLES LIKE '".TB_PREF."useronline'");
flush_dir(company_path().'/js_cache');
- if ($chg_theme && $allow_demo_mode)
+ if ($chg_theme && $SysPrefs->allow_demo_mode)
$_SESSION["wa_current_user"]->prefs->theme = $_POST['theme'];
if ($chg_theme || $chg_lang || $chg_date_format || $chg_date_sep)
meta_forward($_SERVER['PHP_SELF']);
- if ($allow_demo_mode)
+ if ($SysPrefs->allow_demo_mode)
display_warning(_("Display settings have been updated. Keep in mind that changed settings are restored on every login in demo mode."));
else
display_notification_centered(_("Display settings have been updated."));
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root."/includes/packages.inc");
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
$js = get_js_open_window(900, 500);
}
page(_($help_context = "Install Charts of Accounts"), false, false, '', $js);
include_once($path_to_root . "/admin/db/maintenance_db.inc");
include_once($path_to_root . "/includes/ui.inc");
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js = get_js_open_window(900, 500);
page(_($help_context = "Install/Update Languages"), false, false, "", $js);
//
function display_languages()
{
- global $table_style, $installed_languages, $dflt_lang, $GetText;
+ global $installed_languages, $dflt_lang, $GetText;
$th = array(_("Language"), _("Name"), _("Encoding"), _("Right To Left"),
_("Installed"), _("Available"), _("Default"), "", "");
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root."/includes/packages.inc");
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
$js = get_js_open_window(900, 500);
}
page(_($help_context = "Install/Activate extensions"));
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root."/includes/packages.inc");
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
$js = get_js_open_window(900, 500);
}
page(_($help_context = "Install Themes"), false, false, '', $js);
//
// Apply one differential data set.
//
-function upgrade_step($index, $company, $conn)
+function upgrade_step($inst, $company, $conn)
{
- global $path_to_root, $installers;
+ global $path_to_root;
- $inst = $installers[$index];
$pref = $conn['tbpref'];
$ret = true;
// apply all upgrade data
foreach ($installers as $i => $inst)
{
- $ret = upgrade_step($i, $comp, $conn);
+
+ $ret = upgrade_step($installers[$index], $i, $comp, $conn);
if (!$ret)
{
display_error(
// Returns array of defined reports
//
function get_reports() {
- global $path_to_root, $go_debug;
+ global $path_to_root, $SysPrefs;
-if ($go_debug || !isset($_SESSION['reports'])) {
+if ($SysPrefs->go_debug || !isset($_SESSION['reports'])) {
// to save time, store in session.
$paths = array (
$path_to_root.'/reporting/',
update_printer_profile($_POST['profile_id'], $prof);
if ($selected_id == '') {
display_notification_centered(_('New printing profile has been created'));
- clear_form();
+ clear_form($selected_id);
} else {
display_notification_centered(_('Printing profile has been updated'));
}
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
page(_($help_context = "View or Print Transactions"), false, false, "", $js);
$js = "";
if (user_use_date_picker())
$js .= get_js_date_picker();
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
page(_($help_context = "Void a Transaction"), false, false, "", $js);
if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root']))
die("Restricted access");
- if (!ini_get('date.timezone'))
- ini_set('date.timezone', 'Europe/Berlin');
+ // Server time zone. If leaved empty the time zone set in php init file will be used.
+ // If timezone is not set in this file nor in php.ini, Europe/Berlin' is used as defualt.
+ $server_time_zone = '';
// Log file for error/warning messages. Should be set to any location
// writable by www server. When set to empty string logging is switched off.
// Special value 'syslog' can be used for system logger usage (see php manual).
//$error_logfile = '';
- $error_logfile = dirname(__FILE__).'/tmp/errors.log';
+ $error_logfile = $path_to_root.'/tmp/errors.log';
$debug = 1; // show sql on database errors
$show_sql = 0; // show all sql queries in page footer for debugging purposes
//
$sql_trail = 0; // save all sql queries in sql_trail
$select_trail = 0; // track also SELECT queries
- if ($go_debug > 0)
- {
- error_reporting(-1);
- ini_set("display_errors", "On");
- }
- else
- {
- error_reporting(E_USER_WARNING|E_USER_ERROR|E_USER_NOTICE);
- // ini_alter("error_reporting","E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR|E_PARSE");
- ini_set("display_errors", "On");
- }
-
- if($error_logfile != '') {
- ini_set("error_log", $error_logfile);
- ini_set("ignore_repeated_errors", "On");
- ini_set("log_errors", "On");
- }
+
// Main Title
$app_title = "FrontAccounting";
/* UTF-8 font for Business Graphics. Copy it to /reporting/fonts/ folder. */
$UTF8_fontfile = "FreeSans.ttf";
-/*
- Before upgrade from pre-2.2 FA you have to move here your customized
- security roles definitions. If you have used standard roles, you
- can simply uncomment following two arrays. After upgrade both arrays need
- to be deleted or commented out. You may wish to change user roles to
- new better defined in Users Setup. Old not used roles can be set inactive
- or deleted.
-*/
-/* Standard FA2.1 Security Group definitions
-
- $security_headings = array(
- _("Inquiries"),
- _("Accountant"),
- _("System Administrator"),
- );
-
- $security_groups = array(
- array(1,2),
- array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,16),
- array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,20),
- );
-*/
-
- //MySQL Backup and Restore Settings
-
-if(isset($_SESSION["wa_current_user"])) {
- define("BACKUP_PATH", $comp_path.'/'.user_company()."/backup/");
-}
- // static js files path
- $js_path = $path_to_root.'/js/';
- // standard external js scripts included in all files
- $js_static = array('JsHttpRequest.js', 'behaviour.js', 'utils.js', 'inserts.js');
- // additional js source included in header
- $js_lib = $js_userlib = array();
-
/*
Display a dropdown select box for choosing Company to login if false.
Show a blank editbox only if true where the Company NickName
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
get_company_pref($prefs = null)
get_company_prefs()
maintenance_db.inc:
- db_backup($conn, $ext='no', $comm='', $path=null)
+ db_backup($conn, $ext='no', $comm='', $path='')
db_export($conn, $filename, $zip='no', $comment='', $no_default=false)
save_to_file($path, $zip, $fileData)
tax_types_db.inc:
Before 2.4:
db_backup($conn, $ext='no', $comm='', $tbpref = TB_PREF)
Now:
- db_backup($conn, $ext='no', $comm='', $path=null)
+ db_backup($conn, $ext='no', $comm='', $path='')
Description:
$tbpref parameter has been removed. Calls should be done after switch to selected company database with
set_global_connection($company).
include_once($path_to_root . "/includes/banking.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/gl/includes/gl_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/admin/db/attachments_db.inc");
$js = '';
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/taxes/db/tax_types_db.inc");
$js = '';
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
//
function retrieve_exrate($curr_b, $date)
{
- global $xr_providers, $dflt_xr_provider;
- $xchg_rate_provider = ((isset($xr_providers) && isset($dflt_xr_provider)) ? $xr_providers[$dflt_xr_provider] : 'ECB');
-
+ global $SysPrefs;
+
+ $xchg_rate_provider = ((isset($SysPrefs->xr_providers) && isset($SysPrefs->dflt_xr_provider))
+ ? $SysPrefs->xr_providers[$SysPrefs->dflt_xr_provider] : 'ECB');
+
$rate = hook_retrieve_exrate($curr_b, $date);
if (is_numeric($rate))
return $rate;
function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension2, $memo_,
$amount, $currency=null, $person_type_id=null, $person_id=null, $err_msg="", $rate=0)
{
- global $use_audit_trail;
+ global $SysPrefs;
$date = date2sql($date_);
if ($currency != null)
$dimension = 0;
if ($dimension2 == null || $dimension2 < 0)
$dimension2 = 0;
- if (isset($use_audit_trail) && $use_audit_trail)
+ if (isset($SysPrefs->use_audit_trail) && $SysPrefs->use_audit_trail)
{
if ($memo_ == "" || $memo_ == null)
$memo_ = $_SESSION["wa_current_user"]->username;
$account=null, $dimension=0, $dimension2=0, $filter_type=null,
$amount_min=null, $amount_max=null)
{
- global $show_voided_gl_trans;
+ global $SysPrefs;
$from = date2sql($from_date);
$to = date2sql($to_date);
AND ISNULL(v.date_)
AND tran_date >= '$from'
AND tran_date <= '$to'";
- if (isset($show_voided_gl_trans) && $show_voided_gl_trans == 0)
+ if (isset($SysPrefs->show_voided_gl_trans) && $SysPrefs->show_voided_gl_trans == 0)
$sql .= " AND ".TB_PREF."gl_trans.amount <> 0";
if ($trans_no > 0)
$sql .= " AND ".TB_PREF."gl_trans.type_no LIKE ".db_escape('%'.$trans_no);
//----------------------------------------------------------------------------------------------------
-function display_type ($type, $typename, $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root)
+function display_type ($type, $typename, $from, $to, $convert, $dimension, $dimension2, $drilldown)
{
- global $levelptr, $k;
+ global $path_to_root, $levelptr, $k;
$acctstotal = 0;
$typestotal = 0;
while ($accounttype=db_fetch($result))
{
$typestotal += display_type($accounttype["id"], $accounttype["name"], $from, $to,
- $convert, $dimension, $dimension2, $drilldown, $path_to_root);
+ $convert, $dimension, $dimension2, $drilldown);
}
//Display Type Summary if total is != 0
while ($accounttype=db_fetch($typeresult))
{
$TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to,
- $convert, $dimension, $dimension2, $drilldown, $path_to_root);
+ $convert, $dimension, $dimension2, $drilldown);
//Print Summary
if ($TypeTotal != 0 )
{
table_section_title($_POST["AccGrp"]. " " . get_account_type_name($_POST["AccGrp"]));
$classclose = display_type($accounttype["id"], $accounttype["name"], $from, $to,
- $convert, $dimension, $dimension2, $drilldown, $path_to_root);
+ $convert, $dimension, $dimension2, $drilldown);
}
end_table(1); // outer table
include_once($path_to_root . "/includes/banking.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
$js = '';
set_focus('account');
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
function display_trial_balance($type, $typename)
{
- global $path_to_root, $clear_trial_balance_opening,
+ global $path_to_root, $SysPrefs,
$k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;
$printtitle = 0; //Flag for printing type name
// FA doesn't really clear the closed year, therefore the brought forward balance includes all the transactions from the past, even though the balance is null.
// If we want to remove the balanced part for the past years, this option removes the common part from from the prev and tot figures.
- if (@$clear_trial_balance_opening)
+ if (@$SysPrefs->clear_trial_balance_opening)
{
$open = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $begin, false, true);
$offset = min($open['debit'], $open['credit']);
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
date_cells(_("From:"), 'TransFromDate');
date_cells(_("To:"), 'TransToDate');
- //Compare Combo
- global $sel;
$sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
echo "<td>"._("Compare to").":</td>\n";
echo "<td>";
end_table();
hidden('AccGrp');
+
+ return $sel[get_post('Compare')];
}
//----------------------------------------------------------------------------------------------------
-function display_profit_and_loss()
+function display_profit_and_loss($compare)
{
- global $path_to_root, $sel;
+ global $path_to_root;
if (!isset($_POST['Dimension']))
$_POST['Dimension'] = 0;
$from = $_POST['TransFromDate'];
$to = $_POST['TransToDate'];
- $compare = $_POST['Compare'];
if (isset($_POST["AccGrp"]) && (strlen($_POST['AccGrp']) > 0))
$drilldown = 1; // Deeper Level
$tableheader = "<tr>
<td class='tableheader'>" . _("Group/Account Name") . "</td>
<td class='tableheader'>" . _("Period") . "</td>
- <td class='tableheader'>" . $sel[$compare] . "</td>
+ <td class='tableheader'>" . $compare . "</td>
<td class='tableheader'>" . _("Achieved %") . "</td>
</tr>";
start_form();
-inquiry_controls();
+$sel = inquiry_controls();
-display_profit_and_loss();
+display_profit_and_loss($sel);
end_form();
$js = '';
set_focus('account');
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
//---------------------------------------------------------------------------------------------
function check_data()
{
- global $Refs, $allow_gl_reopen;
+ global $Refs, $SysPrefs;
if (!is_date($_POST['date']) || date1_greater_date2($_POST['date'], Today()))
{
}
if (date1_greater_date2(sql2date(get_company_pref('gl_closing_date')), $_POST['date']))
{
- if (!$allow_gl_reopen) {
+ if (!$SysPrefs->allow_gl_reopen) {
display_error(_("The entered date is earlier than date already selected as closing date."));
set_focus('date');
return false;
function display_rate_edit()
{
- global $selected_id, $Ajax, $xr_providers, $dflt_xr_provider;
- $xchg_rate_provider = ((isset($xr_providers) && isset($dflt_xr_provider)) ? $xr_providers[$dflt_xr_provider] : 'ECB');
+ global $selected_id, $Ajax, $SysPrefs;
+ $xchg_rate_provider = ((isset($SysPrefs->xr_providers) && isset($SysPrefs->dflt_xr_provider))
+ ? $SysPrefs->xr_providers[$SysPrefs->dflt_xr_provider] : 'ECB');
start_table(TABLESTYLE2);
if ($selected_id != "")
function can_process()
{
- global $use_oldstyle_convert;
+ global $SysPrefs;
if (strlen(trim($_POST['id'])) == 0)
{
set_focus('name');
return false;
}
- if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
+ if (isset($SysPrefs->use_oldstyle_convert) && $SysPrefs->use_oldstyle_convert == 1)
$_POST['Balance'] = check_value('Balance');
return true;
}
start_form();
start_table(TABLESTYLE);
$th = array(_("Class ID"), _("Class Name"), _("Class Type"), "", "");
-if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
+if (isset($SysPrefs->use_oldstyle_convert) && $SysPrefs->use_oldstyle_convert == 1)
$th[2] = _("Balance Sheet");
inactive_control_column($th);
table_header($th);
label_cell($myrow["cid"]);
label_cell($myrow['class_name']);
- if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
+ if (isset($SysPrefs->use_oldstyle_convert) && $SysPrefs->use_oldstyle_convert == 1)
{
$myrow['ctype'] = ($myrow["ctype"] >= CL_ASSETS && $myrow["ctype"] < CL_INCOME ? 1 : 0);
label_cell(($myrow['ctype'] == 1 ? _("Yes") : _("No")));
$_POST['id'] = $myrow["cid"];
$_POST['name'] = $myrow["class_name"];
- if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
+ if (isset($SysPrefs->use_oldstyle_convert) && $SysPrefs->use_oldstyle_convert == 1)
$_POST['ctype'] = ($myrow["ctype"] >= CL_ASSETS && $myrow["ctype"] < CL_INCOME ? 1 : 0);
else
$_POST['ctype'] = $myrow["ctype"];
text_row_ex(_("Class Name:"), 'name', 50, 60);
-if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
+if (isset($SysPrefs->use_oldstyle_convert) && $SysPrefs->use_oldstyle_convert == 1)
check_row(_("Balance Sheet"), 'ctype', null);
else
class_types_list_row(_("Class Type:"), 'ctype', null);
'SA_GLREP' => array(SS_GL_A|4, _("GL reports and inquiries")),
);
-if (!@$allow_gl_reopen)
+if (!@$SysPrefs->allow_gl_reopen)
unset($security_areas['SA_GLREOPEN']);
/*
This function should be called whenever we want to extend core access level system
function login($company, $loginname, $password)
{
- global $security_areas, $security_groups, $security_headings, $path_to_root, $dflt_lang, $login_delay;
+ global $security_areas, $security_groups, $security_headings, $path_to_root, $dflt_lang, $SysPrefs;
$this->set_company($company);
$this->logged = false;
if (!isset($Auth_Result)) // if not used: standard method
$Auth_Result = get_user_auth($loginname, md5($password));
- if ($login_delay > 0)
+ if ($SysPrefs->login_delay > 0)
write_login_filelog($loginname, $Auth_Result);
if ($Auth_Result)
}
function reset_password($company, $email) {
- global $app_title;
+ global $SysPrefs;
$this->set_company($company);
$this->logged = false;
update_user_password($myrow['id'], $myrow['user_id'], $hash);
- mail($myrow['email'], _("New password for")." ".$app_title, $password);
+ mail($myrow['email'], _("New password for")." ".$SysPrefs->app_title, $password);
return true;
}
function hide_inaccessible_menu_items()
{
- global $hide_inaccessible_menu_items;
+ global $SysPrefs;
- if (!isset($hide_inaccessible_menu_items) || $hide_inaccessible_menu_items == 0)
+ if (!isset($SysPrefs->hide_inaccessible_menu_items) || $SysPrefs->hide_inaccessible_menu_items == 0)
{
return false;
}
function update_prefs($prefs)
{
- global $allow_demo_mode;
-
- if(!$allow_demo_mode) {
+ global $SysPrefs;
+
+ if (!$SysPrefs->allow_demo_mode) {
update_user_prefs($this->user, $prefs);
}
*/
function number_format2($number, $decimals=0)
{
- global $thoseps, $decseps;
- $tsep = $thoseps[$_SESSION["wa_current_user"]->prefs->tho_sep()];
- $dsep = $decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()];
+ global $SysPrefs;
+ $tsep = $SysPrefs->thoseps[$_SESSION["wa_current_user"]->prefs->tho_sep()];
+ $dsep = $SysPrefs->decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()];
//return number_format($number, $decimals, $dsep, $tsep);
if($decimals==='max')
$dec = 15 - floor(log10(abs($number)));
}
function user_numeric($input) {
- global $decseps, $thoseps;
+ global $SysPrefs;
$num = trim($input);
- $sep = $thoseps[user_tho_sep()];
+ $sep = $SysPrefs->thoseps[user_tho_sep()];
if ($sep!='')
$num = str_replace( $sep, '', $num);
- $sep = $decseps[user_dec_sep()];
+ $sep = $SysPrefs->decseps[user_dec_sep()];
if ($sep!='.')
$num = str_replace( $sep, '.', $num);
}
function add_user_js_data() {
- global $path_to_root, $thoseps, $decseps, $date_system, $dateseps;
+ global $path_to_root, $SysPrefs;
- $ts = $thoseps[user_tho_sep()];
- $ds = $decseps[user_dec_sep()];
+ $ts = $SysPrefs->thoseps[user_tho_sep()];
+ $ds = $SysPrefs->decseps[user_dec_sep()];
$js = "\n"
. "var user = {\n"
. "theme: '". $path_to_root . '/themes/'. user_theme().'/'."',\n"
. "loadtxt: '"._('Requesting data...')."',\n"
. "date: '".Today()."',\n" // server date
- . "datesys: ".$date_system.",\n"
+ . "datesys: ".$SysPrefs->date_system.",\n"
. "datefmt: ".user_date_format().",\n"
- . "datesep: '".$dateseps[user_date_sep()]."',\n"
+ . "datesep: '".$SysPrefs->dateseps[user_date_sep()]."',\n"
. "ts: '$ts',\n"
. "ds: '$ds',\n"
. "pdec : " . user_price_dec() . "}\n";
*/
function company_path($comp=null)
{
- global $path_to_root, $comp_path;
+ global $path_to_root, $SysPrefs;
+
+ $comp_path = $SysPrefs->comp_path;
+
if (!isset($comp))
$comp = user_company();
function __date($year, $month, $day)
{
- global $dateseps, $tmonths;
+ global $SysPrefs, $tmonths;
$how = user_date_format();
- $sep = $dateseps[user_date_sep()];
+ $sep = $SysPrefs->dateseps[user_date_sep()];
$day = (int)$day;
$month = (int)$month;
if ($how < 3)
function is_date($date_)
{
- global $dateseps;
+ global $SysPrefs;
if ($date_ == null || $date_ == "")
return 0;
$how = user_date_format();
- $sep = $dateseps[user_date_sep()];
+ $sep = $SysPrefs->dateseps[user_date_sep()];
$date_ = trim($date_);
$date = str_replace($sep, "", $date_);
if (is_long((int)$day) && is_long((int)$month) && is_long((int)$year))
{
- global $date_system;
- if ($date_system == 1)
+ global $SysPrefs;
+ if ($SysPrefs->date_system == 1)
list($year, $month, $day) = jalali_to_gregorian($year, $month, $day);
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($year, $month, $day) = islamic_to_gregorian($year, $month, $day);
if (checkdate((int)$month, (int)$day, (int)$year))
{
function Today()
{
- global $date_system;
+ global $SysPrefs;
$year = date("Y");
$month = date("n");
$day = date("j");
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
list($year, $month, $day) = gregorian_to_jalali($year, $month, $day);
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($year, $month, $day) = gregorian_to_islamic($year, $month, $day);
return __date($year, $month, $day);
}
function begin_month($date)
{
- global $date_system;
+ global $SysPrefs;
list($day, $month, $year) = explode_date_to_dmy($date);
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
list($year, $month, $day) = gregorian_to_jalali($year, $month, $day);
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($year, $month, $day) = gregorian_to_islamic($year, $month, $day);
return __date($year, $month, 1);
}
function days_in_month($month, $year)
{
- global $date_system;
+ global $SysPrefs;
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
{
$days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, ((((((($year - (($year > 0) ? 474 : 473)) % 2820) + 474) + 38) * 682) % 2816) < 682 ? 30 : 29));
}
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
{
$days_in_month = array(30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, (((((11 * $year) + 14) % 30) < 11) ? 30 : 29));
}
function end_month($date)
{
- global $date_system;
+ global $SysPrefs;
list($day, $month, $year) = explode_date_to_dmy($date);
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
{
list($year, $month, $day) = gregorian_to_jalali($year, $month, $day);
}
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
{
list($year, $month, $day) = gregorian_to_islamic($year, $month, $day);
}
function add_days($date, $days) // accepts negative values as well
{
- global $date_system;
+ global $SysPrefs;
list($day, $month, $year) = explode_date_to_dmy($date);
$timet = mktime(0,0,0, $month, $day + $days, $year);
- if ($date_system == 1 || $date_system == 2)
+ if ($SysPrefs->date_system == 1 || $SysPrefs->date_system == 2)
{
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
list($year, $month, $day) = gregorian_to_jalali(date("Y", $timet), date("n", $timet), date("j", $timet));
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($year, $month, $day) = gregorian_to_islamic(date("Y", $timet), date("n", $timet), date("j", $timet));
return __date($year, $month, $day);
}
function add_months($date, $months) // accepts negative values as well
{
- global $date_system;
+ global $SysPrefs;
+
list($day, $month, $year) = explode_date_to_dmy($date);
$months += $year*12+$month;
$timet = mktime(0,0,0, $month, min($day, days_in_month($month, $year)), $year);
- if ($date_system == 1 || $date_system == 2)
+ if ($SysPrefs->date_system == 1 || $SysPrefs->date_system == 2)
{
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
list($year, $month, $day) = gregorian_to_jalali(date("Y", $timet), date("n", $timet), date("j", $timet));
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($year, $month, $day) = gregorian_to_islamic(date("Y", $timet), date("n", $timet), date("j", $timet));
return __date($year, $month, $day);
}
function add_years($date, $years) // accepts negative values as well
{
- global $date_system;
+ global $SysPrefs;
+
list($day, $month, $year) = explode_date_to_dmy($date);
$timet = Mktime(0,0,0, $month, $day, $year + $years);
- if ($date_system == 1 || $date_system == 2)
+ if ($SysPrefs->date_system == 1 || $SysPrefs->date_system == 2)
{
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
list($year, $month, $day) = gregorian_to_jalali(date("Y", $timet), date("n", $timet), date("j", $timet));
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($year, $month, $day) = gregorian_to_islamic(date("Y", $timet), date("n", $timet), date("j", $timet));
return __date($year, $month, $day);
}
function sql2date($date_)
{
- global $date_system;
+ global $SysPrefs;
//for MySQL dates are in the format YYYY-mm-dd
{ /*chop off the time stuff */
$day = substr($day, 0, 2);
}
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
list($year, $month, $day) = gregorian_to_jalali($year, $month, $day);
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($year, $month, $day) = gregorian_to_islamic($year, $month, $day);
return __date($year, $month, $day);
} // end function sql2date
function date2sql($date_)
{
- global $dateseps, $date_system, $tmonths;
+ global $SysPrefs, $tmonths;
/* takes a date in a the format specified in $DefaultDateFormat
and converts to a yyyy/mm/dd format */
$how = user_date_format();
- $sep = $dateseps[user_date_sep()];
+ $sep = $SysPrefs->dateseps[user_date_sep()];
if ($date_ == null || strlen($date_) == 0)
return "";
$month = array_search($month, $tmonths);
}
//to modify assumption in 2030
- if ($date_system == 0 || $date_system == 3)
+ if ($SysPrefs->date_system == 0 || $SysPrefs->date_system == 3)
{
if ((int)$year < 60)
{
{
return 0;
}
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
list($year, $month, $day) = jalali_to_gregorian($year, $month, $day);
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($year, $month, $day) = islamic_to_gregorian($year, $month, $day);
return sprintf("%04d-%02d-%02d", $year, $month, $day);
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
+define('DB_DUPLICATE_ERROR', 1062);
+define('SQL_MODE', ''); // STRICT_ALL_TABLES,NO_ZERO_IN_DATE ?
function set_global_connection($company=-1)
{
- global $db, $transaction_level, $path_to_root, $db_connections;
+ global $db, $path_to_root, $db_connections;
include ($path_to_root . "/config_db.php");
if ($company == -1)
$company = $_SESSION["wa_current_user"]->company;
cancel_transaction(); // cancel all aborted transactions if any
- $transaction_level = 0;
$_SESSION["wa_current_user"]->cur_con = $company;
///// This non empty sql_mode values can interphere with FA, so all is set empty during
///// our sessions.
///// We are, however, investigating the existing code to be compatible in the future.
- if (strncmp(db_get_version(), "5.6", 3) >= 0)
- db_query("SET sql_mode = ''");
+ db_query("SET sql_mode = '".SQL_MODE."'");
/////
return $db;
}
-$db_duplicate_error_code = 1062;
-
//DB wrapper functions to change only once for whole application
function db_query($sql, $err_msg=null)
{
- global $db, $show_sql, $sql_trail, $select_trail, $go_debug, $sql_queries, $Ajax,
- $db_connections, $db_last_inserted_id;
+ global $db, $SysPres, $sql_queries, $Ajax, $db_connections, $db_last_inserted_id;
// set current db prefix
$comp = isset($_SESSION["wa_current_user"]->cur_con) ? $_SESSION["wa_current_user"]->cur_con : 0;
$cur_prefix = $db_connections[$comp]['tbpref'];
$sql = str_replace(TB_PREF, $cur_prefix, $sql);
- if ($show_sql)
+ if ($SysPrefs->show_sql)
{
$Ajax->activate('footer_debug');
$sql_queries .= "<pre>$sql</pre>\n<hr>";
db_profile($sql);
- if($sql_trail) {
+ if($SysPrefs->sql_trail) {
$db_last_inserted_id = mysql_insert_id($db); // preserve in case trail insert is done
- if ($select_trail || (strstr($sql, 'SELECT') === false)) {
+ if ($SysPrefs->select_trail || (strstr($sql, 'SELECT') === false)) {
mysql_query(
"INSERT INTO ".$cur_prefix."sql_trail
(`sql`, `result`, `msg`)
}
}
- if ($err_msg != null || $go_debug) {
+ if ($err_msg != null || $SysPrefs->go_debug) {
$exit = $err_msg != null;
if (function_exists('xdebug_call_file'))
check_db_error('<br>At file '.xdebug_call_file().':'.xdebug_call_line().':<br>'.$err_msg, $sql, $exit);
function db_insert_id()
{
- global $db_last_inserted_id, $sql_trail, $db;
+ global $db_last_inserted_id, $SysPrefs, $db;
- return $sql_trail ? $db_last_inserted_id : mysql_insert_id($db);
+ return $SysPrefs->sql_trail ? $db_last_inserted_id : mysql_insert_id($db);
}
function db_num_affected_rows()
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
-define('SQL_MODE', 'STRICT_ALL_TABLES,NO_ZERO_IN_DATE');
+define('DB_DUPLICATE_ERROR', 1062);
+define('SQL_MODE', ''); // STRICT_ALL_TABLES,NO_ZERO_IN_DATE ?
+
+$db_last_inserted_id = 0;
function set_global_connection($company=-1)
{
- global $db, $transaction_level, $path_to_root, $db_connections;
+ global $db, $path_to_root, $db_connections;
include ($path_to_root . "/config_db.php");
if ($company == -1)
$company = $_SESSION["wa_current_user"]->company;
- cancel_transaction(); // cancel all aborted transactions if any
- $transaction_level = 0;
+ cancel_transaction(); // cancel all aborted transactions (if any)
$_SESSION["wa_current_user"]->cur_con = $company;
///// This non empty sql_mode values can interphere with FA, so all is set empty during
///// our sessions.
///// We are, however, investigating the existing code to be compatible in the future.
-// if (strncmp(db_get_version(), "5.6", 3) >= 0)
db_query("SET sql_mode = '".SQL_MODE."'");
/////
return $db;
}
-$db_duplicate_error_code = 1062;
-
//DB wrapper functions to change only once for whole application
function db_query($sql, $err_msg=null)
{
- global $db, $show_sql, $sql_trail, $select_trail, $go_debug, $sql_queries, $Ajax,
- $db_connections, $db_last_inserted_id;
-
+ global $db, $SysPrefs, $sql_queries, $Ajax, $db_connections, $db_last_inserted_id;
+
// set current db prefix
$comp = isset($_SESSION["wa_current_user"]->cur_con) ? $_SESSION["wa_current_user"]->cur_con : 0;
$cur_prefix = $db_connections[$comp]['tbpref'];
$sql = str_replace(TB_PREF, $cur_prefix, $sql);
- if ($show_sql)
+ if ($SysPrefs->show_sql)
{
$Ajax->activate('footer_debug');
$sql_queries .= "<pre>$sql</pre>\n<hr>";
db_profile($sql);
- if($sql_trail) {
+ if($SysPrefs->sql_trail) {
$db_last_inserted_id = mysqli_insert_id($db); // preserve in case trail insert is done
- if ($select_trail || (strstr($sql, 'SELECT') === false)) {
+ if ($SysPrefs->select_trail || (strstr($sql, 'SELECT') === false)) {
mysqli_query($db, "INSERT INTO ".$cur_prefix."sql_trail
(`sql`, `result`, `msg`)
VALUES(".db_escape($sql).",".($result ? 1 : 0).",
}
}
- if ($err_msg != null || $go_debug) {
+ if ($err_msg != null || $SysPrefs->go_debug) {
$exit = $err_msg != null;
if (function_exists('xdebug_call_file'))
check_db_error('<br>At file '.xdebug_call_file().':'.xdebug_call_line().':<br>'.$err_msg, $sql, $exit);
function db_insert_id()
{
- global $db_last_inserted_id, $sql_trail, $db;
+ global $db_last_inserted_id, $SysPrefs, $db;
- return $sql_trail ? $db_last_inserted_id : mysqli_insert_id($db);
+ return $SysPrefs->sql_trail ? $db_last_inserted_id : mysqli_insert_id($db);
}
function db_num_affected_rows()
//-------------------------------------------------------------------
// Multilevel transaction control.
//
+$transaction_level = 0;
function begin_transaction()
{
- global $transaction_level; // set in set_global_connection()
+ global $transaction_level;
if (!$transaction_level) {
db_query("BEGIN", "could not start a transaction");
if ($transaction_level) {
db_query("ROLLBACK", "could not cancel a transaction");
}
+ $transaction_level = 0;
}
//-----------------------------------------------------------------------------
//
function set_sql($sql)
{
+ global $SysPrefs;
+
if ($sql != $this->sql) {
$this->sql = $sql;
$this->ready = false;
$this->select = $parts[0];
$sql = $parts[1];
} else {
- if ($go_debug)
+ if ($SysPrefs->go_debug)
display_error("Invalid sql input for db_pager");
}
//
function _init()
{
- global $go_debug;
+ global $SysPrefs;
if ($this->ready == false ) {
$sql = $this->_sql_gen(true);
$this->max_page = $this->page_len ?
ceil($this->rec_count/$this->page_len) : 0;
- if ($go_debug) { // FIX - need column name parsing, but for now:
+ if ($SysPrefs->go_debug) { // FIX - need column name parsing, but for now:
// check if field names are set explicite in col def
// for all initially ordered columns
foreach ($this->columns as $col) {
// display in message box.
function error_handler($errno, $errstr, $file, $line) {
- global $messages, $go_debug, $SysPrefs;
+ global $messages, $SysPrefs;
// skip well known warnings we don't care about.
// Please use restrainedly to not risk loss of important messages
}
}
- $bt = $go_debug>1 ? get_backtrace(true, 1) : array();
+ $bt = $SysPrefs->go_debug>1 ? get_backtrace(true, 1) : array();
// error_reporting==0 when messages are set off with @
if ($errno & error_reporting()) {
// Formats system messages before insert them into message <div>
// FIX center is unused now
function fmt_errors($center=false) {
- global $messages, $path_to_root, $go_debug;
+ global $messages, $path_to_root, $SysPrefs;
$msg_class = array(
E_USER_ERROR => 'err_msg',
// $class = 'no_msg';
if (count($messages)) {
foreach($messages as $cnt=>$msg) {
- if ($go_debug && $msg[0]>E_USER_NOTICE)
+ if ($SysPrefs->go_debug && $msg[0]>E_USER_NOTICE)
$msg[0] = E_ERROR;
if ($msg[0]>$type) continue;
if (!in_array($msg[0], array(E_USER_NOTICE, E_USER_ERROR, E_USER_WARNING)) && $msg[2] != null)
$str .= ' '._('in file').': '.$msg[2].' '._('at line ').$msg[3];
- if ($go_debug>1 && $type!=E_USER_NOTICE && $type!=E_USER_WARNING)
+ if ($SysPrefs->go_debug>1 && $type!=E_USER_NOTICE && $type!=E_USER_WARNING)
$str .= '<br>'.$msg[4];
$content .= ($cnt ? '<hr>' : '').$str;
}
function display_db_error($msg, $sql_statement=null, $exit=true)
{
- global $db, $debug, $go_debug, $db_connections;
+ global $db, $SysPrefs, $db_connections;
$warning = $msg==null;
$db_error = db_error_no();
$str .= "error message : " . db_error_msg($db) . "<br>";
}
- if ($debug == 1)
+ if ($SysPrefs->debug == 1)
{
$cur_prefix = $db_connections[$_SESSION["wa_current_user"]->cur_con]['tbpref'];
$str .= "sql that failed was : ".str_replace(TB_PREF, $cur_prefix, $sql_statement)."<br>";
-// if ($go_debug > 1) display_backtrace();
+// if ($SysPrefs->go_debug > 1) display_backtrace();
}
$str .= "<br><br>";
- if (!$go_debug)
+ if (!$SysPrefs->go_debug)
error_log($str);
else {
if($msg)
function frindly_db_error($db_error)
{
- global $db_duplicate_error_code;
-
- if ($db_error == $db_duplicate_error_code)
- {
+ if ($db_error == DB_DUPLICATE_ERROR)
+ {
display_error(_("The entered information is a duplicate. Please go back and enter different values."));
return true;
}
function check_db_error($msg, $sql_statement, $exit_if_error=true, $rollback_if_error=true)
{
- global $db, $go_debug;
+ global $db, $SysPrefs;
$db_error = db_error_no();
if ($db_error != 0)
{
- if ($go_debug || !frindly_db_error($db_error)) {
+ if ($SysPrefs->go_debug || !frindly_db_error($db_error)) {
display_db_error($msg, $sql_statement, false);
}
end_page(); exit;
}
}
- return $db_error;
+ return $db_error;
}
include_once($path_to_root . "/includes/ui/ui_controls.inc");
$page_nested = -1;
+// static js files path
+$js_path = $path_to_root.'/js/';
+// standard external js scripts included in all files
+$js_static = array('JsHttpRequest.js', 'behaviour.js', 'utils.js', 'inserts.js');
+// additional js source included in header
+$js_lib = $js_userlib = array();
function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $script_only=false, $css='')
{
function cache_js_file($fpath, $text)
{
- global $go_debug;
+ global $SysPrefs;
- if(!$go_debug) $text = js_compress($text);
+ if (!$SysPrefs->go_debug) $text = js_compress($text);
$file = force_open($fpath);
if (!$file) return false;
function add_js_source($text)
{
global $js_lib;
-
+
$search = array_search($text, $js_lib);
if ($search === false || $search === null) // php>4.2.0 returns null
$js_lib[] = $text;
function help_url($context=null)
{
- global $help_base_url, $help_context, $old_style_help;
+ global $SysPrefs, $help_context;
$country = $_SESSION['language']->code;
$clean = 0;
$clean = 1;
}
- if (@$old_style_help)
+ if (@$SysPrefs->old_style_help)
$help_page_url = _($help_page_url);
if ($clean)
$help_page_url = access_string($help_page_url, true);
- return $help_base_url
+ return $SysPrefs->help_base_url
.urlencode(strtr(ucwords($help_page_url), array(' '=>'', '/'=>'', '&'=>'And')))
.'&ctxhelp=1&lang='.$country;
}
function send_scripts()
{
- global $js_static, $js_path, $js_userlib, $path_to_root, $go_debug;
+ global $SysPrefs, $path_to_root, $js_static, $js_path, $js_userlib;
$js ='';
foreach($js_static as $jsfile)
$cached_name = basename($jsfile);
$fpath = user_js_cache().'/'.$cached_name;
// compress also static files
- if (!file_exists($fpath) || $go_debug)
+ if (!file_exists($fpath) || $SysPrefs->go_debug)
cache_js_file($fpath, file_get_contents($js_path.$jsfile));
$js .= '<script language="javascript" type="text/javascript" src="'.
function page_header($title, $no_menu=false, $is_index=false, $onload="", $js="", $css='')
{
// titles and screen header
- global $path_to_root, $def_app, $use_popup_windows, $help_base_url, $db_connections;
+ global $path_to_root, $SysPrefs, $db_connections;
if (in_ajax())
return; // just for speed up
$theme = user_theme();
- if ($help_base_url != null && $use_popup_windows && $js == '')
+ if ($SysPrefs->help_base_url != null && $SysPrefs->SysPrefs->use_popup_windows && $js == '')
{
if (!function_exists('get_js_open_window'))
{
function sys_prefs()
{
-// $this->prefs = get_company_prefs();
-
+ global $path_to_root;
+
+ include $path_to_root.'/config.default.php';
+ include $path_to_root.'/config.php';
+
+ // set system wide preferences
+ foreach(get_defined_vars() as $name => $value)
+ $this->$name = $value;
+
+ if (!@$this->time_zone)
+ $this->time_zone = ini_get('date.timezone');
+
+ if (!$this->time_zone)
+ $this->time_zone = 'Europe/Berlin';
+
+ ini_set('date.timezone', $this->time_zone);
}
-
+
function allow_negative_stock()
{
return $this->prefs['allow_negative_stock'];
}
-
+
/* Sherifoz 26.06.03 Proportion by which items can be received over the quantity that is specified in a purchase
invoice
The figure entered is interpreted as a percentage ie 10 means 0.1 or 10% not 10 times
function allocation_settled_allowance()
{
- global $config_allocation_settled_allowance;
- return $config_allocation_settled_allowance;
+ return $this->config_allocation_settled_allowance;
}
function no_zero_lines_amount()
{
if ($user == null) {
// set default values, used before login
- global $dflt_lang, $dflt_date_sep, $dflt_date_fmt;
-
- $this->date_sep = $dflt_date_sep;
- $this->date_format = $dflt_date_fmt;
+ global $dflt_lang, $SysPrefs;
+
+ $this->date_sep = $SysPrefs->dflt_date_sep;
+ $this->date_format = $SysPrefs->dflt_date_fmt;
$this->tho_sep = 0;
$this->dec_sep = 0;
$this->price_dec = 2;
function date_display()
{
- global $dateseps;
- $sep = $dateseps[$this->date_sep];
+ global $SysPrefs;
+ $sep = $SysPrefs->dateseps[$this->date_sep];
if ($this->date_format == 0)
return "m".$sep."d".$sep."Y";
elseif ($this->date_format == 1)
function check_faillog()
{
- global $login_delay, $login_faillog, $login_max_attempts;
+ global $SysPrefs, $login_faillog;
$user = $_SESSION["wa_current_user"]->user;
- if (@$login_delay && (@$login_faillog[$user][$_SERVER['REMOTE_ADDR']] >= @$login_max_attempts) && (time() < $login_faillog[$user]['last'] + $login_delay))
+ if (@$SysPrefs->login_delay && (@$login_faillog[$user][$_SERVER['REMOTE_ADDR']] >= @$SysPrefs->login_max_attempts) && (time() < $login_faillog[$user]['last'] + $SysPrefs->login_delay))
return true;
return false;
*/
function write_login_filelog($login, $result)
{
- global $login_faillog, $login_max_attempts, $path_to_root;
+ global $login_faillog, $SysPrefs, $path_to_root;
$user = $_SESSION["wa_current_user"]->user;
if (!$result)
{
- if ($login_faillog[$user][$ip] < @$login_max_attempts) {
+ if ($login_faillog[$user][$ip] < @$SysPrefs->login_max_attempts) {
$login_faillog[$user][$ip]++;
} else {
//----------------------------------------------------------------------------------------
// set to reasonable values if not set in config file (pre-2.3.12 installations)
-if ((!isset($login_delay)) || ($login_delay < 0))
- $login_delay = 10;
+if ((!isset($SysPrefs->login_delay)) || ($SysPrefs->login_delay < 0))
+ $SysPrefs->login_delay = 10;
-if ((!isset($login_max_attempts)) || ($login_max_attempts < 0))
- $login_max_attempts = 3;
+if ((!isset($SysPrefs->login_max_attempts)) || ($SysPrefs->login_max_attempts < 0))
+ $SysPrefs->login_max_attempts = 3;
// Prevent register_globals vulnerability
include_once($path_to_root.'/'.$ext['path'].'/hooks.php');
}
+$_SESSION['SysPrefs'] = new sys_prefs();
+
+$SysPrefs = &$_SESSION['SysPrefs'];
+
+if ($SysPrefs->go_debug > 0)
+ error_reporting(-1);
+else
+ error_reporting(E_USER_WARNING|E_USER_ERROR|E_USER_NOTICE);
+ini_set("display_errors", "On");
+
+if ($SysPrefs->error_logfile != '') {
+ ini_set("error_log", $SysPrefs->error_logfile);
+ ini_set("ignore_repeated_errors", "On");
+ ini_set("log_errors", "On");
+}
+
+
/*
Uncomment the setting below when using FA on shared hosting
to avoid unexpeced session timeouts.
// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks
header("Cache-control: private");
-include_once($path_to_root . "/config.php");
get_text_init();
-if ($login_delay > 0)
+if ($SysPrefs->login_delay > 0)
@include_once($path_to_root . "/tmp/faillog.php");
// Page Initialisation
if (!$_SESSION["wa_current_user"]->logged_in())
{
- if (@$allow_password_reset && !$allow_demo_mode
+ if (@$SysPrefs->allow_password_reset && !$SysPrefs->allow_demo_mode
&& (isset($_GET['reset']) || isset($_POST['email_entry_field']))) {
if (!isset($_POST["email_entry_field"])) {
include($path_to_root . "/access/password_reset.php");
}
}
-$SysPrefs = &$_SESSION['SysPrefs'];
// POST vars cleanup needed for direct reuse.
// We quote all values later with db_escape() before db update.
function tst_debug()
{
- global $go_debug;
+ global $SysPrefs;
$test['descr'] = _('Debugging mode');
$test['type'] = 0;
- $test['test'] = $go_debug ? _("Yes") : _("No");
+ $test['test'] = $SysPrefs->go_debug ? _("Yes") : _("No");
$test['result'] = $go_debug != 0;
$test['comments'] = _('To switch debugging on set $go_debug>0 in config.php file');
function tst_logging()
{
- global $error_logfile;
+ global $SysPrefs;
+ $error_logfile = $SysPrefs->error_logfile;
$test['descr'] = _('Error logging');
$test['type'] = 2;
// if error lgging is on, but log file does not exists try write
function get_class_type_convert($ctype)
{
- global $use_oldstyle_convert;
- if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
+ global $SysPrefs;
+
+ if (isset($SysPrefs->use_oldstyle_convert) && $SysPrefs->use_oldstyle_convert == 1)
return (($ctype >= CL_INCOME || $ctype == CL_NONE) ? -1 : 1);
else
return ((($ctype >= CL_LIABILITIES && $ctype <= CL_INCOME) || $ctype == CL_NONE) ? -1 : 1);
// Sql paged table view. Call this function inside form.
//
function display_db_pager(&$pager) {
- global $use_popup_windows, $path_to_root;
+ global $path_to_root;
$pager->select_records();
include_once($path_to_root . "/includes/types.inc");
include_once($path_to_root . "/includes/current_user.inc");
-$_search_button = "<input %s type='submit' class='combo_submit' style='border:0;background:url($path_to_root/themes/"
- ."%s/images/locate.png) no-repeat;%s' aspect='fallback' name='%s' value=' ' title='"._("Set filter")."'> ";
+define('SEARCH_BUTTON', "<input %s type='submit' class='combo_submit' style='border:0;background:url($path_to_root/themes/"
+ ."%s/images/locate.png) no-repeat;%s' aspect='fallback' name='%s' value=' ' title='"._("Set filter")."'> ");
-$_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 = ALL_TEXT;
+define('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")."'> ");
//----------------------------------------------------------------------------
// Universal sql combo generator
// if selectable or editable list is used - add select button
if ($select_submit != false || $search_button) {
- global $_select_button;
// button class selects form reload/ajax selector update
- $selector .= sprintf($_select_button, $disabled, user_theme(),
+ $selector .= sprintf(SELECT_BUTTON, $disabled, user_theme(),
(fallback_mode() ? '' : 'display:none;'),
'_'.$name.'_update')."\n";
}
.(!fallback_mode() && !$by_id ? " style=display:none;":'')
.">\n";
if ($search_submit != false || $opts['editable']) {
- global $_search_button;
- $edit_entry .= sprintf($_search_button, $disabled, user_theme(),
+ $edit_entry .= sprintf(SEARCH_BUTTON, $disabled, user_theme(),
(fallback_mode() ? '' : 'display:none;'),
$search_submit ? $search_submit : "_{$name}_button")."\n";
}
$selector = "<span id='_{$name}_sel'>".$selector."</span>\n";
if ($select_submit != false) { // if submit on change is used - add select button
- global $_select_button;
- $selector .= sprintf($_select_button, $disabled, user_theme(),
+ $selector .= sprintf(SELECT_BUTTON, $disabled, user_theme(),
(fallback_mode() ? '' : 'display:none;'),
'_'.$name.'_update')."\n";
}
function add_edit_combo($type)
{
- global $path_to_root, $popup_editors, $use_icon_for_editkey;
+ global $path_to_root, $popup_editors, $SysPrefs;
- if (!isset($use_icon_for_editkey) || $use_icon_for_editkey==0)
+ if (!isset($SysPrefs->use_icon_for_editkey) || $SysPrefs->use_icon_for_editkey==0)
return "";
// Derive theme path
$theme_path = $path_to_root . '/themes/' . user_theme();
function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false,
$all=false, $editkey = false)
{
- global $all_items;
$sql = "SELECT supplier_id, supp_ref, curr_code, inactive FROM ".TB_PREF."suppliers ";
'type' => 1,
'search' => array("supp_ref","supp_name","gst_no"),
'spec_option' => $spec_option === true ? _("All Suppliers") : $spec_option,
- 'spec_id' => $all_items,
+ 'spec_id' => ALL_TEXT,
'select_submit'=> $submit_on_change,
'async' => false,
'sel_hint' => $mode ? _('Press Space tab to filter by name fragment') :
function customer_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false,
$show_inactive=false, $editkey = false)
{
- global $all_items;
$sql = "SELECT debtor_no, debtor_ref, curr_code, inactive FROM ".TB_PREF."debtors_master ";
'size' => 20,
'search' => array("debtor_ref","name","tax_id"),
'spec_option' => $spec_option === true ? _("All Customers") : $spec_option,
- 'spec_id' => $all_items,
+ 'spec_id' => ALL_TEXT,
'select_submit'=> $submit_on_change,
'async' => false,
'sel_hint' => $mode ? _('Press Space tab to filter by name fragment; F2 - entry new customer') :
function customer_branches_list($customer_id, $name, $selected_id=null,
$spec_option = true, $enabled=true, $submit_on_change=false, $editkey = false)
{
- global $all_items;
$sql = "SELECT branch_code, branch_ref FROM ".TB_PREF."cust_branch
WHERE debtor_no=" . db_escape($customer_id)." ";
'where' => $where,
'order' => array('branch_ref'),
'spec_option' => $spec_option === true ? _('All branches') : $spec_option,
- 'spec_id' => $all_items,
+ 'spec_id' => ALL_TEXT,
'select_submit'=> $submit_on_change,
'sel_hint' => _('Select customer branch')
) );
function locations_list($name, $selected_id=null, $all_option=false, $submit_on_change=false)
{
- global $all_items;
$sql = "SELECT loc_code, location_name, inactive FROM ".TB_PREF."locations";
return combo_input($name, $selected_id, $sql, 'loc_code', 'location_name',
array(
'spec_option' => $all_option === true ? _("All Locations") : $all_option,
- 'spec_id' => $all_items,
+ 'spec_id' => ALL_TEXT,
'select_submit'=> $submit_on_change
) );
}
function stock_items_list($name, $selected_id=null, $all_option=false,
$submit_on_change=false, $opts=array(), $editkey = false)
{
- global $all_items;
$sql = "SELECT stock_id, s.description, c.description, s.inactive, s.editable
FROM ".TB_PREF."stock_master s,".TB_PREF."stock_category c WHERE s.category_id=c.category_id";
array(
'format' => '_format_stock_items',
'spec_option' => $all_option===true ? _("All Items") : $all_option,
- 'spec_id' => $all_items,
+ 'spec_id' => ALL_TEXT,
'search_box' => true,
'search' => array("stock_id", "c.description","s.description"),
'search_submit' => get_company_pref('no_item_list')!=0,
function sales_items_list($name, $selected_id=null, $all_option=false,
$submit_on_change=false, $type='', $opts=array())
{
- global $all_items;
// all sales codes
$sql = "SELECT i.item_code, i.description, c.description, count(*)>1 as kit,
i.inactive, if(count(*)>1, '0', s.editable) as editable
array(
'format' => '_format_stock_items',
'spec_option' => $all_option===true ? _("All Items") : $all_option,
- 'spec_id' => $all_items,
+ 'spec_id' => ALL_TEXT,
'search_box' => true,
'search' => array("i.item_code", "c.description", "i.description"),
'search_submit' => get_company_pref('no_item_list')!=0,
function workcenter_list($name, $selected_id=null, $all_option=false)
{
- global $all_items;
$sql = "SELECT id, name, inactive FROM ".TB_PREF."workcentres";
return combo_input($name, $selected_id, $sql, 'id', 'name',
array(
'spec_option' =>$all_option===true ? _("All Suppliers") : $all_option,
- 'spec_id' => $all_items,
+ 'spec_id' => ALL_TEXT,
) );
}
function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false, $all_option=false)
{
- global $all_items;
$sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code, inactive
FROM ".TB_PREF."bank_accounts
echo combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
array(
'spec_option' => $all_option,
- 'spec_id' => $all_items,
+ 'spec_id' => ALL_TEXT,
'format' => '_format_add_curr',
'select_submit'=> $submit_on_change,
'async' => true
function gl_account_types_list($name, $selected_id=null, $all_option=false, $all=true)
{
- global $all_items;
$sql = "SELECT id, name FROM ".TB_PREF."chart_types";
'format' => '_format_account',
'order' => array('class_id', 'id', 'parent'),
'spec_option' =>$all_option,
- 'spec_id' => $all_items
+ 'spec_id' => ALL_TEXT
) );
}
function dateformats_list_row($label, $name, $value=null)
{
- global $dateformats;
+ global $SysPrefs;
echo "<tr><td class='label'>$label</td>\n<td>";
- echo array_selector( $name, $value, $dateformats );
+ echo array_selector( $name, $value, $SysPrefs->dateformats );
echo "</td></tr>\n";
}
function dateseps_list_row($label, $name, $value=null)
{
- global $dateseps;
+ global $SysPrefs;
echo "<tr><td class='label'>$label</td>\n<td>";
- echo array_selector( $name, $value, $dateseps );
+ echo array_selector( $name, $value, $SysPrefs->dateseps );
echo "</td></tr>\n";
}
function thoseps_list_row($label, $name, $value=null)
{
- global $thoseps;
+ global $SysPrefs;
echo "<tr><td class='label'>$label</td>\n<td>";
- echo array_selector( $name, $value, $thoseps );
+ echo array_selector( $name, $value, $SysPrefs->thoseps );
echo "</td></tr>\n";
}
function decseps_list_row($label, $name, $value=null)
{
- global $decseps;
+ global $SysPrefs;
echo "<tr><td class='label'>$label</td>\n<td>";
- echo array_selector( $name, $value, $decseps );
+ echo array_selector( $name, $value, $SysPrefs->decseps );
echo "</td></tr>\n";
}
function pagesizes_list_row($label, $name, $value=null)
{
- global $pagesizes;
+ global $SysPrefs;
$items = array();
- foreach ($pagesizes as $pz)
+ foreach ($SysPrefs->pagesizes as $pz)
$items[$pz] = $pz;
echo "<tr><td class='label'>$label</td>\n<td>";
function cust_allocations_list_cells($label, $name, $selected=null)
{
- global $all_items;
if ($label != null)
label_cell($label);
echo "<td>\n";
$allocs = array(
- $all_items=>_("All Types"),
+ ALL_TEXT=>_("All Types"),
'1'=> _("Sales Invoices"),
'2'=> _("Overdue Invoices"),
'3' => _("Payments"),
function supp_allocations_list_cell($name, $selected=null)
{
- global $all_items;
echo "<td>\n";
$allocs = array(
- $all_items=>_("All Types"),
+ ALL_TEXT=>_("All Types"),
'1'=> _("Invoices"),
'2'=> _("Overdue Invoices"),
'3' => _("Payments"),
function supp_transactions_list_cell($name, $selected=null)
{
- global $all_items;
echo "<td>\n";
$allocs = array(
- $all_items=>_("All Types"),
+ ALL_TEXT=>_("All Types"),
'6'=>_("GRNs"),
'1'=> _("Invoices"),
'2'=> _("Overdue Invoices"),
function security_roles_list($name, $selected_id=null, $new_item=false, $submit_on_change=false,
$show_inactive = false)
{
- global $all_items;
$sql = "SELECT id, role, inactive FROM ".TB_PREF."security_roles";
function subledger_list($name, $account, $selected_id=null)
{
- global $all_items;
$type = is_subledger_account($account);
if (!$type)
//
function exchange_rate_display($from_currency, $to_currency, $date_, $force_edit=false)
{
- global $Ajax, $xr_provider_authoritative;
+ global $Ajax, $SysPrefs;
$readonly = false;
$rate = retrieve_exrate($currency, $date_);
if (!$rate)
display_warning(sprintf(_("Cannot retrieve exchange rate for currency %s. Please adjust approximate rate if needed."), $currency));
- elseif ($xr_provider_authoritative) {
+ elseif ($SysPrefs->xr_provider_authoritative) {
// if the remote exrate is considered authoritative we can store the rate here,
// otherwise exrate will be stored during transaction write
$readonly = true;
function display_customer_trans_tax_details($tax_items, $columns)
{
global $SysPrefs;
+
$first = true;
while ($tax_item = db_fetch($tax_items))
{
function get_js_date_picker()
{
- global $go_debug;
- $fpath = user_js_cache().'/'.'date_picker.js';
+ global $SysPrefs, $tmonths;
- if (!file_exists($fpath) || $go_debug) {
+ $fpath = user_js_cache().'/'.'date_picker.js';
- global $dateseps, $date_system, $tmonths;
+ if (!file_exists($fpath) || $SysPrefs->go_debug) {
+ $date_system = $SysPrefs->date_system;
+ $dateseps = $SysPrefs->dateseps;
$how = user_date_format(); // 0 = us/ca, 1 = eu, au, nz, 2 = jp, sw
$sep = $dateseps[user_date_sep()]; // date separator
$wstart = (($date_system == 1 || $date_system == 2 || $date_system == 3) ? 6 : ($how == 0 || $how == 3 ? 0 : 1)); // weekstart (sun = 0, mon = 1)
include_once($path_to_root . "/inventory/includes/item_adjustments_ui.inc");
include_once($path_to_root . "/inventory/includes/inventory_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/inventory/includes/inventory_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "Inventory Item Cost Update"), false, false, "", $js);
include_once($path_to_root . "/includes/ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include($path_to_root . "/includes/session.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
display_warning(_('Only graphics files are supported - a file extension of .jpg, .png or .gif is expected'));
$upload_file ='No';
}
- elseif ( $_FILES['pic']['size'] > ($max_image_size * 1024))
+ elseif ( $_FILES['pic']['size'] > ($SysPrefs->max_image_size * 1024))
{ //File Size Check
- display_warning(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $max_image_size);
+ display_warning(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $SysPrefs->max_image_size);
$upload_file ='No';
}
elseif ( $_FILES['pic']['type'] == "text/plain" )
}
}
-function item_settings(&$stock_id)
+function item_settings(&$stock_id, $new_id)
{
- global $SysPrefs, $path_to_root, $new_item, $pic_height;
+ global $SysPrefs, $path_to_root;
start_outer_table(TABLESTYLE2);
// 31/08/08 - rand() call is necessary here to avoid caching problems. Thanks to Peter D.
$stock_img_link .= "<img id='item_img' alt = '[".$_POST['NewStockID'].".jpg".
"]' src='".company_path().'/images/'.item_img_name($_POST['NewStockID']).
- ".jpg?nocache=".rand()."'"." height='$pic_height' border='0'>";
+ ".jpg?nocache=".rand()."'"." height='".$SysPrefs->pic_height."' border='0'>";
$check_remove_image = true;
}
else
switch (get_post('_tabs_sel')) {
default:
case 'settings':
- item_settings($stock_id);
+ item_settings($stock_id, $new_id);
break;
case 'sales_pricing':
$_GET['stock_id'] = $stock_id;
}
if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
- update_component($_POST['item_code'], $selected_id);
+ update_component($_POST['item_code'], $selected_id, $selected_kit);
if ($Mode == 'Delete')
{
include_once($path_to_root . "/inventory/includes/stock_transfers_ui.inc");
include_once($path_to_root . "/inventory/includes/inventory_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (isset($_GET['outstanding_only']) && ($_GET['outstanding_only'] == true))
{
include_once($path_to_root . "/includes/session.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Work Order Costs"), true, false, "", $js);
include_once($path_to_root . "/includes/session.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Work Order Issue"), true, false, "", $js);
include_once($path_to_root . "/includes/session.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Work Order Production"), true, false, "", $js);
include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
page(_($help_context = "View Work Order"), true, false, "", $js);
include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
//--------------------------------------------------------------------------------------------------
-function can_process()
+function can_process($wo_details)
{
- global $wo_details, $SysPrefs, $Refs;
+ global $SysPrefs, $Refs;
if (!$Refs->is_valid($_POST['ref']))
{
//--------------------------------------------------------------------------------------------------
-if ((isset($_POST['Process']) || isset($_POST['ProcessAndClose'])) && can_process() == true)
+if ((isset($_POST['Process']) || isset($_POST['ProcessAndClose'])) && can_process($wo_details) == true)
{
$close_wo = 0;
include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
include_once($path_to_root . "/manufacturing/includes/work_order_issue_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
//include_once($path_to_root . "/purchasing/includes/ui/supp_alloc_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
add_js_file('allocate.js');
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "Supplier Allocations"), false, false, "", $js);
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include($path_to_root . "/includes/db_pager.inc");
include_once($path_to_root . "/includes/session.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
);
$js = '';
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
function check_data()
{
- global $total_grn_value, $total_gl_value, $Refs, $SysPrefs;
+ global $Refs, $SysPrefs;
if (!$_SESSION['supp_trans']->is_valid_trans_to_post())
{
return false;
}
- if ($_SESSION['supp_trans']->ov_amount < ($total_gl_value + $total_grn_value))
- {
- display_error(_("The credit note total as entered is less than the sum of the the general ledger entires (if any) and the charges for goods received. There must be a mistake somewhere, the credit note as entered will not be processed."));
- return false;
- }
-
if (!$SysPrefs->allow_negative_stock()) {
foreach ($_SESSION['supp_trans']->grn_items as $n => $item) {
if (is_inventory_item($item->item_code))
if ($_POST['supplier_id']=='')
display_error('No supplier found for entered search text');
else {
- $total_grn_value = display_grn_items($_SESSION['supp_trans'], 1);
+ display_grn_items($_SESSION['supp_trans'], 1);
- $total_gl_value = display_gl_items($_SESSION['supp_trans'], 1);
+ display_gl_items($_SESSION['supp_trans'], 1);
div_start('inv_tot');
invoice_totals($_SESSION['supp_trans']);
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
function check_item_data($n)
{
- global $check_price_charged_vs_order_price,
- $check_qty_charged_vs_del_qty, $SysPrefs;
+ global $SysPrefs;
if (!check_num('this_quantity_inv'.$n, 0) || input_num('this_quantity_inv'.$n)==0)
{
}
$margin = $SysPrefs->over_charge_allowance();
- if ($check_price_charged_vs_order_price == True)
+ if ($SysPrefs->check_price_charged_vs_order_price == True)
{
if ($_POST['order_price'.$n]!=input_num('ChgPrice'.$n)) {
if ($_POST['order_price'.$n]==0 ||
}
}
- if ($check_qty_charged_vs_del_qty == true && ($_POST['qty_recd'.$n] != $_POST['prev_quantity_inv'.$n]))
+ if ($SysPrefs->check_qty_charged_vs_del_qty == true && ($_POST['qty_recd'.$n] != $_POST['prev_quantity_inv'.$n]))
{
if (input_num('this_quantity_inv'.$n) / ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]) >
(1+ ($margin / 100)))
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include($path_to_root . "/includes/session.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Purchase Order Delivery"), true, false, "", $js);
include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Purchase Order"), true, false, "", $js);
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Supplier Credit Note"), true, false, "", $js);
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Supplier Invoice"), true, false, "", $js);
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Payment to Supplier"), true, false, "", $js);
*/
define('SPREADSHEET_EXCEL_WRITER_NE', "<>");
-$encoding_string='';
/**
* Class for creating OLE streams for Excel Spreadsheets
*
*/
function setInputEncoding($encoding)
{
- global $encoding_string;
if ($encoding != 'UTF-16LE' && !function_exists('iconv')) {
die("Using an input encoding other than UTF-16LE requires PHP support for iconv");
}
- $this->_input_encoding = $encoding_string = $encoding;
+ $this->_input_encoding = $encoding;
}
/** added 2009-03-05 by Joe Hunt, FA for arabic languages */
/*
if ($this->_BIFF_version == 0x0600) // Tried to fix the correct handling here, with the
{ // corrected specification from M$ - Joe Hunt 2009-03-08
- global $encoding_string;
+ $encoding_string = $this->_input_encoding;
if ($encoding_string == 'UTF-16LE')
{
$strlen = function_exists('mb_strlen') ? mb_strlen($sheetname, 'UTF-16LE') : (strlen($sheetname) / 2);
function graph()
{
- global $UTF8_fontfile;
+ global $SysPrefs;
$this->encoding = strtoupper($_SESSION['language']->encoding);
$path = dirname(__FILE__).'/../fonts/';
// If you use UTF-8 encoding you have to download and install FreeSans.ttf font.
// It is not bundled with application due to its size.
// You can also use another UTF-8 font and put it in config.php with the name in $UTF8_fontfile
- $this->fontfile = $this->encoding == 'UTF-8' ? (isset($UTF8_fontfile) && $UTF8_fontfile != "" ? $path.$UTF8_fontfile : $path.'FreeSans.ttf') :
- $path.'LiberationSans-Regular.ttf';
+ $this->fontfile = $this->encoding == 'UTF-8' ? (isset($SysPrefs->UTF8_fontfile) && $SysPrefs->UTF8_fontfile != "" ?
+ $path.$SysPrefs->UTF8_fontfile : $path.'FreeSans.ttf') : $path.'LiberationSans-Regular.ttf';
$this->x = $this->y = $this->z = array();
$this->biggest_x = NULL;
return $r;
}
-global $p_chars;
+///
+function arabic($str,$z="",$method='normal')
+{
$p_chars = array (
utf8_chr(0x0622) => array (utf8_chr(0xfe82), utf8_chr(0xfe82), utf8_chr(0x0622)),
utf8_chr(0x0627) => array (utf8_chr(0xfe8e), utf8_chr(0xfe8e), utf8_chr(0x0627)),
utf8_chr(0x0629) => array (utf8_chr(0xfe94), utf8_chr(0xfe98), utf8_chr(0xfe97))
);
-global $nastaligh;
$nastaligh = array (
utf8_chr(0x0647) => array (utf8_chr(0xfbab), utf8_chr(0xfbad), utf8_chr(0xfbac))
);
-global $normal;
+
$normal = array (
utf8_chr(0x0647) => array (utf8_chr(0xfeea), utf8_chr(0xfeec), utf8_chr(0xfeeb))
);
-global $mp_chars;
$mp_chars = array (utf8_chr(0x0622), utf8_chr(0x0627), utf8_chr(0x062f), utf8_chr(0x0630), utf8_chr(0x0631), utf8_chr(0x0632),
utf8_chr(0x0698), utf8_chr(0x0648), utf8_chr(0x0623), utf8_chr(0x0625), utf8_chr(0x0624));
-global $ignorelist;
$ignorelist = array (utf8_chr(0x0000), utf8_chr(0x064c), utf8_chr(0x064d), utf8_chr(0x064b), utf8_chr(0x064f), utf8_chr(0x0650),
utf8_chr(0x064e), utf8_chr(0x0651), utf8_chr(0x0653), utf8_chr(0x0670), utf8_chr(0x0654), utf8_chr(0xfe76), utf8_chr(0xfe7a),
utf8_chr(0xfe78), utf8_chr(0xfe7c), utf8_chr(0xfe7e), utf8_chr(0xfe74), utf8_chr(0xfe70), utf8_chr(0xfc5e), utf8_chr(0xfc5f),
utf8_chr(0xfc60), utf8_chr(0xfc61), utf8_chr(0xfc62), utf8_chr(0xfc63));
-///
-function arabic($str,$z="",$method='normal')
-{
- global $p_chars,$mp_chars, $ignorelist,$nastaligh,$normal;
$str_back = $output = $e_output = $str_next = $str1 = $num = "";
if ($method == 'nastaligh')
$p_chars = array_merge($p_chars, $nastaligh);
* Set document type dependent elements of common page layout.
*
*/
+ global $SysPrefs;
+
$Addr1 = array(
'title' => _("Charge To"),
'name' => @$this->formData['br_name'] ? $this->formData['br_name'] : @$this->formData['DebtorName'],
function FrontReport($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = 6.5)
{
- global $dateseps, $page_security;
+ global $SysPrefs, $page_security;
+
if (!$_SESSION["wa_current_user"]->can_access_page($page_security))
{
display_error(_("The security settings on your account do not permit you to print this report"));
$this->formatTitle->setTopColor('gray');
$how = user_date_format();
- $sep = $dateseps[user_date_sep()];
+ $sep = $SysPrefs->dateseps[user_date_sep()];
if ($sep == '.')
$sep = "\\.";
if ($how == 0)
function Info($params, $cols, $headers, $aligns,
$cols2 = null, $headers2 = null, $aligns2 = null)
{
- global $app_title, $version, $power_by, $power_url;
$this->company = get_company_prefs();
$year = get_current_fiscalyear();
if ($year['closed'] == 0)
$cols2 = null, $headers2 = null, $aligns2 = null,
$companylogoenable = false, $footerenable = false, $footertext = '')
{
- global $app_title, $version, $power_by, $power_url;
+ global $SysPrefs, $version;
$this->addInfo('Title', $this->title);
$this->addInfo('Subject', $this->title);
- $this->addInfo('Author', $app_title . ' ' . $version);
- $this->addInfo('Creator',$power_by . ' - ' . $power_url);
+ $this->addInfo('Author', $SysPrefs->app_title . ' ' . $version);
+ $this->addInfo('Creator',$SysPrefs->power_by . ' - ' . $SysPrefs->power_url);
$year = get_current_fiscalyear();
if ($year['closed'] == 0)
$how = _("Active");
*/
function Header2()
{
- global $path_to_root, $print_as_quote,
- $SysPrefs, $packing_slip, $dflt_lang; // FIXME should be passed as params
+ global $dflt_lang; // FIXME should be passed as params
$doctype = $this->formData['doctype'];
$header2type = true;
function End($email=0, $subject='')
{
- global $pdf_debug, $path_to_root;
+ global $SysPrefs, $path_to_root;
- if ($pdf_debug == 1)
+ if ($SysPrefs->pdf_debug == 1)
{
$pdfcode = $this->Output('','S');
$pdfcode = str_replace("\n", "\n<br>", htmlspecialchars($pdfcode));
function print_link($link_text, $rep, $pars = array(), $dir = '',
$icon=false, $class='printlink', $id='')
{
- global $path_to_root, $pdf_debug;
+ global $path_to_root, $SysPrefs;
$url = $dir == '' ? $path_to_root.'/reporting/prn_redirect.php?' : $dir;
$url .= implode ('&', $pars);
if ($class != '')
- $class = $pdf_debug ? '' : " class='$class'";
+ $class = $SysPrefs->pdf_debug ? '' : " class='$class'";
if ($id != '')
$id = " id='$id'";
$pars = access_string($link_text);
function getDisplay($class=null)
{
- global $path_to_root, $pdf_debug, $Ajax;
+ global $path_to_root, $SysPrefs, $Ajax;
if (find_submit('Rep') != -1) {
include($path_to_root.'/reporting/prn_redirect.php');
. "<form method='POST' action='$action' target='_blank'>\n";
$st_params .= submit('Rep'.$report->id,
_("Display: ") . access_string($report->name, true),
- false, '', $pdf_debug ? false : 'default process') . hidden('REP_ID', $report->id, false).'<br><br>';
+ false, '', $SysPrefs->pdf_debug ? false : 'default process') . hidden('REP_ID', $report->id, false).'<br><br>';
$st_params .= $this->getOptions($report->get_controls(), $report->id);
$st_params .= "\n<input type=hidden name='Class' value=".$cur_class.">"
."\n</form></td></tr></table>\n";
//
function get_ctrl($name, $type)
{
- global $path_to_root, $pdf_debug, $SysPrefs,
+ global $path_to_root, $SysPrefs,
$type_shortcuts;
$st = '';
$rep->Line($rep->row - 8);
if ($graphics)
{
- global $decseps, $graph_skin;
+ global $SysPrefs;
$pg->x = array(_('Current'), $nowdue, $pastdue1, $pastdue2);
$pg->title = $rep->title;
$pg->axis_x = _("Days");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $to;
$pg->type = $graphics;
- $pg->skin = $graph_skin;
+ $pg->skin = $SysPrefs->graph_skin;
$pg->built_in = false;
- $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
+ $pg->latin_notation = ($SysPrefs->decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
$filename = company_path(). "/pdf_files/". uniqid("").".png";
$pg->display($filename, true);
$w = $pg->width / 1.5;
function print_price_listing()
{
- global $path_to_root, $pic_height, $pic_width;
+ global $path_to_root, $SysPrefs;
$currency = $_POST['PARAM_0'];
$category = $_POST['PARAM_1'];
if (file_exists($image))
{
$rep->NewLine();
- if ($rep->row - $pic_height < $rep->bottomMargin)
+ if ($rep->row - $SysPrefs->pic_height < $rep->bottomMargin)
$rep->NewPage();
- $rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
- $rep->row -= $pic_height;
+ $rep->AddImage($image, $rep->cols[1], $rep->row - $SysPrefs->pic_height, 0, $SysPrefs->pic_height);
+ $rep->row -= $SysPrefs->pic_height;
$rep->NewLine();
}
}
print_sales_orders();
-$print_as_quote = 0;
-
function print_sales_orders()
{
- global $path_to_root, $print_as_quote, $SysPrefs;
+ global $path_to_root, $SysPrefs;
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/sales/includes/sales_db.inc");
-$packing_slip = 0;
//----------------------------------------------------------------------------------------------------
print_deliveries();
function print_deliveries()
{
- global $path_to_root, $packing_slip, $SysPrefs;
+ global $path_to_root, $SysPrefs;
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
function print_sales_quotations()
{
- global $path_to_root, $print_as_quote, $SysPrefs, $pic_height;
+ global $path_to_root, $SysPrefs;
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
$dec = user_price_dec();
$pictures = $SysPrefs->print_item_images_on_quote();
- // If you want a larger image, then increase $pic_height f.i.
- // $pic_height += 25;
+ // If you want a larger image, then increase pic_height f.i.
+ // $SysPrefs->pic_height += 25;
$cols = array(4, 60, 225, 300, 325, 385, 450, 515);
if (file_exists($image))
{
//$rep->NewLine();
- if ($rep->row - $pic_height < $rep->bottomMargin)
+ if ($rep->row - $SysPrefs->pic_height < $rep->bottomMargin)
$rep->NewPage();
- $rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
- $rep->row -= $pic_height;
+ $rep->AddImage($image, $rep->cols[1], $rep->row - $SysPrefs->pic_height, 0, $SysPrefs->pic_height);
+ $rep->row -= $SysPrefs->pic_height;
$rep->NewLine();
}
}
function print_aged_supplier_analysis()
{
- global $path_to_root, $systypes_array;
+ global $path_to_root, $systypes_array, $SysPrefs;
$to = $_POST['PARAM_0'];
$fromsupp = $_POST['PARAM_1'];
$rep->NewLine();
if ($graphics)
{
- global $decseps, $graph_skin;
$pg->x = array(_('Current'), $nowdue, $pastdue1, $pastdue2);
$pg->title = $rep->title;
$pg->axis_x = _("Days");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $to;
$pg->type = $graphics;
- $pg->skin = $graph_skin;
+ $pg->skin = $SysPrefs->graph_skin;
$pg->built_in = false;
- $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
+ $pg->latin_notation = ($SysPrefs->decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
$filename = company_path(). "/pdf_files/". uniqid("").".png";
$pg->display($filename, true);
$w = $pg->width / 1.5;
function print_inventory_valuation_report()
{
- global $path_to_root, $use_costed_values;;
+ global $path_to_root, $SysPrefs;
$date = $_POST['PARAM_0'];
$category = $_POST['PARAM_1'];
if ($detail)
$rep->NewLine();
}
- if (isset($use_costed_values) && $use_costed_values==1)
+ if (isset($SysPrefs->use_costed_values) && $SysPrefs->use_costed_values==1)
{
$UnitCost = getAverageCost($trans['stock_id'], $date);
$ItemTotal = $trans['QtyOnHand'] * $UnitCost;
function print_stock_check()
{
- global $path_to_root, $pic_height;
+ global $path_to_root, $SysPrefs;
$category = $_POST['PARAM_0'];
$location = $_POST['PARAM_1'];
if (file_exists($image))
{
$rep->NewLine();
- if ($rep->row - $pic_height < $rep->bottomMargin)
+ if ($rep->row - $SysPrefs->pic_height < $rep->bottomMargin)
$rep->NewPage();
- $rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
- $rep->row -= $pic_height;
+ $rep->AddImage($image, $rep->cols[1], $rep->row - $SysPrefs->pic_height, 0, $SysPrefs->pic_height);
+ $rep->row -= $SysPrefs->pic_height;
$rep->NewLine();
}
}
function print_annual_expense_breakdown()
{
- global $path_to_root, $date_system;
+ global $path_to_root, $SysPrefs;
$dim = get_company_pref('use_dimension');
$dimension = $dimension2 = 0;
$yr = $row['yr'];
$mo = $row['mo'];
$da = 1;
- if ($date_system == 1)
+ if ($SysPrefs->date_system == 1)
list($yr, $mo, $da) = jalali_to_gregorian($yr, $mo, $da);
- elseif ($date_system == 2)
+ elseif ($SysPrefs->date_system == 2)
list($yr, $mo, $da) = islamic_to_gregorian($yr, $mo, $da);
$per12 = strftime('%b',mktime(0,0,0,$mo,$da,$yr));
$per11 = strftime('%b',mktime(0,0,0,$mo-1,$da,$yr));
function print_balance_sheet()
{
- global $path_to_root;
+ global $path_to_root, $SysPrefs;
$dim = get_company_pref('use_dimension');
$dimension = $dimension2 = 0;
$pg->x[] = _('Calculated Return');
$pg->y[] = abs($calc_open);
$pg->z[] = abs($calc_period);
- global $decseps, $graph_skin;
$pg->title = $rep->title;
$pg->axis_x = _("Group");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $headers[2];
$pg->graphic_2 = $headers[3];
$pg->type = $graphics;
- $pg->skin = $graph_skin;
+ $pg->skin = $SysPrefs->graph_skin;
$pg->built_in = false;
- $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
+ $pg->latin_notation = ($SysPrefs->decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
$filename = company_path(). "/pdf_files/". uniqid("").".png";
$pg->display($filename, true);
$w = $pg->width / 1.5;
function print_profit_and_loss_statement()
{
- global $path_to_root;
+ global $path_to_root, $SysPrefs;
$dim = get_company_pref('use_dimension');
$dimension = $dimension2 = 0;
$rep->Line($rep->row);
if ($graphics)
{
- global $decseps, $graph_skin;
$pg->title = $rep->title;
$pg->axis_x = _("Group");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $headers[2];
$pg->graphic_2 = $headers[3];
$pg->type = $graphics;
- $pg->skin = $graph_skin;
+ $pg->skin = $SysPrefs->graph_skin;
$pg->built_in = false;
- $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
+ $pg->latin_notation = ($SysPrefs->decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
$filename = company_path(). "/pdf_files/". uniqid("").".png";
$pg->display($filename, true);
$w = $pg->width / 1.5;
function display_type ($type, $typename, &$dec, &$rep, $from, $to, $zero, $balances, $dimension, $dimension2)
{
- global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal, $clear_trial_balance_opening;
+ global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal, $SysPrefs;
$printtitle = 0; //Flag for printing type name
// FA doesn't really clear the closed year, therefore the brought forward balance includes all the transactions from the past, even though the balance is null.
// If we want to remove the balanced part for the past years, this option removes the common part from from the prev and tot figures.
- if (@$clear_trial_balance_opening)
+ if (@$SysPregs->clear_trial_balance_opening)
{
$open = get_balance($account["account_code"], $dimension, $dimension2, $begin, $begin, false, true);
$offset = min($open['debit'], $open['credit']);
function print_tax_report()
{
- global $path_to_root, $trans_dir, $Hooks, $systypes_array;
+ global $path_to_root, $Hooks, $systypes_array;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
//include_once($path_to_root . "/sales/includes/ui/cust_alloc_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
add_js_file('allocate.js');
include_once($path_to_root . "/sales/includes/sales_ui.inc");
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "Customer Allocations"), false, false, "", $js);
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 600);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
$js .= get_js_open_window(900, 500);
}
if (user_use_date_picker()) {
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
$js .= get_js_open_window(900, 500);
}
include_once($path_to_root . "/taxes/tax_calc.inc");
$js = "";
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
$js .= get_js_open_window(900, 500);
}
if (user_use_date_picker()) {
include_once($path_to_root . "/admin/db/shipping_db.inc");
$js = "";
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
$js .= get_js_open_window(900, 500);
}
if (user_use_date_picker()) {
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
$js .= get_js_open_window(900, 500);
}
if (user_use_date_picker()) {
*/
function get_items()
{
- global $sort_sales_items;
+ global $SysPrefs;
$items = $this->line_items;
- if (@$sort_sales_items)
+ if (@$SysPrefs->sort_sales_items)
uasort($items, array($this, '_cmp_lines'));
return $items;
function get_customer_trans($trans_id, $trans_type)
{
- global $go_debug;
+ global $SysPrefs;
$sql = "SELECT trans.*,"
."ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total,"
if (db_num_rows($result) == 0) {
// can't return nothing
- if($go_debug)
+ if ($SysPrefs->go_debug)
display_backtrace();
display_db_error("no debtor trans found for given params", $sql, true);
exit;
}
if (db_num_rows($result) > 1) {
// can't return multiple
- if($go_debug)
+ if($SysPrefs->go_debug)
display_backtrace();
display_db_error("duplicate debtor transactions found for given params", $sql, true);
exit;
*/
function check_edit_conflicts($cart_id, $cartname='Items')
{
- global $Ajax, $no_check_edit_conflicts;
+ global $Ajax, $SysPrefs;
- if ((!isset($no_check_edit_conflicts) || $no_check_edit_conflicts==0) && get_post('cart_id') && $cart_id != $_SESSION[$cartname]->cart_id) {
+ if ((!isset($SysPrefs->no_check_edit_conflicts) || $SysPrefs->no_check_edit_conflicts==0) && get_post('cart_id') && $cart_id != $_SESSION[$cartname]->cart_id) {
display_error(_('This edit session has been abandoned by opening sales document in another browser tab. You cannot edit more than one sales document at once.'));
$Ajax->activate('_page_body');
display_footer_exit();
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 600);
if (user_use_date_picker())
$js .= get_js_date_picker();
}
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 600);
if (user_use_date_picker())
$js .= get_js_date_picker();
include_once($path_to_root . "/includes/db_pager.inc");
include_once($path_to_root . "/includes/session.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
function handle_submit(&$selected_id)
{
- global $path_to_root, $Ajax, $auto_create_branch;
+ global $path_to_root, $Ajax, $SysPrefs;
if (!can_process())
return;
$selected_id = $_POST['customer_id'] = db_insert_id();
- if (isset($auto_create_branch) && $auto_create_branch == 1)
+ if (isset($SysPrefs->auto_create_branch) && $SysPrefs->auto_create_branch == 1)
{
add_branch($selected_id, $_POST['CustName'], $_POST['cust_ref'],
$_POST['address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], '',
display_notification(_("A new customer has been added."));
- if (isset($auto_create_branch) && $auto_create_branch == 1)
+ if (isset($SysPrefs->auto_create_branch) && $SysPrefs->auto_create_branch == 1)
display_notification(_("A default Branch has been automatically created, please check default Branch values by using link below."));
$Ajax->activate('_page_body');
function customer_settings($selected_id)
{
- global $SysPrefs, $path_to_root, $auto_create_branch;
+ global $SysPrefs, $path_to_root;
if (!$selected_id)
{
if($selected_id)
record_status_list_row(_("Customer status:"), 'inactive');
- elseif (isset($auto_create_branch) && $auto_create_branch == 1)
+ elseif (isset($SysPrefs->auto_create_branch) && $SysPrefs->auto_create_branch == 1)
{
table_section_title(_("Branch"));
text_row(_("Phone:"), 'phone', null, 32, 30);
}
textarea_row(_("General Notes:"), 'notes', null, 35, 5);
- if (!$selected_id && isset($auto_create_branch) && $auto_create_branch == 1)
+ if (!$selected_id && isset($SysPrefs->auto_create_branch) && $SysPrefs->auto_create_branch == 1)
{
table_section_title(_("Branch"));
locations_list_row(_("Default Inventory Location:"), 'location');
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 600);
if (user_use_date_picker())
$js .= get_js_date_picker();
$js = '';
-if ($use_popup_windows) {
+if ($SysPrefs->SysPrefs->use_popup_windows) {
$js .= get_js_open_window(900, 500);
}
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_($help_context = "View Credit Note"), true, false, "", $js);
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 600);
page(_($help_context = "View Sales Dispatch"), true, false, "", $js);
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 600);
page(_($help_context = "View Sales Invoice"), true, false, "", $js);
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 600);
page(_($help_context = "View Customer Payment"), true, false, "", $js);
include_once($path_to_root . "/sales/includes/sales_db.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 600);
if ($_GET['trans_type'] == ST_SALESQUOTE)
{
function get_icon($category)
{
- global $path_to_root, $show_menu_category_icons;
+ global $path_to_root, $SysPrefs;
- if ($show_menu_category_icons)
+ if ($SysPrefs->show_menu_category_icons)
$img = $category == '' ? 'right.gif' : $category.'.png';
else
$img = 'right.gif';
function menu_header($title, $no_menu, $is_index)
{
- global $path_to_root, $help_base_url, $db_connections;
+ global $path_to_root, $SysPrefs, $db_connections;
echo "<table class='callout_main' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>";
echo "<td colspan='2' rowspan='2'>\n";
echo " <td class='logoutBarRight'><a class='shortcut' href='$path_to_root/admin/display_prefs.php?'>" . _("Preferences") . "</a> \n";
echo " <a class='shortcut' href='$path_to_root/admin/change_current_user_password.php?selected_id=" . $_SESSION["wa_current_user"]->username . "'>" . _("Change password") . "</a> \n";
- if ($help_base_url != null)
+ if ($SysPrefs->help_base_url != null)
{
echo "$himg<a target = '_blank' onclick=" .'"'."javascript:openWindow(this.href,this.target); return false;".'" '. "href='". help_url()."'>" . _("Help") . "</a> ";
}
function menu_footer($no_menu, $is_index)
{
- global $version, $allow_demo_mode, $app_title, $power_url,
- $power_by, $path_to_root, $Pagehelp, $Ajax;
+ global $version, $path_to_root, $Pagehelp, $Ajax, $SysPrefs;
+
include_once($path_to_root . "/includes/date_functions.inc");
echo "</td></tr></table>\n"; // 'main_page'
{
echo "<table align='center' id='footer'>\n";
echo "<tr>\n";
- echo "<td align='center' class='footer'><a target='_blank' href='$power_url'><font color='#ffffff'>$app_title $version - " . _("Theme:") . " " . user_theme() . " - ".show_users_online()."</font></a></td>\n";
+ echo "<td align='center' class='footer'><a target='_blank' href='".$SysPrefs->power_url."'><font color='#ffffff'>"
+ .$SysPrefs->app_title." $version - " . _("Theme:") . " " . user_theme() . " - ".show_users_online()."</font></a></td>\n";
echo "</tr>\n";
echo "<tr>\n";
- echo "<td align='center' class='footer'><a target='_blank' href='$power_url'><font color='#ffff00'>$power_by</font></a></td>\n";
+ echo "<td align='center' class='footer'><a target='_blank' href='".$SysPrefs->power_url."'><font color='#ffff00'>"
+ .$SysPrefs->power_by."</font></a></td>\n";
echo "</tr>\n";
- if ($allow_demo_mode==true)
+ if ($SysPrefs->allow_demo_mode==true)
{
echo "<tr>\n";
- //echo "<td><br><div align='center'><a href='http://sourceforge.net'><img src='http://sourceforge.net/sflogo.php?group_id=89967&type=5' alt='SourceForge.net Logo' width='210' height='62' border='0' align='middle' /></a></div></td>\n";
echo "</tr>\n";
}
echo "</table><br><br>\n";
{
function get_icon($category)
{
- global $path_to_root, $show_menu_category_icons;
+ global $path_to_root, $SysPrefs;
- if ($show_menu_category_icons)
+ if ($SysPrefs->show_menu_category_icons)
$img = $category == '' ? 'right.gif' : $category.'.png';
else
$img = 'right.gif';
function menu_header($title, $no_menu, $is_index)
{
- global $path_to_root, $help_base_url, $db_connections;
+ global $path_to_root, $SysPrefs, $db_connections;
echo "<table class='callout_main' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>";
echo "<td colspan='2' rowspan='2'>\n";
echo " <td class='logoutBarRight'><a class='shortcut' href='$path_to_root/admin/display_prefs.php?'>" . _("Preferences") . "</a> \n";
echo " <a class='shortcut' href='$path_to_root/admin/change_current_user_password.php?selected_id=" . $_SESSION["wa_current_user"]->username . "'>" . _("Change password") . "</a> \n";
- if ($help_base_url != null)
+ if ($SysPrefs->help_base_url != null)
{
echo "$himg<a target = '_blank' onclick=" .'"'."javascript:openWindow(this.href,this.target); return false;".'" '. "href='". help_url()."'>" . _("Help") . "</a> ";
}
function menu_footer($no_menu, $is_index)
{
- global $version, $allow_demo_mode, $app_title, $power_url,
- $power_by, $path_to_root, $Pagehelp, $Ajax;
+ global $version, $SysPrefs, $path_to_root, $Pagehelp, $Ajax;
include_once($path_to_root . "/includes/date_functions.inc");
echo "</td></tr></table>\n"; // 'main_page'
{
echo "<table align='center' id='footer'>\n";
echo "<tr>\n";
- echo "<td align='center' class='footer'><a target='_blank' href='$power_url'><font color='#ffffff'>$app_title $version - " . _("Theme:") . " " . user_theme() ." - ".show_users_online(). "</font></a></td>\n";
+ echo "<td align='center' class='footer'><a target='_blank' href='".$SysPrefs->power_url."'><font color='#ffffff'>".$SysPrefs->app_title
+ ." $version - " . _("Theme:") . " " . user_theme() ." - ".show_users_online(). "</font></a></td>\n";
echo "</tr>\n";
echo "<tr>\n";
- echo "<td align='center' class='footer'><a target='_blank' href='$power_url'><font color='#ffff00'>$power_by</font></a></td>\n";
+ echo "<td align='center' class='footer'><a target='_blank' href='".$SysPrefs->power_url."'><font color='#ffff00'".$SysPrefs->power_by
+ ."</font></a></td>\n";
echo "</tr>\n";
- if ($allow_demo_mode==true)
- {
- echo "<tr>\n";
- //echo "<td><br><div align='center'><a href='http://sourceforge.net'><img src='http://sourceforge.net/sflogo.php?group_id=89967&type=5' alt='SourceForge.net Logo' width='210' height='62' border='0' align='middle' /></a></div></td>\n";
- echo "</tr>\n";
- }
echo "</table><br><br>\n";
}
}
{
function get_icon($category)
{
- global $path_to_root, $show_menu_category_icons;
+ global $path_to_root, $SysPrefs;
- if ($show_menu_category_icons)
+ if ($SysPrefs->show_menu_category_icons)
$img = $category == '' ? 'right.gif' : $category.'.png';
else
$img = 'right.gif';
function menu_header($title, $no_menu, $is_index)
{
- global $path_to_root, $help_base_url, $db_connections;
+ global $path_to_root, $SysPrefs, $db_connections;
echo "<table class='callout_main' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td colspan='2' rowspan='2'>\n";
echo " <td class='logoutBarRight'><a class='shortcut' href='$path_to_root/admin/display_prefs.php?'>" . _("Preferences") . "</a> \n";
echo " <a class='shortcut' href='$path_to_root/admin/change_current_user_password.php?selected_id=" . $_SESSION["wa_current_user"]->username . "'>" . _("Change password") . "</a> \n";
- if ($help_base_url != null)
+ if ($SysPrefs->help_base_url != null)
{
echo "$himg<a target = '_blank' onclick=" .'"'."javascript:openWindow(this.href,this.target); return false;".'" '. "href='". help_url()."'>" . _("Help") . "</a> ";
}
function menu_footer($no_menu, $is_index)
{
- global $version, $allow_demo_mode, $app_title, $power_url,
- $power_by, $path_to_root, $Pagehelp, $Ajax;
+ global $version, $path_to_root, $Pagehelp, $Ajax, $SysPrefs;
include_once($path_to_root . "/includes/date_functions.inc");
echo "</td></tr></table>\n"; // 'main_page'
{
echo "<table align='center' id='footer'>\n";
echo "<tr>\n";
- echo "<td align='center' class='footer'><a target='_blank' href='$power_url' tabindex='-1'><font color='#ffffff'>$app_title $version - " . _("Theme:") . " " . user_theme() . " - ".show_users_online()."</font></a></td>\n";
+ echo "<td align='center' class='footer'><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'><font color='#ffffff'>".$SysPrefs->app_title
+ ." $version - " . _("Theme:") . " " . user_theme() . " - ".show_users_online()."</font></a></td>\n";
echo "</tr>\n";
echo "<tr>\n";
- echo "<td align='center' class='footer'><a target='_blank' href='$power_url' tabindex='-1'><font color='#ffff00'>$power_by</font></a></td>\n";
+ echo "<td align='center' class='footer'><a target='_blank' href='".$SysPrefs->power_url
+ ."' tabindex='-1'><font color='#ffff00'>".$SysPrefs->power_by."</font></a></td>\n";
echo "</tr>\n";
- if ($allow_demo_mode==true)
- {
- echo "<tr>\n";
- //echo "<td><br><div align='center'><a href='http://sourceforge.net'><img src='http://sourceforge.net/sflogo.php?group_id=89967&type=5' alt='SourceForge.net Logo' width='210' height='62' border='0' align='middle' /></a></div></td>\n";
- echo "</tr>\n";
- }
echo "</table><br><br>\n";
}
}