From a8e4ceb4c7b8ad7f7f5d79e8990114994f0100aa Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Thu, 17 Sep 2015 17:27:34 -0700 Subject: [PATCH] CRM-15378 - Add max participants and count to price option browse page. ---------------------------------------- * CRM-15378: Include Max Participants and Participant Count columns when viewing price field options https://issues.civicrm.org/jira/browse/CRM-15378 --- CRM/Price/Page/Option.php | 11 +++++++++++ templates/CRM/Price/Page/Option.tpl | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index 7d47ac79a2..5113766055 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -123,6 +123,16 @@ class CRM_Price_Page_Option extends CRM_Core_Page { public function browse() { $customOption = array(); CRM_Price_BAO_PriceFieldValue::getValues($this->_fid, $customOption); + + // CRM-15378 - check if these price options are in an Event price set + $isEvent = FALSE; + $extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'extends', 'id'); + $allComponents = explode(CRM_Core_DAO::VALUE_SEPARATOR, $extendComponentId); + $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent'); + if (in_array($eventComponentId, $allComponents)) { + $isEvent = TRUE; + } + $config = CRM_Core_Config::singleton(); $financialType = CRM_Contribute_PseudoConstant::financialType(); $taxRate = CRM_Core_PseudoConstant::getTaxRates(); @@ -188,6 +198,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $this->assign('getTaxDetails', $getTaxDetails); $this->assign('customOption', $customOption); $this->assign('sid', $this->_sid); + $this->assign('isEvent', $isEvent); } /** diff --git a/templates/CRM/Price/Page/Option.tpl b/templates/CRM/Price/Page/Option.tpl index 4402ffb26e..cd257f921c 100644 --- a/templates/CRM/Price/Page/Option.tpl +++ b/templates/CRM/Price/Page/Option.tpl @@ -54,6 +54,10 @@ {ts}Option Label{/ts} {ts}Option Amount{/ts} + {if $isEvent} + {ts}Participant Count{/ts} + {ts}Maximum{/ts} + {/if} {ts}Default{/ts} {ts}Financial Type{/ts} {ts}Order{/ts} @@ -70,6 +74,10 @@ {$row.label} {$row.amount|crmMoney} + {if $isEvent} + {$row.count} + {$row.max_value} + {/if} {if $row.is_default}{ts}Default{/ts}{/if} {$row.financial_type_id} {$row.weight} -- 2.25.1