Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Partners
CiviCooP
AIVL
aivlspecificactions
Commits
4c36cd82
Commit
4c36cd82
authored
May 20, 2021
by
ErikHommel
Browse files
issue 7740 - add location and metadata event + fix the first_name excel error
parent
8d7f6afe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Civi/Aivlspecificactions/Actions/PetitionActivity.php
View file @
4c36cd82
...
...
@@ -33,6 +33,8 @@ class PetitionActivity extends AbstractAction {
$specs
->
addSpecification
(
new
Specification
(
'petition_flag'
,
'Integer'
,
E
::
ts
(
'Petition Flag'
),
FALSE
,
0
));
$specs
->
addSpecification
(
new
Specification
(
'more_information'
,
'Integer'
,
E
::
ts
(
'More Information'
),
FALSE
,
0
));
$specs
->
addSpecification
(
new
Specification
(
'signature_date'
,
'Date'
,
E
::
ts
(
'Signature Date'
),
FALSE
,
NULL
));
$specs
->
addSpecification
(
new
Specification
(
'location'
,
'String'
,
E
::
ts
(
'Location'
),
FALSE
,
NULL
));
$specs
->
addSpecification
(
new
Specification
(
'metadata_event'
,
'String'
,
E
::
ts
(
'Petition metadata->event'
),
FALSE
,
NULL
));
return
$specs
;
}
...
...
@@ -161,6 +163,18 @@ class PetitionActivity extends AbstractAction {
catch
(
\
Exception
$ex
)
{
}
}
$location
=
$parameterBag
->
getParameter
(
'location'
);
if
(
$location
)
{
$activityParams
[
'location'
]
=
$location
;
}
$metadataEvent
=
$parameterBag
->
getParameter
(
'metadata_event'
);
if
(
$metadataEvent
)
{
$customFieldId
=
$this
->
getEventCustomFieldId
();
if
(
$customFieldId
)
{
$customFieldId
=
"custom_"
.
$customFieldId
;
$activityParams
[
$customFieldId
]
=
$metadataEvent
;
}
}
try
{
$created
=
civicrm_api3
(
'Activity'
,
'create'
,
$activityParams
);
$output
->
setParameter
(
'activity_id'
,
$created
[
'id'
]);
...
...
@@ -171,6 +185,32 @@ class PetitionActivity extends AbstractAction {
}
}
/**
* Method to get custom field id for custom field Event in Petities Metadata
*
* @return array|false
*/
private
function
getEventCustomFieldId
()
{
$customGroupName
=
"Petities_metadata"
;
$customFieldName
=
"Event"
;
try
{
$customFieldId
=
civicrm_api3
(
'CustomField'
,
'getvalue'
,
[
'return'
=>
"id"
,
'custom_group_id'
=>
$customGroupName
,
'name'
=>
$customFieldName
,
]);
if
(
$customFieldId
)
{
return
(
int
)
$customFieldId
;
}
}
catch
(
\
CiviCRM_API3_Exception
$ex
)
{
\
Civi
::
log
()
->
error
(
E
::
ts
(
"Not able to find a custom field with name "
)
.
$customFieldName
.
E
::
ts
(
" in custom group with name "
)
.
$customGroupName
.
E
::
ts
(
" in "
)
.
__METHOD__
.
E
::
ts
(
", error from API3 CustomField getvalue: "
)
.
$ex
->
getMessage
());
}
return
FALSE
;
}
/**
* Method to get the campaign title
*
...
...
info.xml
View file @
4c36cd82
...
...
@@ -14,8 +14,8 @@
<url
desc=
"Support"
>
https://civicoop.org
</url>
<url
desc=
"Licensing"
>
http://www.gnu.org/licenses/agpl-3.0.html
</url>
</urls>
<releaseDate>
2021-05-0
3
</releaseDate>
<version>
1.1
4
</version>
<releaseDate>
2021-05-
2
0
</releaseDate>
<version>
1.1
5
</version>
<develStage>
stable
</develStage>
<compatibility>
<ver>
4.7
</ver>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment