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
8591080b
Unverified
Commit
8591080b
authored
3 years ago
by
Monish Deb
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #21624 from eileenmcnaughton/no_good
#2629
show only contribution statuses on contribution form
parents
00eb2dc0
e47077ce
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/BAO/Contribution/Utils.php
+4
-5
4 additions, 5 deletions
CRM/Contribute/BAO/Contribution/Utils.php
CRM/Contribute/Form/Contribution.php
+37
-11
37 additions, 11 deletions
CRM/Contribute/Form/Contribution.php
with
41 additions
and
16 deletions
CRM/Contribute/BAO/Contribution/Utils.php
+
4
−
5
View file @
8591080b
...
...
@@ -208,13 +208,13 @@ LIMIT 1
* Get contribution statuses by entity e.g. contribution, membership or 'participant'
*
* @param string $usedFor
* @param in
t
$
id
* @param
str
in
g
$
name
* Contribution ID
*
* @return array
* Array of contribution statuses in array('status id' => 'label') format
*/
public
static
function
getContributionStatuses
(
$usedFor
=
'contribution'
,
$
id
=
NULL
)
{
public
static
function
getContributionStatuses
(
$usedFor
=
'contribution'
,
$
name
=
NULL
)
{
if
(
$usedFor
===
'pledge'
)
{
$statusNames
=
CRM_Pledge_BAO_Pledge
::
buildOptions
(
'status_id'
,
'validate'
);
}
...
...
@@ -232,7 +232,7 @@ LIMIT 1
'Template'
,
];
// on create fetch statuses on basis of component
if
(
!
$
id
)
{
if
(
!
$
name
)
{
$statusNamesToUnset
=
array_merge
(
$statusNamesToUnset
,
[
'Refunded'
,
'Chargeback'
,
...
...
@@ -266,8 +266,7 @@ LIMIT 1
}
}
else
{
$contributionStatus
=
CRM_Core_DAO
::
getFieldValue
(
'CRM_Contribute_DAO_Contribution'
,
$id
,
'contribution_status_id'
);
$name
=
$statusNames
[
$contributionStatus
]
??
NULL
;
switch
(
$name
)
{
case
'Completed'
:
// [CRM-17498] Removing unsupported status change options.
...
...
This diff is collapsed.
Click to expand it.
CRM/Contribute/Form/Contribution.php
+
37
−
11
View file @
8591080b
...
...
@@ -9,6 +9,7 @@
+--------------------------------------------------------------------+
*/
use
Civi\Api4\Contribution
;
use
Civi\Payment\Exception\PaymentProcessorException
;
/**
...
...
@@ -200,6 +201,13 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
*/
public
$submitOnce
=
TRUE
;
/**
* Status of contribution prior to edit.
*
* @var string
*/
protected
$previousContributionStatus
;
/**
* Explicitly declare the form context.
*/
...
...
@@ -459,6 +467,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \API_Exception
*/
public
function
buildQuickForm
()
{
if
(
$this
->
_id
)
{
...
...
@@ -653,21 +662,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
$this
->
add
(
'select'
,
'from_email_address'
,
ts
(
'Receipt From'
),
$this
->
_fromEmails
);
$component
=
'contribution'
;
$componentDetails
=
[];
if
(
$this
->
_id
)
{
$componentDetails
=
CRM_Contribute_BAO_Contribution
::
getComponentDetails
(
$this
->
_id
);
if
(
!
empty
(
$componentDetails
[
'membership'
]))
{
$component
=
'membership'
;
}
elseif
(
!
empty
(
$componentDetails
[
'participant'
]))
{
$component
=
'participant'
;
}
}
if
(
$this
->
_ppID
)
{
$component
=
'pledge'
;
}
$status
=
CRM_Contribute_BAO_Contribution_Utils
::
getContributionStatuses
(
$component
,
$this
->
_id
);
$status
=
CRM_Contribute_BAO_Contribution_Utils
::
getContributionStatuses
(
'contribution'
,
$this
->
getPreviousContributionStatus
());
// define the status IDs that show the cancellation info, see CRM-17589
$cancelInfo_show_ids
=
[];
...
...
@@ -1829,4 +1828,31 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
}
}
/**
* Get the contribution ID.
*
* @return int|null
*/
protected
function
getContributionID
():
?int
{
return
$this
->
_id
;
}
/**
* Get the selected contribution status.
*
* @return string
*
* @throws \API_Exception
*/
protected
function
getPreviousContributionStatus
():
string
{
if
(
!
$this
->
previousContributionStatus
)
{
$this
->
previousContributionStatus
=
Contribution
::
get
(
FALSE
)
->
addWhere
(
'id'
,
'='
,
$this
->
getContributionID
())
->
addSelect
(
'contribution_status_id:name'
)
->
execute
()
->
first
()[
'contribution_status_id:name'
];
}
return
$this
->
previousContributionStatus
;
}
}
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