Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Extensions
formercommunicationdata
Commits
d249edf5
Commit
d249edf5
authored
Jun 07, 2022
by
ErikHommel
Browse files
nbr issue 9431 - use postCommit hook if available so phone and email are copied upon delete
parent
f2fed12d
Changes
3
Hide whitespace changes
Inline
Side-by-side
CRM/Formercommunicationdata/CommunicationData.php
View file @
d249edf5
...
...
@@ -313,7 +313,7 @@ class CRM_Formercommunicationdata_CommunicationData {
* @param array $preData
* @return bool
*/
p
rivate
function
saveFormerCommunicationData
(
$preData
)
{
p
ublic
function
saveFormerCommunicationData
(
$preData
)
{
// only if contact_id can be found (it should!)
if
(
isset
(
$preData
[
'contact_id'
])
&&
!
empty
(
$preData
[
'contact_id'
]))
{
$contactId
=
$preData
[
'contact_id'
];
...
...
formercommunicationdata.php
View file @
d249edf5
...
...
@@ -20,11 +20,11 @@ function formercommunicationdata_civicrm_pre($op, $objectName, $objectId, &$para
}
/**
* Implements hook_civicrm_post().
* Implements hook_civicrm_post
Commit
().
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_post/
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_post
Commit
/
*/
function
formercommunicationdata_civicrm_post
(
$op
,
$objectName
,
$objectId
,
&
$objectRef
)
{
function
formercommunicationdata_civicrm_post
Commit
(
$op
,
$objectName
,
$objectId
,
&
$objectRef
)
{
if
(
strtolower
(
$op
)
==
'delete'
||
strtolower
(
$op
)
==
'edit'
)
{
$validObjectNames
=
[
"address"
,
"email"
,
"phone"
];
$objectName
=
strtolower
(
$objectName
);
...
...
@@ -34,6 +34,19 @@ function formercommunicationdata_civicrm_post($op, $objectName, $objectId, &$obj
}
}
}
function
formercommunicationdata_civicrm_post
(
$op
,
$objectName
,
$objectId
,
&
$objectRef
)
{
// only if postCommit does not work in installation
if
(
!
method_exists
(
'CRM_Utils_Hook'
,
'postCommit'
))
{
if
(
strtolower
(
$op
)
==
'delete'
||
strtolower
(
$op
)
==
'edit'
)
{
$validObjectNames
=
[
"address"
,
"email"
,
"phone"
];
$objectName
=
strtolower
(
$objectName
);
if
(
in_array
(
$objectName
,
$validObjectNames
))
{
$fcd
=
new
CRM_Formercommunicationdata_CommunicationData
(
$objectName
,
$objectId
);
$fcd
->
processPostHook
(
$op
);
}
}
}
}
/**
* Implements hook_civicrm_postProcess().
...
...
info.xml
View file @
d249edf5
...
...
@@ -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>
202
0
-0
1-23
</releaseDate>
<version>
1.
1
</version>
<releaseDate>
202
2
-0
6-07
</releaseDate>
<version>
1.
2
</version>
<develStage>
stable
</develStage>
<compatibility>
<ver>
5.9
</ver>
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment