#NEWLINE# def group_membership( ) : #NEWLINE# #INDENT# '\n        Membership controller\n        - uses the group_membership table from PR\n    ' #NEWLINE# s3db . hrm_configure_pr_group_membership ( ) #NEWLINE# table = db . pr_group_membership #NEWLINE# s3db . configure ( 'pr_group_membership' , list_fields = [ 'group_id' , 'group_id$description' , 'group_head' , 'person_id$first_name' , 'person_id$middle_name' , 'person_id$last_name' , ( T ( 'Email' ) , 'person_id$email.value' ) , ( settings . get_ui_label_mobile_phone ( ) , 'person_id$phone.value' ) ] ) #NEWLINE# gtable = db . pr_group #NEWLINE# htable = s3db . hrm_human_resource #NEWLINE# s3 . filter = ( ( ( ( gtable . system == False ) & ( gtable . group_type == 3 ) ) & ( htable . type == 2 ) ) & ( htable . person_id == table . person_id ) ) #NEWLINE# def prep( r ) : #NEWLINE# #INDENT# if ( r . method in ( 'create' , 'create.popup' , 'update' , 'update.popup' ) ) : #NEWLINE# #INDENT# person_id = get_vars . get ( '~.person_id' , None ) #NEWLINE# if person_id : #NEWLINE# #INDENT# field = table . person_id #NEWLINE# field . default = person_id #NEWLINE# field . readable = field . writable = False #NEWLINE# #UNINDENT# #UNINDENT# return True #NEWLINE# #UNINDENT# s3 . prep = table #NEWLINE# return s3_rest_controller ( 'pr' , 'group_membership' , csv_template = ( 'hrm' , 'group_membership' ) , csv_stylesheet = ( 'hrm' , 'group_membership.xsl' ) )