From 4b2b159d12f38f6bb2a9bea22aa2e2482adbaba0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 30 Apr 2012 20:00:19 +0530 Subject: [PATCH 01/15] if max_users = 0, consider unlimited users --- erpnext/utilities/page/users/users.js | 2 +- erpnext/utilities/page/users/users.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js index 704682eafc..28fbc1b0f4 100644 --- a/erpnext/utilities/page/users/users.js +++ b/erpnext/utilities/page/users/users.js @@ -223,7 +223,7 @@ $.extend(wn.pages.users, { add_user: function() { var me = wn.pages.users; var active_users = $('.user-card:not(.disabled)'); - if(wn.boot.max_users && (active_users.length >= wn.boot.max_users)) { + if(wn.boot.max_users && (active_users.length >= wn.boot.max_users) && wn.boot.max_users) { msgprint(repl("Alas!
\ You already have %(active_users)s active users, \ which is the maximum number that you are currently allowed to add.

\ diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py index 819f7bb1da..2b7c884821 100644 --- a/erpnext/utilities/page/users/users.py +++ b/erpnext/utilities/page/users/users.py @@ -112,7 +112,7 @@ def add_profile(args): active_users = sql("""select count(*) from tabProfile where ifnull(enabled, 0)=1 and docstatus<2 and name not in ('Administrator', 'Guest')""")[0][0] - if active_users >= conf.max_users: + if active_users >= conf.max_users and not conf.max_users: # same message as in users.js webnotes.msgprint("""Alas!
\ You already have %(active_users)s active users, \ From 5c2a792d03680deab68761cf6504b0493bbb5413 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 30 Apr 2012 20:03:23 +0530 Subject: [PATCH 02/15] if max_users = 0, consider unlimited users --- erpnext/utilities/page/users/users.js | 2 +- erpnext/utilities/page/users/users.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js index 28fbc1b0f4..704682eafc 100644 --- a/erpnext/utilities/page/users/users.js +++ b/erpnext/utilities/page/users/users.js @@ -223,7 +223,7 @@ $.extend(wn.pages.users, { add_user: function() { var me = wn.pages.users; var active_users = $('.user-card:not(.disabled)'); - if(wn.boot.max_users && (active_users.length >= wn.boot.max_users) && wn.boot.max_users) { + if(wn.boot.max_users && (active_users.length >= wn.boot.max_users)) { msgprint(repl("Alas!
\ You already have %(active_users)s active users, \ which is the maximum number that you are currently allowed to add.

\ diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py index 2b7c884821..7da8003a3d 100644 --- a/erpnext/utilities/page/users/users.py +++ b/erpnext/utilities/page/users/users.py @@ -112,7 +112,7 @@ def add_profile(args): active_users = sql("""select count(*) from tabProfile where ifnull(enabled, 0)=1 and docstatus<2 and name not in ('Administrator', 'Guest')""")[0][0] - if active_users >= conf.max_users and not conf.max_users: + if active_users >= conf.max_users and conf.max_users: # same message as in users.js webnotes.msgprint("""Alas!
\ You already have %(active_users)s active users, \ From 563fcc1b05c818b6ade98596add70d3b4c9bf988 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 30 Apr 2012 21:06:31 +0530 Subject: [PATCH 03/15] fix in startup.js --- erpnext/startup/startup.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 321149cf81..5dfd692aec 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -106,7 +106,7 @@ erpnext.startup.start = function() { ', { expiry_string: expiry_string })); } else if (diff < 0) { $('header').append(repl('
\ - This ERPNext subscription has expired and should be deleted. \ + This ERPNext subscription has expired. \
', { expiry_string: expiry_string })); } } @@ -215,12 +215,3 @@ erpnext.send_message = function(opts) { } }); } - -erpnext.hide_naming_series = function() { - if(cur_frm.fields_dict.naming_series) { - hide_field('naming_series'); - if(cur_frm.doc.__islocal) { - unhide_field('naming_series'); - } - } -} From 220434c0ef1c13741d2f052a238842bae1753cf6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 30 Apr 2012 21:06:54 +0530 Subject: [PATCH 04/15] fix in startup.js --- js/all-app.js | 5 ++--- js/all-web.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/js/all-app.js b/js/all-app.js index 31c1e6db30..e0717431fd 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -2233,11 +2233,11 @@ if(wn.boot.startup_code){eval(wn.boot.startup_code);}}else{wn.boot.profile.allow if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');} erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup.show();} if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil.str_to_obj(dateutil.get_today());var expires_on=dateutil.str_to_obj(wn.boot.expires_on);var diff=dateutil.get_diff(expires_on,today);if(0<=diff&&diff<=15){var expiry_string=diff==0?"today":repl("in %(diff)s day(s)",{diff:diff});$('header').append(repl('
\ - Ahem! Your ERPNext subscription will expire %(expiry_string)s. \ + Your ERPNext subscription will expire %(expiry_string)s. \ Please renew your subscription to continue using ERPNext \ (and remove this annoying banner). \
',{expiry_string:expiry_string}));}else if(diff<0){$('header').append(repl('
\ - Ahem! This ERPNext subscription has expired and should be deleted. \ + This ERPNext subscription has expired. \
',{expiry_string:expiry_string}));}}} erpnext.set_about();$('#startup_div').toggle(false);} show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);} @@ -2254,7 +2254,6 @@ erpnext.set_user_background=function(src){set_style(repl('#body_div { background $(document).bind('startup',function(){erpnext.startup.start();});erpnext.send_message=function(opts){if(opts.btn){$(opts.btn).start_working();} wn.call({method:'website.send_message',args:opts,callback:function(r){if(opts.btn){$(opts.btn).done_working();} if(opts.callback)opts.callback(r)}});} -erpnext.hide_naming_series=function(){console.log(1);if(cur_frm.fields_dict.naming_series){hide_field('naming_series');if(cur_frm.doc.__islocal){unhide_field('naming_series');}}} /* * erpnext/startup/js/modules.js */ diff --git a/js/all-web.js b/js/all-web.js index ee051811e8..888aca2b6e 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -844,11 +844,11 @@ if(wn.boot.startup_code){eval(wn.boot.startup_code);}}else{wn.boot.profile.allow if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');} erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup.show();} if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil.str_to_obj(dateutil.get_today());var expires_on=dateutil.str_to_obj(wn.boot.expires_on);var diff=dateutil.get_diff(expires_on,today);if(0<=diff&&diff<=15){var expiry_string=diff==0?"today":repl("in %(diff)s day(s)",{diff:diff});$('header').append(repl('
\ - Ahem! Your ERPNext subscription will expire %(expiry_string)s. \ + Your ERPNext subscription will expire %(expiry_string)s. \ Please renew your subscription to continue using ERPNext \ (and remove this annoying banner). \
',{expiry_string:expiry_string}));}else if(diff<0){$('header').append(repl('
\ - Ahem! This ERPNext subscription has expired and should be deleted. \ + This ERPNext subscription has expired. \
',{expiry_string:expiry_string}));}}} erpnext.set_about();$('#startup_div').toggle(false);} show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);} @@ -865,7 +865,6 @@ erpnext.set_user_background=function(src){set_style(repl('#body_div { background $(document).bind('startup',function(){erpnext.startup.start();});erpnext.send_message=function(opts){if(opts.btn){$(opts.btn).start_working();} wn.call({method:'website.send_message',args:opts,callback:function(r){if(opts.btn){$(opts.btn).done_working();} if(opts.callback)opts.callback(r)}});} -erpnext.hide_naming_series=function(){console.log(1);if(cur_frm.fields_dict.naming_series){hide_field('naming_series');if(cur_frm.doc.__islocal){unhide_field('naming_series');}}} /* * erpnext/website/js/topbar.js */ From 3f6eed2dc212092d54e0ffb64dea93f09ba94544 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 1 May 2012 12:23:28 +0530 Subject: [PATCH 05/15] fix in account subscription info box creation --- erpnext/utilities/page/users/users.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js index 704682eafc..757b1a3bda 100644 --- a/erpnext/utilities/page/users/users.js +++ b/erpnext/utilities/page/users/users.js @@ -64,7 +64,8 @@ $.extend(wn.pages.users, { } }); if(!$('.subscription-info').length && (wn.boot.max_users || wn.boot.expires_on)) { - var $sub_info = $('
').insertAfter('.help'); + var $sub_info = $('
') + .insertAfter($(wn.pages.users).find('.help')); if(wn.boot.max_users) { $sub_info.append(repl('\ \ From 6f8e9e951eb81fc9a3874a459a5e9466be137bfe Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 1 May 2012 13:41:44 +0530 Subject: [PATCH 06/15] website fixes --- .../doctype/style_settings/style_settings.py | 3 ++ erpnext/website/js/topbar.js | 34 ++++++++++++++----- js/all-app.js | 3 +- js/all-web.js | 21 +++++++----- js/app.js | 4 +-- 5 files changed, 44 insertions(+), 21 deletions(-) diff --git a/erpnext/website/doctype/style_settings/style_settings.py b/erpnext/website/doctype/style_settings/style_settings.py index db26a15e80..f47a427bae 100644 --- a/erpnext/website/doctype/style_settings/style_settings.py +++ b/erpnext/website/doctype/style_settings/style_settings.py @@ -25,6 +25,9 @@ class DocType: with open('erpnext/website/doctype/style_settings/custom_template.css', 'r') as f: temp = Template(f.read()) + if not self.doc.font_size: + self.doc.font_size = '13px' + self.doc.small_font_size = str(int(self.doc.font_size[:-2])-2) + 'px' self.doc.custom_css = temp.render(doc = self.doc) diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index 8caf8dcf1c..e6a6b59c4a 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -27,7 +27,7 @@ wn.provide('erpnext.navbar'); erpnext.navbar.Navbar = Class.extend({ init: function() { this.make(); - $('.brand').html(wn.boot.website_settings.brand_html); + $('.brand').html(wn.boot.website_settings.brand_html || sys_defaults.company); this.make_items(); $('.dropdown-toggle').dropdown(); }, @@ -54,9 +54,11 @@ erpnext.navbar.Navbar = Class.extend({ for(var i=0;i\ - %(label)s', item)) + %(label)s', item)); } } @@ -77,18 +79,23 @@ erpnext.navbar.Navbar = Class.extend({ }); $parent_li.append(''); } - item.route = item.url || item.custom_page; + erpnext.header_link_settings(item); $parent_li.find('.dropdown-menu').append(repl('
  • \ - %(label)s
  • ', item)) + %(label)s', item)) } } } }); - // footer erpnext.Footer = Class.extend({ init: function() { + if(!wn.boot.website_settings.copyright) { + wn.boot.website_settings.copyright = sys_defaults.company; + } + if(!wn.boot.website_settings.address) { + wn.boot.website_settings.address = ''; + } $('footer').html(repl('