Development issueshttps://lab.civicrm.org/groups/dev/-/issues2023-10-04T05:03:19Zhttps://lab.civicrm.org/dev/core/-/issues/2882Proposal to add new field for Organisation contacts to record the Tax Identif...2023-10-04T05:03:19Zjustinfreeman (Agileware)Proposal to add new field for Organisation contacts to record the Tax Identification Number: ABN (AU), VATIN (EU), TIN...Proposal to add new field for Organisation contacts to record the Tax Identification Number: ABN (AU), VATIN (EU), TIN/EIN/FEIN/IRS EIN/EIN TAX ID (US) and there's probably more variations. This could also be useful on Individual contact...Proposal to add new field for Organisation contacts to record the Tax Identification Number: ABN (AU), VATIN (EU), TIN/EIN/FEIN/IRS EIN/EIN TAX ID (US) and there's probably more variations. This could also be useful on Individual contacts as well.
This information is also very relevant for the CiviCRM Domain, Organisation Contact. The CiviCRM Contribution message templates could do with adding this information to the default template.
Raising as a proposal here to gather thoughts and find out if people are recording this information elsewhere, renaming the SIC Code field for example. Not looking for responses like: "just use a custom field!" and "change the default templates" - because that's what we already do.
Agileware Ref: CIVICRM-1852https://lab.civicrm.org/dev/core/-/issues/209Case Scheduled Reminders2023-10-03T05:03:22ZshitijgCase Scheduled Reminders**User story:**
- As a CiviCRM administrator
- I would like to configure a scheduled reminder to be sent
- that will include the following tokens:
- All fields from table civicrm_case and associated case custom fields
- All contac...**User story:**
- As a CiviCRM administrator
- I would like to configure a scheduled reminder to be sent
- that will include the following tokens:
- All fields from table civicrm_case and associated case custom fields
- All contact tokens for the contact the scheduled reminder is being sent to as per normal scheduled reminders
- when a specific case type (or types) changes to a specific case status (or status’s)
- either immediately or after a desired period of time has passed from the change in status*
- to one or more case roles, groups of contacts or individual contacts
- so that I can have an email or sms sent to specific contacts when the case status changes to inform them about changes in the case.
**Wireframe:**
The wireframe in the original ticket is somewhat incomplete and doesn’t discuss
- The time period point and how it should work
- The case role’s filtering
As such I would suggest the following solution:
![8d2fca53-d8a0-4cfa-b208-4cc889ee09e0](/uploads/a292bb55efdea95398d0ca47e4b363d4/8d2fca53-d8a0-4cfa-b208-4cc889ee09e0.png)
**Notes:**
- If case type or case status is not selected then all case types and status should send the reminder.
- The “when” feature should operate such that if it is left blank then the reminder should be sent and only sent once but for cases meeting the criteria and the following when criteria:
- “After status change”
- Immediately after the status change takes place if that is the selected option and no other fields are filled in.
- Or the specified time after the status change takes place if a “number of hours or days after” is filled in
- Or on or after the “when” date if this is filled in
- If both the when and the “number of hours or days after” is filled in then the scheduled reminder should send only once on the earlier of those two dates. CiviCRM’s UX here is a bit nutty - 😳
- “Case start date”
- Immediately after the case start date for cases that meet that criteria if that is the selected option and no other fields are filled in.
- Or the specified time after the case start date if a “number of hours or days after” is filled in
- Or on or after the “when” date if this is filled in
- If both the when and the “number of hours or days after” is filled in then the scheduled reminder should send only once on the earlier of those two dates.
- “Case end date”
- Immediately after the case end date for cases that meet that criteria if that is the selected option and no other fields are filled in.
- Or the specified time after the case end date if a “number of hours or days after” is filled in
- Or on or after the “when” date if this is filled in
- If both the when and the “number of hours or days after” is filled in then the scheduled reminder should send only once on the earlier of those two dates.
- NICE TO HAVE: Can we also support any date type custom fields that are added to the case with the same logic and list those custom fields in the dropdown? i.e. create a case custom field “Court date” and then have that date in the scheduled reminder filters? Lower priority.
- Limit or add to case roles:
- Should allow user to select the case roles that the email will be sent to.https://lab.civicrm.org/dev/core/-/issues/2859Custom File field in custom group used by entity group not saving2023-10-03T05:03:21ZnieloCustom File field in custom group used by entity group not savingI attached a new custom group to entity type group and added a field of type file. When editing the group settings and fill in a file, it is posted without errors and notification bubble confirms success. But there is no file uploaded.
...I attached a new custom group to entity type group and added a field of type file. When editing the group settings and fill in a file, it is posted without errors and notification bubble confirms success. But there is no file uploaded.
No error logs even with debugging enabled, file tmp folder is checked and I successfully tried another custom file field attached to entity contact.
Just tried on https://dmaster.demo.civicrm.org/ - same misbehavior.
Looked at the code and it seems that the posted file info is not getting into the params array. Although the posted name is of correct format custom_123_21313 the packages/HTML/QuickForm/Controller.php->exportValues gets "MAX_FILE_SIZE" as key for the custom field. Could it be that https://lab.civicrm.org/dev/core/-/blob/master/CRM/Group/Controller.php 's overridden custom file field preparation causes this error?
Civi and Drupal are current versions.https://lab.civicrm.org/dev/core/-/issues/2865Missing message template updates2023-10-02T05:03:25ZDaveDMissing message template updatesI had noticed a missing handful earlier and added it to https://github.com/civicrm/civicrm-core/blob/0ebeb224903925880f3ad0ddacd4e90470049839/CRM/Upgrade/Incremental/MessageTemplates.php#L252, but I'm noticing a few more seem to be out o...I had noticed a missing handful earlier and added it to https://github.com/civicrm/civicrm-core/blob/0ebeb224903925880f3ad0ddacd4e90470049839/CRM/Upgrade/Incremental/MessageTemplates.php#L252, but I'm noticing a few more seem to be out of date. I'll try to reconcile.
It's technically a regression but at first glance they all seem to just be php8 updates, nothing functional.
A bigger project: Why does the upgrade work the way it does and why does it need this list to be manually updated? Why doesn't it just compare the default version in the database to what's on disk, and update it if different? Why does it even need a default version in the database anyway - maybe just because it makes Revert code easier?https://lab.civicrm.org/dev/core/-/issues/2877Add recurring failed messaging to core?2023-10-02T05:03:25ZeileenAdd recurring failed messaging to core?I'm just working on updating our custom code for sending emails when people's credit cards start failing & just thought I'd put it out there that this could be moved to core if there is demand.
The basic spec is
- a workflow template
-...I'm just working on updating our custom code for sending emails when people's credit cards start failing & just thought I'd put it out there that this could be moved to core if there is demand.
The basic spec is
- a workflow template
- code to send an email when failures hit a threshold IF they don't have any active recurrings (because people often start a new one themselves).
- the threshold would be from a 'number of fails before emailing' setting I think with empty = disabled
My guess is that user orgs would feel this should be in core & extension writers might prefer to solve in an extension. If there isn't demand I won't do it.https://lab.civicrm.org/dev/core/-/issues/2854ipAddress function and front-end proxies (like Varnish)2023-10-01T05:03:27ZAlanDixonipAddress function and front-end proxies (like Varnish)There are times where CiviCRM likes to know who it's talking to, i.e. the ip address of the visitor.
This matters especially when it gets passed on to a payment processor (e.g. for the purposes of mitigating card tumbling).
Here's the ...There are times where CiviCRM likes to know who it's talking to, i.e. the ip address of the visitor.
This matters especially when it gets passed on to a payment processor (e.g. for the purposes of mitigating card tumbling).
Here's the utility function that does that for several core-shipped payment processors:
https://github.com/civicrm/civicrm-core/blob/b599743f3daa46ab96c09ebe410fbb833cdd080f/CRM/Utils/System.php#L1293
This code is fairly naive, but notably makes use of the fact that Drupal 7 (and earlier) that had a function "ip_address()" that would pay attention to the Drupal configuration to be able to deal with front end proxies.
Unfortunately, D8/9 no longer includes this function, but more importantly, it also fails for other CMSs.
In researching this issue, I noticed that D8/9 now uses a core symphony function, which might provide a better solution than using our current CMS-specific approach.
Specifically, in Drupal, you can reliably get the 'client' ip with this: return Drupal::request()->getClientIp();
Assuming civicrm has a container similar to Drupal, a similar solution might be available for CiviCRM.
It's reasonable to ask whether ipAddress should be changed in this way - here's a search showing where this function gets called:
https://github.com/civicrm/civicrm-core/search?q=ipAddresshttps://lab.civicrm.org/dev/core/-/issues/2860Contribution Page Premium "No Thank You" is always disabled2023-10-01T05:03:26ZredgarContribution Page Premium "No Thank You" is always disabledOverview
----------------------------------------
Contribution pages that have the option of Premiums enabled always have the "No Thank You" checkbox disabled. This is true even if you select a donation greater than the amount for the mi...Overview
----------------------------------------
Contribution pages that have the option of Premiums enabled always have the "No Thank You" checkbox disabled. This is true even if you select a donation greater than the amount for the minimum premium. The checkbox still works - but the input field has disabled="disabled" and the checkbox is always grayed out.
I'm using civicrm 5.41.1 on Joomla.
Proposed behavior
----------------------------------------
Code could be written to enable the checkbox once a donation amount greater than the minimum is selected - but it would be easier, and maybe even preferable to never disable the checkbox.
[screenshots](/uploads/81546b7525d3093b8483b6ffc37f7e35/screenshots.png)
Comments
----------------------------------------
The code that sets it to disabled in in templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl
Line numbers 44, 47, 96, and 99 hardcode the checkbox to disabled.https://lab.civicrm.org/dev/core/-/issues/2875CiviCase Forces Case Status to Resolved (Closed) when all Activities in a Seq...2023-09-30T05:03:30ZpbarmakCiviCase Forces Case Status to Resolved (Closed) when all Activities in a Sequence are CompleteOverview
----------------------------------------
For Cases that use a Sequence, once all activities in the sequence are complete, the Case gets set to a Resolved (aka Closed) status. This is fine. However, after a Case is in the Resolve...Overview
----------------------------------------
For Cases that use a Sequence, once all activities in the sequence are complete, the Case gets set to a Resolved (aka Closed) status. This is fine. However, after a Case is in the Resolved status, if a user then wishes to change the status to something other than Resolved (like to a custom status), even though CiviCase says it made the change and even creates a status change activity that shows the status was changed, the case remains in Resolved status.
It looks like Civi/CCase/SequenceListener.php is firing after any case status changes are written to the DB, but SequenceListener is not accounting for someone purposefully trying to change the case status. It only looks for all activities being completed and forces the case back to Resolved.
This doesn't seem like correct behavior nor a good user experience. The listener should check to see if the action was a status change action and not fire the API call in that case. I'm not sure how that can be done (not sure what input the listener has), but that's my guess on how to resolve the issue.
Reproduction steps
----------------------------------------
1. Create a Case Type that uses a sequence of activities (doesn't matter how many)
1. Create a new Case using that type
1. Complete each activity in the sequence and see that the Case automatically changes to Resolved.
1. Try to then change the Case Status to something other than Resolved (like In Progress or Ongoing or any custom status).
1. See that the Case status remains as Resolved, even though a new case activity says it was changed.
Expected behaviour
----------------------------------------
The Case should allow a change in Status even if all Activities in a Sequence are completed. That way user can change to a custom status that also reflects completion (we have multiple status that denote completion but for a variety of reasons).https://lab.civicrm.org/dev/core/-/issues/2879Message admin extension won't load workflows from extensions2023-09-29T05:03:22ZeileenMessage admin extension won't load workflows from extensionsI spent ages trying to get our wmf workflow message to work with the Message Admin extension (I even renamed all the abbreviated variable names to words & added getters for all the abbreviated class properties so I could read the code wi...I spent ages trying to get our wmf workflow message to work with the Message Admin extension (I even renamed all the abbreviated variable names to words & added getters for all the abbreviated class properties so I could read the code without glazing over) and ... eventually I tracked it down.....
https://github.com/civicrm/civicrm-core/blob/master/Civi/Test/ExampleDataLoader.php#L80-L88
Normally I would say it's great to constrain things to core while things bed in - but in this case being able to define workflow messages in an extension is the main deliverable.https://lab.civicrm.org/dev/core/-/issues/805CiviCRM cases don't appear on contact case tab if no activities2023-09-28T05:03:22ZDevAppCiviCRM cases don't appear on contact case tab if no activitiesWhen viewing a client record, then clicking the Cases tab - The cases are not displayed if the case has no activities associated with it. This can happen if you don't have a standard timeline with the case, which typically has the open j...When viewing a client record, then clicking the Cases tab - The cases are not displayed if the case has no activities associated with it. This can happen if you don't have a standard timeline with the case, which typically has the open job activity.
Doing some debugging, the SQL join appears to be an INNER JOIN and not a LEFT JOIN for civicrm_activity. When changed to a LEFT JOIN, then the cases without activities show as the join doesn't filter by the join.
```
SELECT civicrm_case.id as case_id
FROM civicrm_contact contact_a
LEFT JOIN civicrm_phone
ON (contact_a.id = civicrm_phone.contact_id AND civicrm_phone.is_primary = 1)
LEFT JOIN civicrm_case_contact
ON civicrm_case_contact.contact_id = contact_a.id
INNER JOIN civicrm_case ON civicrm_case_contact.case_id = civicrm_case.id
LEFT JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 1 AND case_relationship.case_id = civicrm_case.id )
LEFT JOIN civicrm_relationship_type case_relation_type ON ( case_relation_type.id = case_relationship.relationship_type_id AND case_relation_type.id = case_relationship.relationship_type_id )
LEFT JOIN civicrm_case_activity
ON civicrm_case_activity.case_id = civicrm_case.id
INNER JOIN civicrm_activity case_activity
ON ( civicrm_case_activity.activity_id = case_activity.id AND case_activity.is_current_revision = 1 )
LEFT JOIN civicrm_option_group option_group_activity_type
ON (option_group_activity_type.name = 'activity_type')
LEFT JOIN civicrm_option_value rec_activity_type ON (case_activity.activity_type_id = rec_activity_type.value AND option_group_activity_type.id = rec_activity_type.option_group_id )
LEFT JOIN civicrm_option_group option_group_case_status
ON (option_group_case_status.name = 'case_status')
LEFT JOIN civicrm_option_value case_status
ON (civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id )
LEFT JOIN civicrm_case_type ON civicrm_case.case_type_id = civicrm_case_type.id WHERE ( contact_a.id = '1' AND civicrm_case.is_deleted = 0 ) AND (contact_a.is_deleted = 0)
GROUP BY civicrm_case.id
```
Page: CRM_Case_BAO_Casehttps://lab.civicrm.org/dev/core/-/issues/2805Field transformations2023-09-27T05:03:14ZeileenField transformationsField transformation options for money field don't make sense
Rounding would make sense
![image](/uploads/3266f956bb062d11d3b574fc6ebad623/image.png)Field transformation options for money field don't make sense
Rounding would make sense
![image](/uploads/3266f956bb062d11d3b574fc6ebad623/image.png)https://lab.civicrm.org/dev/core/-/issues/2493CiviCRM 5.35.1, truncation of money values where $1,000 donation is recorded...2023-09-27T05:03:13ZeileenCiviCRM 5.35.1, truncation of money values where $1,000 donation is recorded as $1 which appears to be truncating at the thousand separator when using the Australian (AU) and US Locale@justinfreeman said to the AU-NZ crowd that there is a bug with money in order api but we can't do anything without a proper bug report
placeholder for regression to be clarified
I wasn't able to replicate based on the limited info pro...@justinfreeman said to the AU-NZ crowd that there is a bug with money in order api but we can't do anything without a proper bug report
placeholder for regression to be clarified
I wasn't able to replicate based on the limited info provided
Follow-up, here's the bug report:
> With CiviCRM 5.35.1, we (Agileware) have observed on two separate sites. The truncation of money values where $1,000 donation is recorded as $1 which appears to be truncating at the thousand separator. This has been observed on both WordPress and Drupal sites.
>
> Drupal site with Xero integration (Contribution stuff API) and a WordPress site using Caldera Form integration (Order API).
Agileware Ref: CIVICRM-1692https://lab.civicrm.org/dev/core/-/issues/2845[WP] Fatal errors on log-in with ACF-Extended running2023-09-26T05:03:26Zjbonlinea[WP] Fatal errors on log-in with ACF-Extended runningHi guys,
First post here, I'll do my best to be comprehensive, but we'll probably have to go step by step ;)
I've been doing some quite extensive testing and implementation of CiviCRM on wordpress single site and multisite, and a lots...Hi guys,
First post here, I'll do my best to be comprehensive, but we'll probably have to go step by step ;)
I've been doing some quite extensive testing and implementation of CiviCRM on wordpress single site and multisite, and a lots of plug-in (event if in the end I use the least I could). I've bumped into quite many challenges and issue which are now behind me, and start to have a decent knowlege, as a civi admin and user, more than a developer.
Lately I've bumped into a weird issue, related to user log-in. I've done so many testing that I won't detail it now, but later if needed to narrow down the source.
Basically, I do get quite easilly the below fatal error on user log-in when ACF-Extended is active. if this give you a start that's great, otherwise please ask me a more detail case (there are quite many with the settings behind moving)
Cheers
`Fatal error: Uncaught Error: Call to a member function get_page_permastruct() on null in /home/html/wp-includes/link-template.php:430 Stack trace: #0 /home/html/wp-includes/link-template.php(392): _get_page_link(Object(WP_Post), false, false) #1 /home/html/wp-includes/link-template.php(197): get_page_link(Object(WP_Post), false, false) #2 /home/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php(79): get_permalink(Object(WP_Post)) #3 [internal function]: CRM_Utils_System_WordPress->{closure}() #4 /home/html/wp-content/plugins/civicrm/civicrm/Civi/Core/Paths.php(130): call_user_func(Object(Closure)) #5 /home/html/wp-content/plugins/civicrm/civicrm/Civi/Core in /home/html/wp-includes/link-template.php on line 430`https://lab.civicrm.org/dev/core/-/issues/2765Revisit the decision to enforce the CMS new user account option, allow CiviCR...2023-09-26T05:03:25Zjustinfreeman (Agileware)Revisit the decision to enforce the CMS new user account option, allow CiviCRM to create CMS user accounts when CMS has public registrations disabledRaising this a request to revisit the decision [originating in 2009 (CRM-4036)](https://issues.civicrm.org/jira/browse/CRM-4036.html) to enforce the CMS new user account option and instead **allow CiviCRM to create CMS user accounts when...Raising this a request to revisit the decision [originating in 2009 (CRM-4036)](https://issues.civicrm.org/jira/browse/CRM-4036.html) to enforce the CMS new user account option and instead **allow CiviCRM to create CMS user accounts when CMS has public registrations disabled**.
There are three key reasons to have this functionality:
1. Public registrations on websites attract spamming and therefore require moderation and anti-spam systems to be in place.
2. For member-only websites, the method to because a member is using the membership sign-up form (CiviCRM) and when the membership fee is paid, that's when the corresponding CMS user account should be created. And not by any other means.
3. With user account creation disabled, a separate and in some cases manual process needs to be performed to create the corresponding user account for members - which is a waste of effort.
With the current logic where CiviCRM uses the CMS configuration, the site must be open for public user registrations to support CiviCRM registering a member user account.
The change is relatively simple and would be removing the check of the user registration option for each supported CMS. Thus CiviCRM Profiles can be used to create CMS accounts.
See also related, _User Profiles, the User account registration option is displayed even when the CMS has the "User can register" option disabled_ - https://lab.civicrm.org/dev/user-interface/-/issues/41
Agileware Ref: CIVICRM-1809https://lab.civicrm.org/dev/core/-/issues/2907Some contact core tokens stopped working in 5.43 RC2023-09-25T22:40:57Zmagnolia61Some contact core tokens stopped working in 5.43 RCSome contact core tokens stopped working in scheduled reminders & send email in the 5.43 RC
**Does render in subject:**<BR>
```
{contact.id}
{contact.contact_type:label}
{contact.display_name}
{contact.middle_name}
{contact.last_name}
{...Some contact core tokens stopped working in scheduled reminders & send email in the 5.43 RC
**Does render in subject:**<BR>
```
{contact.id}
{contact.contact_type:label}
{contact.display_name}
{contact.middle_name}
{contact.last_name}
{contact.email_greeting_display}
{contact.phone}
{contact.city}
```
**Does NOT render in subject:**<BR>
```
{contact.first_name}
{contact.birth_date}
(and maybe more)
```
**Does not render in the body:**<BR>
```
{contact.id}
{contact.contact_type:label}
{contact.display_name}
{contact.middle_name}
{contact.last_name}
{contact.email_greeting_display}
{contact.phone}
{contact.city}
```
...
I actually cannot get any contact core token to render in the body field of the template
All my contact custom tokens work fine in subject and body thoughhttps://lab.civicrm.org/dev/core/-/issues/2717Fix code to use Order api to create Memberships in core forms2023-09-25T05:03:28ZeileenFix code to use Order api to create Memberships in core formsThis is just to track the ongoing effort to move the creation of memberships from all sorts of scary stuff, to using the order api - the process includes moving the weird and wonderful logic from 'whereever it might be found' to 'where i...This is just to track the ongoing effort to move the creation of memberships from all sorts of scary stuff, to using the order api - the process includes moving the weird and wonderful logic from 'whereever it might be found' to 'where it should be' -something that has been ongoing as part of getting v4 Membership api up & runninghttps://lab.civicrm.org/dev/core/-/issues/3444Contribution balance token2023-09-24T22:55:47Zmagnolia61Contribution balance tokenOverview
----------------------------------------
Would it be technically easy and functional desired to have contribution balance token?
Example use-case
----------------------------------------
We would like to advocate for an contrib...Overview
----------------------------------------
Would it be technically easy and functional desired to have contribution balance token?
Example use-case
----------------------------------------
We would like to advocate for an contribution balance token
Current behaviour
----------------------------------------
1. We want to send our customers an email with the amount due, or the amount that is pending refund.
2. There is a balance field in the event participant context. But this is absent in the contribution context.
Proposed behaviour
----------------------------------------
A custom token field like {contribution.balance} is available in the contribution context
Comments
----------------------------------------
Eileen opened an issue to enable a balance field for api4 (and an total paid field): https://lab.civicrm.org/dev/core/-/issues/2890https://lab.civicrm.org/dev/core/-/issues/2638Money - create new Civi:: facade - now format helper2023-09-24T22:53:25ZeileenMoney - create new Civi:: facade - now format helperOur CRM_Utils_Money class wound up a mess so we talked about creating a new supported/tested/readable class to put our money functions in and this class would be supported for use by core & external code.
@seamuslee did a first cut here...Our CRM_Utils_Money class wound up a mess so we talked about creating a new supported/tested/readable class to put our money functions in and this class would be supported for use by core & external code.
@seamuslee did a first cut here https://github.com/civicrm/civicrm-core/pull/20296 which highlighted some of the issues / complexity
I made comments there but I've moved them to this gitlab
Useful framing by @jaapjansma
CiviCRM has the following ways of displaying data:
- On the screen in back office (this is the language and locale of the logged in user)
- On the screen in front office screens (such as registering for an event, this should be the sites locale and language)
- In communications with the contact, such as letters and pdf. We should use the language and locale of the contact
Ideally we should also have a setting for the locale and not only the language.
Looking at @jaapjansma's list it seems that at the end of the day we want (these don't have to be all working / added now but I think we might want to comment in the intent into the class)
```
Money()->formatMachine($amount, $currency);
Money()->formatSiteLocale($amount, $currency);
Money()->formatUserLocale($amount, $currency, $contactID); // defaults to logged in user
Money()->formatSpecifiedLocale($amount, $currency, $locale);
```
We also have 2 other variables in the mix - precision & noCurrencySymbol
I tend to prefer to use separate functions for noCurrencySymbol - eg
```
Money()->formatNumericOnlyMachine($amount, $currency);
Money()->formatNumericOnlySiteLocale($amount, $currency);
Money()->formatNumericOnlyUserLocale($amount, $currency, $contactID); // defaults to logged in user
Money()->formatNumericOnlySpecifiedLocale($amount, $currency, $locale);
```
but it could be a consistent parameter in the other functions
On the precision question we have
- fixed precision
- no rounding
- currency specific precision
Perhaps this is a parameter on all the above functions ('fixed', NULL or 'by_currency' ) - I personally prefer documenting that in the comment block than using a constant although some people like constants
This is quickly getting us back into the confusion of CRM_Core_Money which this PR was intended to get us away from but hopefully we can figure out the set of signatures we want this time AND remember what they actually mean!
Also - we probably want functions that returns the actual Money object - not just the output
Note that where we want to be is that the CRM_Utils_Money class can be an internal class and the Civi::Money is an external class - so how we deal with the thousand separator in CRM_Utils_Money can change over timehttps://lab.civicrm.org/dev/core/-/issues/28715.43 will need an upgrade message about the token changes - with a link to th...2023-09-24T22:50:51Zeileen5.43 will need an upgrade message about the token changes - with a link to the docshttps://lab.civicrm.org/dev/core/-/issues/2890Contribution api - get paid, balance2023-09-24T22:50:10ZeileenContribution api - get paid, balance@colemanw just wanted to put this on your radar - being able to get
contribution.paid_amount and
contribution.balance
would be hugely use at the api level , search kit AND the template / token level.
We currently have a php function ...@colemanw just wanted to put this on your radar - being able to get
contribution.paid_amount and
contribution.balance
would be hugely use at the api level , search kit AND the template / token level.
We currently have a php function & what it does to get paid_amount is this...
I suspect there are some challenges in that it would have to be a subquery which would have performance limits but it would have a lot of application
```
$sql = "SELECT SUM(ft.total_amount) FROM civicrm_financial_trxn ft
INNER JOIN civicrm_entity_financial_trxn eft ON (eft.financial_trxn_id = ft.id AND eft.entity_table = 'civicrm_contribution')
WHERE eft.entity_id = %1 AND ft.is_payment = 1 AND ft.status_id IN (%2) ";
return (float) CRM_Core_DAO::singleValueQuery($sql, [
1 => [$contributionID, 'Integer'],
// status IDs are 'completed' & 'refunded'
2 => [implode(',', $statusIDs), 'CommaSeparatedIntegers'],
]);
```