It is a bug in the Magento_Reward
Magento 2 Enterprise module.
The problem method is \Magento\Reward\Model\ResourceModel\Reward\History\Collection::loadExpiredSoonPoints()
:
/**
* Return total amounts of points that will be expired soon (pre-configured days value) for specified website
* Result is grouped by customer
*
* @param int $websiteId Specified Website
* @param bool $subscribedOnly Whether to load expired soon points only for subscribed customers
* @return $this
*/
public function loadExpiredSoonPoints($websiteId, $subscribedOnly = true)
{
$expiryConfig = $this->_getExpiryConfig($websiteId);
if (!$expiryConfig) {
return $this;
}
$inDays = (int)$expiryConfig->getExpiryDayBefore();
// Empty Value disables notification
if (!$inDays) {
return $this;
}
// join info about current balance and filter records by website
$this->_joinReward();
$this->addWebsiteFilter($websiteId);
$field = $expiryConfig->getExpiryCalculation() == 'static' ? 'expired_at_static' : 'expired_at_dynamic';
$expireAtLimit = (new \DateTime(null, new \DateTimeZone('UTC')))
->add(new \DateInterval('P', $inDays . 'D'))
->format('Y-m-d H:i:s');
$this->getSelect()->columns(
['total_expired' => new \Zend_Db_Expr('SUM(points_delta-points_used)')]
)->where(
'points_delta-points_used > 0'
)->where(
'is_expired=0'
)->where(
"{$field} IS NOT NULL" // expire_at - BEFORE_DAYS < NOW
)->where(
// eq. expire_at - BEFORE_DAYS < NOW
"{$field} < ?",
$expireAtLimit
)->group(
['reward_table.customer_id', 'main_table.store_id']
);
if ($subscribedOnly) {
$this->addCustomerInfo();
$this->getSelect()->where('warning_notification.value=1');
}
$this->setFlag('expired_soon_points_loaded', true);
return $this;
}
Look at the block:
$expireAtLimit = (new \DateTime(null, new \DateTimeZone('UTC')))
->add(new \DateInterval('P', $inDays . 'D'))
->format('Y-m-d H:i:s');
It tries to create a DateInterval
with 2 parameters.
Magento 2 Enterprise developers should learn PHP: the DateInterval::__construct()
method accepts only 1 paramerer.
So to fix the issue you should contact the Magento 2 Enterprise support.