mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
fix: handle exception if sending Appointment Confirmation message fails (#21568)
This commit is contained in:
@@ -69,12 +69,13 @@ class PatientAppointment(Document):
|
|||||||
if fee_validity.ref_invoice:
|
if fee_validity.ref_invoice:
|
||||||
frappe.db.set_value("Patient Appointment", appointment.name, "invoiced", True)
|
frappe.db.set_value("Patient Appointment", appointment.name, "invoiced", True)
|
||||||
frappe.msgprint(_("{0} has fee validity till {1}").format(appointment.patient, fee_validity.valid_till))
|
frappe.msgprint(_("{0} has fee validity till {1}").format(appointment.patient, fee_validity.valid_till))
|
||||||
confirm_sms(self)
|
|
||||||
|
|
||||||
if frappe.db.get_value("Healthcare Settings", None, "manage_appointment_invoice_automatically") == '1' and \
|
if frappe.db.get_value("Healthcare Settings", None, "manage_appointment_invoice_automatically") == '1' and \
|
||||||
frappe.db.get_value("Patient Appointment", self.name, "invoiced") != 1:
|
frappe.db.get_value("Patient Appointment", self.name, "invoiced") != 1:
|
||||||
invoice_appointment(self)
|
invoice_appointment(self)
|
||||||
|
|
||||||
|
send_confirmation_msg(self)
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def invoice_appointment(appointment_doc):
|
def invoice_appointment(appointment_doc):
|
||||||
if not appointment_doc.name:
|
if not appointment_doc.name:
|
||||||
@@ -303,10 +304,14 @@ def set_pending_appointments():
|
|||||||
"('Scheduled','Open') and appointment_date < %s", today)
|
"('Scheduled','Open') and appointment_date < %s", today)
|
||||||
|
|
||||||
|
|
||||||
def confirm_sms(doc):
|
def send_confirmation_msg(doc):
|
||||||
if frappe.db.get_value("Healthcare Settings", None, "app_con") == '1':
|
if frappe.db.get_single_value("Healthcare Settings", "app_con"):
|
||||||
message = frappe.db.get_value("Healthcare Settings", None, "app_con_msg")
|
message = frappe.db.get_single_value("Healthcare Settings", "app_con_msg")
|
||||||
send_message(doc, message)
|
try:
|
||||||
|
send_message(doc, message)
|
||||||
|
except Exception:
|
||||||
|
frappe.log_error(frappe.get_traceback(), _("Appointment Confirmation Message Not Sent"))
|
||||||
|
frappe.msgprint(_("Appointment Confirmation Message Not Sent"), indicator="orange")
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_encounter(appointment):
|
def create_encounter(appointment):
|
||||||
|
|||||||
Reference in New Issue
Block a user