<s> from __future__ import unicode_literals <EOL> import frappe <EOL> from frappe import _ <EOL> import json <EOL> @ frappe . whitelist ( ) <EOL> def update_event ( args , field_map ) : <EOL> """<STR_LIT>""" <EOL> args = frappe . _dict ( json . loads ( args ) ) <EOL> field_map = frappe . _dict ( json . loads ( field_map ) ) <EOL> w = frappe . get_doc ( args . doctype , args . name ) <EOL> w . set ( field_map . start , args [ field_map . start ] ) <EOL> w . set ( field_map . end , args . get ( field_map . end ) ) <EOL> w . save ( ) <EOL> def get_event_conditions ( doctype , filters = None ) : <EOL> """<STR_LIT>""" <EOL> from frappe . desk . reportview import build_match_conditions <EOL> if not frappe . has_permission ( doctype ) : <EOL> frappe . throw ( _ ( "<STR_LIT>" ) , frappe . PermissionError ) <EOL> conditions = build_match_conditions ( doctype ) <EOL> conditions = conditions and ( "<STR_LIT>" + conditions ) or "<STR_LIT>" <EOL> if filters : <EOL> filters = json . loads ( filters ) <EOL> for key in filters : <EOL> if filters [ key ] : <EOL> conditions += "<STR_LIT>" + key + '<STR_LIT>' + filters [ key ] . replace ( '<STR_LIT:">' , '<STR_LIT>' ) + '<STR_LIT:">' <EOL> return conditions </s>
