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
19fc02ee
Commit
19fc02ee
authored
2 years ago
by
Eileen McNaughton
Browse files
Options
Downloads
Patches
Plain Diff
Fix pledge payment not to refer to contribution status
parent
3d3fa367
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Pledge/BAO/Pledge.php
+1
-10
1 addition, 10 deletions
CRM/Pledge/BAO/Pledge.php
CRM/Pledge/Form/Pledge.php
+19
-13
19 additions, 13 deletions
CRM/Pledge/Form/Pledge.php
with
20 additions
and
23 deletions
CRM/Pledge/BAO/Pledge.php
+
1
−
10
View file @
19fc02ee
...
...
@@ -472,12 +472,11 @@ GROUP BY currency
* @param array $params
* An assoc array of name/value pairs.
*/
public
static
function
sendAcknowledgment
(
&
$form
,
$params
)
{
public
static
function
sendAcknowledgment
(
$form
,
$params
)
{
//handle Acknowledgment.
$allPayments
=
$payments
=
[];
// get All Payments status types.
$paymentStatusTypes
=
CRM_Contribute_PseudoConstant
::
contributionStatus
(
NULL
,
'name'
);
$returnProperties
=
[
'status_id'
,
'scheduled_amount'
,
...
...
@@ -508,14 +507,6 @@ GROUP BY currency
'status'
=>
CRM_Core_PseudoConstant
::
getKey
(
'CRM_Contribute_BAO_Contribution'
,
'contribution_status_id'
,
'Pending'
),
]
);
// get the first valid payment id.
if
(
!
isset
(
$form
->
paymentId
)
&&
(
$paymentStatusTypes
[
$values
[
'status_id'
]]
==
'Pending'
||
$paymentStatusTypes
[
$values
[
'status_id'
]]
==
'Overdue'
)
)
{
$form
->
paymentId
=
$values
[
'id'
];
}
}
}
...
...
This diff is collapsed.
Click to expand it.
CRM/Pledge/Form/Pledge.php
+
19
−
13
View file @
19fc02ee
...
...
@@ -15,6 +15,8 @@
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
use
Civi\Api4\PledgePayment
;
/**
* This class generates form components for processing a pledge
*/
...
...
@@ -79,9 +81,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
$this
->
userDisplayName
=
$this
->
userEmail
=
NULL
;
if
(
$this
->
_contactID
)
{
list
(
$this
->
userDisplayName
,
$this
->
userEmail
)
=
CRM_Contact_BAO_Contact_Location
::
getEmailDetails
(
$this
->
_contactID
);
[
$this
->
userDisplayName
,
$this
->
userEmail
]
=
CRM_Contact_BAO_Contact_Location
::
getEmailDetails
(
$this
->
_contactID
);
}
$this
->
setPageTitle
(
ts
(
'Pledge'
));
...
...
@@ -416,8 +416,10 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
/**
* Process the form submission.
*
* @throws \API_Exception
*/
public
function
postProcess
()
{
public
function
postProcess
()
:
void
{
if
(
$this
->
_action
&
CRM_Core_Action
::
DELETE
)
{
CRM_Pledge_BAO_Pledge
::
deletePledge
(
$this
->
_id
);
return
;
...
...
@@ -457,13 +459,13 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
$dates
=
[
'create_date'
,
'start_date'
,
'acknowledge_date'
,
'cancel_date'
];
foreach
(
$dates
as
$d
)
{
if
(
$this
->
_id
&&
(
!
$this
->
_isPending
)
&&
!
empty
(
$this
->
_values
[
$d
]))
{
if
(
$d
==
'start_date'
)
{
if
(
$d
==
=
'start_date'
)
{
$params
[
'scheduled_date'
]
=
CRM_Utils_Date
::
processDate
(
$this
->
_values
[
$d
]);
}
$params
[
$d
]
=
CRM_Utils_Date
::
processDate
(
$this
->
_values
[
$d
]);
}
elseif
(
!
empty
(
$formValues
[
$d
])
&&
!
CRM_Utils_System
::
isNull
(
$formValues
[
$d
]))
{
if
(
$d
==
'start_date'
)
{
if
(
$d
==
=
'start_date'
)
{
$params
[
'scheduled_date'
]
=
CRM_Utils_Date
::
processDate
(
$formValues
[
$d
]);
}
$params
[
$d
]
=
CRM_Utils_Date
::
processDate
(
$formValues
[
$d
]);
...
...
@@ -499,10 +501,11 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
// create pledge record.
$pledge
=
CRM_Pledge_BAO_Pledge
::
create
(
$params
);
$pledgeID
=
$pledge
->
id
;
$statusMsg
=
NULL
;
if
(
$pledge
->
id
)
{
if
(
$pledge
ID
)
{
// set the status msg.
if
(
$this
->
_action
&
CRM_Core_Action
::
ADD
)
{
$statusMsg
=
ts
(
'Pledge has been recorded and the payment schedule has been created.<br />'
);
...
...
@@ -513,28 +516,31 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
}
// handle Acknowledgment.
if
(
!
empty
(
$formValues
[
'is_acknowledge'
])
&&
$pledge
->
id
)
{
if
(
!
empty
(
$formValues
[
'is_acknowledge'
]))
{
// calculate scheduled amount.
$params
[
'scheduled_amount'
]
=
round
(
$params
[
'amount'
]
/
$params
[
'installments'
]);
$params
[
'total_pledge_amount'
]
=
$params
[
'amount'
];
// get some required pledge values in params.
$params
[
'id'
]
=
$pledge
->
id
;
$params
[
'id'
]
=
$pledge
ID
;
$params
[
'acknowledge_date'
]
=
$pledge
->
acknowledge_date
;
$params
[
'is_test'
]
=
$pledge
->
is_test
;
$params
[
'currency'
]
=
$pledge
->
currency
;
// retrieve 'from email id' for acknowledgement
$params
[
'from_email_id'
]
=
$formValues
[
'from_email_address'
];
$this
->
paymentId
=
NULL
;
// send Acknowledgment mail.
CRM_Pledge_BAO_Pledge
::
sendAcknowledgment
(
$this
,
$params
);
$statusMsg
.
=
' '
.
ts
(
"An acknowledgment email has been sent to %1.<br />"
,
[
1
=>
$this
->
userEmail
]);
// get the first valid payment id.
$nextPaymentID
=
PledgePayment
::
get
()
->
addWhere
(
'pledge_id'
,
'='
,
$pledgeID
)
->
addWhere
(
'status_id:name'
,
'IN'
,
[
'Pending'
,
'Overdue'
])
->
addOrderBy
(
'scheduled_date'
)
->
setLimit
(
1
)
->
execute
()
->
first
()[
'id'
];
// build the payment urls.
if
(
$
this
->
p
aymentI
d
)
{
$urlParams
=
"reset=1&action=add&cid=
{
$this
->
_contactID
}
&ppid=
{
$
this
->
p
aymentI
d
}
&context=pledge"
;
if
(
$
nextP
aymentI
D
)
{
$urlParams
=
"reset=1&action=add&cid=
{
$this
->
_contactID
}
&ppid=
{
$
nextP
aymentI
D
}
&context=pledge"
;
$contribURL
=
CRM_Utils_System
::
url
(
'civicrm/contact/view/contribution'
,
$urlParams
);
$urlParams
.
=
"&mode=live"
;
$creditURL
=
CRM_Utils_System
::
url
(
'civicrm/contact/view/contribution'
,
$urlParams
);
...
...
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