blob: 7d5eb4e6ef89572f76cb36ca738dedf7c51db139 [file] [log] [blame]
Rushabh Mehta74506e92013-03-25 17:52:14 +05301# ERPNext: Copyright 2013 Web Notes Technologies Pvt Ltd
2# GNU General Public License. See "license.txt"
3
4
5from __future__ import unicode_literals
6import webnotes
7import home
8
9def 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 Mehtadd790a52013-06-17 12:55:54 +053017 if webnotes.session['user']!='Guest':
Rushabh Mehta74506e92013-03-25 17:52:14 +053018 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 Mehta27c40792013-04-03 15:21:44 +053023
Rushabh Mehta74506e92013-03-25 17:52:14 +053024 # 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 Doshiaeef7bd2013-04-19 16:21:55 +053033 bootinfo['docs'] += webnotes.conn.sql("""select name, default_currency, cost_center
34 from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
Rushabh Mehta74506e92013-03-25 17:52:14 +053035
36def 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