Access to system settings moved from global scope to SysPrefs.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 10 Jan 2015 15:53:55 +0000 (16:53 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 10 Jan 2015 23:18:35 +0000 (00:18 +0100)
136 files changed:
access/login.php
access/logout.php
access/password_reset.php
admin/attachments.php
admin/backups.php
admin/change_current_user_password.php
admin/company_preferences.php
admin/db/company_db.inc
admin/db/fiscalyears_db.inc
admin/db/maintenance_db.inc
admin/db/users_db.inc
admin/display_prefs.php
admin/inst_chart.php
admin/inst_lang.php
admin/inst_module.php
admin/inst_theme.php
admin/inst_upgrade.php
admin/print_profiles.php
admin/view_print_transaction.php
admin/void_transaction.php
config.default.php
dimensions/inquiry/search_dimensions.php
doc/api_changes.txt
gl/bank_account_reconcile.php
gl/bank_transfer.php
gl/gl_bank.php
gl/gl_journal.php
gl/includes/db/gl_db_rates.inc
gl/includes/db/gl_db_trans.inc
gl/inquiry/balance_sheet.php
gl/inquiry/bank_inquiry.php
gl/inquiry/gl_account_inquiry.php
gl/inquiry/gl_trial_balance.php
gl/inquiry/journal_inquiry.php
gl/inquiry/profit_loss.php
gl/inquiry/tax_inquiry.php
gl/manage/close_period.php
gl/manage/exchange_rates.php
gl/manage/gl_account_classes.php
includes/access_levels.inc
includes/current_user.inc
includes/date_functions.inc
includes/db/connect_db_mysql.inc
includes/db/connect_db_mysqli.inc
includes/db/sql_functions.inc
includes/db_pager.inc
includes/errors.inc
includes/main.inc
includes/page/header.inc
includes/prefs/sysprefs.inc
includes/prefs/userprefs.inc
includes/session.inc
includes/system_tests.inc
includes/types.inc
includes/ui/db_pager_view.inc
includes/ui/ui_lists.inc
includes/ui/ui_view.inc
inventory/adjustments.php
inventory/cost_update.php
inventory/inquiry/stock_movements.php
inventory/manage/items.php
inventory/manage/sales_kits.php
inventory/transfers.php
manufacturing/search_work_orders.php
manufacturing/view/wo_costs_view.php
manufacturing/view/wo_issue_view.php
manufacturing/view/wo_production_view.php
manufacturing/view/work_order_view.php
manufacturing/work_order_add_finished.php
manufacturing/work_order_costs.php
manufacturing/work_order_entry.php
manufacturing/work_order_issue.php
manufacturing/work_order_release.php
purchasing/allocations/supplier_allocate.php
purchasing/allocations/supplier_allocation_main.php
purchasing/inquiry/po_search.php
purchasing/inquiry/po_search_completed.php
purchasing/inquiry/supplier_allocation_inquiry.php
purchasing/inquiry/supplier_inquiry.php
purchasing/manage/suppliers.php
purchasing/po_entry_items.php
purchasing/po_receive_items.php
purchasing/supplier_credit.php
purchasing/supplier_invoice.php
purchasing/supplier_payment.php
purchasing/view/view_grn.php
purchasing/view/view_po.php
purchasing/view/view_supp_credit.php
purchasing/view/view_supp_invoice.php
purchasing/view/view_supp_payment.php
reporting/includes/Workbook.php
reporting/includes/class.graphic.inc
reporting/includes/doctext.inc
reporting/includes/excel_report.inc
reporting/includes/pdf_report.inc
reporting/includes/reporting.inc
reporting/includes/reports_classes.inc
reporting/rep102.php
reporting/rep104.php
reporting/rep109.php
reporting/rep110.php
reporting/rep111.php
reporting/rep202.php
reporting/rep301.php
reporting/rep303.php
reporting/rep705.php
reporting/rep706.php
reporting/rep707.php
reporting/rep708.php
reporting/rep709.php
sales/allocations/customer_allocate.php
sales/allocations/customer_allocation_main.php
sales/create_recurrent_invoices.php
sales/credit_note_entry.php
sales/customer_credit_invoice.php
sales/customer_delivery.php
sales/customer_invoice.php
sales/customer_payments.php
sales/includes/cart_class.inc
sales/includes/db/cust_trans_db.inc
sales/includes/sales_ui.inc
sales/inquiry/customer_allocation_inquiry.php
sales/inquiry/customer_inquiry.php
sales/inquiry/sales_deliveries_view.php
sales/inquiry/sales_orders_view.php
sales/manage/customers.php
sales/manage/recurrent_invoices.php
sales/sales_order_entry.php
sales/view/view_credit.php
sales/view/view_dispatch.php
sales/view/view_invoice.php
sales/view/view_receipt.php
sales/view/view_sales_order.php
themes/aqua/renderer.php
themes/cool/renderer.php
themes/default/renderer.php

index d3154b5240bb3adcbac6c3a3a367fb3af283a940..9c58933d48b264a383d1834007c1b4951618f6ba 100644 (file)
@@ -21,15 +21,15 @@ function defaultCompany()
 }
 </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>";
     }
        }
@@ -40,7 +40,7 @@ function defaultCompany()
 
            $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());
@@ -50,7 +50,7 @@ function defaultCompany()
 
        $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()'" : "";
@@ -79,7 +79,7 @@ function 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>";
        } 
@@ -88,12 +88,12 @@ function defaultCompany()
 
        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);
 
@@ -104,7 +104,7 @@ function defaultCompany()
                        $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>";
@@ -154,10 +154,10 @@ function defaultCompany()
        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";
index 0a2a2ba9a82ef4392eabcc08ff51cbd8bf07e32f..bb30e713a42f926cdcdaf7c5fa6ec96e3b244824 100644 (file)
@@ -31,7 +31,7 @@ echo "<table width='100%' border='0'>
     <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>
index b1fba1b061696d04a6970ae97db24cf44fc45ffd..afa2a1ec01305209d87fa12396c0115ed28c3cf4 100644 (file)
@@ -28,7 +28,7 @@ function defaultCompany()
 
        $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()'" : "";
@@ -53,12 +53,12 @@ function 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);
 
@@ -66,7 +66,7 @@ function defaultCompany()
     $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>";
@@ -105,10 +105,10 @@ function defaultCompany()
        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";
index 347c1be5aa23d1f52520593fe322c9fc1b9a5758..4803ca771e00744abfeab67b1999db85882a1def 100644 (file)
@@ -69,7 +69,7 @@ if ($download_id != -1)
 }
 
 $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);
 
index 07c6212bca81fc8840f043483142665181161f73..63f15a018f5370eab48fdabd9458ee4c1f5e12d0 100644 (file)
@@ -16,6 +16,8 @@ include_once($path_to_root . "/includes/session.inc");
 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.'));
@@ -57,7 +59,7 @@ function check_paths()
 
 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);
index b226cd553b6e5f42e16f909efd927b0d14ad62a2..1b69e00ec5f7fdea54e09a49ad0be8494c9a83ec 100644 (file)
@@ -64,7 +64,7 @@ if (isset($_POST['UPDATE_ITEM']) && check_csrf_token())
 
        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, 
index 9a7b772b3ae8b3f2082b8ff9724ebd9ab2b2f3d0..b889aeb96031bbdedc115bdc56463648ce74a897 100644 (file)
@@ -52,9 +52,9 @@ if (isset($_POST['update']) && $_POST['update'] != "")
                        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" )
index 1346aa3ad457cc1970654f71dbb490c45cf0aaab..3b66dc4cc12fd05796117b5594052f8d9571f55c 100644 (file)
@@ -36,7 +36,7 @@ function get_company_pref($prefs = null)
        
        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
@@ -216,3 +216,20 @@ function clean_user_themes($theme)
 }
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index cec7380561f87db3aaa39aadc9ed171b39c19ca1..0d9a9d21646f463349790225860b1c1649f99004 100644 (file)
@@ -48,8 +48,6 @@ function get_fiscalyear($id)
 
 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);
index fd30bc2ca6ef88ec0ac38675f9765eccf38b7ed1..6a66ce08046108ce729e6bbea805e1d9bc3d2dae 100644 (file)
@@ -263,9 +263,10 @@ function write_lang()
 */
 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', 
@@ -413,8 +414,8 @@ function db_import($filename, $connection, $force=true, $init=true, $protect=fal
 /*/
        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))
@@ -457,7 +458,9 @@ function db_import($filename, $connection, $force=true, $init=true, $protect=fal
        }
 
        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
@@ -530,16 +533,13 @@ function db_unzip($mode, $path)
        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);
 }
 //
@@ -548,7 +548,7 @@ function db_backup($conn, $ext='no', $comm='', $path=null)
 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
@@ -572,8 +572,8 @@ function db_export($conn, $filename, $zip='no', $comment='')
     //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";
@@ -809,7 +809,6 @@ function order_sql_tables($tables, $fks)
 // 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);
 
index 3e0bce2292aa12323fa0a0a99c2d4a8fc0eb8201..8e215a20222f736330edd537fd070fb7cbbe56a5 100644 (file)
@@ -171,9 +171,9 @@ function check_user_activity($id)
 //-----------------------------------------------------------------------------------------------
 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'"); 
index 66acf88dde0ff795e680df18b34044e78ac41a20..e686a81a59ff4d6f1dc493d77a524cb78a3d9a17 100644 (file)
@@ -51,13 +51,13 @@ if (isset($_POST['setprefs']))
 
                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."));
index bb41100d5d9812b77b4891a1548243848e381fca..c291a0308edfddd1401e3088b3b878be2f230dba 100644 (file)
@@ -14,7 +14,7 @@ $path_to_root="..";
 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);
index 73591b6606d564b46d66bea38e5831277daeec68..b2264c1dfd8e7b1b92be0a34f92d3c3b75e3e742 100644 (file)
@@ -17,7 +17,7 @@ include_once($path_to_root."/includes/packages.inc");
 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);
@@ -30,7 +30,7 @@ simple_page_mode(true);
 //
 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"), "", "");
index d2f482c9f2b354c2bd621751903efee556370b4e..eda65097e50426d5cfb4337ffc908d2772792a1d 100644 (file)
@@ -14,7 +14,7 @@ $path_to_root="..";
 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"));
index 259ec7b1fe06988e09a714cf8ba68651eb6b099d..70d8eb60a34afbc5768c5d6704e634a07367fa25 100644 (file)
@@ -14,7 +14,7 @@ $path_to_root="..";
 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);
index 4ff67d52167fb7a212640139a9055726aadd970c..e7b4667c9ba6fc50dc5c250653091d11de0bd04c 100644 (file)
@@ -52,11 +52,10 @@ function get_installers()
 //
 //     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;
 
@@ -110,7 +109,8 @@ if (get_post('Upgrade'))
        // 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(
index ea5535af78e53d821642c7dbad0366971b05633f..bf3d698f7cc0f0c7911dea339e53b7b4f0b71431 100644 (file)
@@ -23,9 +23,9 @@ $selected_id = get_post('profile_id','');
 // 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/',
@@ -105,7 +105,7 @@ if ( get_post('submit'))
                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'));
                }
index a386cbfdd0ff2bddd9075bf31c51ae96d710fa00..0b4de2d25fde1dc98498a595e96ee33c0148a026 100644 (file)
@@ -22,7 +22,7 @@ include_once($path_to_root . "/admin/db/transactions_db.inc");
 
 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);
 
index a77cbce983571970a3629fcecc9a048179bc0f6a..110516072153c1e09b54562f54c022a5177dd508 100644 (file)
@@ -23,7 +23,7 @@ include_once($path_to_root . "/admin/db/voiding_db.inc");
 $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);
index c9651dd6ef07d167276233e22575b0f02866aa58..1b319a2b7487961dc46f15017e78e645c9f652ce 100644 (file)
 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
@@ -41,23 +42,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
        //
        $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";
 
@@ -170,41 +155,6 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
        /* 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
index ea1781a10d305153ecefc444e5ae1679dfc04a22..2d7c8541a9ced0c1645de5ce6cdebb61bdb86871 100644 (file)
@@ -18,7 +18,7 @@ include_once($path_to_root . "/includes/session.inc");
 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();
index 2f4c9838abce8afb57cfe8fb3666cbdef043530a..36c94fe443c6d957b7035c866886d294d6aa5d1b 100644 (file)
@@ -8,7 +8,7 @@ Changed functions:
        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:
@@ -48,7 +48,7 @@ Description:
 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).
index a6d8dd650f88ec48c946f9ad0f51d7bacd6ce8aa..e7b584b1302c829e4f26e847a35247636af842fc 100644 (file)
@@ -23,7 +23,7 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 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();
index a11352a6ebbca0370942f572425476588d8f54c5..7b987636a16162d005e06a133bba6b247720013e 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 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();
index 5815f68306f82accdfa4ad872aa7853f8574f1a7..de4bcc730b46a6ef08e1dac1695ea42c3f861b8d 100644 (file)
@@ -25,7 +25,7 @@ include_once($path_to_root . "/gl/includes/gl_ui.inc");
 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();
index 003e8292bd6c00aa2d794a2a779e748bd7769ce9..a6f264075719fa08f0913f8517828f8f832da285 100644 (file)
@@ -24,7 +24,7 @@ include_once($path_to_root . "/gl/includes/gl_ui.inc");
 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();
index a6162ae2538e60b95b8dd43145c715559deb20aa..0a1abf6251f2f371883060152574c916159dd7b0 100644 (file)
@@ -110,9 +110,11 @@ function delete_exchange_rate($rate_id)
 //
 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;
index 372c516199c9c9d1ed2a06f7b6981fd2c894cf17..cac714b062f1504faeaffde4cb289d75367a84b5 100644 (file)
@@ -19,7 +19,7 @@
 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)
@@ -35,7 +35,7 @@ function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension
                $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;
@@ -106,7 +106,7 @@ function get_gl_transactions($from_date, $to_date, $trans_no=0,
        $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);
@@ -121,7 +121,7 @@ function get_gl_transactions($from_date, $to_date, $trans_no=0,
                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);
index 0243be4d9c3bf1b78b10b9e1490450249689702e..85b22f28723386920ad1f3f4a4a626211e992f4d 100644 (file)
@@ -47,9 +47,9 @@ if (isset($_GET["AccGrp"]))
 
 //----------------------------------------------------------------------------------------------------
 
-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;
@@ -86,7 +86,7 @@ function display_type ($type, $typename, $from, $to, $convert, $dimension, $dime
        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  
@@ -185,7 +185,7 @@ function display_balance_sheet()
                        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 )
                                {
@@ -252,7 +252,7 @@ function display_balance_sheet()
                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
index e25e7ba823502ffffd5b9981b1a2bd6cba1a50fd..efc0fd406065721012908991019f7fed759e839a 100644 (file)
@@ -22,7 +22,7 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 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();
index 1fed9b30a95a90427b70a3ecde1d1dcd43c8829f..3f81e035e3d7dfce4d671f8c43fd5bf24bd3aeac 100644 (file)
@@ -23,7 +23,7 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 
 $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();
index c49b9a166decbe2f33fa7fc15440e15c338096a0..9d422037e96da24a79fdf2f320085dc63f327403 100644 (file)
@@ -69,7 +69,7 @@ function gl_inquiry_controls()
 
 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
@@ -97,7 +97,7 @@ function display_trial_balance($type, $typename)
 
                // 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']);
index 88e36a9171626196387f8641499947ea9f94b812..0b5a47dc0d990b0279e528c5e452bc29d7ff4737 100644 (file)
@@ -19,7 +19,7 @@ include_once($path_to_root . "/includes/session.inc");
 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();
index 1e236159a2f8172bf0b447f36d084e096817db75..347b9ff8539ccdc9d198e27a3dea01602f09e67f 100644 (file)
@@ -168,8 +168,6 @@ function inquiry_controls()
     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>";
@@ -184,13 +182,15 @@ function inquiry_controls()
     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;
@@ -201,7 +201,6 @@ function display_profit_and_loss()
 
        $from = $_POST['TransFromDate'];
        $to = $_POST['TransToDate'];
-       $compare = $_POST['Compare'];
        
        if (isset($_POST["AccGrp"]) && (strlen($_POST['AccGrp']) > 0))
                $drilldown = 1; // Deeper Level
@@ -234,7 +233,7 @@ function display_profit_and_loss()
        $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>";        
        
@@ -332,9 +331,9 @@ function display_profit_and_loss()
 
 start_form();
 
-inquiry_controls();
+$sel = inquiry_controls();
 
-display_profit_and_loss();
+display_profit_and_loss($sel);
 
 end_form();
 
index 4adc57bf9524f6fc8e6b7c15158bc52de99b14f8..ec96716a267b12279ce09d921a63306ac21e582f 100644 (file)
@@ -22,7 +22,7 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 
 $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();
index 68d753575392cd41d29a066d2657a47ed1cc3b55..21a6aaeee806c4d45568d826e20ba80cec781209 100644 (file)
@@ -27,7 +27,7 @@ page(_($help_context = "Closing GL Transactions"), false, false, "", $js);
 //---------------------------------------------------------------------------------------------
 function check_data()
 {
-       global $Refs, $allow_gl_reopen;
+       global $Refs, $SysPrefs;
        
        if (!is_date($_POST['date']) || date1_greater_date2($_POST['date'], Today()))
        {
@@ -43,7 +43,7 @@ function check_data()
        }
        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;
index e2e989a11c1f34c1378be6cf097708096587b452..05953c04bd452d77714077edc71d386fe1b7cc18 100644 (file)
@@ -108,8 +108,9 @@ function display_rates($curr_code)
 
 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 != "")
index 24b7c4e4004bb048d84edb2aec98d2080e8eb045..d02cfdb44674ae91b3af932dfc3f6eecb69becd8 100644 (file)
@@ -24,7 +24,7 @@ simple_page_mode(false);
 
 function can_process() 
 {
-       global $use_oldstyle_convert;
+       global $SysPrefs;
 
        if (strlen(trim($_POST['id'])) == 0) 
        {
@@ -38,7 +38,7 @@ function can_process()
                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;
 }
@@ -108,7 +108,7 @@ $result = get_account_classes(check_value('show_inactive'));
 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);
@@ -121,7 +121,7 @@ while ($myrow = db_fetch($result))
 
        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")));
@@ -147,7 +147,7 @@ if ($selected_id != "")
        
                $_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"];
@@ -165,7 +165,7 @@ else
 
 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);
index 51c0a4beae97c8366fb87e19ef9d4b795e51bf45..c54f02edddee4906c1330fe0af5e3f489355745c 100644 (file)
@@ -250,7 +250,7 @@ $security_areas =array(
        '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
index 80aad22b465029d8efd1b1eeed1a701a8f389a10..c5e2c975521bbfb821eb2b514ffc634b19a02d33 100644 (file)
@@ -59,7 +59,7 @@ class current_user
 
        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;
@@ -77,7 +77,7 @@ class current_user
                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)
@@ -143,7 +143,7 @@ class current_user
        }
 
        function reset_password($company, $email) {
-               global $app_title;
+               global $SysPrefs;
 
                $this->set_company($company);
                $this->logged = false;
@@ -161,7 +161,7 @@ class current_user
 
                        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;
                }
@@ -258,9 +258,9 @@ class current_user
 
        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;
                }
@@ -278,9 +278,9 @@ class current_user
 
        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);
                }
 
@@ -303,9 +303,9 @@ function round2($number, $decimals=0)
 */
 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)));
