def trigger_repeat_sms_with_condition(condition):
	if frappe.flags.in_import or frappe.flags.in_patch:
		# don't send notifications while syncing or patching
		return

	doc_list = frappe.get_all('SMS Notification',
		filters={
			'event': 'Condition Days After',
			'interval':condition,
			'enabled': 1
		})
	for d in doc_list:
		alert = frappe.get_doc("SMS Notification", d.name)
		print(d.name,'alert selected')
		for doc in get_documents_for_processing(alert):
			print(doc.name,'doc impacted')
			evaluate_alert(doc, alert, alert.event)
			frappe.db.commit()	
def trigger_notifications(doc, method=None):
	if frappe.flags.in_import or frappe.flags.in_patch:
		# don't send notifications while syncing or patching
		return

	if method == "daily":
		doc_list = frappe.get_all('SMS Notification',
			filters={
				'event': ('in', ('Days Before', 'Days After')),
				'enabled': 1
			})
		print('daily doc',doc_list)
		for d in doc_list:
			alert = frappe.get_doc("SMS Notification", d.name)

			for doc in alert.get_documents_for_today():
				evaluate_alert(doc, alert, alert.event)
				frappe.db.commit()
Exemple #3
0
		def _evaluate_alert(alert):
			if not alert.name in self.flags.notifications_executed:
				evaluate_alert(self, alert.name, alert.event)
				self.flags.notifications_executed.append(alert.name)
Exemple #4
0
		def _evaluate_alert(alert):
			if not alert.name in self.flags.notifications_executed:
				evaluate_alert(self, alert.name, alert.event)
				self.flags.notifications_executed.append(alert.name)