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 | |
| 17 | if webnotes.session['user']=='Guest': |
| 18 | bootinfo['website_menus'] = webnotes.conn.sql("""select label, url, custom_page, |
| 19 | parent_label, parentfield |
| 20 | from `tabTop Bar Item` where parent='Website Settings' order by idx asc""", as_dict=1) |
| 21 | bootinfo['startup_code'] = \ |
| 22 | webnotes.conn.get_value('Website Settings', None, 'startup_code') |
| 23 | else: |
| 24 | bootinfo['letter_heads'] = get_letter_heads() |
| 25 | |
| 26 | import webnotes.model.doctype |
| 27 | bootinfo['notification_settings'] = webnotes.doc("Notification Control", |
| 28 | "Notification Control").get_values() |
| 29 | |
| 30 | bootinfo['modules_list'] = webnotes.conn.get_global('modules_list') |
| 31 | |
| 32 | # if no company, show a dialog box to create a new company |
| 33 | bootinfo['setup_complete'] = webnotes.conn.sql("""select name from |
| 34 | tabCompany limit 1""") and 'Yes' or 'No' |
| 35 | |
| 36 | # load subscription info |
| 37 | import conf |
| 38 | for key in ['max_users', 'expires_on', 'max_space', 'status', 'developer_mode']: |
| 39 | if hasattr(conf, key): bootinfo[key] = getattr(conf, key) |
| 40 | |
| 41 | bootinfo['docs'] += webnotes.conn.sql("select name, default_currency from `tabCompany`", |
| 42 | as_dict=1, update={"doctype":":Company"}) |
| 43 | |
| 44 | def get_letter_heads(): |
| 45 | """load letter heads with startup""" |
| 46 | import webnotes |
| 47 | ret = webnotes.conn.sql("""select name, content from `tabLetter Head` |
| 48 | where ifnull(disabled,0)=0""") |
| 49 | return dict(ret) |
| 50 | |