PaulT
Member
I have a timesheet form that contains an employee_name field which is the user_id. I want to make an element on the timesheet hidden or visible conditional on if this employee is part of the Driver (user_group) Group. I have a Fabrik Employee table that contains the user_id and user_group.
How can I have a hidden field on the Timesheet form check the employee_name and return true or false if that use_id is a member of the Driver group (11)?
I think this might be possible as a calc element but I am not sure how to write the calculation.
Something like:
$ename = '{geh_timesheet___employee_name}';
$ugroup = '{geh_employees___user_group}';
$uid = '{geh_employees___user_id}';
$egroup = '{geh_timesheet___employee_group}';
$egroup = 1 if $ugroup contains 11
$egroup = 0 if $ugroup != 11
return $egroup;
geh_timesheet___employee_name is FK for geh_employees___user_id
Most employees are only in one group but when in more than one the values in user_group are like this ["14","18"]
How can I have a hidden field on the Timesheet form check the employee_name and return true or false if that use_id is a member of the Driver group (11)?
I think this might be possible as a calc element but I am not sure how to write the calculation.
Something like:
$ename = '{geh_timesheet___employee_name}';
$ugroup = '{geh_employees___user_group}';
$uid = '{geh_employees___user_id}';
$egroup = '{geh_timesheet___employee_group}';
$egroup = 1 if $ugroup contains 11
$egroup = 0 if $ugroup != 11
return $egroup;
geh_timesheet___employee_name is FK for geh_employees___user_id
Most employees are only in one group but when in more than one the values in user_group are like this ["14","18"]
Last edited: