Changed hardcoded trans days in inquiries (30) to be a user preference.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 9 Apr 2012 09:32:29 +0000 (11:32 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 9 Apr 2012 09:32:29 +0000 (11:32 +0200)
22 files changed:
admin/display_prefs.php
gl/inquiry/bank_inquiry.php
gl/inquiry/gl_account_inquiry.php
gl/inquiry/gl_trial_balance.php
gl/inquiry/profit_loss.php
gl/inquiry/tax_inquiry.php
gl/view/accrual_trans.php
includes/current_user.inc
includes/prefs/userprefs.inc
inventory/inquiry/stock_movements.php
purchasing/includes/ui/invoice_ui.inc
purchasing/inquiry/po_search.php
purchasing/inquiry/po_search_completed.php
purchasing/inquiry/supplier_allocation_inquiry.php
purchasing/inquiry/supplier_inquiry.php
sales/inquiry/customer_allocation_inquiry.php
sales/inquiry/customer_inquiry.php
sales/inquiry/sales_deliveries_view.php
sales/inquiry/sales_orders_view.php
sql/alter2.4.sql
sql/en_US-demo.sql
sql/en_US-new.sql

index 4c90ec780da3a8c57fff2b8b036a155c8ed533be..2da5c592b66122c8941e15441c16880acafa72a3 100644 (file)
@@ -40,7 +40,7 @@ if (isset($_POST['setprefs']))
                        'theme', 'page_size', 'language', 'startup_tab',
                        'show_gl' => 0, 'show_codes'=> 0, 'show_hints' => 0,
                        'rep_popup' => 0, 'graphic_links' => 0, 'sticky_doc_date' => 0,
-                       'query_size' => 10.0)));
+                       'query_size' => 10.0, 'transaction_days' => 30)));
 
                if ($chg_lang)
                        $_SESSION['language']->set_language($_POST['language']);
@@ -137,6 +137,8 @@ text_row_ex(_("Query page size:"), 'query_size',  5, 5, '', user_query_size());
 check_row(_("Remember last document date:"), 'sticky_doc_date', sticky_doc_date(),
        false, _('If set document date is remembered on subsequent documents, otherwise default is current date'));
 
+text_row_ex(_("Transaction days:"), 'transaction_days', 5, 5, '', user_transaction_days());
+
 end_outer_table(1);
 
 submit_center('setprefs', _("Update"), true, '',  'default');
index 30380989c73ab95a6a557a55b34587a00e95dfa2..4330a2ade68f54fd6de21a716c05fc9df2fcdc48 100644 (file)
@@ -46,7 +46,7 @@ start_table(TABLESTYLE_NOBORDER);
 start_row();
 bank_accounts_list_cells(_("Account:"), 'bank_account', null);
 
-date_cells(_("From:"), 'TransAfterDate', '', null, -30);
+date_cells(_("From:"), 'TransAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("To:"), 'TransToDate');
 
 submit_cells('Show',_("Show"),'','', 'default');
index 9aff2365ac093c3c9d50d8c1d315100e4ad847bc..4a9b7d0b040bed9bd62804dc9d3e41d1ba5e4945 100644 (file)
@@ -68,7 +68,7 @@ function gl_inquiry_controls()
     start_table(TABLESTYLE_NOBORDER);
        start_row();
     gl_all_accounts_list_cells(_("Account:"), 'account', null, false, false, _("All Accounts"));
-       date_cells(_("from:"), 'TransFromDate', '', null, -30);
+       date_cells(_("from:"), 'TransFromDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
        date_cells(_("to:"), 'TransToDate');
     end_row();
        end_table();
index 1f6545c9ded2b3983e14aa736141ceeeedb63181..484ba459f5364dd90155332cee6c0a360641a9d1 100644 (file)
@@ -46,7 +46,7 @@ function gl_inquiry_controls()
 
     start_table(TABLESTYLE_NOBORDER);
 
-    date_cells(_("From:"), 'TransFromDate', '', null, -30);
+    date_cells(_("From:"), 'TransFromDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
        date_cells(_("To:"), 'TransToDate');
        if ($dim >= 1)
                dimensions_list_cells(_("Dimension")." 1:", 'Dimension', null, true, " ", false, 1);
index 351fc3d738003fe07a29de95ae3b8d59986de8f2..f7ba91767c1055bc9b1282c5f8830d58d90f76e1 100644 (file)
@@ -160,7 +160,7 @@ function inquiry_controls()
        $dim = get_company_pref('use_dimension');
     start_table(TABLESTYLE_NOBORDER);
     
-    date_cells(_("From:"), 'TransFromDate', '', null, -30);
+    date_cells(_("From:"), 'TransFromDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
        date_cells(_("To:"), 'TransToDate');
        
        //Compare Combo
index 6022fcd7211f67d8579c643566e1c0887f97e453..e1e7c853070f02c3eaa5f779c59f35c591a1364e 100644 (file)
@@ -58,7 +58,7 @@ function tax_inquiry_controls()
     start_table(TABLESTYLE_NOBORDER);
        start_row();
 
-       date_cells(_("from:"), 'TransFromDate', '', null, -30);
+       date_cells(_("from:"), 'TransFromDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
        date_cells(_("to:"), 'TransToDate');
        submit_cells('Show',_("Show"),'','', 'default');
 
index 6d1d360dde84fea009ca178cb12a32a8efe4cc63..9289c737793e663f37331aa6f1fc485355f9490f 100644 (file)
@@ -64,7 +64,7 @@ $th = array_merge($first_cols, $dim_cols, $remaining_cols);
 table_header($th);
 $end = $_GET['date'];
 $account = $_GET['act'];
-$begin = add_days($end, -30);
+$begin = add_days($end, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 
 $result = get_gl_transactions($begin, $end, -1,        $account, 0, 0, null);
 $j = 0;
index 0a5b7481dc381bba29617ae769f30ef60a24dae0..eea7e1b9a291d81831579d779f6004fc682dfe1d 100644 (file)
@@ -434,6 +434,12 @@ function user_startup_tab()
        return $_SESSION["wa_current_user"]->prefs->start_up_tab();
 }
 
+function user_transaction_days()
+{
+    return $_SESSION["wa_current_user"]->prefs->transaction_days();
+}
+
+
 function user_check_access($sec_area)
 {
        return $_SESSION["wa_current_user"]->can_access($sec_area);
index 50fa0a8811e1b5cf3a32a220dcae1179ff0a1746..caf0506648c0b963b0003129ed54ced26608495b 100644 (file)
@@ -35,7 +35,8 @@ class user_prefs
        var $graphic_links; // use graphic links
        var $sticky_date;       // save date on subsequent document entry
        var $startup_tab;  // default start-up menu tab
-       
+       var $transaction_days; // transaction days in inquiries.
+
        function user_prefs($user=null)
        {
                if ($user == null) { 
@@ -49,7 +50,8 @@ class user_prefs
                        $this->price_dec = 2;
                        $this->language = $dflt_lang;
                        $this->theme = 'default';
-                       
+                       $this->transaction_days = -30;
+
                } else {
                        $this->language = $user["language"];
                        $_SESSION['language']->set_language($this->language);
@@ -82,6 +84,7 @@ class user_prefs
                                $this->sticky_date = 0;
                                $this->startup_tab = "orders";
                        }
+                       $this->transaction_days = $user['transaction_days'];
                }
        }
        
@@ -222,6 +225,11 @@ class user_prefs
                return $this->startup_tab;
        }
 
+    function transaction_days() 
+    {
+        return $this->transaction_days;
+    }
+
        function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes) 
        {
                $this->price_dec = $price_dec;
index 417b5df5c6ad7b9440e95aa89d970998bd1879c7..a18f9a7936287835c00ba1630972f1fe7837d48f 100644 (file)
@@ -55,7 +55,7 @@ start_row();
 
 locations_list_cells(_("From Location:"), 'StockLocation', null);
 
-date_cells(_("From:"), 'AfterDate', '', null, -30);
+date_cells(_("From:"), 'AfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("To:"), 'BeforeDate');
 
 submit_cells('ShowMoves',_("Show Movements"),'',_('Refresh Inquiry'), 'default');
index 298fcb828f33d9fb665673fad6b7d7f481b0af4f..af1ba2021b699ffb5bed341bbcb05bff6ec246e2 100644 (file)
@@ -468,7 +468,8 @@ function display_grn_items(&$supp_trans, $mode=0)
                if ($supp_trans->trans_type == ST_SUPPCREDIT)
                {
                        echo "</td>";
-                       date_cells(_("Received between"), 'receive_begin', "", null, -30, 0, 0, "valign=middle");
+                       date_cells(_("Received between"), 'receive_begin', "", null, 
+                               -$_SESSION["wa_current_user"]->prefs->transaction_days(), 0, 0, "valign=middle");
                        date_cells(_("and"), 'receive_end', '', null, 1, 0, 0, "valign=middle");
                        submit_cells('RefreshInquiry', _("Search"),'',_('Refresh Inquiry'), true);
                        echo "<td>";
index 220b1e1a325d62e2c36d2452ee939ca1dd268f34..2cd7223a59635e7bdc654441127a9f83544a469f 100644 (file)
@@ -61,7 +61,7 @@ start_table(TABLESTYLE_NOBORDER);
 start_row();
 ref_cells(_("#:"), 'order_number', '',null, '', true);
 
-date_cells(_("from:"), 'OrdersAfterDate', '', null, -30);
+date_cells(_("from:"), 'OrdersAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("to:"), 'OrdersToDate');
 
 locations_list_cells(_("Location:"), 'StockLocation', null, true);
index 90d869aa907acbe5cf0452e0e4047e293b59913b..986a706f3c60d0fe09d5e87820b053f0e8bac00a 100644 (file)
@@ -59,7 +59,7 @@ start_table(TABLESTYLE_NOBORDER);
 start_row();
 ref_cells(_("#:"), 'order_number', '',null, '', true);
 
-date_cells(_("from:"), 'OrdersAfterDate', '', null, -30);
+date_cells(_("from:"), 'OrdersAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("to:"), 'OrdersToDate');
 
 locations_list_cells(_("into location:"), 'StockLocation', null, true);
index eb7cedc169c5da130b6f71a83dc3a06cc3207640..6998b74fce50d535f82dbd650be28a2f0da41608 100644 (file)
@@ -47,7 +47,7 @@ start_row();
 
 supplier_list_cells(_("Select a supplier: "), 'supplier_id', $_POST['supplier_id'], true);
 
-date_cells(_("From:"), 'TransAfterDate', '', null, -30);
+date_cells(_("From:"), 'TransAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("To:"), 'TransToDate', '', null, 1);
 
 supp_allocations_list_cell("filterType", null);
index af6c2216623c06cd168d7d8cd735143f5dfdfaca..d1e2ee82f4ebc3fc4f070f7e3242d047952ee809 100644 (file)
@@ -47,7 +47,7 @@ start_row();
 if (!$page_nested)
        supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, true);
 
-date_cells(_("From:"), 'TransAfterDate', '', null, -30);
+date_cells(_("From:"), 'TransAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("To:"), 'TransToDate');
 
 supp_transactions_list_cell("filterType", null, true);
index e7b0ca27c5a5ec1ecf3cc7cd8147c5ce825e75fa..45815855d05b5c4471fd73730b2e8d0f271e8519 100644 (file)
@@ -41,7 +41,7 @@ start_row();
 
 customer_list_cells(_("Select a customer: "), 'customer_id', $_POST['customer_id'], true);
 
-date_cells(_("from:"), 'TransAfterDate', '', null, -30);
+date_cells(_("from:"), 'TransAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("to:"), 'TransToDate', '', null, 1);
 
 cust_allocations_list_cells(_("Type:"), 'filterType', null);
index d8a000c1866431d7d4ba3fc857adfe104a9b805f..86b965881f6ef4bdb677a816b2c7c0c9645296f6 100644 (file)
@@ -43,7 +43,7 @@ start_row();
 if (!$page_nested)
        customer_list_cells(_("Select a customer: "), 'customer_id', null, true, false, false, !@$_GET['popup']);
 
-date_cells(_("From:"), 'TransAfterDate', '', null, -30);
+date_cells(_("From:"), 'TransAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("To:"), 'TransToDate', '', null, 1);
 
 if (!isset($_POST['filterType']))
index 5a29b43401ad61c6d46cb32ac79cff88e464fa5d..4da4d98b5ca06798cf0e60cd5a7029942171141d 100644 (file)
@@ -101,7 +101,7 @@ start_form(false, false, $_SERVER['PHP_SELF'] ."?OutstandingOnly=".$_POST['Outst
 start_table(TABLESTYLE_NOBORDER);
 start_row();
 ref_cells(_("#:"), 'DeliveryNumber', '',null, '', true);
-date_cells(_("from:"), 'DeliveryAfterDate', '', null, -30);
+date_cells(_("from:"), 'DeliveryAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
 date_cells(_("to:"), 'DeliveryToDate', '', null, 1);
 
 locations_list_cells(_("Location:"), 'StockLocation', null, true);
index 281e3a5f548482877ac3c35e68fb556357e3172b..f8309de9789b3e6de565f41b340ba6e95adf667d 100644 (file)
@@ -225,7 +225,7 @@ ref_cells(_("#:"), 'OrderNumber', '',null, '', true);
 ref_cells(_("Ref"), 'OrderReference', '',null, '', true);
 if ($show_dates)
 {
-       date_cells(_("from:"), 'OrdersAfterDate', '', null, -30);
+       date_cells(_("from:"), 'OrdersAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
        date_cells(_("to:"), 'OrdersToDate', '', null, 1);
 }
 locations_list_cells(_("Location:"), 'StockLocation', null, true);
index 13f10736bf6966a4e8222c52d387e21ad8236cdd..c0fdca279ba582820837a3cbf6a654d01b00b3a0 100644 (file)
@@ -44,4 +44,5 @@ UPDATE `0_debtor_trans` tr, `0_trans_tax_details` td SET tr.tax_included=td.incl
        WHERE tr.`type`=td.trans_type AND tr.trans_no=td.trans_no AND td.included_in_price
 ALTER TABLE `0_bank_accounts` ADD COLUMN `bank_charge_act` varchar(15) NOT NULL DEFAULT '' AFTER `id`;
 UPDATE `0_bank_accounts` SET `bank_charge_act`=(SELECT `value` FROM 0_sys_prefs WHERE name='bank_charge_act'); 
-       
\ No newline at end of file
+ALTER TABLE `0_users` ADD `transaction_days` INT( 6 ) NOT NULL COMMENT 'Transaction days' AFTER `startup_tab`; 
+UPDATE `0_users` SET `transaction_days`=30; 
index b36a446b212d8c22772321018448bee1a97a70a6..9819ca99dbf0fe0a65ea2c8faa61daa3015b65ea 100644 (file)
@@ -2322,6 +2322,7 @@ CREATE TABLE IF NOT EXISTS `0_users` (
   `rep_popup` tinyint(1) default '1',
   `sticky_doc_date` tinyint(1) default '0',
   `startup_tab` varchar(20) NOT NULL default '',
+  `transaction_days` smallint(6) NOT NULL default '0',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `user_id` (`user_id`)
@@ -2331,8 +2332,8 @@ CREATE TABLE IF NOT EXISTS `0_users` (
 -- Dumping data for table `0_users`
 --
 
-INSERT INTO `0_users` VALUES(1, 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'adm@adm.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, 0, '2010-05-11 23:27:46', 10, 1, 1, '1', 1, 0, 'orders', 0);
-INSERT INTO `0_users` VALUES(2, 'demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', 9, '999-999-999', 'demo@demo.nu', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 3, 1, 1, 0, 0, '2008-02-06 19:02:35', 10, 1, 1, '1', 1, 0, 'orders', 0);
+INSERT INTO `0_users` VALUES(1, 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'adm@adm.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, 0, '2010-05-11 23:27:46', 10, 1, 1, '1', 1, 0, 'orders', 30, 0);
+INSERT INTO `0_users` VALUES(2, 'demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', 9, '999-999-999', 'demo@demo.nu', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 3, 1, 1, 0, 0, '2008-02-06 19:02:35', 10, 1, 1, '1', 1, 0, 'orders', 30, 0);
 
 -- --------------------------------------------------------
 
index 525806e31ac7cfde3ea030126d3efe4e5eddaabc..69d6b9971f755e205b1689f217b34c51d583548f 100644 (file)
@@ -2070,6 +2070,7 @@ CREATE TABLE IF NOT EXISTS `0_users` (
   `rep_popup` tinyint(1) default '1',
   `sticky_doc_date` tinyint(1) default '0',
   `startup_tab` varchar(20) NOT NULL default '',
+  `transaction_days` smallint(6) NOT NULL default '0',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `user_id` (`user_id`)