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
38 var $transaction_days; // transaction days in inquiries.
40 function user_prefs($user=null)
43 // set default values, used before login
44 global $dflt_lang, $dflt_date_sep, $dflt_date_fmt;
46 $this->date_sep = $dflt_date_sep;
47 $this->date_format = $dflt_date_fmt;
51 $this->language = $dflt_lang;
52 $this->theme = 'default';
53 $this->transaction_days = -30;
56 $this->language = $user["language"];
57 $_SESSION['language']->set_language($this->language);
59 $this->qty_dec = $user["qty_dec"];
60 $this->price_dec = $user["prices_dec"];
61 $this->exrate_dec = $user["rates_dec"];
62 $this->percent_dec = $user["percent_dec"];
64 $this->show_gl_info = $user["show_gl"];
65 $this->show_codes = $user["show_codes"];
66 $this->date_format = $user["date_format"];
67 $this->date_sep = $user["date_sep"];
68 $this->tho_sep = $user["tho_sep"];
69 $this->dec_sep = $user["dec_sep"];
70 $this->theme = $user["theme"];
71 $this->pagesize = $user["page_size"];
72 $this->show_hints = $user["show_hints"];
73 $this->print_profile = $user["print_profile"];
74 $this->rep_popup = $user["rep_popup"];
75 $this->query_size = $user["query_size"];
76 $this->graphic_links = $user["graphic_links"];
77 if (isset($user["sticky_doc_date"]))
79 $this->sticky_date = $user["sticky_doc_date"];
80 $this->startup_tab = $user['startup_tab'];
84 $this->sticky_date = 0;
85 $this->startup_tab = "orders";
87 $this->transaction_days = $user['transaction_days'];
94 'language' => $this->language,
95 'qty_dec' => $this->qty_dec,
96 'prices_dec' => $this->price_dec,
97 'rates_dec' => $this->exrate_dec,
98 'percent_dec' => $this->percent_dec,
99 'show_gl' => $this->show_gl_info,
100 'show_codes' => $this->show_codes,
101 'date_format' =>$this->date_format,
102 'date_sep' => $this->date_sep,
103 'tho_sep' => $this->tho_sep,
104 'dec_sep' => $this->dec_sep,
105 'theme' => $this->theme,
106 'page_size' => $this->pagesize,
107 'show_hints' => $this->show_hints,
108 'print_profile' => $this->print_profile,
109 'rep_popup' => $this->rep_popup,
110 'query_size' => $this->query_size,
111 'graphic_links' => $this->graphic_links,
112 'sticky_doc_date' => $this->sticky_date,
113 'startup_tab' => $this->startup_tab);
118 return $this->language;
123 return $this->qty_dec;
128 return $this->price_dec;
131 function exrate_dec()
133 return $this->exrate_dec;
136 function percent_dec()
138 return $this->percent_dec;
141 function show_gl_info()
143 return $this->show_gl_info;
146 function show_codes()
148 return $this->show_codes;
151 function date_format()
153 return $this->date_format;
158 return $this->date_sep;
161 function date_display()
164 $sep = $dateseps[$this->date_sep];
165 if ($this->date_format == 0)
166 return "m".$sep."d".$sep."Y";
167 elseif ($this->date_format == 1)
168 return "d".$sep."m".$sep."Y";
170 return "Y".$sep."m".$sep."d";
175 return $this->tho_sep;
180 return $this->dec_sep;
188 function get_pagesize()
190 return $this->pagesize;
193 function show_hints()
195 return $this->show_hints;
198 function print_profile()
200 return $this->print_profile;
205 return $this->rep_popup;
208 function query_size()
210 return $this->query_size;
213 function graphic_links()
215 return $this->graphic_links;
218 function sticky_date()
220 return $this->sticky_date;
223 function start_up_tab()
225 return $this->startup_tab;
228 function transaction_days()
230 return $this->transaction_days;
233 function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes)
235 $this->price_dec = $price_dec;
236 $this->qty_dec = $qty_dec;
237 $this->exrate_dec = $exrate_dec;
238 $this->percent_dec = $percent_dec;
239 $this->show_gl_info = $showgl;
240 $this->show_codes = $showcodes;
243 function set_format($date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize)
245 $this->date_format = $date_format;
246 $this->date_sep = $date_sep;
247 $this->tho_sep = $tho_sep;
248 $this->dec_sep = $dec_sep;
249 $this->theme = $theme;
250 $this->pagesize = $pagesize;