4 // Validate that they are only maintaining their own timesheets
5 if ( is_member_of('Admin','Support') ) {
6 // OK, they can add time onto requests :-)
8 else if ( is_member_of('Contractor') ) {
9 // Build an array of the request IDs the person is trying to put time against
10 $request_ids = array();
11 for ( $dow = 0; $dow < 7; $dow ++
) {
12 while( list( $k, $v ) = each ( $tm[$dow] ) ) {
14 list( $number, $description ) = split( '/', $v, 2);
15 $number = intval($number);
17 $request_ids[$number] = $number;
22 // Select the user's system_role for each such system
23 $sql = "SELECT request.request_id, system_usr.role ";
24 $sql .= "FROM request LEFT OUTER JOIN system_usr ON request.system_id = system_usr.system_id AND system_usr.user_no=? ";
25 $sql .= "WHERE request_id IN (" . implode( ",", $request_ids ) . ");";
26 $qry = new PgQuery( $sql, $session->user_no
);
27 if ( $qry->Exec("TimeSheet") ) {
28 if ( $qry->rows
> 0 ) {
29 while( $row = $qry->Fetch() ) {
30 $request_ids[$row->request_id
] = $row->role
;
32 foreach( $request_ids AS $r_id => $role ) {
33 if ( $role == $r_id ) {
34 $client_messages[] = "W/R $r_id does not exist.";
37 else if ( $role == "" ) {
38 $client_messages[] = "You may not assign time to W/R $r_id.";
46 $client_messages[] = "You may not maintain timesheet information.";
51 $client_messages[] = 'Please correct and resubmit: <span style="font-size:150%;"> No data has been saved!</span>';
54 $session->Dbg("TimeSheet","Timesheet entry validated OK");