From a3fdbabb4a635328a8a63016463a37300aa74549 Mon Sep 17 00:00:00 2001 From: Davi Alexandre Date: Tue, 13 Nov 2018 09:52:20 -0200 Subject: [PATCH] PCHR-4396: Fix for the new response format of HRJobContract.getCurrentContract That API now returns an array instead of an object --- civihr_employee_portal/src/View/MyDetailsView.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/civihr_employee_portal/src/View/MyDetailsView.php b/civihr_employee_portal/src/View/MyDetailsView.php index 88d31f42..e630c43a 100644 --- a/civihr_employee_portal/src/View/MyDetailsView.php +++ b/civihr_employee_portal/src/View/MyDetailsView.php @@ -51,15 +51,12 @@ private function getCurrentRevision($contactID) { 'contact_id' => $contactID, ]); - // God knows why but this result is a stdClass - if (!isset($contract['values']->contract_id)) { + if (empty($contract['values']['contract_id'])) { return NULL; } - $contractID = $contract['values']->contract_id; - return civicrm_api3('HRJobContractRevision', 'getcurrentrevision', [ - 'jobcontract_id' => $contractID, + 'jobcontract_id' => $contract['values']['contract_id'], ])['values']; }