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
09bd07be
Commit
09bd07be
authored
1 year ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Update some functions to use API4 internally
parent
42d921ea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Core/Payment/MJWTrait.php
+28
-20
28 additions, 20 deletions
CRM/Core/Payment/MJWTrait.php
with
28 additions
and
20 deletions
CRM/Core/Payment/MJWTrait.php
+
28
−
20
View file @
09bd07be
...
...
@@ -9,7 +9,9 @@
+--------------------------------------------------------------------+
*/
use
Civi\Api4\Contribution
;
use
Civi\Api4\ContributionRecur
;
use
Civi\Api4\Phone
;
use
Civi\Payment\Exception\PaymentProcessorException
;
use
Civi\Payment\PropertyBag
;
use
CRM_Mjwshared_ExtensionUtil
as
E
;
...
...
@@ -92,28 +94,27 @@ trait CRM_Core_Payment_MJWTrait {
/**
* Get the billing email address
*
* @deprecated This is not used anywhere and will be removed in a future version
*
* @param array $params
* @param int $contactI
d
* @param int $contactI
D
*
* @return string|NULL
*/
protected
function
getBillingPhone
(
$params
,
$contactI
d
)
{
$billingLocation
Id
=
CRM_Core_
BAO_L
ocation
T
ype
::
get
Billing
(
);
$phoneNumber
=
$params
[
"phone-
{
$billingLocation
Id
}
"
]
??
$params
[
'phone-Primary'
]
??
$params
[
'phone'
]
??
NULL
;
protected
function
getBillingPhone
(
$params
,
$contactI
D
)
{
$billingLocation
TypeID
=
CRM_Core_
PseudoConstant
::
getKey
(
'CRM_Core_DAO_Address'
,
'l
ocation
_t
ype
_id'
,
'
Billing
'
);
$phoneNumber
=
$params
[
"phone-
{
$billingLocation
TypeID
}
"
]
??
$params
[
'phone-Primary'
]
??
$params
[
'phone'
]
??
NULL
;
if
(
empty
(
$phoneNumber
)
&&
!
empty
(
$contactI
d
))
{
if
(
empty
(
$phoneNumber
)
&&
!
empty
(
$contactI
D
))
{
// Try and retrieve a phone number from Contact ID
try
{
$phoneNumber
=
civicrm_api3
(
'Phone'
,
'getvalue'
,
[
'contact_id'
=>
$contactId
,
'return'
=>
[
'phone'
],
]);
}
catch
(
CiviCRM_API3_Exception
$e
)
{
return
NULL
;
}
$phone
=
Phone
::
get
(
FALSE
)
->
addSelect
(
'phone'
)
->
addWhere
(
'contact_id'
,
'='
,
$contactID
)
->
addOrderBy
(
'is_primary'
,
'DESC'
)
->
execute
()
->
first
();
}
return
$phone
Number
;
return
$phone
[
'phone'
]
??
''
;
}
/**
...
...
@@ -159,15 +160,22 @@ trait CRM_Core_Payment_MJWTrait {
}
if
(
$propertyBag
->
has
(
'contributionID'
))
{
return
(
int
)
civicrm_api3
(
'Contribution'
,
'getvalue'
,
[
'id'
=>
$propertyBag
->
getContributionID
(),
'return'
=>
'contribution_recur_id'
]);
return
Contribution
::
get
(
FALSE
)
->
addSelect
(
'contribution_recur_id'
)
->
addWhere
(
'id'
,
'='
,
$propertyBag
->
getContributionID
())
->
addWhere
(
'is_test'
,
'IN'
,
[
TRUE
,
FALSE
])
->
execute
()
->
first
()[
'contribution_recur_id'
]
??
NULL
;
}
if
(
$propertyBag
->
has
(
'processorID'
))
{
$propertyBag
->
getRecurProcessorID
();
return
(
int
)
civicrm_api3
(
'ContributionRecur'
,
'getvalue'
,
[
'processor_id'
=>
$propertyBag
->
getRecurProcessorID
(),
'return'
=>
'id'
]);
return
ContributionRecur
::
get
(
FALSE
)
->
addSelect
(
'id'
)
->
addWhere
(
'processor_id'
,
'='
,
$propertyBag
->
getRecurProcessorID
())
->
addWhere
(
'is_test'
,
'IN'
,
[
TRUE
,
FALSE
])
->
execute
()
->
first
()[
'id'
]
??
NULL
;
}
return
NULL
;
}
...
...
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