def get_event_conditions(doctype, filters=None):
 from frappe.desk.reportview import build_match_conditions
 if (not frappe.has_permission(doctype)):
  frappe.throw(_(u'Not Permitted'), frappe.PermissionError)
 conditions = build_match_conditions(doctype)
 conditions = ((conditions and (u' and ' + conditions)) or u'')
 if filters:
  filters = json.loads(filters)
  for key in filters:
   if filters[key]:
    conditions += u'and `{0}` = "{1}"'.format(frappe.db.escape(key), frappe.db.escape(filters[key]))
 return conditions

def get_event_conditions ( doctype , filters = None ) : from frappe . desk . reportview import build_match_conditions if ( not frappe . has_permission ( doctype ) ) : frappe . throw ( _ ( u'Not Permitted' ) , frappe . PermissionError ) conditions = build_match_conditions ( doctype ) conditions = ( ( conditions and ( u' and ' + conditions ) ) or u'' ) if filters : filters = json . loads ( filters ) for key in filters : if filters [ key ] : conditions += u'and `{0}` = "{1}"' . format ( frappe . db . escape ( key ) , frappe . db . escape ( filters [ key ] ) ) return conditions
returns sql conditions with user permissions and filters for event queries .