Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PWA): strip html tags in holiday descriptions (backport #1829) #1830

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions hrms/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from frappe import _
from frappe.model.workflow import get_workflow_name
from frappe.query_builder import Order
from frappe.utils import getdate
from frappe.utils import getdate, strip_html

SUPPORTED_FIELD_TYPES = [
"Link",
Expand Down Expand Up @@ -207,13 +207,18 @@ def get_holidays_for_employee(employee: str) -> list[dict]:
return []

Holiday = frappe.qb.DocType("Holiday")
return (
holidays = (
frappe.qb.from_(Holiday)
.select(Holiday.name, Holiday.holiday_date, Holiday.description)
.where((Holiday.parent == holiday_list) & (Holiday.weekly_off == 0))
.orderby(Holiday.holiday_date, order=Order.asc)
).run(as_dict=True)

for holiday in holidays:
holiday["description"] = strip_html(holiday["description"] or "").strip()

return holidays


@frappe.whitelist()
def get_leave_approval_details(employee: str) -> dict:
Expand Down
Loading