diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py index 75556e39370..5f9c44737a8 100644 --- a/erpnext/home/__init__.py +++ b/erpnext/home/__init__.py @@ -66,7 +66,7 @@ def make_feed(feedtype, doctype, name, owner, subject, color): def update_feed(doc, method=None): "adds a new feed" - if method=='on_update': + if method in ['on_update', 'on_submit']: subject, color = feed_dict.get(doc.doctype, [None, None]) if subject: make_feed('', doc.doctype, doc.name, doc.owner, subject % doc.fields, color) diff --git a/erpnext/patches/jan_mar_2012/remove_archive.py b/erpnext/patches/jan_mar_2012/remove_archive.py index 5f2cdab8c01..1b914d5606f 100644 --- a/erpnext/patches/jan_mar_2012/remove_archive.py +++ b/erpnext/patches/jan_mar_2012/remove_archive.py @@ -8,7 +8,7 @@ def execute(): from webnotes.utils import archive arc_tables = webnotes.conn.sql('show tables like "arc%"') try: - webnotes.conn.auto_commit_on_excess = 1 + webnotes.conn.auto_commit_on_many_writes = 1 for tab in arc_tables: tab = tab[0] dt = tab[3:] diff --git a/erpnext/patches/jan_mar_2012/website/getfile_rename.py b/erpnext/patches/jan_mar_2012/website/getfile_rename.py index 8f7cede659b..15aa8157e6f 100644 --- a/erpnext/patches/jan_mar_2012/website/getfile_rename.py +++ b/erpnext/patches/jan_mar_2012/website/getfile_rename.py @@ -23,17 +23,23 @@ def execute(): txt = get_file_id(txt) webnotes.conn.sql("""update `tab%s` set %s=%s where name=%s""" % \ - (table[0], table[1], '%s', '%s'), (txt, item[0]), debug=1) + (table[0], table[1], '%s', '%s'), (txt, item[0])) # control panel, client name txt = webnotes.conn.get_value('Control Panel',None,'client_name') - txt = get_file_id(txt) - webnotes.conn.set_value('Control Panel', None, 'client_name', txt.replace('index.cgi?cmd=get_file&fname=', 'files/')) - + if txt: + txt = get_file_id(txt) + webnotes.conn.set_value('Control Panel', None, 'client_name', txt.replace('index.cgi?cmd=get_file&fname=', 'files/')) + def get_file_id(txt): """old file links may be from fileid or filename""" import re match = re.search('files/([^"\']*)', txt) + + if not match: + print txt + return txt + fname = match.groups()[0] if not fname.startswith('FileData'): fid = webnotes.conn.sql("""select name from `tabFile Data` @@ -41,4 +47,4 @@ def get_file_id(txt): if fid: fid = fid[0][0].replace('/', '-') txt = txt.replace(fname, fid) - return txt \ No newline at end of file + return txt diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index b6b1f9f2580..9740be48801 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -7,7 +7,7 @@ def on_login(login_manager): """ called from login manager, before login """ - if login_manager.user not in ('Guest', None, ''): + if login_manager.user not in ('Guest', None, '') and webnotes.conn.cur_db_name!='accounts' and webnotes.conn.get_value('Control Panel', 'Control Panel', 'account_id')!='s5u011': try: login_manager = login_as(login_manager) update_account_details() @@ -32,7 +32,7 @@ def on_login_post_session(login_manager): sid!=%s""", \ (webnotes.session['user'], webnotes.session['sid']), as_list=1) - if webnotes.session['user'] not in ('Guest'): + if webnotes.session['user'] not in ('Guest') and webnotes.conn.cur_db_name!='accounts': # create feed from webnotes.utils import nowtime home.make_feed('Login', 'Profile', login_manager.user, login_manager.user,