def staff_for_site():
 try:
  site_id = request.args[0]
 except:
  result = current.xml.json_message(False, 400, 'No Site provided!')
 else:
  table = s3db.hrm_human_resource
  ptable = db.pr_person
  query = (((((table.site_id == site_id) & (table.deleted == False)) & (table.status == 1)) & ((table.end_date == None) | (table.end_date > request.utcnow))) & (ptable.id == table.person_id))
  rows = db(query).select(ptable.id, ptable.first_name, ptable.middle_name, ptable.last_name, orderby=ptable.first_name)
  result = []
  append = result.append
  for row in rows:
   append({'id': row.id, 'name': s3_fullname(row)})
  result = json.dumps(result)
 response.headers['Content-Type'] = 'application/json'
 return result

def staff_for_site ( ) : try : site_id = request . args [ 0 ] except : result = current . xml . json_message ( False , 400 , 'No Site provided!' ) else : table = s3db . hrm_human_resource ptable = db . pr_person query = ( ( ( ( ( table . site_id == site_id ) & ( table . deleted == False ) ) & ( table . status == 1 ) ) & ( ( table . end_date == None ) | ( table . end_date > request . utcnow ) ) ) & ( ptable . id == table . person_id ) ) rows = db ( query ) . select ( ptable . id , ptable . first_name , ptable . middle_name , ptable . last_name , orderby = ptable . first_name ) result = [ ] append = result . append for row in rows : append ( { 'id' : row . id , 'name' : s3_fullname ( row ) } ) result = json . dumps ( result ) response . headers [ 'Content-Type' ] = 'application/json' return result
used by the req/req/create page - note that this returns person ids .