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 ***********************************************************************/
32 var $pagesize; // for printing
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 var $startup_tab; // default start-up menu tab
39 function user_prefs($user=null)
42 // set default values, used before login
43 global $dflt_lang, $dflt_date_sep, $dflt_date_fmt;
45 $this->date_sep = $dflt_date_sep;
46 $this->date_format = $dflt_date_fmt;
49 $this->language = $dflt_lang;
50 $this->theme = 'default';
53 $this->language = $user["language"];
54 $_SESSION['language']->set_language($this->language);
56 $this->qty_dec = $user["qty_dec"];
57 $this->price_dec = $user["prices_dec"];
58 $this->exrate_dec = $user["rates_dec"];
59 $this->percent_dec = $user["percent_dec"];
61 $this->show_gl_info = $user["show_gl"];
62 $this->show_codes = $user["show_codes"];
63 $this->date_format = $user["date_format"];
64 $this->date_sep = $user["date_sep"];
65 $this->tho_sep = $user["tho_sep"];
66 $this->dec_sep = $user["dec_sep"];
67 $this->theme = $user["theme"];
68 $this->pagesize = $user["page_size"];
69 $this->show_hints = $user["show_hints"];
70 $this->print_profile = $user["print_profile"];
71 $this->rep_popup = $user["rep_popup"];
72 $this->query_size = $user["query_size"];
73 $this->graphic_links = $user["graphic_links"];
74 if (isset($user["sticky_doc_date"]))
76 $this->sticky_date = $user["sticky_doc_date"];
77 $this->startup_tab = $user['startup_tab'];
81 $this->sticky_date = 0;
82 $this->startup_tab = "orders";
89 return $this->language;
94 return $this->qty_dec;
99 return $this->price_dec;
102 function exrate_dec()
104 return $this->exrate_dec;
107 function percent_dec()
109 return $this->percent_dec;
112 function show_gl_info()
114 return $this->show_gl_info;
117 function show_codes()
119 return $this->show_codes;
122 function date_format()
124 return $this->date_format;
129 return $this->date_sep;
132 function date_display()
135 $sep = $dateseps[$this->date_sep];
136 if ($this->date_format == 0)
137 return "m".$sep."d".$sep."Y";
138 elseif ($this->date_format == 1)
139 return "d".$sep."m".$sep."Y";
141 return "Y".$sep."m".$sep."d";
146 return $this->tho_sep;
151 return $this->dec_sep;
159 function get_pagesize()
161 return $this->pagesize;
164 function show_hints()
166 return $this->show_hints;
169 function print_profile()
171 return $this->print_profile;
176 return $this->rep_popup;
179 function query_size()
181 return $this->query_size;
184 function graphic_links()
186 return $this->graphic_links;
189 function sticky_date()
191 return $this->sticky_date;
194 function start_up_tab()
196 return $this->startup_tab;
199 function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes)
201 $this->price_dec = $price_dec;
202 $this->qty_dec = $qty_dec;
203 $this->exrate_dec = $exrate_dec;
204 $this->percent_dec = $percent_dec;
205 $this->show_gl_info = $showgl;
206 $this->show_codes = $showcodes;
209 function set_format($date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize)
211 $this->date_format = $date_format;
212 $this->date_sep = $date_sep;
213 $this->tho_sep = $tho_sep;
214 $this->dec_sep = $dec_sep;
215 $this->theme = $theme;
216 $this->pagesize = $pagesize;