fix: don't send payment reminder if member has already paid later
This commit is contained in:
@@ -33,9 +33,24 @@ def send_payment_reminder():
|
|||||||
)
|
)
|
||||||
|
|
||||||
for payment in incomplete_payments:
|
for payment in incomplete_payments:
|
||||||
|
if has_paid_later(payment):
|
||||||
|
continue
|
||||||
|
|
||||||
send_mail(payment)
|
send_mail(payment)
|
||||||
|
|
||||||
|
|
||||||
|
def has_paid_later(payment):
|
||||||
|
return frappe.db.exists(
|
||||||
|
"LMS Payment",
|
||||||
|
{
|
||||||
|
"member": payment.member,
|
||||||
|
"payment_received": 1,
|
||||||
|
"payment_for_document": payment.payment_for_document,
|
||||||
|
"payment_for_document_type": payment.payment_for_document_type,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def send_mail(payment):
|
def send_mail(payment):
|
||||||
subject = _("Complete Your Enrollment - Don't miss out!")
|
subject = _("Complete Your Enrollment - Don't miss out!")
|
||||||
template = "payment_reminder"
|
template = "payment_reminder"
|
||||||
|
|||||||
Reference in New Issue
Block a user