feat(breaking): update get_last_membership to fetch correct details
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 38d8a62..5a5c448 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -132,16 +132,10 @@
return caller
-def get_last_membership():
+def get_last_membership(member):
'''Returns last membership if exists'''
last_membership = frappe.get_all('Membership', 'name,to_date,membership_type',
- dict(member=frappe.session.user, paid=1), order_by='to_date desc', limit=1)
+ dict(member=member, paid=1), order_by='to_date desc', limit=1)
- return last_membership and last_membership[0]
-
-def is_member():
- '''Returns true if the user is still a member'''
- last_membership = get_last_membership()
- if last_membership and getdate(last_membership.to_date) > getdate():
- return True
- return False
+ if last_membership:
+ return last_membership[0]
diff --git a/erpnext/non_profit/doctype/membership/membership.py b/erpnext/non_profit/doctype/membership/membership.py
index ac3b89a..7c83a4e 100644
--- a/erpnext/non_profit/doctype/membership/membership.py
+++ b/erpnext/non_profit/doctype/membership/membership.py
@@ -34,7 +34,7 @@
self.member = member_name
# get last membership (if active)
- last_membership = erpnext.get_last_membership()
+ last_membership = erpnext.get_last_membership(self.member)
# if person applied for offline membership
if last_membership and not frappe.session.user == "Administrator":