Skip to content

Commit

Permalink
Merge pull request #28013 from agileware/CIVICRM-2188
Browse files Browse the repository at this point in the history
Pass year to mktime as int in CRM_Contribution_Form_ContributionCharts
  • Loading branch information
seamuslee001 authored Nov 13, 2023
2 parents 2e8aeca + 84eb342 commit 99553cb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions CRM/Contribute/Form/ContributionCharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,15 @@ public function postProcess() {
$urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
}
elseif ($chartKey == 'by_year') {
$year = substr($index, 0, 4);
$year = is_numeric($year) ? (int) $year : date('Y');
if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] != 1 || $config->fiscalYearStart['d'] != 1)) {
$startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], substr($index, 0, 4)));
$endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index, 0, 4)) + 1));
$startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], $year));
$endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], $year + 1));
}
else {
$startDate = CRM_Utils_Date::format(['Y' => substr($index, 0, 4)]);
$endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index, 0, 4)));
$startDate = CRM_Utils_Date::format(['Y' => $year]);
$endDate = date('Ymd', mktime(0, 0, 0, 13, 0, $year));
}
$urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
}
Expand Down

0 comments on commit 99553cb

Please sign in to comment.