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
9231464f
Commit
9231464f
authored
11 years ago
by
Kurund Jalmi
Browse files
Options
Downloads
Patches
Plain Diff
CRM-12514 expose petitions on activity search along with surveys
parent
dabf18d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Activity/BAO/Query.php
+2
-2
2 additions, 2 deletions
CRM/Activity/BAO/Query.php
CRM/Activity/Form/Search.php
+11
-8
11 additions, 8 deletions
CRM/Activity/Form/Search.php
CRM/Campaign/BAO/Survey.php
+12
-13
12 additions, 13 deletions
CRM/Campaign/BAO/Survey.php
with
25 additions
and
23 deletions
CRM/Activity/BAO/Query.php
+
2
−
2
View file @
9231464f
...
...
@@ -525,8 +525,8 @@ class CRM_Activity_BAO_Query {
$parentNames
=
CRM_Core_BAO_Tag
::
getTagSet
(
'civicrm_activity'
);
CRM_Core_Form_Tag
::
buildQuickForm
(
$form
,
$parentNames
,
'civicrm_activity'
,
NULL
,
TRUE
,
FALSE
,
TRUE
);
$surveys
=
CRM_Campaign_BAO_Survey
::
getSurveys
();
if
(
$surveys
)
$form
->
add
(
'select'
,
'activity_survey_id'
,
ts
(
'Survey'
),
$surveys
=
CRM_Campaign_BAO_Survey
::
getSurveys
(
TRUE
,
FALSE
,
FALSE
,
TRUE
);
if
(
$surveys
)
$form
->
add
(
'select'
,
'activity_survey_id'
,
ts
(
'Survey
/ Petition
'
),
array
(
''
=>
ts
(
'- none -'
))
+
$surveys
,
FALSE
);
...
...
This diff is collapsed.
Click to expand it.
CRM/Activity/Form/Search.php
+
11
−
8
View file @
9231464f
...
...
@@ -326,13 +326,6 @@ class CRM_Activity_Form_Search extends CRM_Core_Form {
// if we are editing / running a saved search and the form has not been posted
$this
->
_formValues
=
CRM_Contact_BAO_SavedSearch
::
getFormValues
(
$this
->
_ssID
);
}
if
(
CRM_Utils_Array
::
value
(
'activity_survey_id'
,
$this
->
_formValues
))
{
// if the user has choosen a survey but not any activity type, we force the activity type
$sid
=
CRM_Utils_Array
::
value
(
'activity_survey_id'
,
$this
->
_formValues
);
$activity_type_id
=
CRM_Core_DAO
::
getFieldValue
(
'CRM_Campaign_DAO_Survey'
,
$sid
,
'activity_type_id'
);
$this
->
_formValues
[
'activity_type_id'
][
$activity_type_id
]
=
1
;
}
if
(
!
CRM_Utils_Array
::
value
(
'activity_test'
,
$this
->
_formValues
))
{
$this
->
_formValues
[
"activity_test"
]
=
0
;
...
...
@@ -410,7 +403,12 @@ class CRM_Activity_Form_Search extends CRM_Core_Form {
$survey
=
CRM_Utils_Request
::
retrieve
(
'survey'
,
'Positive'
,
CRM_Core_DAO
::
$_nullObject
);
if
(
$survey
)
{
$this
->
_formValues
[
'activity_survey_id'
]
=
$survey
;
$this
->
_formValues
[
'activity_survey_id'
]
=
$this
->
_defaults
[
'activity_survey_id'
]
=
$survey
;
$sid
=
CRM_Utils_Array
::
value
(
'activity_survey_id'
,
$this
->
_formValues
);
$activity_type_id
=
CRM_Core_DAO
::
getFieldValue
(
'CRM_Campaign_DAO_Survey'
,
$sid
,
'activity_type_id'
);
$this
->
_formValues
[
'activity_type_id'
][
$activity_type_id
]
=
1
;
$this
->
_defaults
[
'activity_type_id'
][
$activity_type_id
]
=
1
;
}
$cid
=
CRM_Utils_Request
::
retrieve
(
'cid'
,
'Positive'
,
$this
);
...
...
@@ -431,6 +429,11 @@ class CRM_Activity_Form_Search extends CRM_Core_Form {
$this
->
_single
=
TRUE
;
}
}
if
(
!
empty
(
$this
->
_defaults
))
{
$this
->
setDefaults
(
$this
->
_defaults
);
}
}
function
getFormValues
()
{
...
...
This diff is collapsed.
Click to expand it.
CRM/Campaign/BAO/Survey.php
+
12
−
13
View file @
9231464f
...
...
@@ -239,15 +239,13 @@ SELECT survey.id as id,
* @param boolean $onlyActive retrieve only active surveys.
* @param boolean $onlyDefault retrieve only default survey.
* @param boolean $forceAll retrieve all surveys.
* @param boolean $includePetition include or exclude petitions
*
* @static
*/
static
function
getSurveys
(
$onlyActive
=
TRUE
,
$onlyDefault
=
FALSE
,
$forceAll
=
FALSE
)
{
static
function
getSurveys
(
$onlyActive
=
TRUE
,
$onlyDefault
=
FALSE
,
$forceAll
=
FALSE
,
$includePetition
=
FALSE
)
{
$cacheKey
=
0
;
$cacheKeyParams
=
array
(
'onlyActive'
,
'onlyDefault'
,
'forceAll'
);
$cacheKeyParams
=
array
(
'onlyActive'
,
'onlyDefault'
,
'forceAll'
,
'includePetition'
);
foreach
(
$cacheKeyParams
as
$param
)
{
$cacheParam
=
$$param
;
if
(
!
$cacheParam
)
{
...
...
@@ -259,14 +257,15 @@ SELECT survey.id as id,
static
$surveys
;
if
(
!
isset
(
$surveys
[
$cacheKey
]))
{
//we only have activity type as a
//difference between survey and petition.
$petitionTypeID
=
CRM_Core_OptionGroup
::
getValue
(
'activity_type'
,
'petition'
,
'name'
);
$where
=
array
();
if
(
$petitionTypeID
)
{
$where
[]
=
"( survey.activity_type_id !=
{
$petitionTypeID
}
)"
;
if
(
!
$includePetition
)
{
//we only have activity type as a
//difference between survey and petition.
$petitionTypeID
=
CRM_Core_OptionGroup
::
getValue
(
'activity_type'
,
'petition'
,
'name'
);
$where
=
array
();
if
(
$petitionTypeID
)
{
$where
[]
=
"( survey.activity_type_id !=
{
$petitionTypeID
}
)"
;
}
}
if
(
!
$forceAll
&&
$onlyActive
)
{
$where
[]
=
'( survey.is_active = 1 )'
;
...
...
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