Skip to content

Commit

Permalink
CIVIEWAY-263 Refactor to remove calls to deprecated CRM_Utils_Array::…
Browse files Browse the repository at this point in the history
…value
  • Loading branch information
agileware-justin committed Dec 14, 2023
1 parent 9372117 commit 55551dc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CRM/eWAYRecurring/Form/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function addFormElements() {
if (isset($setting['quick_form_type'])) {
$add = 'add' . $setting['quick_form_type'];
if ($add == 'addElement') {
$this->$add($setting['html_type'], $name, $setting['title'], CRM_Utils_Array::value('html_attributes', $setting, [], TRUE), TRUE);
$this->$add($setting['html_type'], $name, $setting['title'], $setting['html_attributes'], TRUE);
}
elseif ($setting['html_type'] == 'Select') {
$optionValues = [];
Expand Down
8 changes: 4 additions & 4 deletions eWAYRecurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,20 @@ function ewayrecurring_civicrm_validateForm($formName, &$fields, &$files, &$form

switch($formName) {
case'CRM_Admin_Form_PaymentProcessor':
if(CRM_Utils_Array::value('payment_processor_type_id', $fields) != $paymentProcessorID) {
if($fields['payment_processor_type_id'] != $paymentProcessorID) {
break;
}

if (empty(CRM_Utils_Array::value('user_name', $fields, ''))) {
if (empty($fields['user_name')) {
$errors['user_name'] = E::ts('API Key is a required field.');
}

if (empty(CRM_Utils_Array::value('password', $fields, ''))) {
if (empty($fields['password')) {
$errors['password'] = E::ts('API Password is a required field.');
}
break;
case 'CRM_Contribute_Form_UpdateSubscription':
$submitted_nsd = strtotime(CRM_Utils_Array::value('next_scheduled_date', $fields) . ' ' . CRM_Utils_Array::value('next_scheduled_date_time', $fields));
$submitted_nsd = strtotime($fields['next_scheduled_date'] . ' ' . $fields['next_scheduled_date_time']);

($crid = $form->getVar('contributionRecurID')) || ($crid = $form->getVar('_crid'));

Expand Down
6 changes: 3 additions & 3 deletions tests/phpunit/CRM/EwayRecurring/MyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ public function testPaidSubmit($thousandSeparator) {
],
]
);
$this->assertEquals(CRM_Utils_Array::value('payment_processor_id', $financialTrxn), $paymentProcessorID);
$this->assertEquals(CRM_Utils_Array::value('card_type_id.label', $financialTrxn), 'Visa');
$this->assertEquals(CRM_Utils_Array::value('pan_truncation', $financialTrxn), 1111);
$this->assertEquals($financialTrxn['payment_processor_id'], $paymentProcessorID);
$this->assertEquals($financialTrxn['card_type_id.label'], 'Visa');
$this->assertEquals($financialTrxn['pan_truncation'], 1111);
}
}
6 changes: 3 additions & 3 deletions tests/phpunit/CRM/EwayRecurring/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ protected function eventCreatePaid($params) {
$this->priceSetID = $this->eventPriceSetCreate(55, 0, 'Radio');
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $event['id'], $this->priceSetID);
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($this->priceSetID, TRUE, FALSE);
$priceSet = CRM_Utils_Array::value($this->priceSetID, $priceSet);
$this->eventFeeBlock = CRM_Utils_Array::value('fields', $priceSet);
$priceSet = $priceSet[$this->priceSetID];
$this->eventFeeBlock = $priceSet['fields'];
return $event;
}

Expand Down Expand Up @@ -154,7 +154,7 @@ public function eventCreate($params = []) {
private function _contactCreate($params) {
$result = $this->callAPISuccess('contact', 'create', $params);
if (!empty($result['is_error']) || empty($result['id'])) {
throw new \Exception('Could not create test contact, with message: ' . \CRM_Utils_Array::value('error_message', $result) . "\nBacktrace:" . \CRM_Utils_Array::value('trace', $result));
throw new \Exception('Could not create test contact, with message: ' . $result['error_message'] . "\nBacktrace:" . $result['trace']);
}
return $result['id'];
}
Expand Down

0 comments on commit 55551dc

Please sign in to comment.