mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 04:09:11 +00:00
feature to set / unset birthday reminders webnotes/erpnext#851
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import getdate, validate_email_add, cstr
|
||||
from webnotes.utils import getdate, validate_email_add, cstr, cint
|
||||
from webnotes.model.doc import make_autoname
|
||||
from webnotes import msgprint, _
|
||||
|
||||
@@ -39,12 +39,12 @@ class DocType:
|
||||
self.validate_email()
|
||||
self.validate_status()
|
||||
self.validate_employee_leave_approver()
|
||||
self.update_dob_event()
|
||||
|
||||
def on_update(self):
|
||||
if self.doc.user_id:
|
||||
self.update_user_default()
|
||||
self.update_profile()
|
||||
self.update_dob_event()
|
||||
|
||||
def update_user_default(self):
|
||||
webnotes.conn.set_default("employee", self.doc.name, self.doc.user_id)
|
||||
@@ -155,10 +155,11 @@ class DocType:
|
||||
raise_exception=InvalidLeaveApproverError)
|
||||
|
||||
def update_dob_event(self):
|
||||
if self.doc.status == "Active" and self.doc.date_of_birth:
|
||||
if self.doc.status == "Active" and self.doc.date_of_birth \
|
||||
and not cint(webnotes.conn.get_value("HR Settings", None, "stop_birthday_reminders")):
|
||||
birthday_event = webnotes.conn.sql("""select name from `tabEvent` where repeat_on='Every Year'
|
||||
and ref_type='Employee' and ref_name=%s""", self.doc.name)
|
||||
|
||||
|
||||
starts_on = self.doc.date_of_birth + " 00:00:00"
|
||||
ends_on = self.doc.date_of_birth + " 00:15:00"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user