Merge branch 'master' into perpetual

This commit is contained in:
Nabin Hait 2013-09-04 14:56:44 +05:30
commit 0d57de3092
7 changed files with 41 additions and 31 deletions

View file

@ -322,3 +322,21 @@ def sign_up(email, full_name):
profile.insert()
return _("Registration Details Emailed.")
def profile_query(doctype, txt, searchfield, start, page_len, filters):
from webnotes.widgets.reportview import get_match_cond
return webnotes.conn.sql("""select name, concat_ws(' ', first_name, middle_name, last_name)
from `tabProfile`
where ifnull(enabled, 0)=1
and docstatus < 2
and name not in ('Administrator', 'Guest')
and user_type != 'Website User'
and (%(key)s like "%(txt)s"
or concat_ws(' ', first_name, middle_name, last_name) like "%(txt)s")
%(mcond)s
order by
case when name like "%(txt)s" then 0 else 1 end,
case when concat_ws(' ', first_name, middle_name, last_name) like "%(txt)s"
then 0 else 1 end,
name asc
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})

View file

@ -116,17 +116,7 @@ wn.ui.form.AssignTo = Class.extend({
});
}
}
me.dialog.fields_dict.assign_to.get_query = function() {
return "select name, concat_ws(' ', first_name, middle_name, last_name) \
from `tabProfile` where ifnull(enabled, 0)=1 and docstatus < 2 and \
name not in ('Administrator', 'Guest') and (%(key)s like \"%s\" or \
concat_ws(' ', first_name, middle_name, last_name) like \"%%%s\") \
order by \
case when name like \"%s%%\" then 0 else 1 end, \
case when concat_ws(' ', first_name, middle_name, last_name) \
like \"%s%%\" then 0 else 1 end, \
name asc limit 50";
};
me.dialog.fields_dict.assign_to.get_query = "core.doctype.profile.profile.profile_query";
}
me.dialog.clear();
me.dialog.show();

View file

@ -124,7 +124,7 @@ wn.views.QueryReport = Class.extend({
},
clear_filters: function() {
this.filters = [];
this.appframe.$w.find('.navbar .filters').remove();
this.appframe.$w.find('.appframe-form .filters').remove();
},
set_filters_by_name: function() {
this.filters_by_name = {};

View file

@ -46,7 +46,6 @@ def get_bootinfo():
add_home_page(bootinfo, doclist)
add_allowed_pages(bootinfo)
load_translations(bootinfo)
load_country_and_currency(bootinfo, doclist)
# ipinfo
if webnotes.session['data'].get('ipinfo'):
@ -67,14 +66,6 @@ def get_bootinfo():
return bootinfo
def load_country_and_currency(bootinfo, doclist):
if bootinfo.control_panel.country and \
webnotes.conn.exists("Country", bootinfo.control_panel.country):
doclist += [webnotes.doc("Country", bootinfo.control_panel.country)]
doclist += webnotes.conn.sql("""select * from tabCurrency
where ifnull(enabled,0)=1""", as_dict=1, update={"doctype":":Currency"})
def add_allowed_pages(bootinfo):
bootinfo.page_info = dict(webnotes.conn.sql("""select distinct parent, modified from `tabPage Role`
where role in ('%s')""" % "', '".join(webnotes.get_roles())))

View file

@ -21,14 +21,12 @@ def bundle(no_compress, cms_make=True):
bundle.make()
if cms_make:
# build index.html and app.html
from website.helpers.make_web_include_files import make
make()
if not no_compress:
from home.page.latest_updates import latest_updates
latest_updates.make()
try:
from startup.event_handlers import on_build
on_build()
except ImportError, e:
pass
def watch(no_compress):
"""watch and rebuild if necessary"""
import time

View file

@ -11,7 +11,6 @@ import webnotes
import conf
from webnotes import msgprint
from webnotes.utils import cint
import email
def get_email(recipients, sender='', msg='', subject='[No Subject]', text_content = None):
"""send an html email as multipart with attachments and all"""
@ -227,10 +226,14 @@ class EMail:
smtpserver.sess.sendmail(self.sender, self.recipients + (self.cc or []),
self.as_string())
except smtplib.SMTPSenderRefused, e:
except smtplib.SMTPSenderRefused:
webnotes.msgprint("""Invalid Outgoing Mail Server's Login Id or Password. \
Please rectify and try again.""",
raise_exception=webnotes.OutgoingEmailError)
except smtplib.SMTPRecipientsRefused:
webnotes.msgprint("""Invalid Recipient (To) Email Address. \
Please rectify and try again.""",
raise_exception=webnotes.OutgoingEmailError)
class SMTPServer:
def __init__(self, login=None, password=None, server=None, port=None, use_ssl=None):

View file

@ -386,3 +386,13 @@ def scrub_user_tags(tagcount):
def get_table_columns(table):
res = webnotes.conn.sql("DESC `tab%s`" % table, as_dict=1)
if res: return [r['Field'] for r in res]
# used in building query in queries.py
def get_match_cond(doctype, searchfield = 'name'):
cond = build_match_conditions(doctype)
if cond:
cond = ' and ' + cond
else:
cond = ''
return cond