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;
57 $this->language = $user["language"];
58 $_SESSION['language']->set_language($this->language);
60 $this->qty_dec = $user["qty_dec"];
61 $this->price_dec = $user["prices_dec"];
62 $this->exrate_dec = $user["rates_dec"];
63 $this->percent_dec = $user["percent_dec"];
65 $this->show_gl_info = $user["show_gl"];
66 $this->show_codes = $user["show_codes"];
67 $this->date_format = $user["date_format"];
68 $this->date_sep = $user["date_sep"];
69 $this->tho_sep = $user["tho_sep"];
70 $this->dec_sep = $user["dec_sep"];
71 $this->theme = $user["theme"];
72 $this->pagesize = $user["page_size"];
73 $this->show_hints = $user["show_hints"];
74 $this->print_profile = $user["print_profile"];
75 $this->rep_popup = $user["rep_popup"];
76 $this->query_size = $user["query_size"];
77 $this->graphic_links = $user["graphic_links"];
78 if (isset($user["sticky_doc_date"]))
80 $this->sticky_date = $user["sticky_doc_date"];
81 $this->startup_tab = $user['startup_tab'];
85 $this->sticky_date = 0;
86 $this->startup_tab = "orders";
88 $this->transaction_days = $user['transaction_days'];
89 if (!file_exists("$path_to_root/themes/$this->theme"))
90 $this->theme = "default";
97 'language' => $this->language,
98 'qty_dec' => $this->qty_dec,
99 'prices_dec' => $this->price_dec,
100 'rates_dec' => $this->exrate_dec,
101 'percent_dec' => $this->percent_dec,
102 'show_gl' => $this->show_gl_info,
103 'show_codes' => $this->show_codes,
104 'date_format' =>$this->date_format,
105 'date_sep' => $this->date_sep,
106 'tho_sep' => $this->tho_sep,
107 'dec_sep' => $this->dec_sep,
108 'theme' => $this->theme,
109 'page_size' => $this->pagesize,
110 'show_hints' => $this->show_hints,
111 'print_profile' => $this->print_profile,
112 'rep_popup' => $this->rep_popup,
113 'query_size' => $this->query_size,
114 'graphic_links' => $this->graphic_links,
115 'sticky_doc_date' => $this->sticky_date,
116 'startup_tab' => $this->startup_tab);
121 return $this->language;
126 return $this->qty_dec;
131 return $this->price_dec;
134 function exrate_dec()
136 return $this->exrate_dec;
139 function percent_dec()
141 return $this->percent_dec;
144 function show_gl_info()
146 return $this->show_gl_info;
149 function show_codes()
151 return $this->show_codes;
154 function date_format()
156 return $this->date_format;
161 return $this->date_sep;
164 function date_display()
167 $sep = $dateseps[$this->date_sep];
168 if ($this->date_format == 0)
169 return "m".$sep."d".$sep."Y";
170 elseif ($this->date_format == 1)
171 return "d".$sep."m".$sep."Y";
172 elseif ($this->date_format == 2)
173 return "Y".$sep."m".$sep."d";
174 elseif ($this->date_format == 3)
175 return "M".$sep."j".$sep."Y";
176 elseif ($this->date_format == 4)
177 return "j".$sep."M".$sep."Y";
179 return "Y".$sep."M".$sep."j";
184 return $this->tho_sep;
189 return $this->dec_sep;
197 function get_pagesize()
199 return $this->pagesize;
202 function show_hints()
204 return $this->show_hints;
207 function print_profile()
209 return $this->print_profile;
214 return $this->rep_popup;
217 function query_size()
219 return $this->query_size;
222 function graphic_links()
224 return $this->graphic_links;
227 function sticky_date()
229 return $this->sticky_date;
232 function start_up_tab()
234 return $this->startup_tab;
237 function transaction_days()
239 return $this->transaction_days;
242 function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes)
244 $this->price_dec = $price_dec;
245 $this->qty_dec = $qty_dec;
246 $this->exrate_dec = $exrate_dec;
247 $this->percent_dec = $percent_dec;
248 $this->show_gl_info = $showgl;
249 $this->show_codes = $showcodes;
252 function set_format($date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize)
254 $this->date_format = $date_format;
255 $this->date_sep = $date_sep;
256 $this->tho_sep = $tho_sep;
257 $this->dec_sep = $dec_sep;
258 $this->theme = $theme;
259 $this->pagesize = $pagesize;