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
368a5cb2
Unverified
Commit
368a5cb2
authored
3 years ago
by
Seamus Lee
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #21118 from eileenmcnaughton/5.40
5.40 contribution save regression
parents
b914d938
32322d09
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/Contribute/Form/Contribution.php
+1
-1
1 addition, 1 deletion
CRM/Contribute/Form/Contribution.php
CRM/Financial/BAO/Order.php
+31
-3
31 additions, 3 deletions
CRM/Financial/BAO/Order.php
with
32 additions
and
4 deletions
CRM/Contribute/Form/Contribution.php
+
1
−
1
View file @
368a5cb2
...
...
@@ -914,7 +914,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
$order
=
new
CRM_Financial_BAO_Order
();
$order
->
setPriceSelectionFromUnfilteredInput
(
$fields
);
if
(
isset
(
$fields
[
'total_amount'
]))
{
$order
->
setOverrideTotalAmount
(
$fields
[
'total_amount'
]);
$order
->
setOverrideTotalAmount
(
(
float
)
CRM_Utils_Rule
::
cleanMoney
(
$fields
[
'total_amount'
])
)
;
}
$lineItems
=
$order
->
getLineItems
();
try
{
...
...
This diff is collapsed.
Click to expand it.
CRM/Financial/BAO/Order.php
+
31
−
3
View file @
368a5cb2
...
...
@@ -65,6 +65,30 @@ class CRM_Financial_BAO_Order {
*/
protected
$defaultFinancialTypeID
;
/**
* Number of line items.
*
* @var int
*/
protected
$lineItemCount
;
/**
* @return int
*/
public
function
getLineItemCount
():
int
{
if
(
!
isset
(
$this
->
lineItemCount
))
{
$this
->
lineItemCount
=
count
(
$this
->
getPriceOptions
())
||
count
(
$this
->
lineItems
);
}
return
$this
->
lineItemCount
;
}
/**
* @param int $lineItemCount
*/
public
function
setLineItemCount
(
int
$lineItemCount
):
void
{
$this
->
lineItemCount
=
$lineItemCount
;
}
/**
* @return int
*/
...
...
@@ -179,7 +203,7 @@ class CRM_Financial_BAO_Order {
public
function
getOverrideTotalAmount
()
{
// The override amount is only valid for quick config price sets where more
// than one field has not been selected.
if
(
!
$this
->
overrideTotalAmount
||
!
$this
->
supportsOverrideAmount
()
||
count
(
$this
->
getPriceOptions
()
)
>
1
)
{
if
(
!
$this
->
overrideTotalAmount
||
$this
->
getLineItemCount
(
)
>
1
)
{
return
FALSE
;
}
return
$this
->
overrideTotalAmount
;
...
...
@@ -190,9 +214,9 @@ class CRM_Financial_BAO_Order {
*
* @internal use in tested core code only.
*
* @param float $overrideTotalAmount
* @param float
|null
$overrideTotalAmount
*/
public
function
setOverrideTotalAmount
(
float
$overrideTotalAmount
):
void
{
public
function
setOverrideTotalAmount
(
?
float
$overrideTotalAmount
):
void
{
$this
->
overrideTotalAmount
=
$overrideTotalAmount
;
}
...
...
@@ -573,6 +597,10 @@ class CRM_Financial_BAO_Order {
$lineItems
[
$newLine
[
'price_field_value_id'
]]
=
$newLine
;
}
}
// Set the line item count here because it is needed to determine whether
// we can use overrides and would not be set yet if we have loaded them from
// a template contribution.
$this
->
setLineItemCount
(
count
(
$lineItems
));
foreach
(
$lineItems
as
&
$lineItem
)
{
// Set any pre-calculation to zero as we will calculate.
...
...
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