Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
justinfreeman (Agileware)
Core
Commits
1cbea43e
Commit
1cbea43e
authored
12 years ago
by
gitsync
Browse files
Options
Downloads
Patches
Plain Diff
CRM-12133 - api/v3/ReportTemplate - Fix option_group_id and component_id errors
parent
e310e129
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/v3/ReportTemplate.php
+6
-0
6 additions, 0 deletions
api/v3/ReportTemplate.php
tests/phpunit/api/v3/ReportTemplateTest.php
+5
-5
5 additions, 5 deletions
tests/phpunit/api/v3/ReportTemplateTest.php
with
11 additions
and
5 deletions
api/v3/ReportTemplate.php
+
6
−
0
View file @
1cbea43e
...
...
@@ -38,6 +38,9 @@ function civicrm_api3_report_template_create($params) {
$params
[
'option_group_id'
]
=
CRM_Core_DAO
::
getFieldValue
(
'CRM_Core_DAO_OptionGroup'
,
'report_template'
,
'id'
,
'name'
);
if
(
!
empty
(
$params
[
'component_id'
])
&&
!
is_numeric
(
$params
[
'component_id'
]))
{
$params
[
'component_id'
]
=
array_search
(
$params
[
'component_id'
],
CRM_Core_PseudoConstant
::
component
());
}
return
civicrm_api3_option_value_create
(
$params
);
}
...
...
@@ -52,6 +55,9 @@ function _civicrm_api3_report_template_create_spec(&$params) {
_civicrm_api3_option_value_create_spec
(
$params
);
$params
[
'value'
][
'api.aliases'
]
=
array
(
'report_url'
);
$params
[
'name'
][
'api.aliases'
]
=
array
(
'class_name'
);
$params
[
'option_group_id'
][
'api.default'
]
=
CRM_Core_DAO
::
getFieldValue
(
'CRM_Core_DAO_OptionGroup'
,
'report_template'
,
'id'
,
'name'
);
// $params['component']['api.required'] = TRUE;
}
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/api/v3/ReportTemplateTest.php
+
5
−
5
View file @
1cbea43e
...
...
@@ -54,7 +54,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
'report_url'
=>
'example/path'
,
'component'
=>
'CiviCase'
,
));
$this
->
assert
Equals
(
0
,
$result
[
'is_error'
],
'In line '
.
__LINE__
);
$this
->
assert
APISuccess
(
$result
);
$this
->
assertEquals
(
1
,
$result
[
'count'
],
'In line '
.
__LINE__
);
$entityId
=
$result
[
'id'
];
$this
->
assertTrue
(
is_numeric
(
$entityId
),
'In line '
.
__LINE__
);
...
...
@@ -71,7 +71,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
'id'
=>
$entityId
,
'component'
=>
''
,
));
$this
->
assert
Equals
(
0
,
$result
[
'is_error'
],
'In line '
.
__LINE__
);
$this
->
assert
APISuccess
(
$result
);
$this
->
assertEquals
(
1
,
$result
[
'count'
],
'In line '
.
__LINE__
);
$this
->
assertDBQuery
(
1
,
'SELECT count(*) FROM civicrm_option_value
WHERE name = "CRM_Report_Form_Examplez"
...
...
@@ -86,7 +86,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
'id'
=>
$entityId
,
'is_active'
=>
0
,
));
$this
->
assert
Equals
(
0
,
$result
[
'is_error'
],
'In line '
.
__LINE__
);
$this
->
assert
APISuccess
(
$result
);
$this
->
assertEquals
(
1
,
$result
[
'count'
],
'In line '
.
__LINE__
);
$this
->
assertDBQuery
(
1
,
'SELECT count(*) FROM civicrm_option_value
WHERE name = "CRM_Report_Form_Examplez"
...
...
@@ -100,7 +100,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
'id'
=>
$entityId
,
'is_active'
=>
1
,
));
$this
->
assert
Equals
(
0
,
$result
[
'is_error'
],
'In line '
.
__LINE__
);
$this
->
assert
APISuccess
(
$result
);
$this
->
assertEquals
(
1
,
$result
[
'count'
],
'In line '
.
__LINE__
);
$this
->
assertDBQuery
(
1
,
'SELECT count(*) FROM civicrm_option_value
WHERE name = "CRM_Report_Form_Examplez"
...
...
@@ -112,7 +112,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
'version'
=>
$this
->
_apiversion
,
'id'
=>
$entityId
,
));
$this
->
assert
Equals
(
0
,
$result
[
'is_error'
],
'In line '
.
__LINE__
);
$this
->
assert
APISuccess
(
$result
);
$this
->
assertEquals
(
1
,
$result
[
'count'
],
'In line '
.
__LINE__
);
$this
->
assertDBQuery
(
0
,
'SELECT count(*) FROM civicrm_option_value
WHERE name = "CRM_Report_Form_Examplez"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment