Option to use last dcument date on subsequent new documents.
[fa-stable.git] / includes / prefs / userprefs.inc
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 class user_prefs 
13 {
14
15         var $language;
16
17         var $qty_dec;
18         var $price_dec;
19         var     $exrate_dec;
20         var     $percent_dec;
21
22         var     $show_gl_info;
23         var     $show_codes;
24
25         var $date_format;
26         var $date_sep;
27         var $tho_sep;
28         var $dec_sep;
29         var $theme;
30         var $print_profile;
31         var $rep_popup;
32         var $pagesize; // for printing
33         var $show_hints;
34         var $query_size; // table pager page length
35         var $graphic_links; // use graphic links
36         var $sticky_date;       // save date on subsequent document entry
37         
38         function user_prefs($user=null)
39         {
40                 if ($user == null) { 
41                         // set default values, used before login
42                         global $dflt_lang;
43                         
44                         $this->language = $dflt_lang;
45                         $this->theme = 'default';
46                         
47                 } else {
48                         $this->language = $user["language"];
49                         language::set_language($this->language);
50
51                         $this->qty_dec = $user["qty_dec"];
52                         $this->price_dec = $user["prices_dec"];
53                         $this->exrate_dec = $user["rates_dec"];
54                         $this->percent_dec = $user["percent_dec"];
55
56                         $this->show_gl_info = $user["show_gl"];
57                         $this->show_codes = $user["show_codes"];
58                         $this->date_format = $user["date_format"];
59                         $this->date_sep = $user["date_sep"];
60                         $this->tho_sep = $user["tho_sep"];
61                         $this->dec_sep = $user["dec_sep"];
62                         $this->theme = $user["theme"];
63                         $this->pagesize = $user["page_size"];
64                         $this->show_hints = $user["show_hints"];
65                         $this->print_profile = $user["print_profile"];
66                         $this->rep_popup = $user["rep_popup"];
67                         $this->query_size = $user["query_size"];
68                         $this->graphic_links = $user["graphic_links"];
69                         $this->sticky_date = $user["sticky_doc_date"];
70                 }
71         }
72
73         function language() 
74         {
75                 return $this->language;
76         }
77
78         function qty_dec() 
79         {
80                 return $this->qty_dec;
81         }
82
83         function price_dec() 
84         {
85                 return $this->price_dec;
86         }
87
88         function exrate_dec() 
89         {
90                 return $this->exrate_dec;
91         }
92
93         function percent_dec() 
94         {
95                 return $this->percent_dec;
96         }
97
98         function show_gl_info() 
99         {
100                 return $this->show_gl_info;
101         }
102
103         function show_codes() 
104         {
105                 return $this->show_codes;
106         }
107
108         function date_format() 
109         {
110                 return $this->date_format;
111         }
112
113         function date_sep() 
114         {
115                 return $this->date_sep;
116         }
117
118         function date_display() 
119         {
120                 global $dateseps;
121                 $sep = $dateseps[$this->date_sep];
122                 if ($this->date_format == 0)
123                         return "m".$sep."d".$sep."Y";
124                 elseif ($this->date_format == 1)
125                         return "d".$sep."m".$sep."Y";
126                 else
127                         return "Y".$sep."m".$sep."d";
128         }
129
130         function tho_sep() 
131         {
132                 return $this->tho_sep;
133         }
134
135         function dec_sep() 
136         {
137                 return $this->dec_sep;
138         }
139
140         function get_theme() 
141         {
142                 return $this->theme;
143         }
144
145         function get_pagesize() 
146         {
147                 return $this->pagesize;
148         }
149
150         function show_hints() 
151         {
152                 return $this->show_hints;
153         }
154
155         function print_profile() 
156         {
157                 return $this->print_profile;
158         }
159
160         function rep_popup() 
161         {
162                 return $this->rep_popup;
163         }
164
165         function query_size() 
166         {
167                 return $this->query_size;
168         }
169
170         function graphic_links() 
171         {
172                 return $this->graphic_links;
173         }
174         
175         function sticky_date()
176         {
177                 return $this->sticky_date;
178         }
179         
180         function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes) 
181         {
182                 $this->price_dec = $price_dec;
183                 $this->qty_dec = $qty_dec;
184                 $this->exrate_dec = $exrate_dec;
185                 $this->percent_dec = $percent_dec;
186                 $this->show_gl_info = $showgl;
187                 $this->show_codes = $showcodes;
188         }
189
190         function set_format($date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize) 
191         {
192                 $this->date_format = $date_format;
193                 $this->date_sep = $date_sep;
194                 $this->tho_sep = $tho_sep;
195                 $this->dec_sep = $dec_sep;
196                 $this->theme = $theme;
197                 $this->pagesize = $pagesize;
198         }
199
200 }
201
202 ?>