Option to use last dcument date on subsequent new documents.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 22 Mar 2009 17:02:30 +0000 (17:02 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 22 Mar 2009 17:02:30 +0000 (17:02 +0000)
admin/db/users_db.inc
admin/display_prefs.php
includes/current_user.inc
includes/prefs/userprefs.inc
sql/alter2.2.php
sql/alter2.2.sql
sql/en_US-demo.sql
sql/en_US-new.sql

index 5200f2c99933bb0d104270218ff587d7bac652b7..c19cbd82a89838175b69a1f8e5e5182953873708 100644 (file)
@@ -55,7 +55,7 @@ function update_user($user_id, $real_name, $phone, $email, $full_access,
 function update_user_display_prefs($user_id, $price_dec, $qty_dec, $exrate_dec, 
        $percent_dec, $showgl, $showcodes, $date_format, $date_sep, $tho_sep, 
        $dec_sep, $theme, $pagesize, $show_hints, $profile, $rep_popup, $query_size, 
-       $graphic_links, $lang)
+       $graphic_links, $lang, $stickydate)
 {
        $sql = "UPDATE ".TB_PREF."users SET
                prices_dec=".db_escape($price_dec).",
@@ -75,7 +75,8 @@ function update_user_display_prefs($user_id, $price_dec, $qty_dec, $exrate_dec,
                rep_popup=$rep_popup,
                query_size=$query_size,
                graphic_links=$graphic_links,
-               language=".db_escape($lang)."
+               language=".db_escape($lang).",
+               sticky_doc_date=".db_escape($stickydate)."
                WHERE user_id = ".db_escape($user_id);
 
        db_query($sql, "could not update user display prefs for $user_id");
index 81d951ad1453876c4574e7c03a1b1fc832c61129..6d1bd6c47e839ec6b3139778e6e9e3df12b9b70a 100644 (file)
@@ -42,7 +42,7 @@ if (isset($_POST['setprefs']))
                        $_POST['theme'], $_POST['page_size'], check_value('show_hints'),
                        $_POST['profile'], check_value('rep_popup'), 
                        (int)($_POST['query_size']), check_value('graphic_links'), 
-                       $_POST['language']);
+                       $_POST['language'], check_value('sticky_doc_date'));
 
                if ($chg_lang)
                        language::set_language($_POST['language']);
@@ -127,6 +127,9 @@ check_row(_("Use icons instead of text links:"), 'graphic_links', user_graphic_l
 
 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'));
+
 end_outer_table(1);
 
 submit_center('setprefs', _("Update"), true, '',  'default');
index 023591d351852727b06a1022b3b0e8d0eab29213..f55f248dd2618c27c58912a7261dc3f040ef8144 100644 (file)
@@ -110,11 +110,11 @@ class current_user
        function update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, 
                $showgl, $showcodes, $date_format, $date_sep, $tho_sep, $dec_sep, 
                $theme, $pagesize, $show_hints, $profile, $rep_popup, $query_size, 
-               $graphic_links, $lang) {
+               $graphic_links, $lang, $stickydate) {
                update_user_display_prefs($this->username, $price_dec, 
                        $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes, 
                        $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, 
-                       $show_hints, $profile, $rep_popup, $query_size, $graphic_links, $lang);
+                       $show_hints, $profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate);
 
                // re-read the prefs
                $user = get_user($this->username);
@@ -302,14 +302,19 @@ function user_graphic_links()
        return $_SESSION["wa_current_user"]->prefs->graphic_links();
 }
 
+function sticky_doc_date()
+{
+       return $_SESSION["wa_current_user"]->prefs->sticky_date();
+}
+
 function set_user_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes,
        $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints,
