Rushabh Mehta | 74506e9 | 2013-03-25 17:52:14 +0530 | [diff] [blame] | 1 | # ERPNext: Copyright 2013 Web Notes Technologies Pvt Ltd |
| 2 | # GNU General Public License. See "license.txt" |
| 3 | |
| 4 | |
| 5 | from __future__ import unicode_literals |
| 6 | import webnotes |
| 7 | import home |
| 8 | |
| 9 | def boot_session(bootinfo): |
| 10 | """boot session - send website info if guest""" |
| 11 | import webnotes |
| 12 | import webnotes.model.doc |
| 13 | |
| 14 | bootinfo['custom_css'] = webnotes.conn.get_value('Style Settings', None, 'custom_css') or '' |
| 15 | bootinfo['website_settings'] = webnotes.model.doc.getsingle('Website Settings') |
| 16 | |
Rushabh Mehta | dd790a5 | 2013-06-17 12:55:54 +0530 | [diff] [blame] | 17 | if webnotes.session['user']!='Guest': |
Rushabh Mehta | 74506e9 | 2013-03-25 17:52:14 +0530 | [diff] [blame] | 18 | bootinfo['letter_heads'] = get_letter_heads() |
| 19 | |
| 20 | import webnotes.model.doctype |
| 21 | bootinfo['notification_settings'] = webnotes.doc("Notification Control", |
| 22 | "Notification Control").get_values() |
Rushabh Mehta | 27c4079 | 2013-04-03 15:21:44 +0530 | [diff] [blame] | 23 | |
Rushabh Mehta | 74506e9 | 2013-03-25 17:52:14 +0530 | [diff] [blame] | 24 | # if no company, show a dialog box to create a new company |
| 25 | bootinfo['setup_complete'] = webnotes.conn.sql("""select name from |
| 26 | tabCompany limit 1""") and 'Yes' or 'No' |
| 27 | |
| 28 | # load subscription info |
| 29 | import conf |
| 30 | for key in ['max_users', 'expires_on', 'max_space', 'status', 'developer_mode']: |
| 31 | if hasattr(conf, key): bootinfo[key] = getattr(conf, key) |
| 32 | |
Anand Doshi | aeef7bd | 2013-04-19 16:21:55 +0530 | [diff] [blame] | 33 | bootinfo['docs'] += webnotes.conn.sql("""select name, default_currency, cost_center |
| 34 | from `tabCompany`""", as_dict=1, update={"doctype":":Company"}) |
Rushabh Mehta | 74506e9 | 2013-03-25 17:52:14 +0530 | [diff] [blame] | 35 | |
| 36 | def get_letter_heads(): |
| 37 | """load letter heads with startup""" |
| 38 | import webnotes |
| 39 | ret = webnotes.conn.sql("""select name, content from `tabLetter Head` |
| 40 | where ifnull(disabled,0)=0""") |
| 41 | return dict(ret) |
| 42 | |