'Get the first HR record ID for the current logged-in user'

def s3_logged_in_human_resource(self):

    row = None
    if self.s3_logged_in():
        s3db = current.s3db
        ptable = s3db.pr_person
        htable = s3db.hrm_human_resource
        try:
            query = ((htable.person_id == ptable.id) & (ptable.pe_id == self.user.pe_id))
        except AttributeError:
            pass
        else:
            row = current.db(query).select(htable.id, orderby=(~ htable.modified_on), limitby=(0, 1)).first()
    return (row.id if row else None)
