Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
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
Development
CiviCRM Core
Commits
73b82cb4
Unverified
Commit
73b82cb4
authored
4 years ago
by
mattwire
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #19411 from eileenmcnaughton/deprecate_add
Deprecate Pledge::add() function
parents
a0fb1ff4
1f6f2538
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Pledge/BAO/Pledge.php
+21
-6
21 additions, 6 deletions
CRM/Pledge/BAO/Pledge.php
with
21 additions
and
6 deletions
CRM/Pledge/BAO/Pledge.php
+
21
−
6
View file @
73b82cb4
...
...
@@ -61,7 +61,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge {
* @return CRM_Pledge_DAO_Pledge
*/
public
static
function
add
(
array
$params
):
CRM_Pledge_DAO_Pledge
{
CRM_Core_Error
::
deprecatedFunctionWarning
(
'v4 api'
);
$hook
=
empty
(
$params
[
'id'
])
?
'create'
:
'edit'
;
CRM_Utils_Hook
::
pre
(
$hook
,
'Pledge'
,
$params
[
'id'
]
??
NULL
,
$params
);
...
...
@@ -117,7 +117,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge {
* @return CRM_Pledge_DAO_Pledge
* @throws \CRM_Core_Exception
*/
public
static
function
create
(
$params
)
{
public
static
function
create
(
array
$params
)
:
CRM_Pledge_DAO_Pledge
{
$isRecalculatePledgePayment
=
self
::
isPaymentsRequireRecalculation
(
$params
);
$transaction
=
new
CRM_Core_Transaction
();
...
...
@@ -144,12 +144,27 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge {
}
$paymentParams
[
'status_id'
]
=
$params
[
'status_id'
]
??
NULL
;
$pledge
=
self
::
add
(
$params
);
if
(
is_a
(
$pledge
,
'CRM_Core_Error'
))
{
$pledge
->
rollback
();
return
$pledge
;
$hook
=
empty
(
$params
[
'id'
])
?
'create'
:
'edit'
;
CRM_Utils_Hook
::
pre
(
$hook
,
'Pledge'
,
$params
[
'id'
]
??
NULL
,
$params
);
$pledge
=
new
CRM_Pledge_DAO_Pledge
();
// if pledge is complete update end date as current date
if
(
$pledge
->
status_id
==
1
)
{
$pledge
->
end_date
=
date
(
'Ymd'
);
}
$pledge
->
copyValues
(
$params
);
// set currency for CRM-1496
if
(
!
isset
(
$pledge
->
currency
))
{
$pledge
->
currency
=
CRM_Core_Config
::
singleton
()
->
defaultCurrency
;
}
$pledge
->
save
();
CRM_Utils_Hook
::
post
(
$hook
,
'Pledge'
,
$pledge
->
id
,
$pledge
);
// handle custom data.
if
(
!
empty
(
$params
[
'custom'
])
&&
is_array
(
$params
[
'custom'
])
...
...
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