mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix: Use multisql to support postgres
This commit is contained in:
@@ -332,13 +332,28 @@ def send_birthday_reminder(recipients, reminder_text, birthday_persons, message)
|
|||||||
def get_employees_who_are_born_today():
|
def get_employees_who_are_born_today():
|
||||||
"""Get all employee born today & group them based on their company"""
|
"""Get all employee born today & group them based on their company"""
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
employees_born_today = frappe.db.sql("""
|
employees_born_today = frappe.db.multisql({
|
||||||
SELECT `personal_email`, `company`, `company_email`, `user_id`, `employee_name` as 'name', `image`
|
"mariadb": """
|
||||||
FROM `tabEmployee`
|
SELECT `personal_email`, `company`, `company_email`, `user_id`, `employee_name` AS 'name', `image`
|
||||||
WHERE DAY(date_of_birth) = DAY(CURDATE())
|
FROM `tabEmployee`
|
||||||
AND MONTH(date_of_birth) = MONTH(CURDATE())
|
WHERE
|
||||||
AND `status` = 'Active'
|
DAY(date_of_birth) = DAY(%(today)s)
|
||||||
""", as_dict=1)
|
AND
|
||||||
|
MONTH(date_of_birth) = MONTH(%(today)s)
|
||||||
|
AND
|
||||||
|
`status` = 'Active'
|
||||||
|
""",
|
||||||
|
"postgres": """
|
||||||
|
SELECT "personal_email", "company", "company_email", "user_id", "employee_name" AS 'name', "image"
|
||||||
|
FROM "tabEmployee"
|
||||||
|
WHERE
|
||||||
|
DATE_PART('day', "date_of_birth") = date_part('day', %(today)s)
|
||||||
|
AND
|
||||||
|
DATE_PART('month', "date_of_birth") = date_part('month', %(today)s)
|
||||||
|
AND
|
||||||
|
"status" = 'Active'
|
||||||
|
""",
|
||||||
|
}, dict(today=today()), as_dict=1)
|
||||||
|
|
||||||
grouped_employees = defaultdict(lambda: [])
|
grouped_employees = defaultdict(lambda: [])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user