From 6d90017bc8a0802fdfb34056aa4565c67e0c3583 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sun, 27 Mar 2022 09:44:05 +0100 Subject: [PATCH] Avoid PHP notices from smarty on pricefield table --- CRM/Price/Page/Field.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CRM/Price/Page/Field.php b/CRM/Price/Page/Field.php index 71cec4233d..72ab8d481a 100644 --- a/CRM/Price/Page/Field.php +++ b/CRM/Price/Page/Field.php @@ -148,11 +148,11 @@ class CRM_Price_Page_Field extends CRM_Core_Page { } } - if ($priceFieldBAO->active_on == '0000-00-00 00:00:00') { + if (!isset($priceField[$priceFieldBAO->id]['active_on']) || $priceFieldBAO->active_on == '0000-00-00 00:00:00') { $priceField[$priceFieldBAO->id]['active_on'] = ''; } - if ($priceFieldBAO->expire_on == '0000-00-00 00:00:00') { + if (!isset($priceField[$priceFieldBAO->id]['expire_on']) || $priceFieldBAO->expire_on == '0000-00-00 00:00:00') { $priceField[$priceFieldBAO->id]['expire_on'] = ''; } @@ -230,8 +230,13 @@ class CRM_Price_Page_Field extends CRM_Core_Page { ); if ($this->_sid) { + $usedByDefaults = [ + 'civicrm_event' => FALSE, + 'civicrm_event' => FALSE, + 'civicrm_contribution_page' => FALSE, + ]; $usedBy = CRM_Price_BAO_PriceSet::getUsedBy($this->_sid); - $this->assign('usedBy', $usedBy); + $this->assign('usedBy', array_merge($usedByDefaults, $usedBy)); $this->_isSetReserved = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'is_reserved'); $this->assign('isReserved', $this->_isSetReserved); -- 2.25.1