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'];
90 if (!file_exists("$path_to_root/themes/$this->theme"))
91 $this->theme = "default";
98 'language' => $this->language,
99 'qty_dec' => $this->qty_dec,
100 'prices_dec' => $this->price_dec,
101 'rates_dec' => $this->exrate_dec,
102 'percent_dec' => $this->percent_dec,
103 'show_gl' => $this->show_gl_info,
104 'show_codes' => $this->show_codes,
105 'date_format' =>$this->date_format,
106 'date_sep' => $this->date_sep,
107 'tho_sep' => $this->tho_sep,
108 'dec_sep' => $this->dec_sep,
109 'theme' => $this->theme,
110 'page_size' => $this->pagesize,
111 'show_hints' => $this->show_hints,
112 'print_profile' => $this->print_profile,
113 'rep_popup' => $this->rep_popup,
114 'query_size' => $this->query_size,
115 'graphic_links' => $this->graphic_links,
116 'sticky_doc_date' => $this->sticky_date,
117 'startup_tab' => $this->startup_tab);
122 return $this->language;
127 return $this->qty_dec;
132 return $this->price_dec;
135 function exrate_dec()
137 return $this->exrate_dec;
140 function percent_dec()
142 return $this->percent_dec;
145 function show_gl_info()
147 return $this->show_gl_info;
150 function show_codes()
152 return $this->show_codes;
155 function date_format()
157 return $this->date_format;
162 return $this->date_sep;
165 function date_display()
168 $sep = $dateseps[$this->date_sep];
169 if ($this->date_format == 0)
170 return "m".$sep."d".$sep."Y";
171 elseif ($this->date_format == 1)
172 return "d".$sep."m".$sep."Y";
173 elseif ($this->date_format == 2)
174 return "Y".$sep."m".$sep."d";
175 elseif ($this->date_format == 3)
176 return "M".$sep."j".$sep."Y";
177 elseif ($this->date_format == 4)
178 return "j".$sep."M".$sep."Y";
180 return "Y".$sep."M".$sep."j";
185 return $this->tho_sep;
190 return $this->dec_sep;
198 function get_pagesize()
200 return $this->pagesize;
203 function show_hints()
205 return $this->show_hints;
208 function print_profile()
210 return $this->print_profile;
215 return $this->rep_popup;
218 function query_size()
220 return $this->query_size;
223 function graphic_links()
225 return $this->graphic_links;
228 function sticky_date()
230 return $this->sticky_date;
233 function start_up_tab()
235 return $this->startup_tab;
238 function transaction_days()
240 return $this->transaction_days;
243 function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes)
245 $this->price_dec = $price_dec;
246 $this->qty_dec = $qty_dec;
247 $this->exrate_dec = $exrate_dec;
248 $this->percent_dec = $percent_dec;
249 $this->show_gl_info = $showgl;
250 $this->show_codes = $showcodes;
253 function set_format($date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize)
255 $this->date_format = $date_format;
256 $this->date_sep = $date_sep;
257 $this->tho_sep = $tho_sep;
258 $this->dec_sep = $dec_sep;
259 $this->theme = $theme;
260 $this->pagesize = $pagesize;