@@ -405,14 +405,14 @@ function percent_format($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);
 
@@ -579,19 +579,19 @@ function set_user_prefs($prefs)
 }
 
 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";
@@ -720,7 +720,10 @@ function flush_dir($path, $wipe = false)
 */
 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();
index 623452e229c607c116a381f97721dd237f665992..af05456353a76e126a61e83c3f89ec49bf97ebcf 100644 (file)
@@ -21,10 +21,10 @@ this can be a string either "d/m/Y" for UK/Australia/New Zealand dates or
 
 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)
@@ -50,12 +50,12 @@ function __date($year, $month, $day)
 
 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_);
@@ -134,10 +134,10 @@ function is_date($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))
                {
@@ -156,14 +156,14 @@ function is_date($date_)
 
 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);     
 }
@@ -239,24 +239,24 @@ function end_fiscalyear()
 
 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));
        }
@@ -268,14 +268,14 @@ function days_in_month($month, $year)
 
 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);
        }
@@ -285,14 +285,14 @@ function end_month($date)
 
 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);
     }
@@ -302,7 +302,8 @@ function add_days($date, $days) // accepts negative values as well
 
 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;
@@ -311,11 +312,11 @@ function add_months($date, $months) // accepts negative values as well
 
        $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);
     }
@@ -325,14 +326,15 @@ function add_months($date, $months) // accepts negative values as well
 
 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);
     }
