'Link alert_id for CAP XML import'

@staticmethod
def cap_resource_onaccept(form):

    form_vars = form.vars
    info_id = form_vars.get('info_id', None)
    if info_id:
        db = current.db
        itable = db.cap_info
        item = db((itable.id == info_id)).select(itable.alert_id, limitby=(0, 1)).first()
        alert_id = item.alert_id
        if alert_id:
            db((db.cap_resource.id == form_vars.id)).update(alert_id=alert_id)
