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

dev/core#1652 - Check for change case type activity on case activity form doesn't work #16785

Merged
merged 1 commit into from
Mar 23, 2020
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
11 changes: 0 additions & 11 deletions CRM/Case/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,6 @@ public function preProcess() {
);
}
if (!$this->_activityId) {
$caseTypes = CRM_Case_PseudoConstant::caseType();

if (empty($caseTypes) && ($this->_activityTypeName == 'Change Case Type') && !$this->_caseId) {
$url = CRM_Utils_System::url('civicrm/contact/view/case',
"reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1"
);
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
CRM_Core_Error::statusBounce(ts("You do not have any active Case Types"));
}

// check if activity count is within the limit
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
foreach ($this->_caseId as $casePos => $caseId) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Form/Activity/ChangeCaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function buildQuickForm(&$form) {
$form->_caseType[$form->_caseTypeId] = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $form->_caseTypeId, 'title');
}

$form->addField('case_type_id', ['context' => 'create', 'entity' => 'Case']);
$form->addField('case_type_id', ['context' => 'create', 'entity' => 'Case'], TRUE);

// timeline
$form->addYesNo('is_reset_timeline', ts('Reset Case Timeline?'), NULL, TRUE);
Expand Down
8 changes: 8 additions & 0 deletions tests/phpunit/CRM/Core/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ function(CRM_Core_Form $form) {
$form->_action = CRM_Core_Action::ADD;
},
],
// This one is a bit flawed but the only point of this test is to catch
// simple stuff. This will catch e.g. "undefined index" and similar.
'Find Contacts' => [
'CRM_Contact_Form_Search_Basic',
function(CRM_Core_Form $form) {
$form->_action = CRM_Core_Action::BASIC;
},
],
];
}

Expand Down