Skip to content
Snippets Groups Projects
Verified Commit 72618f9b authored by Kevin Cristiano's avatar Kevin Cristiano :earth_americas:
Browse files

civicrm release-5.64.3

parent fd6c0826
No related branches found
No related tags found
No related merge requests found
Showing
with 62 additions and 50 deletions
......@@ -2,7 +2,7 @@
/**
* Plugin Name: CiviCRM
* Description: CiviCRM - Growing and Sustaining Relationships
* Version: 5.64.2
* Version: 5.64.3
* Requires at least: 4.9
* Requires PHP: 7.3
* Author: CiviCRM LLC
......@@ -36,7 +36,7 @@ if (!defined('ABSPATH')) {
}
// Set version here: changing it forces Javascript and CSS to reload.
define('CIVICRM_PLUGIN_VERSION', '5.64.2');
define('CIVICRM_PLUGIN_VERSION', '5.64.3');
// Store reference to this file.
if (!defined('CIVICRM_PLUGIN_FILE')) {
......
......@@ -67,6 +67,10 @@ trait CRM_Event_WorkflowMessage_ParticipantTrait {
*/
protected $participantContacts;
private function isCiviContributeEnabled(): bool {
return array_key_exists('Contribution', \Civi::service('action_object_provider')->getEntities());
}
/**
* @param array $participantContacts
*
......@@ -93,7 +97,7 @@ trait CRM_Event_WorkflowMessage_ParticipantTrait {
*/
public function setParticipantID(int $participantID) {
$this->participantID = $participantID;
if (!$this->getContributionID()) {
if (!$this->getContributionID() && $this->isCiviContributeEnabled()) {
$lineItem = LineItem::get(FALSE)
->addWhere('entity_table', '=', 'civicrm_participant')
->addWhere('entity_id', '=', $participantID)
......@@ -103,13 +107,14 @@ trait CRM_Event_WorkflowMessage_ParticipantTrait {
$this->setContributionID($lineItem['contribution_id']);
}
else {
// no ts() since this should be rare
CRM_Core_Session::setStatus('There might be a data problem, contribution id could not be loaded from the line item');
// It might be bad data on the site - let's do a noisy fall back to participant payment
// (the relationship between contribution & participant should be in the line item but
// some integrations might mess this up - if they are not using the order api).
// Note that for free events there won't be a participant payment either hence moving the status message into the if statement.
$participantPayment = civicrm_api3('ParticipantPayment', 'get', ['participant_id' => $participantID])['values'];
if (!empty($participantPayment)) {
// no ts() since this should be rare
CRM_Core_Session::setStatus('There might be a data problem, contribution id could not be loaded from the line item');
$participantPayment = reset($participantPayment);
$this->setContributionID((int) $participantPayment['contribution_id']);
}
......@@ -185,34 +190,36 @@ trait CRM_Event_WorkflowMessage_ParticipantTrait {
}
// Initiate with the current participant to ensure they are first.
$participants = [$this->participantID => ['id' => $this->participantID, 'tax_rate_breakdown' => []]];
foreach ($this->getLineItems() as $lineItem) {
if ($lineItem['entity_table'] === 'civicrm_participant') {
$participantID = $lineItem['entity_id'];
}
else {
// It is not clear if this could ever be true - testing the CiviCRM event
// form shows all line items assigned to participants but we should
// assign to primary if this can occur.
$participantID = $this->getPrimaryParticipantID();
}
$participants[$participantID]['line_items'][] = $lineItem;
if (!isset($participants[$participantID]['totals'])) {
$participants[$participantID]['totals'] = ['total_amount_exclusive' => 0, 'tax_amount' => 0, 'total_amount_inclusive' => 0];
}
$participants[$participantID]['totals']['total_amount_exclusive'] += $lineItem['line_total'];
$participants[$participantID]['totals']['tax_amount'] += $lineItem['tax_amount'];
$participants[$participantID]['totals']['total_amount_inclusive'] += ($lineItem['line_total'] + $lineItem['tax_amount']);
if (!isset($participants[$participantID]['tax_rate_breakdown'])) {
$participants[$participantID]['tax_rate_breakdown'] = [];
}
if (!isset($participants[$participantID]['tax_rate_breakdown'][$lineItem['tax_rate']])) {
$participants[$participantID]['tax_rate_breakdown'][$lineItem['tax_rate']] = [
'amount' => 0,
'rate' => $lineItem['tax_rate'],
'percentage' => sprintf('%.2f', $lineItem['tax_rate']),
];
if ($this->isCiviContributeEnabled()) {
foreach ($this->getLineItems() as $lineItem) {
if ($lineItem['entity_table'] === 'civicrm_participant') {
$participantID = $lineItem['entity_id'];
}
else {
// It is not clear if this could ever be true - testing the CiviCRM event
// form shows all line items assigned to participants but we should
// assign to primary if this can occur.
$participantID = $this->getPrimaryParticipantID();
}
$participants[$participantID]['line_items'][] = $lineItem;
if (!isset($participants[$participantID]['totals'])) {
$participants[$participantID]['totals'] = ['total_amount_exclusive' => 0, 'tax_amount' => 0, 'total_amount_inclusive' => 0];
}
$participants[$participantID]['totals']['total_amount_exclusive'] += $lineItem['line_total'];
$participants[$participantID]['totals']['tax_amount'] += $lineItem['tax_amount'];
$participants[$participantID]['totals']['total_amount_inclusive'] += ($lineItem['line_total'] + $lineItem['tax_amount']);
if (!isset($participants[$participantID]['tax_rate_breakdown'])) {
$participants[$participantID]['tax_rate_breakdown'] = [];
}
if (!isset($participants[$participantID]['tax_rate_breakdown'][$lineItem['tax_rate']])) {
$participants[$participantID]['tax_rate_breakdown'][$lineItem['tax_rate']] = [
'amount' => 0,
'rate' => $lineItem['tax_rate'],
'percentage' => sprintf('%.2f', $lineItem['tax_rate']),
];
}
$participants[$participantID]['tax_rate_breakdown'][$lineItem['tax_rate']]['amount'] += $lineItem['tax_amount'];
}
$participants[$participantID]['tax_rate_breakdown'][$lineItem['tax_rate']]['amount'] += $lineItem['tax_amount'];
}
$count = 1;
......
......@@ -78,7 +78,7 @@ trait EventTestTrait {
}
/**
* Create a paid event.
* Create an unpaid event.
*
* @param array $eventParameters
* Values to
......
......@@ -56,7 +56,12 @@ class TokenCompatSubscriber implements EventSubscriberInterface {
*/
public function onRender(TokenRenderEvent $e): void {
$useSmarty = !empty($e->context['smarty']);
$e->string = $e->getTokenProcessor()->visitTokens($e->string, function() {
$e->string = $e->getTokenProcessor()->visitTokens($e->string, function($token = NULL, $entity = NULL, $field = NULL, $filterParams = NULL) {
if ($filterParams && $filterParams[0] === 'boolean') {
// This token was missed during primary rendering, and it's supposed to be coerced to boolean.
// Treat an unknown token as false-y.
return 0;
}
// For historical consistency, we filter out unrecognized tokens.
return '';
});
......
<?php
/** @deprecated */
function civicrmVersion( ) {
return array( 'version' => '5.64.2',
return array( 'version' => '5.64.3',
'cms' => 'Wordpress',
'revision' => '' );
}
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-09</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>beta</develStage>
<compatibility>
<ver>5.64</ver>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-09</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>beta</develStage>
<compatibility>
<ver>5.64</ver>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-09</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>alpha</develStage>
<compatibility>
<ver>5.64</ver>
......
......@@ -12,7 +12,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-09</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<tags>
<tag>mgmt:hidden</tag>
</tags>
......
......@@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-02-11</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.64</ver>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-04-08</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<tags>
<tag>component</tag>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-04-08</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<tags>
<tag>component</tag>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-04-08</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<tags>
<tag>component</tag>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-04-08</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<tags>
<tag>component</tag>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-04-08</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<tags>
<tag>component</tag>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-04-08</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<tags>
<tag>component</tag>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-04-08</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<tags>
<tag>component</tag>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2023-04-08</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<tags>
<tag>component</tag>
......
......@@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2022-01-02</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>alpha</develStage>
<compatibility>
<ver>5.64</ver>
......
......@@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-11-11</releaseDate>
<version>5.64.2</version>
<version>5.64.3</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.64</ver>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment