From 859cb7260605e7510fdcf1e9c478c07c8fdaa319 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 10 Apr 2012 11:35:19 +0530 Subject: [PATCH] new favicon --- .../doctype/naming_series/naming_series.py | 38 ++++++++++++++---- erpnext/startup/startup.js | 1 + favicon.ico | Bin 318 -> 0 bytes images/favicon.ico | Bin 0 -> 1150 bytes js/all-app.js | 10 +++-- js/all-web.js | 10 +++-- js/app.js | 2 +- version.num | 2 +- 8 files changed, 47 insertions(+), 16 deletions(-) delete mode 100644 favicon.ico create mode 100644 images/favicon.ico diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index bef4987927..3b820b8231 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -19,6 +19,7 @@ import webnotes from webnotes.utils import cint, cstr from webnotes import msgprint, errprint +import webnotes.model.doctype sql = webnotes.conn.sql @@ -31,13 +32,13 @@ class DocType: #----------------------------------------------------------------------------------------------------------------------------------- def get_transactions(self): - return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.module !='Recycle Bin' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")]) + return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")]) #----------------------------------------------------------------------------------------------------------------------------------- def get_options_for(self, doctype): - sr = sql("select options from `tabDocField` where parent='%s' and fieldname='naming_series'" % (doctype)) - if sr and sr[0][0]: - return sr[0][0].split("\n") + sr = webnotes.model.doctype.get_property(doctype, 'naming_series') + if sr: + return sr.split("\n") else: return [] @@ -50,7 +51,7 @@ class DocType: options = self.scrub_options_list(ol) # validate names - [self.validate_series_name(i) for i in options] + for i in options: self.validate_series_name(i) if self.doc.user_must_always_select: options = [''] + options @@ -58,8 +59,28 @@ class DocType: else: default = options[0] - # update - sql("update tabDocField set `options`=%s, `default`=%s where parent=%s and fieldname='naming_series'", ("\n".join(options), default, doctype)) + # update in property setter + prop_dict = {'options': "\n".join(options), 'default': default} + for prop in prop_dict: + ps_exists = webnotes.conn.sql("""SELECT name FROM `tabProperty Setter` + WHERE doc_type = %s AND field_name = 'naming_series' + AND property = %s""", (doctype, prop)) + if ps_exists: + ps = Document('Property Setter', ps_exists[0][0]) + ps.value = prop_dict[prop] + ps.save() + else: + ps = Document('Property Setter', fielddata = { + 'doctype_or_field': 'DocField', + 'doc_type': doctype, + 'field_name': 'naming_series', + 'property': prop, + 'value': prop_dict[prop], + 'property_type': 'Select', + 'select_doctype': doctype + }) + ps.save(1) + self.doc.set_options = "\n".join(options) #----------------------------------------------------------------------------------------------------------------------------------- @@ -73,7 +94,8 @@ class DocType: from core.doctype.doctype.doctype import DocType dt = DocType() - sr = sql("select options, parent from `tabDocField` where fieldname='naming_series' and parent != %s", self.doc.select_doc_for_series) + parent = sql("select parent from `tabDocField` where fieldname='naming_series' and parent != %s", self.doc.select_doc_for_series) + sr = ([p[0], webnotes.model.doctype.get_property(p[0], 'naming_series')] for p in parent) options = self.scrub_options_list(self.doc.set_options.split("\n")) for series in options: dt.validate_series(series, self.doc.select_doc_for_series) diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 5d7e663d42..3a51a84bbe 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -171,3 +171,4 @@ erpnext.set_user_background = function(src) { $(document).bind('startup', function() { erpnext.startup.start(); }); + diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index 794eaaf00a9b1ae997877153523175563332969a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 318 zcmY+6txf|$5XXOaJyKE8Gp#}NSViiZdQ!1Tk!O|=av`Y#JP*(WL3JOYPtXK8hJvlX zAV@#~!SG?~jv1~3b~693nOTUm(lo{1egs`(ZA&ukh(r;lzgR=PUF+TQox#Z`2ao4e zs|i{8O8?=F>i(4KZi2t~VsQMe^E39!mp{LlOni|Wjc3J?ibL;1Cy-ov2u0rXBiIS~ zSgi)ZtOn~X2bY;|$(D!CnHPyIXvs3RKxBz?PDCJ{FU+cNH%glxJT>9A0aq)yeunl3 R^fv$7GMm|s?b?mq{s0BbL9GA) diff --git a/images/favicon.ico b/images/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..045b1bddd20462f229d5443a7d5eeba7dbd38641 GIT binary patch literal 1150 zcma)*xi3Uf6vpq^#Wq9iyGSsWN+TM7i%Ls^gosHHiEe6*h60HtA{vRUu@wqKi;k9> z-#2q^Jj}?Pm)|?*e(&Cw`@VCZb0My9*l}-jV|mWiIOnbIoa5POaf;;l`&LaE zH5$kv&}+O_ZyM=O6rrrbld(^3hBbHw={pdCbWw(Q3ZKR!c>pc~T7p{pN*7vx0)G7i zbw6agKA*W$aA>TMt6(OeEmN03rl{pXFZ6-FUH;YCSX!fL^0d=Xt$B1L>D4P)96<}L z+gREGG{F|UfwVm+hiv_eGWQz1Pj}SndnW(R19R`Gd*CXd`StQ|0(OlhawSZI_9%S; zA}|YHo2S;dD>`7r&_3mhJR3AxO_K*+lSi6Y3i9Uz-r*9uU<2fnP;b?jZ5vC|IjsQg z>lVB(FVw>j{Qd-E?JJ#sT7Lt6z0Uj)oCUQ1{3~Q$433RBS$!FYO=FI%-+3~i>3r(n gQ>X{>LFj#o94IhyB@oI#w3wXzMGPsMSZsIh3wzpgZvX%Q literal 0 HcmV?d00001 diff --git a/js/all-app.js b/js/all-app.js index 75a130b7f9..0d379fc16d 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -240,7 +240,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}} wn.get_route=function(route){if(!route) route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});} -wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;} +wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;set_favicon();} wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route) return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}}); /* @@ -2178,7 +2178,7 @@ var setup_viewport=function(){wn.container=new wn.views.Container();if(user=='Gu user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();} $(document).trigger('startup');try{if(wn.control_panel.custom_startup_code) eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);} -var t=to_open();if(t){window.location.hash=t;}else if(home_page){loadpage(home_page);} +var t=to_open();if(t){window.location.hash=t;set_favicon();}else if(home_page){loadpage(home_page);} wn.route();$dh('startup_div');$ds('body_div');} var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_viewport();} if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages) @@ -2205,12 +2205,16 @@ var resize_observers=[] function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);} window.onresize=function(){return;var ht=get_window_height();for(var i=0;i \ + ' +$(favicon).appendTo('head');} /* * js/app.js */ wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'© Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number} wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',function(){startup();});$(document).bind('toolbar_setup',function(){$('.brand').html('erpnext\ - ').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});}) + ').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});}); /* * erpnext/startup/startup.js */ diff --git a/js/all-web.js b/js/all-web.js index 58b748db01..90f035eb3f 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -154,7 +154,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}} wn.get_route=function(route){if(!route) route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});} -wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;} +wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;set_favicon();} wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route) return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}}); /* @@ -1206,7 +1206,7 @@ var setup_viewport=function(){wn.container=new wn.views.Container();if(user=='Gu user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();} $(document).trigger('startup');try{if(wn.control_panel.custom_startup_code) eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);} -var t=to_open();if(t){window.location.hash=t;}else if(home_page){loadpage(home_page);} +var t=to_open();if(t){window.location.hash=t;set_favicon();}else if(home_page){loadpage(home_page);} wn.route();$dh('startup_div');$ds('body_div');} var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_viewport();} if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages) @@ -1233,12 +1233,16 @@ var resize_observers=[] function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);} window.onresize=function(){return;var ht=get_window_height();for(var i=0;i \ + ' +$(favicon).appendTo('head');} /* * js/app.js */ wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'© Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number} wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',function(){startup();});$(document).bind('toolbar_setup',function(){$('.brand').html('erpnext\ - ').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});}) + ').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});}); /* * erpnext/startup/startup.js */ diff --git a/js/app.js b/js/app.js index f2e24bba1e..6555de0c9c 100644 --- a/js/app.js +++ b/js/app.js @@ -38,4 +38,4 @@ $(document).bind('toolbar_setup', function() { }, function() { $(this).find('.icon-home').removeClass('navbar-icon-home-hover'); }); -}) +}); diff --git a/version.num b/version.num index f6e16be538..ae6f1163f2 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1496 \ No newline at end of file +1507 \ No newline at end of file