Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Extensions
automaticsoftcredit
Commits
093af21b
Unverified
Commit
093af21b
authored
Nov 12, 2021
by
JonGold
Browse files
soft credit is in the same currency as the contribution, not the default currency
parent
0dca6007
Changes
2
Hide whitespace changes
Inline
Side-by-side
automaticsoftcredit.php
View file @
093af21b
...
...
@@ -23,12 +23,13 @@ function automaticsoftcredit_civicrm_postCommit($op, $objectName, $objectId, &$o
if
(
$relationship
[
'orientation'
]
===
'b_a'
&&
$relationship
[
'relationship_type.automaticsoftcredit.softcreditdirection'
]
===
1
)
{
continue
;
}
// TODO: Civi 5.33 should support ContributionSoft in API4.
civicrm_api3
(
'ContributionSoft'
,
'create'
,
[
'contribution_id'
=>
$objectId
,
'amount'
=>
$objectRef
->
total_amount
,
'contact_id'
=>
$relationship
[
'far_contact_id'
],
]);
\
Civi\Api4\ContributionSoft
::
create
(
FALSE
)
->
addValue
(
'contribution_id'
,
$objectId
)
->
addValue
(
'amount'
,
$objectRef
->
total_amount
)
->
addValue
(
'currency'
,
$objectRef
->
currency
)
->
addValue
(
'contact_id'
,
$relationship
[
'far_contact_id'
])
->
addValue
(
'soft_credit_type_id'
,
$relationship
[
'relationship_type.automaticsoftcredit.softcreditrelationshiptype'
])
->
execute
();
}
}
...
...
@@ -37,7 +38,6 @@ function automaticsoftcredit_civicrm_fieldOptions($entity, $field, &$options, $p
return
;
}
$softCreditTypeField
=
'custom_'
.
CRM_Core_BAO_CustomField
::
getCustomFieldID
(
'softcreditrelationshiptype'
);
$softCreditDirectionField
=
'custom_'
.
CRM_Core_BAO_CustomField
::
getCustomFieldID
(
'softcreditdirection'
);
if
(
$field
==
$softCreditTypeField
)
{
$softCreditOptions
=
civicrm_api3
(
'OptionValue'
,
'get'
,
[
'option_group_id'
=>
"soft_credit_type"
])[
'values'
];
foreach
(
$softCreditOptions
as
$softCreditOption
)
{
...
...
info.xml
View file @
093af21b
...
...
@@ -15,10 +15,10 @@
<url
desc=
"Licensing"
>
http://www.gnu.org/licenses/agpl-3.0.html
</url>
</urls>
<releaseDate>
2021-06-01
</releaseDate>
<version>
2.
1.1
</version>
<version>
2.
2
</version>
<develStage>
stable
</develStage>
<compatibility>
<ver>
5.3
1
</ver>
<ver>
5.3
5
</ver>
</compatibility>
<comments></comments>
<civix>
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment