Skip to content

Commit

Permalink
Update BannerTermProvider and WebServiceDataProvider for webservice c…
Browse files Browse the repository at this point in the history
…hanges.
  • Loading branch information
jlbooker committed Mar 24, 2017
1 parent ba0e688 commit eaba8cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion class/BannerTermProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ protected function plugValues(&$termInfo, \stdClass $data)
$termInfo->setTermDesc($data->term_desc);
$termInfo->setTermStartDate($data->term_start_date);
$termInfo->setTermEndDate($data->term_end_date);
$termInfo->setCensusDate($data->census_date);

// Census date may not always be set in our web service response
if(isset($data->census_date)){
$termInfo->setCensusDate($data->census_date);
}

if(is_array($data->part_term)){
foreach($data->part_term as $termPart){
Expand Down
11 changes: 7 additions & 4 deletions class/WebServiceDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public function getStudent($studentId, $term)
throw new \Intern\Exception\StudentNotFoundException("Could not locate student: $studentId");
}

// Response may have multiple records (faculty/staff + student), so
// just take the first one
// TODO: Maybe be smarter about which result we use?
if(is_array($response)){
$response = $response[0];
}

// Check for an InvalidUsername error (i.e. the user doesn't have banner permissions)
if($response->error_num == 1002 && $response->error_desc == 'InvalidUserName'){
throw new \Intern\Exception\BannerPermissionException("No banner permissions for {$this->currentUserName}");
Expand All @@ -89,10 +96,6 @@ public function getStudent($studentId, $term)

}

if(is_array($response)){
$response = $response[0];
}

// Log the request
$this->logRequest('getStudent', 'success', $params);

Expand Down

0 comments on commit eaba8cc

Please sign in to comment.