@@ -344,7 +346,7 @@ function add_years($date, $years) // accepts negative values as well
 
 function sql2date($date_) 
 {
-       global $date_system;
+       global $SysPrefs;
 
        //for MySQL dates are in the format YYYY-mm-dd
 
@@ -363,9 +365,9 @@ function sql2date($date_)
        {  /*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
@@ -373,12 +375,12 @@ function sql2date($date_)
 
 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 "";
@@ -398,7 +400,7 @@ and converts to a yyyy/mm/dd format */
                $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)
                {
@@ -413,9 +415,9 @@ and converts to a yyyy/mm/dd format */
        {
                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);
index 6767cb25379dbd211fc109e6c35a00fa1925c882..b25f0b239a71fadb7c9d2e1340582503ed278ab6 100644 (file)
@@ -9,17 +9,18 @@
     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;
 
@@ -32,27 +33,23 @@ function set_global_connection($company=-1)
        ///// 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>";
@@ -64,9 +61,9 @@ function db_query($sql, $err_msg=null)
 
        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`)
@@ -75,7 +72,7 @@ function db_query($sql, $err_msg=null)
                }
        }
 
-       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);
@@ -166,9 +163,9 @@ function db_error_msg($conn)
 
 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()
index bb452f2b2faa95543c51f21cbffce9c75f69954f..cc53bcfa25a903af973086a32aa28c27225c99ab 100644 (file)
@@ -9,18 +9,20 @@
     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;
 
@@ -33,27 +35,23 @@ function set_global_connection($company=-1)
        ///// 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>";
@@ -65,9 +63,9 @@ function db_query($sql, $err_msg=null)
 
        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).",
@@ -75,7 +73,7 @@ function db_query($sql, $err_msg=null)
                }
        }
 
-       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);
@@ -164,9 +162,9 @@ function db_error_msg($conn)
 
 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()
index aead5d376e8c2f415925324f39dae6848dee46ce..66a781d25d868c21286076411c8f559df3394ff4 100644 (file)
 //-------------------------------------------------------------------
 // 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");
@@ -48,6 +49,7 @@ function cancel_transaction()
        if ($transaction_level) {
                db_query("ROLLBACK", "could not cancel a transaction"); 
        }
+       $transaction_level = 0;
 }
 
 //-----------------------------------------------------------------------------
index 51dfcccc9ddb1012d9a1fb3df3f5e18b1d4da3b1..f9089e9ee5a0f2ba89f152762f0645f5dab020ad 100644 (file)
@@ -77,6 +77,8 @@ class db_pager {
        //
        function set_sql($sql)
        {
+               global $SysPrefs;
+
                if ($sql != $this->sql) {
                    $this->sql = $sql;
                    $this->ready = false;
@@ -94,7 +96,7 @@ class db_pager {
                                                $this->select = $parts[0];
                                                $sql = $parts[1];
                                        } else {
-                                               if ($go_debug)
+                                               if ($SysPrefs->go_debug)
                                                        display_error("Invalid sql input for db_pager");
                                        }
 
@@ -346,7 +348,7 @@ class db_pager {
        //
        function _init() 
        {
-               global $go_debug;
+               global $SysPrefs;
                
            if ($this->ready == false ) {
                        $sql = $this->_sql_gen(true);
@@ -358,7 +360,7 @@ class db_pager {
                        $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) {
index 781e2232dc66a42f59a25e1282d1b7ed7b863b16..7c911fcef1d9d755185d0bde0e94f1c66bcf3dad 100644 (file)
@@ -56,7 +56,7 @@ function get_backtrace($html = false, $skip=0)
 //    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
@@ -71,7 +71,7 @@ function error_handler($errno, $errstr, $file, $line) {
                }
        }
 
-       $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()) {
@@ -91,7 +91,7 @@ function error_handler($errno, $errstr, $file, $line) {
 //     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',
@@ -103,7 +103,7 @@ function fmt_errors($center=false) {
 //  $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;
@@ -123,7 +123,7 @@ function fmt_errors($center=false) {
                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;
        }
@@ -168,7 +168,7 @@ function end_flush() {
 
 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();
@@ -185,16 +185,16 @@ function display_db_error($msg, $sql_statement=null, $exit=true)
                $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)
@@ -208,10 +208,8 @@ function display_db_error($msg, $sql_statement=null, $exit=true)
 
 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;
        }
@@ -221,13 +219,13 @@ function frindly_db_error($db_error)
 
 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);
                }
                
@@ -241,6 +239,6 @@ function check_db_error($msg, $sql_statement, $exit_if_error=true, $rollback_if_
                        end_page(); exit;
                }
        }
-       return $db_error;               
+       return $db_error;
 }
 
index 6ac3fc14837a177c57974203b947a01f91f949d0..11746a288b386bc254d0ea2b6ab4fdd6b436480e 100644 (file)
@@ -23,6 +23,12 @@ include_once($path_to_root . "/includes/ui/ui_view.inc");
 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='')
 {
@@ -64,9 +70,9 @@ function end_page($no_menu=false, $is_index=false, $final_screen=false, $type_no
 
 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;
@@ -117,7 +123,7 @@ function add_js_ufile($filename)
 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;
index c7df52411eb7ffb01253bb20ac7a212cf7f0fcb0..880c03f449489eb4ac4729bfbb63327ce3741dd2 100644 (file)
@@ -15,7 +15,7 @@
 function help_url($context=null)
 {
 
-       global $help_base_url, $help_context, $old_style_help;
+       global $SysPrefs, $help_context;
 
        $country = $_SESSION['language']->code;
        $clean = 0;
@@ -34,20 +34,20 @@ function help_url($context=null)
                $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)
@@ -55,7 +55,7 @@ function send_scripts()
                $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="'.
@@ -73,7 +73,7 @@ function send_scripts()
 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
@@ -85,7 +85,7 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
 
        $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'))
                {
index 5639f043be251109eb226c629680c51cce9f0d11..bf68576823f16072319ffbdb224f34a1d16a7cf4 100644 (file)
@@ -18,15 +18,29 @@ class sys_prefs
 
        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
@@ -83,8 +97,7 @@ class sys_prefs
        
        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() 
index dcbc9fcd8c22c05a343ac0809a843ac5c3731582..060f764fa570cf0520c07cd3d12a42ab17b183ce 100644 (file)
@@ -45,10 +45,10 @@ class user_prefs
        {
                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;
@@ -180,8 +180,8 @@ class user_prefs
 
        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)
index 15d21d84951f357d99d48a19f8e1d0a5979c5b4f..b5cb1e2ea3637ed5efe47a321cf8f6e8c2dc1549 100644 (file)
@@ -175,11 +175,11 @@ function password_reset_success()
 
 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;
@@ -190,7 +190,7 @@ function check_faillog()
 */
 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;
 
@@ -201,7 +201,7 @@ function write_login_filelog($login, $result)
 
        if (!$result)
        {
-               if ($login_faillog[$user][$ip] < @$login_max_attempts) {
+               if ($login_faillog[$user][$ip] < @$SysPrefs->login_max_attempts) {
 
                        $login_faillog[$user][$ip]++;
                } else {
@@ -345,11 +345,11 @@ if (!isset($path_to_root))
 //----------------------------------------------------------------------------------------
 // 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
@@ -379,6 +379,23 @@ foreach ($installed_extensions as $ext)
                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.
@@ -396,10 +413,9 @@ $Session_manager->sessionStart('FA'.md5(dirname(__FILE__)));
 // 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
@@ -456,7 +472,7 @@ if (!defined('FA_LOGOUT_PHP_FILE')){
 
        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");
@@ -539,7 +555,6 @@ if (!defined('FA_LOGOUT_PHP_FILE')){
        }
 }
 
-$SysPrefs = &$_SESSION['SysPrefs'];
 
 // POST vars cleanup needed for direct reuse.
 // We quote all values later with db_escape() before db update.
index dca83e51c4858245c54fcc536d815769cd76ab6b..883ee038d1b2e8a1174d2e3b41945b6371be6a99 100644 (file)
@@ -120,10 +120,10 @@ function tst_gettext()
 
 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');
 
@@ -132,8 +132,9 @@ function tst_debug()
 
 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
index 65805a901787bbeb8fbf5ddc9444a74629c212b8..2c233be66f927b14074059665f7ca64c6388c09f 100644 (file)
@@ -186,8 +186,9 @@ define('CL_EXPENSE', 6);
 
 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);
index 717df95f586e3519ee40c0286e899b49714f9996..96609dc3afe1afefb983e613bf33020a5fbe8908 100644 (file)
@@ -40,7 +40,7 @@ function navi_button_cell($name, $value, $enabled=true, $align='left') {
 //    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();
 
index 689646629c675e069cc0d4c7bd336ddd77302855..f604f69a6a190ad25f213a01d14a2bcd8666c8c9 100644 (file)
@@ -13,13 +13,11 @@ include_once($path_to_root . "/includes/banking.inc");
 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
@@ -266,9 +264,8 @@ $opts = array(              // default options
 
         // 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";
        }
@@ -282,8 +279,7 @@ $opts = array(              // default options
                        .(!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";
                }
@@ -394,8 +390,7 @@ $opts = array(              // default options
        $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";
        }
@@ -419,9 +414,9 @@ function _format_add_curr($row)
 
 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();
@@ -435,7 +430,6 @@ function add_edit_combo($type)
 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 ";
 
@@ -452,7 +446,7 @@ function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_
                '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') :
@@ -487,7 +481,6 @@ function supplier_list_row($label, $name, $selected_id=null, $all_option = false
 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 ";
 
@@ -505,7 +498,7 @@ function customer_list($name, $selected_id=null, $spec_option=false, $submit_on_
                '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') :
@@ -543,7 +536,6 @@ function customer_list_row($label, $name, $selected_id=null, $all_option = false
 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)." ";
@@ -557,7 +549,7 @@ function customer_branches_list($customer_id, $name, $selected_id=null,
                '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')
        ) );
@@ -593,14 +585,13 @@ function customer_branches_list_row($label, $customer_id, $name, $selected_id=nu
 
 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
        ) );
 }
@@ -739,7 +730,6 @@ function dimensions_list_row($label, $name, $selected_id=null, $no_option=false,
 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";
@@ -752,7 +742,7 @@ function stock_items_list($name, $selected_id=null, $all_option=false,
          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,
@@ -794,7 +784,6 @@ function stock_items_list_row($label, $name, $selected_id=null, $all_option=fals
 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
@@ -820,7 +809,7 @@ function sales_items_list($name, $selected_id=null, $all_option=false,
          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,
@@ -1382,14 +1371,13 @@ function bank_reconciliation_list_row($label, $account, $name, $selected_id=null
 
 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,
        ) );
 }
 
@@ -1446,7 +1434,6 @@ function bank_accounts_list_row($label, $name, $selected_id=null, $submit_on_cha
 
 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
@@ -1458,7 +1445,7 @@ function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_cha
        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
@@ -1583,7 +1570,6 @@ function stock_categories_list_row($label, $name, $selected_id=null, $spec_opt=f
 
 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";
 
@@ -1592,7 +1578,7 @@ function gl_account_types_list($name, $selected_id=null, $all_option=false, $all
                'format' => '_format_account',
                'order' => array('class_id', 'id', 'parent'),
                'spec_option' =>$all_option,
-               'spec_id' => $all_items
+               'spec_id' => ALL_TEXT
        ) );
 }
 
@@ -1810,37 +1796,37 @@ function wo_types_list_row($label, $name, $selected_id=null)
 
 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";
 }
 
@@ -1867,10 +1853,10 @@ function themes_list_row($label, $name, $value=null)
 
 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>";
@@ -1937,13 +1923,12 @@ function journal_types_list_cells($label, $name, $value=null, $submit_on_change=
 
 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"),
@@ -1956,11 +1941,10 @@ function cust_allocations_list_cells($label, $name, $selected=null)
 
 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"),
@@ -1973,11 +1957,10 @@ function supp_allocations_list_cell($name, $selected=null)
 
 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"),
@@ -2179,7 +2162,6 @@ function class_types_list_row($label, $name, $selected_id=null, $submit_on_chang
 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";
 
@@ -2407,7 +2389,6 @@ function tax_algorithm_list_row($label, $name, $value=null, $submit_on_change=fa
 
 function subledger_list($name, $account, $selected_id=null)
 {
-       global $all_items;
 
        $type = is_subledger_account($account);
        if (!$type)
index 0b4f31138de66cae22ae324e81c4f559e2286144..8fee0ae0bf3c9b88a1cf3ea1843c3553ba6ad3f8 100644 (file)
@@ -272,7 +272,7 @@ function check_ui_refresh($name=null)
 //
 function exchange_rate_display($from_currency, $to_currency, $date_, $force_edit=false)
 {
-    global $Ajax, $xr_provider_authoritative;
+    global $Ajax, $SysPrefs;
 
        $readonly = false;
 
@@ -299,7 +299,7 @@ function exchange_rate_display($from_currency, $to_currency, $date_, $force_edit
                                        $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;
@@ -424,6 +424,7 @@ function display_debit_or_credit_cells($value, $bold=false)
 function display_customer_trans_tax_details($tax_items, $columns)
 {
        global $SysPrefs;
+
        $first = true;
     while ($tax_item = db_fetch($tax_items))
     {
@@ -888,13 +889,14 @@ function reset_focus()
 
 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)
index 8fde40770c6811a8633b6330a2f338a610ba4945..0b47fa49532925058791afd10d303d30a96c4c9f 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/data_checks.inc");
 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();
index 8abab67198a3ccec976d9ea4c0a1c4d8a8e73f77..4fcb852d69ed27be158bba9d005d06c8a7dc34e6 100644 (file)
@@ -24,7 +24,7 @@ include_once($path_to_root . "/includes/data_checks.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(900, 500);
 page(_($help_context = "Inventory Item Cost Update"), false, false, "", $js);
 
index 892b6c6476d351cb16a47384f26ca9947cf1f521..c368d223ce0914d35e5024d3ee7c2f4c30e35a3b 100644 (file)
@@ -19,7 +19,7 @@ include_once($path_to_root . "/sales/includes/sales_db.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();
index 08a2d9a6ac2df239a36d899549341dabfe4790e5..0b069ea3c66702305a50a89ba2e5628175f4b273 100644 (file)
@@ -14,7 +14,7 @@ $path_to_root = "../..";
 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();
@@ -81,9 +81,9 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '')
                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" ) 
@@ -254,9 +254,9 @@ if (isset($_POST['delete']) && strlen($_POST['delete']) > 1)
        }
 }
 
-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);
 
@@ -396,7 +396,7 @@ function item_settings(&$stock_id)
         // 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 
@@ -474,7 +474,7 @@ tabbed_content_start('tabs', array(
        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;
index 1ccc53162aaff818e9a1751c46ac7db93e7fde2d..4368bb7a12fee3323dfb42ce725443f192e81fed 100644 (file)
@@ -141,7 +141,7 @@ if (get_post('update_name')) {
 }
 
 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')
 {
index 2dbd00b3dd7192c5c3d5868db18c1c3756a2265a..155e1055bba8f493a5267f37bec9c0bc87021c22 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/data_checks.inc");
 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();
index b0c8688e644a3990e8d6befcd20d6a68ecf3b289..d79fc1dc2aeead789c37acf56bc49bb99becd835 100644 (file)
@@ -17,7 +17,7 @@ include_once($path_to_root . "/includes/session.inc");
 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))
 {
index 9c63eb6c44fe96aa32e8cb1382cf47de7ac88f9c..ff474a97a8b84596a22071cd8c3fb4dcae078078 100644 (file)
@@ -15,7 +15,7 @@ $path_to_root = "../..";
 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);
 
index c1fb044fd4b2322b00304091310be20c5a75733d..6787dee678c24d8b62c734b7f6f6b583551a7258 100644 (file)
@@ -14,7 +14,7 @@ $path_to_root = "../..";
 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);
 
index 95eedab094665b16ef7bd41445cb58e51869557f..0661fd1e43ca1c8b9ab72f5377c8539ac8f575dd 100644 (file)
@@ -15,7 +15,7 @@ $path_to_root = "../..";
 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);
 
index 2cd9619db549fb5d09b19acc2d081c8691d129a5..b298555e24e1031502fb5a7a082b5ca9529fdd23 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/data_checks.inc");
 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);
 
index 23d3d192ba2d45dca436247ceb805867d08de4ae..1d42cbf643ceb86be1945854c0ae1e34f0852188 100644 (file)
@@ -22,7 +22,7 @@ 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(900, 500);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
@@ -68,9 +68,9 @@ if (strlen($wo_details[0]) == 0)
 
 //--------------------------------------------------------------------------------------------------
 
-function can_process()
+function can_process($wo_details)
 {
-       global $wo_details, $SysPrefs, $Refs;
+       global $SysPrefs, $Refs;
 
        if (!$Refs->is_valid($_POST['ref']))
        {
@@ -157,7 +157,7 @@ function can_process()
 
 //--------------------------------------------------------------------------------------------------
 
-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;
index 87c59fe2723a6970bf2a3a1a1ec4f6867ac1797d..32184da9151fa3115270d2006322590a5db13f6e 100644 (file)
@@ -22,7 +22,7 @@ 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(900, 500);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
index a1280391c4b4438d1f2a8d139a76a3272137faed..37d761e1c9cb194c9f5c1baccfb3334bf09216ff 100644 (file)
@@ -22,7 +22,7 @@ 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(900, 500);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
index 66bf9fbdd3f9166f362db6878ed0e27624a7a92b..4f7837b444f8736d7bbbb7e1b83e054738a9ae2f 100644 (file)
@@ -23,7 +23,7 @@ include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
 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();
index 7e0f54f2262617f069872f357892951f6f0fef03..2837f5e9eac2fcc2082a17ba62bb50db831c4abd 100644 (file)
@@ -20,7 +20,7 @@ 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);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
index 80e235576b01885a97bd1b252d2dd09ca7a7b6f1..d26ed61bf796ce02c4e51dbf09c0f11c22ea8bd1 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/sales/includes/sales_db.inc");
 //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');
index 907b1e53d38f7d0e0bff032b28da246167885643..d4fef6408ec545e7833dd6daed9a713a48f0ff87 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/banking.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 = "Supplier Allocations"), false, false, "", $js);
 
index 5aa19b4e5ab8c8e9907fc093f1c1f743bb4f7894..42446bb28f8567b9648b5b2e7e2bbf33dfd6b398 100644 (file)
@@ -18,7 +18,7 @@ include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
 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();
index 7a89e4eb9986aa29b555f4285409c15d442915fe..74b8f719e570e3758a9a2e45064cb722989c6de7 100644 (file)
@@ -18,7 +18,7 @@ include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
 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();
index 62dddd94e5857af686719310324b63712a1b7b74..fe80c722d51b77fba408840d125fd1d0af2e4f21 100644 (file)
@@ -16,7 +16,7 @@ include($path_to_root . "/includes/session.inc");
 
 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();
index 4abd00007b17a4b22ca9fe50ef11a671ff392d85..88c30d23a3feaa9736fec7226e4ebc8ee809912f 100644 (file)
@@ -18,7 +18,7 @@ include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
 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();
index 058f2bc1b2789fc18611d8fba65e8c3575d503b4..f36213117801af990b984282fbabb50b85275821 100644 (file)
@@ -14,7 +14,7 @@ $path_to_root = "../..";
 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();
index 77ace907d6a88297a3cfe93f876906086b18ae2b..086303bd06931596a9d2bc78690a3e97190b8ee2 100644 (file)
@@ -31,7 +31,7 @@ set_page_security( @$_SESSION['PO']->trans_type,
 );
 
 $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();
index bc1115897e16e3d07e3a8d7cc5cfa8bae23e5d54..30d18878855caa7789370ad250e0464e688b2a73 100644 (file)
@@ -18,7 +18,7 @@ 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();
index e57ef09f973f68b41363259b3d098a5583ede44a..c2fe7c6113f9d7cfcdb62c792b55392903396107 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/data_checks.inc");
 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();
@@ -161,7 +161,7 @@ if (isset($_POST['AddGLCodeToTrans'])) {
 
 function check_data()
 {
-       global $total_grn_value, $total_gl_value, $Refs, $SysPrefs;
+       global $Refs, $SysPrefs;
 
        if (!$_SESSION['supp_trans']->is_valid_trans_to_post())
        {
@@ -210,12 +210,6 @@ function check_data()
                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))
@@ -356,9 +350,9 @@ invoice_header($_SESSION['supp_trans']);
 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']);
index 94b65f4df545aa99ee0cfb4beaf77fc68054b299..7bc308afc5e8de698ea153f69e0a5a001e1a088f 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/includes/data_checks.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();
@@ -257,8 +257,7 @@ if (isset($_POST['PostInvoice']))
 
 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)
        {
@@ -275,7 +274,7 @@ function check_item_data($n)
        }
 
        $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 ||
@@ -290,7 +289,7 @@ function check_item_data($n)
                }
        }
 
-       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)))
index d43f227392cc9b93807a9242f3df4c91fed1e8e0..babb02d9df4ed9283508d9b4bdc575035eb99b8f 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
 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();
index 79f38a71c7df6d98317755129c2bc3c62617eef6..addb95fec6fed32a0054bdd645fc99abe9d033b6 100644 (file)
@@ -16,7 +16,7 @@ include($path_to_root . "/purchasing/includes/po_class.inc");
 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);
 
index dd2ffeb5785633736c2bc5d87286c169335987d5..666a637b13a931b94184987883a209824a74157b 100644 (file)
@@ -17,7 +17,7 @@ include($path_to_root . "/includes/session.inc");
 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);
 
index 243f8e60a0ed7dbd0f76216ffb39eefb2b924e07..0025962ae93406b4132e79769db814b88cc0172f 100644 (file)
@@ -18,7 +18,7 @@ include_once($path_to_root . "/includes/session.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);
 page(_($help_context = "View Supplier Credit Note"), true, false, "", $js);
 
index e2e0710ec8546da050de9d9066a2c2a052d56e3e..98d5cdc4dd75560e70338e476d48f78dc93953c0 100644 (file)
@@ -19,7 +19,7 @@ include_once($path_to_root . "/includes/session.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);
 page(_($help_context = "View Supplier Invoice"), true, false, "", $js);
 
index 43877659b2da32bed88c6819c186b61deee89fd1..1cee060ebf4f89f3625d409eaf0f90baf751059b 100644 (file)
@@ -17,7 +17,7 @@ include($path_to_root . "/includes/session.inc");
 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);
 
index bfc0c8efd545b6ef4ba14f8859da209fe8e1b811..718bdb66343e1bec237c5d543d7ce6af309e799f 100644 (file)
@@ -102,7 +102,6 @@ define('SPREADSHEET_EXCEL_WRITER_EQ', "=");
 */
 define('SPREADSHEET_EXCEL_WRITER_NE', "<>");
 
-$encoding_string='';
 /**
 * Class for creating OLE streams for Excel Spreadsheets
 *
@@ -4878,11 +4877,10 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
     */
     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 */
@@ -7744,7 +7742,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
 /*        
         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);
index d5e86fb463ae605b787d621d16ea789a936774ee..60b41021fa124846d56b9ca86b3564d7e276a545 100644 (file)
@@ -151,15 +151,15 @@ class graph
        
     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;
@@ -1074,7 +1074,9 @@ function utf8_chr($uni)
        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)),
@@ -1117,29 +1119,22 @@ $p_chars = array (
     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);
index be391fde7392bb3905c77ca602327c691b11f678..439d7b8f0e11f44297aea5b74774ec5310b6d92c 100644 (file)
@@ -14,6 +14,8 @@
 *      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'],
index 214bcfde04aad6f0e03bca71021b6e53db027891..f139ba836465caa053f39ee787d1316b95341c25 100644 (file)
@@ -61,7 +61,8 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
 
        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"));
@@ -99,7 +100,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
                $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)
@@ -225,7 +226,6 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
        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)
index 70a7e88d2f1826784a019352e80b25a5a952b142..e64b7f5a5a13a4688bfa28c4dc0c8adf1e2dba8d 100644 (file)
@@ -253,12 +253,12 @@ class FrontReport extends Cpdf
                $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");
@@ -423,8 +423,7 @@ class FrontReport extends Cpdf
        */
        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;
@@ -947,9 +946,9 @@ class FrontReport extends Cpdf
 
        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));
index caffb6888a22062987b309dab734dbaebdb24143..707bb172f4923d6ea97fe8b85900767706474ffe 100644 (file)
@@ -125,7 +125,7 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no,
 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;
 
@@ -137,7 +137,7 @@ function print_link($link_text, $rep, $pars = array(), $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);
index ffeb42be524762b2238214817949431a2a5b9ac5..dd2e069f223ce9396a1852f5e226e52284aed02b 100644 (file)
@@ -47,7 +47,7 @@ class BoxReports
 
        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');
@@ -99,7 +99,7 @@ class BoxReports
                                                . "<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";
@@ -167,7 +167,7 @@ class BoxReports
        //
        function get_ctrl($name, $type)
        {
-               global $path_to_root, $pdf_debug, $SysPrefs,
+               global $path_to_root, $SysPrefs,
                        $type_shortcuts;
 
                $st = '';
index d0856e0c554977c578134a4d7ef3316ee1fa10d5..ca14dc0362446b526ef5e28fd689428a6119b9f2 100644 (file)
@@ -238,16 +238,16 @@ function print_aged_customer_analysis()
        $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;
index b431fe3e853adb02a401cc2eefb61c4ed9fe4eb6..f73a2c4a2a079c9f3b49b73da73acb795a50af7e 100644 (file)
@@ -66,7 +66,7 @@ function get_kits($category=0)
 
 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'];
@@ -169,10 +169,10 @@ function print_price_listing()
                        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();
                        }
                }
index d01c9bdae0e865ff9a6e948b4e840859eb9590be..a7dfbf13eb72224727af8aa2302105d6b08acb41 100644 (file)
@@ -29,11 +29,9 @@ include_once($path_to_root . "/taxes/tax_calc.inc");
 
 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");
 
index 665d20f3f52d55991fc2ee481c133a2ba90a01b5..85b17ddb01f6fcc3bfc41128060cafedda4f3e4d 100644 (file)
@@ -25,7 +25,6 @@ include_once($path_to_root . "/includes/date_functions.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();
@@ -34,7 +33,7 @@ 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");
 
index 11284eda20f273f0b6a7181c90a44a7fad919ef6..95ce5318b9cdfd3545bc3b3b1ae5774e7ea47e14 100644 (file)
@@ -31,7 +31,7 @@ print_sales_quotations();
 
 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");
 
@@ -48,8 +48,8 @@ function print_sales_quotations()
        $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);
 
@@ -127,10 +127,10 @@ function print_sales_quotations()
                                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();
                                }
                        }
index e6cc707b8255e5510f16b665b7859e64e9501117..61303541b7c148788ce5fc1626c524e1498db6d0 100644 (file)
@@ -72,7 +72,7 @@ function get_invoices($supplier_id, $to, $all=true)
 
 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'];
@@ -246,16 +246,15 @@ function print_aged_supplier_analysis()
        $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;
index 953bafcad3544903091020f04260ae9f392fa8e0..fe8b58e743a9480ee840c37aad03ea6f99f5ff84 100644 (file)
@@ -133,7 +133,7 @@ function getTransactions($category, $location, $date)
 
 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'];
@@ -211,7 +211,7 @@ function print_inventory_valuation_report()
                        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;
index 4549a02a3b98ca66f44d9fed84dd9d57304a8a1b..9794e8c7b3b58b907b5c13565e7c6dc451adf7f5 100644 (file)
@@ -71,7 +71,7 @@ function getTransactions($category, $location, $item_like)
 
 function print_stock_check()
 {
-    global $path_to_root, $pic_height;
+    global $path_to_root, $SysPrefs;
 
        $category = $_POST['PARAM_0'];
        $location = $_POST['PARAM_1'];
@@ -204,10 +204,10 @@ function print_stock_check()
                        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();
                        }
                }
index c09d0a47d07af7b2609827922c9db948cae9ce1f..c9b3fd1ac201d9e77aa58c52bef63098354e4038 100644 (file)
@@ -163,7 +163,7 @@ function display_type ($type, $typename, $yr, $mo, $convert, &$dec, &$rep, $dime
 
 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;
@@ -218,9 +218,9 @@ function print_annual_expense_breakdown()
        $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));
index 6c7f5c6458859cf8c0edc331e3d332e3a80d14a2..f54fddc6769871fcc629bb2af93ced0538cd0df7 100644 (file)
@@ -127,7 +127,7 @@ print_balance_sheet();
 
 function print_balance_sheet()
 {
-       global $path_to_root;
+       global $path_to_root, $SysPrefs;
 
        $dim = get_company_pref('use_dimension');
        $dimension = $dimension2 = 0;
@@ -303,16 +303,15 @@ function print_balance_sheet()
                $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;
index fe3efeddb8d8cc64d5e6bd19276307f29ca0111a..bdf8c3ba8290652b16fa3c3bef526205037d3668 100644 (file)
@@ -150,7 +150,7 @@ function Achieve($d1, $d2)
 
 function print_profit_and_loss_statement()
 {
-       global $path_to_root;
+       global $path_to_root, $SysPrefs;
 
        $dim = get_company_pref('use_dimension');
        $dimension = $dimension2 = 0;
@@ -321,16 +321,15 @@ function print_profit_and_loss_statement()
        $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;
index e965ae182c224fb9c7871da8a4b6084723f77501..a7a0df3a142dc723af77289fd829f05d3ad594f4 100644 (file)
@@ -31,7 +31,7 @@ $pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0;
 
 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  
        
@@ -57,7 +57,7 @@ function display_type ($type, $typename, &$dec, &$rep, $from, $to, $zero, $balan
                
                // 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']);
index 46aae6ba1a0a7ffb5adf3208394f8fed415488fa..b9cd1171272cbf905579c3589375c230b4fef819 100644 (file)
@@ -78,7 +78,7 @@ function getTaxInfo($id)
 
 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'];
index 2c5da35db02aba69f4665af4bff9b68f08a5ef5a..ab3a30013ab7cf11ea2c7d3dd960379d14e52321 100644 (file)
@@ -20,7 +20,7 @@ include_once($path_to_root . "/sales/includes/sales_db.inc");
 //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');
index bac9c899899ee64f943c5ab8162c7c1ba1791562..766f6312635e604a67da0cf813168a3e55c7068d 100644 (file)
@@ -17,7 +17,7 @@ include_once($path_to_root . "/includes/session.inc");
 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);
 
index 7a626e4addd5b55987de33bd043b9a2202e2870b..9b825d0115b53417264b9118c2860f97f2122272 100644 (file)
@@ -18,7 +18,7 @@ include_once($path_to_root . "/includes/ui.inc");
 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();
index 0673415bff6d50b6d7bf381d76af6c884749102e..f32e2268d8bfc8e39b1ffec802d8ef48fab97838 100644 (file)
@@ -26,7 +26,7 @@ include_once($path_to_root . "/sales/includes/ui/sales_order_ui.inc");
 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()) {
index e87113ffa5c6aa850c1094ca6e0fa0d5f40c6fe0..b64a57a07aa27d372748434b9a9dc54a948abae5 100644 (file)
@@ -26,7 +26,7 @@ include_once($path_to_root . "/sales/includes/sales_ui.inc");
 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);
 }
 
index fb7efe0a0394ab124b1c10d1c9f9314ecfc8bca0..9cbd252710e176255427609d416ac0eb8118edc7 100644 (file)
@@ -26,7 +26,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc");
 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()) {
index 588f0f56a652386616ecccc7846b72b3e75f282e..7f46f16968f61aea38bf28f7c13bd701422fcae5 100644 (file)
@@ -27,7 +27,7 @@ include_once($path_to_root . "/taxes/tax_calc.inc");
 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()) {
index 1f49461c400f3d13f488295e31789b49061eb769..956023bbcf14933bb17609686ca63dc1a1b651f6 100644 (file)
@@ -21,7 +21,7 @@ include_once($path_to_root . "/sales/includes/sales_db.inc");
 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()) {
index 612391642ccbbb5f9f3ef923ef9db3c980757752..4a99d3cd4800d226dd2dc7e11d046c508d924455 100644 (file)
@@ -116,10 +116,10 @@ class cart
        */
        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;
index f9c12a4dcd42523990e94d8c3fe216d4410eaf2e..65db5a75377e89f93d53c334c0686b0d7c0c39ff 100644 (file)
@@ -119,7 +119,7 @@ function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo,
 
 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,"
@@ -188,14 +188,14 @@ function get_customer_trans($trans_id, $trans_type)
 
        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;
index 378f336127fc3fe22d417cc954b1587abb785e90..73b99ca610bcd6925f1f5782a706a8e245643c51 100644 (file)
@@ -44,9 +44,9 @@ function processing_active()
 */
 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();
index a67a7b245875131047934d5b075f0d845111a9b5..968600bb15e47832818228caa0b60d368d6b49d4 100644 (file)
@@ -18,7 +18,7 @@ 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);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
index 123066edebe6f1ab6f09e5443368e8807a286c95..34b06832e0e292aeb95642afdd25c5ceb3faf95c 100644 (file)
@@ -19,7 +19,7 @@ include_once($path_to_root . "/sales/includes/sales_db.inc");
 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();
index b9ed9b6e6b06cc4a015307fb53706ca4b71b83d6..7bcea70fcc6ff93998bf865fbe1691d2be8db2b5 100644 (file)
@@ -18,7 +18,7 @@ include($path_to_root . "/sales/includes/sales_ui.inc");
 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();
index f5977aa791bb0bb9444ad87ffcb92c50cd67c760..0095a418f78e542b1e039385abd454c0f669f6c5 100644 (file)
@@ -71,7 +71,7 @@ else
 }
 
 $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();
index 84bdfe68cb8d452e468ab6eecbf5c9011f1de38e..e7e21e894dab641b8f74eb2ac02a33e674f2833d 100644 (file)
@@ -15,7 +15,7 @@ $path_to_root = "../..";
 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();
@@ -79,7 +79,7 @@ function can_process()
 
 function handle_submit(&$selected_id)
 {
-       global $path_to_root, $Ajax, $auto_create_branch;
+       global $path_to_root, $Ajax, $SysPrefs;
 
        if (!can_process())
                return;
@@ -108,7 +108,7 @@ function handle_submit(&$selected_id)
 
                $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'], '',
@@ -129,7 +129,7 @@ function handle_submit(&$selected_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');
@@ -187,7 +187,7 @@ if (isset($_POST['delete']))
 
 function customer_settings($selected_id) 
 {
-       global $SysPrefs, $path_to_root, $auto_create_branch;
+       global $SysPrefs, $path_to_root;
        
        if (!$selected_id) 
        {
@@ -250,7 +250,7 @@ function customer_settings($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);
@@ -290,7 +290,7 @@ function customer_settings($selected_id)
        }
 
        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');
index bce635a8086782452ccb8d855fbbd62b53fbbc3f..8a08a6d1c63d652b209346124afe2d2e18e1489a 100644 (file)
@@ -16,7 +16,7 @@ include($path_to_root . "/includes/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, 600);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
index fa9fee184468cf524db4c2ba22365b1e62f31c1f..2a0aa0b63b8b7be6eecc8f6c06efcdcb873f76b3 100644 (file)
@@ -51,7 +51,7 @@ set_page_security( @$_SESSION['Items']->trans_type,
 
 $js = '';
 
-if ($use_popup_windows) {
+if ($SysPrefs->SysPrefs->use_popup_windows) {
        $js .= get_js_open_window(900, 500);
 }
 
index f006f4f3467783655244541ad6b85ee8d3c75927..f7e8c2995f5362eecc6c1c2ff3f691aabe2109c1 100644 (file)
@@ -19,7 +19,7 @@ include_once($path_to_root . "/includes/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 = "View Credit Note"), true, false, "", $js);
 
index b71738d572b5c394b03a7608104e4a586c1fd5a6..d8a7cc95e54b21f6163d699bdd7115fffd30811b 100644 (file)
@@ -18,7 +18,7 @@ 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, 600);
 page(_($help_context = "View Sales Dispatch"), true, false, "", $js);
 
index 7ad6743a9ca3893fcaf2cca5346d11b207f60a37..9532bb778e5d005e498219be1899f964f977d7e8 100644 (file)
@@ -18,7 +18,7 @@ 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, 600);
 page(_($help_context = "View Sales Invoice"), true, false, "", $js);
 
index 210b7bc2b225f28d739f3c4c586d6498d19e52ef..a481f27dc59ffbe123074cfd96aabdd158df7867 100644 (file)
@@ -18,7 +18,7 @@ include_once($path_to_root . "/includes/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, 600);
 
 page(_($help_context = "View Customer Payment"), true, false, "", $js);
index b9c9c86717e8276765e4ed6ba99730685e9fb99b..605350afd0cc9e3ea36733f0043eb8b436234582 100644 (file)
@@ -20,7 +20,7 @@ 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, 600);
 
 if ($_GET['trans_type'] == ST_SALESQUOTE)
index ec70782b42adaa6ccd5d34bd8b9d2d328d12f354..51dc97008a73289ccc8a649fcc1632f2521d1c2f 100644 (file)
@@ -13,9 +13,9 @@
        {
                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';
@@ -34,7 +34,7 @@
 
                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";
@@ -77,7 +77,7 @@
                                echo "  <td class='logoutBarRight'><a class='shortcut' href='$path_to_root/admin/display_prefs.php?'>" . _("Preferences") . "</a>&nbsp;&nbsp;&nbsp;\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>&nbsp;&nbsp;&nbsp;\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>&nbsp;&nbsp;&nbsp;";
                                }
 
                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&amp;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";
index bbfc447505ccfd9279ee06861585d67f9a2be02c..5e7e8b655182ba8215fcfb004f57167b2e8257ef 100644 (file)
@@ -13,9 +13,9 @@
        {
                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';
@@ -34,7 +34,7 @@
 
                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";
@@ -77,7 +77,7 @@
                                echo "  <td class='logoutBarRight'><a class='shortcut' href='$path_to_root/admin/display_prefs.php?'>" . _("Preferences") . "</a>&nbsp;&nbsp;&nbsp;\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>&nbsp;&nbsp;&nbsp;\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>&nbsp;&nbsp;&nbsp;";
                                }
 
                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&amp;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";
                        }
                }
index e1c03f42ccde1a5691c62bdcd483a66d074038de..d9ae2b0020c28a32f245afbc5ecadf8e8c8fcca6 100644 (file)
@@ -14,9 +14,9 @@
        {
                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';
@@ -35,7 +35,7 @@
 
                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";
@@ -76,7 +76,7 @@
                                echo "  <td class='logoutBarRight'><a class='shortcut' href='$path_to_root/admin/display_prefs.php?'>" . _("Preferences") . "</a>&nbsp;&nbsp;&nbsp;\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>&nbsp;&nbsp;&nbsp;\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>&nbsp;&nbsp;&nbsp;";
                                }
 
                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&amp;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";
                        }
                }