Skip to content

Commit

Permalink
Merge pull request #420 from compucorp/CPS-155-fix-draft-email-assignee
Browse files Browse the repository at this point in the history
CPS-155: Fix draft email assignee
  • Loading branch information
tunbola authored Apr 2, 2020
2 parents 67536b0 + 33530bf commit cb95e77
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CRM/Civicase/Hook/PermissionCheck/CaseCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ private function getCaseCategoryName() {
$isAjaxRequest = $url == 'civicrm/ajax/rest';
$isCaseActivityPage = $url == 'civicrm/case/activity';
$isPrintActivityReportPage = $url == 'civicrm/case/customreport/print';
$isActivityPage = $url == 'civicrm/activity' || $url == 'civicrm/activity/add';
$isActivityPage = in_array($url, [
'civicrm/activity',
'civicrm/activity/add',
'civicrm/activity/pdf/view',
'civicrm/activity/email/view',
]);
$isCaseContactTabPage = $url == 'civicrm/case/contact-case-tab';
$isDownloadAllActivityFilesPage = $url == 'civicrm/case/activity/download-all-files';

Expand Down
2 changes: 1 addition & 1 deletion CRM/Civicase/Hook/ValidateForm/SaveActivityDraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private function saveDraftForSpecialForms($formName, CRM_Core_Form &$form, array
'status_id' => 'Draft',
'case_id' => $caseId,
'id' => $form->getVar('_activityId'),
'assignee_id' => $form->getVar('_contactIds'),
'assignee_id' => CRM_Core_Session::getLoggedInContactID(),
];
if (in_array($formName, $this->specialForms)) {
$params['details'] = CRM_Utils_Array::value('html_message', $fields);
Expand Down
4 changes: 2 additions & 2 deletions CRM/Civicase/Hook/alterAPIPermissions/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private function getCaseCategoryName($entity, $action, array $params) {
* Case category name.
*/
private function getCaseCategoryNameFromCaseType(array $params, $key) {
if (empty($params[$key])) {
if (empty($params[$key]) || !is_numeric($params[$key])) {
return;
}

Expand All @@ -199,7 +199,7 @@ private function getCaseCategoryNameFromCaseType(array $params, $key) {
* Case category name.
*/
private function getCaseCategoryNameFromCaseId(array $params, $key) {
if (empty($params[$key])) {
if (empty($params[$key]) || !is_numeric($params[$key])) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@

return getCrmUrl('civicrm/activity/email/' + options.action, {
action: options.action,
atype: activity.activity_type_id,
caseId: activity.case_id,
cid: assigneeContactId,
draft_id: activity.id,
id: activity.id,
reset: '1'
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@

expectedActivityFormUrlParams = {
action: 'add',
atype: activity.activity_type_id,
caseId: activity.case_id,
cid: activity.assignee_contact_id[0],
draft_id: activity.id,
id: activity.id,
reset: '1'
};
});
Expand Down
2 changes: 1 addition & 1 deletion css/civicase.min.css

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions scss/components/_draft-activity-panel.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* We temporarily hide the "File On Case" action for draft activities.
* This is done because this functionality needs to be fixed so it works
* with case categories, and supports translation. More info on CPS-155.
*/
.civicase__activity-panel__core_container--draft {
[title='File On Case'] {
display: none;
}
}

0 comments on commit cb95e77

Please sign in to comment.