ooiservices/app/redmine/routes.py
def update_redmine_ticket_for_notification(resource_id, project_id, subject, description, priority, assigned_id):
    ''' Update a specific ticket for alert notification. Success return ticket_id, if error return None.
    '''
    ticket_id = None
    try:
        data = {'resource_id': resource_id,
                'project_id': project_id,
                'subject':  subject,
                'description': description,
                'priority': priority,
                'assigned_to': assigned_id,
                'category_id':  1
                }

        update_fields = ['project', 'subject', 'due_date', 'description', 'priority',
                         'assigned_to', 'start_date', 'estimated_hours', 'status_id', 'notes',
                         'tracker_id', 'parent_issue_id', 'done_ratio']

        # Get all the valid update fields from the request
        fields = dict()
        for field in update_fields:
            if field in data:
                fields[field] = data[field]

        # Log into Redmine
        redmine = redmine_login()

        # Get the issue; update all fields except the issue resource id
        issue = redmine.issue.get(data['resource_id'])
        for key, value in fields.iteritems():
            if 'resource_id' != key:
                setattr(issue, key, value)
        if issue.save():
            ticket_id = issue.id

    except Exception as err:
        current_app.logger.exception('[update_redmine_ticket_for_notification] %s ' % err.message)
    finally:
        return ticket_id
 Update a specific ticket for alert notification. Success return ticket_id, if error return None.
    
Update a specific ticket for alert notification. Success return ticket_id, if error return None.
Update a specific ticket for alert notification . Success return ticket_id if error return None .
def update_redmine_ticket_for_notification(resource_id, project_id, subject, description, priority, assigned_id):
    ticket_id = None
    try:
        data = {'resource_id': resource_id,
                'project_id': project_id,
                'subject':  subject,
                'description': description,
                'priority': priority,
                'assigned_to': assigned_id,
                'category_id':  1
                }
        update_fields = ['project', 'subject', 'due_date', 'description', 'priority',
                         'assigned_to', 'start_date', 'estimated_hours', 'status_id', 'notes',
                         'tracker_id', 'parent_issue_id', 'done_ratio']
        fields = dict()
        for field in update_fields:
            if field in data:
                fields[field] = data[field]
        redmine = redmine_login()
        issue = redmine.issue.get(data['resource_id'])
        for key, value in fields.iteritems():
            if 'resource_id' != key:
                setattr(issue, key, value)
        if issue.save():
            ticket_id = issue.id
    except Exception as err:
        current_app.logger.exception('[update_redmine_ticket_for_notification] %s ' % err.message)
    finally:
        return ticket_id
def update_redmine_ticket_for_notification ( resource_id , project_id , subject , description , priority , assigned_id ) : ticket_id = None try : data = { 'resource_id' : resource_id , 'project_id' : project_id , 'subject' : subject , 'description' : description , 'priority' : priority , 'assigned_to' : assigned_id , 'category_id' : 1 } update_fields = [ 'project' , 'subject' , 'due_date' , 'description' , 'priority' , 'assigned_to' , 'start_date' , 'estimated_hours' , 'status_id' , 'notes' , 'tracker_id' , 'parent_issue_id' , 'done_ratio' ] fields = dict ( ) for field in update_fields : if field in data : fields [ field ] = data [ field ] redmine = redmine_login ( ) issue = redmine . issue . get ( data [ 'resource_id' ] ) for key , value in fields . iteritems ( ) : if 'resource_id' != key : setattr ( issue , key , value ) if issue . save ( ) : ticket_id = issue . id except Exception as err : current_app . logger . exception ( '[update_redmine_ticket_for_notification] %s ' % err . message ) finally : return ticket_id
Update a specific ticket for alert notification.
Update a specific ticket for alert notification .
''' Update a specific ticket for alert notification. Success return ticket_id, if error return None.
    ''' # Get all the valid update fields from the request # Log into Redmine # Get the issue; update all fields except the issue resource id
resource_id
project_id
subject
description
priority
assigned_id