Aditya Hase | f3c22f3 | 2019-01-22 18:22:20 +0530 | [diff] [blame] | 1 | from __future__ import unicode_literals |
asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 2 | import frappe |
asbasawaraj | 4c26348 | 2018-06-15 10:04:19 +0530 | [diff] [blame] | 3 | |
| 4 | no_cache = 1 |
| 5 | |
| 6 | def get_context(context): |
| 7 | if frappe.session.user != 'Guest': |
| 8 | context.all_certifications = get_all_certifications_of_a_member() |
| 9 | context.show_sidebar = True |
| 10 | |
| 11 | |
| 12 | def get_all_certifications_of_a_member(): |
| 13 | '''Returns all certifications''' |
| 14 | all_certifications = [] |
| 15 | all_certifications = frappe.db.sql(""" select cc.name,cc.from_date,cc.to_date,ca.amount,ca.currency |
| 16 | from `tabCertified Consultant` cc |
| 17 | inner join `tabCertification Application` ca |
| 18 | on cc.certification_application = ca.name |
| 19 | where paid = 1 and email = %(user)s order by cc.to_date desc""" ,{'user': frappe.session.user},as_dict=True) |
| 20 | return all_certifications |