Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mjwshared
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Extensions
mjwshared
Commits
e1639c79
Commit
e1639c79
authored
3 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Automatically handle deprecated trxn_id on civicrm_contribution_recur
parent
4ead2be0
No related branches found
Branches containing commit
Tags
0.9.8
Tags containing commit
1 merge request
!23
Release 1.1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mjwshared.php
+24
-0
24 additions, 0 deletions
mjwshared.php
with
24 additions
and
0 deletions
mjwshared.php
+
24
−
0
View file @
e1639c79
...
@@ -28,6 +28,9 @@ function mjwshared_civicrm_config(&$config) {
...
@@ -28,6 +28,9 @@ function mjwshared_civicrm_config(&$config) {
Civi
::
dispatcher
()
->
addListener
(
'hook_civicrm_buildAsset'
,
'mjwshared_symfony_civicrm_buildAsset'
,
-
990
);
Civi
::
dispatcher
()
->
addListener
(
'hook_civicrm_buildAsset'
,
'mjwshared_symfony_civicrm_buildAsset'
,
-
990
);
// This should run before (almost) anything else as we're loading shared libraries
// This should run before (almost) anything else as we're loading shared libraries
Civi
::
dispatcher
()
->
addListener
(
'hook_civicrm_coreResourceList'
,
'mjwshared_symfony_civicrm_coreResourceList'
,
1000
);
Civi
::
dispatcher
()
->
addListener
(
'hook_civicrm_coreResourceList'
,
'mjwshared_symfony_civicrm_coreResourceList'
,
1000
);
\Civi
::
dispatcher
()
->
addListener
(
'civi.dao.preUpdate'
,
'mjwshared_symfony_preUpdateInsert'
);
\Civi
::
dispatcher
()
->
addListener
(
'civi.dao.preInsert'
,
'mjwshared_symfony_preUpdateInsert'
);
}
}
/**
/**
...
@@ -264,3 +267,24 @@ function mjwshared_civicrm_buildForm($formName, &$form) {
...
@@ -264,3 +267,24 @@ function mjwshared_civicrm_buildForm($formName, &$form) {
\Civi
::
resources
()
->
addVars
(
'payment'
,
$jsVars
);
\Civi
::
resources
()
->
addVars
(
'payment'
,
$jsVars
);
}
}
/**
* @param \Civi\Core\DAO\Event\PreUpdate $event
*/
function
mjwshared_symfony_preUpdateInsert
(
\Civi\Core\DAO\Event\PreUpdate
$event
)
{
if
(
$event
->
object
instanceof
CRM_Contribute_BAO_ContributionRecur
)
{
// Handle deprecated civicrm_contribution_recur.trxn_id and set it to match processor_id if empty
if
(
!
empty
(
$event
->
object
->
processor_id
)
&&
empty
(
$event
->
object
->
trxn_id
))
{
// We set trxn_id to match processor_id as it is still used in some places
$event
->
object
->
trxn_id
=
$event
->
object
->
processor_id
;
}
elseif
(
!
empty
(
$event
->
object
->
trxn_id
)
&&
empty
(
$event
->
object
->
processor_id
))
{
// warn old set
CRM_Core_Error
::
deprecatedFunctionWarning
(
'civicrm_contribution_recur.processor_id'
,
'civicrm_contribution_recur.trxn_id'
);
}
if
(
!
empty
(
$event
->
object
->
trxn_id
)
&&
!
empty
(
$event
->
object
->
processor_id
)
&&
(
$event
->
object
->
trxn_id
!==
$event
->
object
->
processor_id
))
{
// Warn set to different values
CRM_Core_Error
::
deprecatedWarning
(
"Recur ID:
{
$event
->
object
->
id
}
; civicrm_contribution_recur processor_id is different to trxn_id. trxn_id is deprecated and should be empty or match processor_id"
);
}
}
}
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