-       $print_profile, $rep_popup, $query_size, $graphic_links, $lang)
+       $print_profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate)
 {
 
        $_SESSION["wa_current_user"]->update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes,
                $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints,
-               $print_profile, $rep_popup, $query_size, $graphic_links, $lang);
+               $print_profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate);
 }
 
 function add_user_js_data() {
@@ -323,6 +328,7 @@ function add_user_js_data() {
          . "var user = {\n"
          . "theme: '". $path_to_root . '/themes/'. 'default' /*user_theme()*/.'/'."',\n"
          . "loadtxt: '"._('Requesting data...')."',\n"
+         . "date: '".Today()."',\n"
          . "ts: '$ts',\n"
          . "ds: '$ds',\n"
          . "pdec : " . user_price_dec() . "}\n--></script>";
index 43afba6fff0225fb97466ea2648a1d6692273e61..7ba4c0c7ef40b301401ab4a8e2018833621ee7f5 100644 (file)
@@ -33,7 +33,8 @@ class user_prefs
        var $show_hints;
        var $query_size; // table pager page length
        var $graphic_links; // use graphic links
-
+       var $sticky_date;       // save date on subsequent document entry
+       
        function user_prefs($user=null)
        {
                if ($user == null) { 
@@ -65,6 +66,7 @@ class user_prefs
                        $this->rep_popup = $user["rep_popup"];
                        $this->query_size = $user["query_size"];
                        $this->graphic_links = $user["graphic_links"];
+                       $this->sticky_date = $user["sticky_doc_date"];
                }
        }
 
@@ -169,7 +171,12 @@ class user_prefs
        {
                return $this->graphic_links;
        }
-
+       
+       function sticky_date()
+       {
+               return $this->sticky_date;
+       }
+       
        function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes) 
        {
                $this->price_dec = $price_dec;
index 3f557aae94edebca3bcfc1b8b41977e773535352..bcd772e1251b8408091f18441f72e8b132705cca 100644 (file)
@@ -44,6 +44,7 @@ class fa2_2 {
        function installed($pref) {
                if (check_table($pref, 'company', 'default_delivery_required')) return false;
                if (check_table($pref, 'stock_category', 'dflt_dim2')) return false;
+               if (check_table($pref, 'users', 'sticky_doc_date')) return false;
                return true;
        }
 };
index 01c49685c7bbf081d40a694051bfcee90dce2fc6..07e8095913642948f187b931f14083bed2c07985 100644 (file)
@@ -22,3 +22,5 @@ ALTER TABLE `0_stock_category` ADD COLUMN `dflt_adjustment_act` varchar(11) NOT
 ALTER TABLE `0_stock_category` ADD COLUMN `dflt_assembly_act` varchar(11) NOT NULL default '';
 ALTER TABLE `0_stock_category` ADD COLUMN `dflt_dim1` int(11) default NULL;
 ALTER TABLE `0_stock_category` ADD COLUMN `dflt_dim2` int(11) default NULL;
+
+ALTER TABLE `0_users` ADD `sticky_doc_date` TINYINT(1) DEFAULT '0';
index 3bcddfffa63b3ae5b8d8872f1ba10b553f15495e..af0448ad685198ac544f44815bba51706b156b09 100644 (file)
@@ -2267,14 +2267,15 @@ CREATE TABLE `0_users` (
   `pos` smallint(6) default '1',
   `print_profile` varchar(30) NOT NULL default '1',
   `rep_popup` tinyint(1) default '1',
+  `sticky_doc_date` tinyint(1) default '0',
   PRIMARY KEY  (`user_id`)
 ) TYPE=MyISAM  ;
 
 
 ### Data of table `0_users` ###
 
-INSERT INTO `0_users` VALUES ('demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', '1', '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');
-INSERT INTO `0_users` VALUES ('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2009-01-30 09:39:03', '10', '1', '1', '', '1');
+INSERT INTO `0_users` VALUES ('demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', '1', '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');
+INSERT INTO `0_users` VALUES ('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2009-01-30 09:39:03', '10', '1', '1', '', '1', '0');
 
 
 ### Structure of table `0_voided` ###
index f479dd7cd935020d0ade972b65fc12d86abb31d4..3131e6b7d8ea9524e815e5f7de5d46701c18fa6b 100644 (file)
@@ -1545,13 +1545,14 @@ CREATE TABLE `0_users` (
   `pos` smallint(6) default '1',
   `print_profile` varchar(30) NOT NULL default '1',
   `rep_popup` tinyint(1) default '1',
+  `sticky_doc_date` tinyint(1) default '0',
   PRIMARY KEY  (`user_id`)
 ) TYPE=MyISAM  ;
 
 
 ### Data of table `0_users` ###
 
-INSERT INTO `0_users` VALUES ('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2008-04-04 12:34:29', '10', '1', '1', '1', '1');
+INSERT INTO `0_users` VALUES ('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2008-04-04 12:34:29', '10', '1', '1', '1', '1', '0');
 
 
 ### Structure of table `0_voided` ###