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

CPS-427: Civicase alignment with CiviCRM 5.35 #717

Merged
merged 23 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3c7040b
COMCL-101: Regenerate civix and Base upgrader class
erawat Feb 19, 2021
2b5f8ff
COMCL-101: Exclude Upgrader Base class
erawat Feb 22, 2021
ce472ae
COMCL-101: Update entityTypes hook
erawat Feb 22, 2021
deedd0c
CPS-427: Return module files relatively to extension path instead of …
reneolivo Feb 28, 2021
7383e7b
CPS-427: Return activity feed URL directly as a string
reneolivo Feb 28, 2021
4b1ed72
CPS-427: Fix API file lint issues
reneolivo Feb 28, 2021
f313d18
CPS-427: Pass BAO class directly to basic get function
reneolivo Feb 28, 2021
24d7994
CPS-427: Remove custom CRM Dashboard
reneolivo Mar 2, 2021
b15b4af
CPS-427: Fix "defaultPrevented" error on angular tests
reneolivo Mar 3, 2021
7ea98ee
CPS-427: Remove activity URL trusted value test
reneolivo Mar 3, 2021
a7ed76e
CPS-427: Fix missing case type route on workflow tests
reneolivo Mar 3, 2021
7ce49ca
CPS-427: Specify broadcast event name on test expectation
reneolivo Mar 3, 2021
bc5bd5c
CPS-427: Fix unhandled rejected promises
reneolivo Mar 3, 2021
7186291
CPS-427: Use array shorthand definition
reneolivo Mar 3, 2021
50e6a3a
CPS-427: Update Github tests CiviCRM version
reneolivo Mar 3, 2021
a4c3cbf
CPS-427: Fix non static function call from static function
reneolivo Mar 3, 2021
36bed71
Merge pull request #710 from compucorp/COMCL-101-regerate-civix-and-b…
reneolivo Mar 3, 2021
ca3b3c1
CPS-479: Fix Add Activity Form URL
reneolivo Mar 9, 2021
d563734
Merge pull request #728 from compucorp/CPS-479-fix-activity-create
reneolivo Mar 9, 2021
b45c550
Merge branch 'master' into CPS-427-civicase-civicrm-5.35-alignment
reneolivo Mar 17, 2021
6a07c94
CPS-480: Change button markup
deb1990 Oct 1, 2020
0ca517c
Merge pull request #744 from compucorp/CPS-332-support-new-button-markup
deb1990 Mar 22, 2021
8063224
Merge branch 'master' into CPS-427-civicase-civicrm-5.35-alignment
deb1990 Mar 25, 2021
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
Prev Previous commit
Next Next commit
CPS-479: Fix Add Activity Form URL
  • Loading branch information
reneolivo committed Mar 9, 2021
commit ca3b3c1d1e45d60e22efe0b3c940a722d142f382
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
* @returns {string} url
*/
$scope.newActivityUrl = function (actType) {
var caseClientId = _.first($scope.case.client).contact_id;
var caseType = CaseType.getById($scope.case.case_type_id);
var caseQueryParams = JSON.stringify(getCaseQueryParams({
caseId: $scope.case.id,
Expand All @@ -107,7 +108,8 @@
};
var options = {
action: 'add',
civicase_reload: caseQueryParams
civicase_reload: caseQueryParams,
cid: caseClientId
};
var activityForm = ActivityForms.getActivityFormService(newActivity, options);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@
(function (_) {
describe('AddActivityMenu', function () {
describe('Add Activity Menu Controller', function () {
var $controller, $rootScope, $scope, CaseType;
var $controller, $rootScope, $scope, ActivityForms, activityForm, CaseType,
mockCase;

beforeEach(module('civicase', 'civicase.data'));
beforeEach(module('civicase', 'civicase.data', ($provide) => {
ActivityForms = jasmine.createSpyObj('ActivityForms', ['getActivityFormService']);
activityForm = jasmine.createSpyObj('activityForm', ['getActivityFormUrl']);

beforeEach(inject(function (_$controller_, _$rootScope_, _CaseType_, _ActivityType_) {
ActivityForms.getActivityFormService.and.returnValue(activityForm);
activityForm.getActivityFormUrl.and.returnValue('/activity-form-url');

$provide.value('ActivityForms', ActivityForms);
}));

beforeEach(inject(function (_$controller_, _$rootScope_, _CaseType_) {
$controller = _$controller_;
$rootScope = _$rootScope_;
CaseType = _CaseType_;
Expand All @@ -21,7 +30,7 @@
activityTypeWithMaxInstance = activityTypes.find(function (activity) {
return activity.max_instances;
});
var mockCase = {
mockCase = {
case_type_id: 1
};

Expand All @@ -37,6 +46,64 @@
});
});

describe('new activity URL', () => {
beforeEach(() => {
mockCase = {
id: _.uniqueId(),
case_type_id: '1',
client: [{ contact_id: _.uniqueId() }]
};

initController(mockCase);
});

describe('when getting the form URL for a particular activity type', () => {
let returnedUrl, activityType;

beforeEach(() => {
activityType = {
id: _.uniqueId(),
name: 'sample-activity-type'
};
returnedUrl = $scope.newActivityUrl(activityType);
});

it('requests the appropriate activity form service', () => {
expect(ActivityForms.getActivityFormService).toHaveBeenCalledWith(
{
activity_type_id: activityType.id,
case_id: $scope.case.id,
type: activityType.name
},
{
action: 'add',
civicase_reload: jasmine.any(String),
cid: _.first(mockCase.client).contact_id
}
);
});

it('requests the activity type form URL', () => {
expect(activityForm.getActivityFormUrl).toHaveBeenCalledWith(
{
activity_type_id: activityType.id,
case_id: $scope.case.id,
type: activityType.name
},
{
action: 'add',
civicase_reload: jasmine.any(String),
cid: _.first(mockCase.client).contact_id
}
);
});

it('returns the URL for the acitivity type form', () => {
expect(returnedUrl).toBe('/activity-form-url');
});
});
});

/**
* Initializes the add activity menu controller.
*
Expand Down