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