-
-
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
CRM-21227 Fix test following merge of PR #10435 #11032
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, '[]'))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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++) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the change here? It changes the logic from asking: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
& replace with
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'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
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 is just changing to be the same as L115 but for contact_type_b