Skip to content
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

CRM-21227 Fix test following merge of PR #10435 #11032

Merged
merged 1 commit into from
Sep 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Admin/Form/RelationshipType.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function setDefaultValues() {
$defaults['contact_types_a'] .= '__' . $defaults['contact_sub_type_a'];
}

$defaults['contact_types_b'] = $defaults['contact_type_b'];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just changing to be the same as L115 but for contact_type_b

$defaults['contact_types_b'] = CRM_Utils_Array::value('contact_type_b', $defaults);
if (!empty($defaults['contact_sub_type_b'])) {
$defaults['contact_types_b'] .= '__' . $defaults['contact_sub_type_b'];
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Badge/Form/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function buildQuickForm() {
public function setDefaultValues() {
if (isset($this->_id)) {
$defaults = array_merge($this->_values,
CRM_Badge_BAO_Layout::getDecodedData($this->_values['data']));
CRM_Badge_BAO_Layout::getDecodedData(CRM_Utils_Array::value('data', $this->_values, '[]')));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checks for data in $this->_values and passes an empty json_encoded array as the default value (getDecodedData does a jsonDecode

}
else {
for ($i = 1; $i <= self::FIELD_ROWCOUNT; $i++) {
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contact/Form/DedupeRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function preProcess() {
$this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$contactTypes = civicrm_api3('Contact', 'getOptions', array('field' => "contact_type"));
$contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
if (in_array($contactType, $contactTypes['values'])) {
$this->_contactType = $contactTypes['values'][$contactType];
if (CRM_Utils_Array::value($contactType, $contactTypes['values'])) {
Copy link
Contributor

@mickadoo mickadoo Sep 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change here? It changes the logic from asking:
"is $contactType in the array $values"
to
"is $values[$contactType] truthy?"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mickadoo Michael if you look at how old L64 was crafted it was using it as a Key whereas in_array checks on the value so somewhere we stuffed up. I'm not sure if should be on the key or not

Copy link
Contributor

@eileenmcnaughton eileenmcnaughton Sep 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the effect here is that IF contactType is passed in via the URL we accept it if valid. If not we calculate from the rule.

Perhaps keep this & change lower down

Remove

    elseif (!empty($contactType)) {
      throw new CRM_Core_Exception('Contact Type is Not valid');
    }

& replace with

    if (!$this->_rgid && !$this->_contactType) {
      CRM_Core_Session::setStatus('Contact Type could not be determined, assuming Individual');
     $this->_contactType = 'Individual';
}

Or we could throw an exception - but I can't see why we don't just use a default

$this->_contactType = CRM_Utils_Array::value($contactType, $contactTypes['values']);
}
elseif (!empty($contactType)) {
throw new CRM_Core_Exception('Contact Type is Not valid');
Expand Down
3 changes: 1 addition & 2 deletions CRM/Financial/Form/FinancialBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public function preProcess() {
public function buildQuickForm() {
parent::buildQuickForm();
$this->setPageTitle(ts('Financial Batch'));

if (isset($this->_id)) {
if (!empty($this->_id)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine - although I think it would be better to define the property on the class

$this->_title = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'title');
CRM_Utils_System::setTitle($this->_title . ' - ' . ts('Accounting Batch'));
$this->assign('batchTitle', $this->_title);
Expand Down