From 4f1ddb2539f3a3b188ea39b0c7c2222e64c9ad15 Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Sat, 29 Jun 2013 15:34:26 +0530 Subject: [PATCH] label configuration form fixes, CRM-12965 --- CRM/Admin/Form/LabelFormats.php | 4 ++-- CRM/Core/BAO/LabelFormat.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CRM/Admin/Form/LabelFormats.php b/CRM/Admin/Form/LabelFormats.php index 0c668f351f..f5152af074 100644 --- a/CRM/Admin/Form/LabelFormats.php +++ b/CRM/Admin/Form/LabelFormats.php @@ -176,7 +176,7 @@ class CRM_Admin_Form_LabelFormats extends CRM_Admin_Form { if ($this->_action & CRM_Core_Action::COPY) { // make a copy of the Label Format $labelFormat = CRM_Core_BAO_LabelFormat::getById($this->_id, $this->_group); - $list = CRM_Core_BAO_LabelFormat::getList(TRUE); + $list = CRM_Core_BAO_LabelFormat::getList(TRUE, $this->_group); $count = 1; $prefix = ts('Copy of '); while (in_array($prefix . $labelFormat['label'], $list)) { @@ -188,7 +188,7 @@ class CRM_Admin_Form_LabelFormats extends CRM_Admin_Form { $labelFormat['is_reserved'] = 0; $bao = new CRM_Core_BAO_LabelFormat(); - $bao->saveLabelFormat($values, NULL, $this->_group); + $bao->saveLabelFormat($labelFormat, NULL, $this->_group); CRM_Core_Session::setStatus($labelFormat['label'] . ts(' has been created.'), ts('Saved'), 'success'); return; } diff --git a/CRM/Core/BAO/LabelFormat.php b/CRM/Core/BAO/LabelFormat.php index c6e1a2fe3e..c1d62ab64d 100644 --- a/CRM/Core/BAO/LabelFormat.php +++ b/CRM/Core/BAO/LabelFormat.php @@ -263,31 +263,31 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { * Retrieve list of Label Formats. * * @param bool $namesOnly return simple list of names - * @param string $name name of the option group + * @param string $groupName group name of the label format option group * * @return array (reference) label format list * @static * @access public */ - static function &getList($namesOnly = FALSE, $name='label_format') { + static function &getList($namesOnly = FALSE, $groupName='label_format') { static $list = array(); - if (self::_getGid($name)) { + if (self::_getGid($groupName)) { // get saved label formats from Option Value table $dao = new CRM_Core_DAO_OptionValue(); - $dao->option_group_id = self::_getGid($name); + $dao->option_group_id = self::_getGid($groupName); $dao->is_active = 1; $dao->orderBy('weight'); $dao->find(); while ($dao->fetch()) { if ($namesOnly) { - $list[$name][$dao->name] = $dao->label; + $list[$groupName][$dao->name] = $dao->label; } else { - CRM_Core_DAO::storeValues($dao, $list[$name][$dao->id]); + CRM_Core_DAO::storeValues($dao, $list[$groupName][$dao->id]); } } } - return $list[$name]; + return $list[$groupName]; } /** @@ -433,7 +433,7 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { * @return void * @access public */ - function customGroupName() { + public static function customGroupName() { return ts('Custom'); } -- 2.25.1