diff --git a/core/doctype/event/event.py b/core/doctype/event/event.py index c9e7bfd38d..dceee1902b 100644 --- a/core/doctype/event/event.py +++ b/core/doctype/event/event.py @@ -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 = "
%(description)s
" % e text += ''\ @@ -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' diff --git a/webnotes/translate.py b/webnotes/translate.py index db0139d7a4..a4270e46c9 100644 --- a/webnotes/translate.py +++ b/webnotes/translate.py @@ -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"""