def send_event_digest(): today = nowdate() for user in webnotes.conn.sql("""select name, email, language from tabProfile where ifnull(enabled,0)=1 and user_type='System User' and name not in ('Guest', 'Administrator')""", as_dict=1): events = get_events(today, today, user.name, for_reminder=True) if events: text = "" webnotes.set_user_lang(user.name, user.language) webnotes.load_translations("core", "doctype", "event") 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;">'\ + webnotes._("Daily Event Digest is sent for Calendar Events where reminders are set.")+'</p>' from webnotes.utils.email_lib import sendmail sendmail(recipients=user.email, subject=webnotes._("Upcoming Events for Today"), msg=text)
def load_translations(bootinfo): webnotes.set_user_lang(webnotes.session.user) if webnotes.lang != 'en': from webnotes.translate import get_lang_data # framework bootinfo["__messages"] = get_lang_data("../lib/public/js/wn", None, "js") # doctype and module names bootinfo["__messages"].update(get_lang_data('../app/public/js', None, "js")) bootinfo["lang"] = webnotes.lang
def load_translations(bootinfo): webnotes.set_user_lang(webnotes.session.user) if webnotes.lang != 'en': from webnotes.translate import get_lang_data from webnotes.utils import get_path # framework bootinfo["__messages"] = get_lang_data(get_path("lib","public", "js", "wn"), None, "js") # doctype and module names bootinfo["__messages"].update(get_lang_data(get_path("app","public", "js"), None, "js")) bootinfo["lang"] = webnotes.lang
def send_event_digest(): today = nowdate() for user in webnotes.conn.sql("""select name, email, language from tabProfile where ifnull(enabled,0)=1 and user_type='System User' and name not in ('Guest', 'Administrator')""", as_dict=1): events = get_events(today, today, user.name, for_reminder=True) if events: text = "" webnotes.set_user_lang(user.name, user.language) 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;">'\ + webnotes._("Daily Event Digest is sent for Calendar Events where reminders are set.")+'</p>' from webnotes.utils.email_lib import sendmail sendmail(recipients=user.email, subject=webnotes._("Upcoming Events for Today"), msg = text)
def load_translations(bootinfo): webnotes.set_user_lang(webnotes.session.user) if webnotes.lang != 'en': bootinfo["__messages"] = webnotes.get_lang_dict("include") bootinfo["lang"] = webnotes.lang