diff --git a/foundation/erpnext_foundation/doctype/chapter/chapter.py b/foundation/erpnext_foundation/doctype/chapter/chapter.py index 67bd2342..f0d2bc57 100644 --- a/foundation/erpnext_foundation/doctype/chapter/chapter.py +++ b/foundation/erpnext_foundation/doctype/chapter/chapter.py @@ -33,3 +33,15 @@ def get_list_context(context): context.no_breadcrumbs = True context.order_by = 'creation desc' context.introduction = '
All ERPNext Chapters
' + + +@frappe.whitelist() +def leave(title, user_id, leave_reason): + chapter = frappe.get_doc("Chapter", title) + for member in chapter.members: + if member.user == user_id: + member.enabled = 0 + member.leave_reason = leave_reason + chapter.save(ignore_permissions=1) + frappe.db.commit() + return "Thank you for Feedback" \ No newline at end of file diff --git a/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html b/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html index 8649904c..832aef51 100644 --- a/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html +++ b/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html @@ -8,31 +8,35 @@ {{ meetup_embed_html }} {% endif %}| Member Details | |||
|---|---|---|---|
| {{ loop.index }} | -
-
- {{ frappe.db.get_value('User', user.user, 'full_name') }}
-
- {% if user.website_url %}
- {{ user.website_url or '' }}
- {% endif %}
+ {% if user.enabled == 1 %}
+ {{ flag }} |
+
+ |
-
+
- {{ frappe.db.get_value('User', user.user, 'full_name') }}
+
+ {% if user.website_url %}
+ {{ user.website_url or '' }}
+ {% endif %}
+
+
+ {% if user.introduction %}
+ {{ user.introduction }}
+ {% endif %}
+
- {% if user.introduction %}
- {{ user.introduction }}
- {% endif %}
-
-
- |
+
- {{ frappe.db.get_value('User', chapter_head, 'full_name') }} - - {% if members %} - Members: {{ members|length }} - {% else %} - Members: 0 - {% endif %} - + Chapter Head : {{ frappe.db.get_value('User', chapter_head, 'full_name') }} +
{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}
diff --git a/foundation/erpnext_foundation/doctype/chapter_member/chapter_member.json b/foundation/erpnext_foundation/doctype/chapter_member/chapter_member.json index dbc5f5af..60074372 100644 --- a/foundation/erpnext_foundation/doctype/chapter_member/chapter_member.json +++ b/foundation/erpnext_foundation/doctype/chapter_member/chapter_member.json @@ -132,6 +132,36 @@ "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "leave_reason", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Leave Reason", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "has_web_view": 0, @@ -144,7 +174,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-05-22 16:29:01.536405", + "modified": "2017-11-15 02:09:49.082752", "modified_by": "Administrator", "module": "ERPNext Foundation", "name": "Chapter Member", diff --git a/foundation/www/join_chapter.py b/foundation/www/join_chapter.py index bc9ba6ba..121f4440 100644 --- a/foundation/www/join_chapter.py +++ b/foundation/www/join_chapter.py @@ -4,14 +4,14 @@ def get_context(context): context.no_cache = True chapter = frappe.get_doc('Chapter', frappe.form_dict.name) if frappe.session.user!='Guest': - if frappe.session.user in [d.user for d in chapter.members]: + if frappe.session.user in [d.user for d in chapter.members if d.enabled == 1]: context.already_member = True else: if frappe.request.method=='GET': pass elif frappe.request.method=='POST': chapter.append('members', dict( - user=frappe.session.user, + user=frappe.session.user, introduction=frappe.form_dict.introduction, website_url=frappe.form_dict.website_url, enabled=1 diff --git a/foundation/www/leave-chapter.html b/foundation/www/leave-chapter.html index 2f8452d5..9b92221e 100644 --- a/foundation/www/leave-chapter.html +++ b/foundation/www/leave-chapter.html @@ -1,16 +1,42 @@ {% extends "templates/web.html" %} - {% block page_content %} {% if member_deleted %}You are not a member of {{ chapter.title }}!
+Please signup and login to join this chapter
{% endif %} + {% endblock %} \ No newline at end of file diff --git a/foundation/www/leave_chapter.py b/foundation/www/leave_chapter.py index 6dbdeca5..da2d819e 100644 --- a/foundation/www/leave_chapter.py +++ b/foundation/www/leave_chapter.py @@ -3,13 +3,5 @@ import frappe def get_context(context): context.no_cache = True chapter = frappe.get_doc('Chapter', frappe.form_dict.name) - # if frappe.session.user!='Guest': - if frappe.session.user in [d.user for d in chapter.members]: - user = frappe.session.user - parent = frappe.form_dict.name - frappe.db.sql("""delete from `tabChapter Member` where parent = %s and user = %s """, (parent, user)) - frappe.db.commit() - context.member_deleted = True - context.chapter = chapter