Delicious      Technorati      Blinklist      Furl      Reddit

TimeTrex Time and Attendance

TimeTrex Time and Attendance


* FAQ    * Search
* Login   * Register

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Apr 19, 2015 4:20 pm 
Offline

Joined: Wed Oct 17, 2012 4:48 pm
Posts: 108
Running 8.0.5 CE on Ubuntu 14.04.

I'm trying to use the API to find which users have a Meal Policy. There doesn't seem to be a report which identifies this. Which API class do I use to do that?

I tried the following, but got an error.
Code:
   
    $ttAPI_group = new TimeTrexClientAPI( 'PolicyGroup' );
    $group_factory = $ttAPI_group->getMainClassObject();
    $meals = $group_factory->getMealPolicy();
    var_dump($meals);

PHP Notice: SOAP Fault: (Code: SOAP-ENV:Server, String: Function 'getMealPolicy' doesn't exist) - Request: Response: in /var/www/html/run/classes/modules/api/client/TimeTrexClientAPI.class.php on line 197


Top
 Profile  
 
PostPosted: Mon Apr 20, 2015 7:48 am 
Offline

Joined: Tue Sep 19, 2006 2:22 pm
Posts: 7256
You need to get the PolicyGroup data, then pull the user and meal policy data from that, something along these lines:
Code:
$ttAPI_group = new TimeTrexClientAPI( 'PolicyGroup' );
$retval = $ttAPI_group->getPolicyGroup();


$retval will now contain the result of all your policy groups in an array, which will have 'user' and 'meal_policy' array elements.


Top
 Profile  
 
PostPosted: Tue Apr 21, 2015 10:46 pm 
Offline

Joined: Wed Oct 17, 2012 4:48 pm
Posts: 108
Quote:
$retval will now contain the result of all your policy groups in an array, which will have 'user' and 'meal_policy' array elements.

Here is an excerpt of the return value. It does not have a 'user' or 'meal_policy' array element.
Code:
array {
...
[10]=>
    array(6) {
      ["id"]=>
      int(44)
      ["name"]=>
      string(20) "Staff - Mechanic"
      ["description"]=>
      bool(false)
      ["total_users"]=>
      int(11)
      ["updated_by"]=>
      string(22) "TimeTrex Administrator"
      ["updated_date"]=>
      string(14) "02-Apr-15 4:06"
    }
    [11]=>
    array(6) {
      ["id"]=>
      int(3)
      ["name"]=>
      string(17) "Staff - Pilot"
      ["description"]=>
      bool(false)
      ["total_users"]=>
      int(11)
      ["updated_by"]=>
      string(22) "TimeTrex Administrator"
      ["updated_date"]=>
      string(14) "02-Apr-15 4:06"
    }
}

Is there anything else I can try?


Top
 Profile  
 
PostPosted: Wed Apr 22, 2015 8:08 am 
Offline

Joined: Tue Sep 19, 2006 2:22 pm
Posts: 7256
It seems as though you may not be logging into the API as a full administrator that has permissions to view the data you are looking for.


Top
 Profile  
 
PostPosted: Wed Apr 22, 2015 5:14 pm 
Offline

Joined: Wed Oct 17, 2012 4:48 pm
Posts: 108
Thank you! We adjusted our permissions for the API user and were able to retrieve the desired information.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Time and Attendance




Powered by phpBB® Forum Software © phpBB Group