[event] [minor fixes]
This commit is contained in:
parent
9714ce9970
commit
3ac8db7a18
2 changed files with 19 additions and 1 deletions
|
|
@ -29,6 +29,10 @@ weekdays = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday",
|
|||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def validate(self):
|
||||
if self.doc.starts_on > self.doc.ends_on:
|
||||
webnotes.msgprint(webnotes._("Event Start must be after End"), raise_exception=True)
|
||||
|
||||
def send_event_digest():
|
||||
today = nowdate()
|
||||
|
|
@ -43,6 +47,8 @@ def send_event_digest():
|
|||
|
||||
text = "<h3>" + webnotes._("Events In Today's Calendar") + "</h3>"
|
||||
for e in events:
|
||||
if e.all_day:
|
||||
e.starts_on = "All Day"
|
||||
text += "<h4>%(starts_on)s: %(subject)s</h4><p>%(description)s</p>" % e
|
||||
|
||||
text += '<p style="color: #888; font-size: 80%; margin-top: 20px; padding-top: 10px; border-top: 1px solid #eee;">'\
|
||||
|
|
@ -63,6 +69,7 @@ def get_events(start, end, user=None, for_reminder=False):
|
|||
from tabEvent where ((
|
||||
(starts_on between '%(start)s 00:00:00' and '%(end)s 23:59:59')
|
||||
or (ends_on between '%(start)s 00:00:00' and '%(end)s 23:59:59')
|
||||
or (starts_on <= '%(start)s' and ends_on >= '%(end)s')
|
||||
) or (
|
||||
starts_on <= '%(start)s 00:00:00' and ifnull(repeat_this_event,0)=1 and
|
||||
ifnull(repeat_till, "3000-01-01 00:00:00") > '%(start)s'
|
||||
|
|
|
|||
|
|
@ -299,11 +299,22 @@ def import_messages(lang, infile):
|
|||
_update_lang_file('js')
|
||||
_update_lang_file('py')
|
||||
|
||||
docs_loaded = []
|
||||
def load_doc_messages(module, doctype, name):
|
||||
if webnotes.lang=="en":
|
||||
return {}
|
||||
|
||||
global docs_loaded
|
||||
doc_path = get_doc_path(module, doctype, name)
|
||||
|
||||
# don't repload the same doc again
|
||||
if (webnotes.lang + ":" + doc_path) in docs_loaded:
|
||||
return
|
||||
|
||||
docs_loaded.append(webnotes.lang + ":" + doc_path)
|
||||
|
||||
global messages
|
||||
messages.update(get_lang_data(get_doc_path(module, doctype, name), None, 'doc'))
|
||||
messages.update(get_lang_data(doc_path, None, 'doc'))
|
||||
|
||||
def get_lang_data(basepath, lang, mtype):
|
||||
"""get language dict from langfile"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue