-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REF] Switch CRM_Utils_Array::value to empty in conditionals #17091
Conversation
(Standard links)
|
It would be good to get this merged so it doesn't conflict with other PRs. |
CRM/Contribute/Form/Contribution.php
Outdated
@@ -369,7 +369,7 @@ public function setDefaultValues() { | |||
$defaults['total_amount'] = CRM_Utils_Money::format($total_value, NULL, '%a'); | |||
if (!empty($defaults['tax_amount'])) { | |||
$componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); | |||
if (!(CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails))) { | |||
if (!(!empty($componentDetails['membership']) || !empty($componentDetails['participant']))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be clearer as empty($componentDetails['membership']) && empty($componentDetails['participant'])
CRM/Contribute/Form/Contribution.php
Outdated
@@ -1462,7 +1462,7 @@ protected function submit($submittedValues, $action, $pledgePaymentID) { | |||
if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { | |||
//CRM-16833: Ensure tax is applied only once for membership conribution, when status changed.(e.g Pending to Completed). | |||
$componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); | |||
if (!(CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails))) { | |||
if (!(!empty($componentDetails['membership']) || !empty($componentDetails['participant']))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here.
@@ -55,7 +55,7 @@ public static function _invoke($args) { | |||
return NULL; | |||
} | |||
// CRM-15901: Turn off PHP errors display for all ajax calls | |||
if (CRM_Utils_Array::value(1, $args) == 'ajax' || CRM_Utils_Array::value('snippet', $_REQUEST)) { | |||
if (CRM_Utils_Array::value(1, $args) == 'ajax' || !empty($_REQUEST['snippet'])) { | |||
ini_set('display_errors', 0); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The replacement is fine but this has bugged me for a while and I wonder if there's a way to only do this when in production. Devs should have errors mess up their snippets. 😈
All the others look good. |
jenkins test this please |
Thanks @demeritcowboy I've made the changes you suggested. |
Overview
Code refactor to fix some more cases of
CRM_Utils_Array::value