From fd9725b8273415b3a7801c6e219d8005a30a48e0 Mon Sep 17 00:00:00 2001 From: Jimmy Huang Date: Sat, 30 Mar 2024 01:01:17 +0800 Subject: [PATCH] refs #40295, #40266 do not override receipt_date when already has one on complete transaction --- CRM/Core/Payment/BaseIPN.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index c3ef1a84e..c1616b007 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -411,7 +411,15 @@ function completeTransaction(&$input, &$ids, &$objects, &$transaction, $recur = $contribution->source = !empty($contribution->source) ? $contribution->source : $values['title']; if ($values['is_email_receipt'] || $values['is_send_sms']) { - $contribution->receipt_date = self::$_now; + // only override receipt_date when necessary + if (empty($contribution->receipt_date)) { + $contribution->receipt_date = self::$_now; + } + else { + if (is_string($contribution->receipt_date) && strtotime($contribution->receipt_date) <= 10000) { + $contribution->receipt_date = self::$_now; + } + } } if ($membership) { @@ -540,7 +548,15 @@ function completeTransaction(&$input, &$ids, &$objects, &$transaction, $recur = $contribution->source = !empty($contribution->source) ? $contribution->source : ts('Online Event Registration') . ':' . $values['event']['title']; if ($values['event']['is_email_confirm']) { - $contribution->receipt_date = self::$_now; + // only override receipt_date when necessary + if (empty($contribution->receipt_date)) { + $contribution->receipt_date = self::$_now; + } + else { + if (is_string($contribution->receipt_date) && strtotime($contribution->receipt_date) <= 10000) { + $contribution->receipt_date = self::$_now; + } + } } $participant->status_id = 1;