label configuration form fixes, CRM-12965
authorKurund Jalmi <kurund@civicrm.org>
Sat, 29 Jun 2013 10:04:26 +0000 (15:34 +0530)
committerKurund Jalmi <kurund@civicrm.org>
Sat, 29 Jun 2013 10:04:26 +0000 (15:34 +0530)
CRM/Admin/Form/LabelFormats.php
CRM/Core/BAO/LabelFormat.php

index 0c668f351f2c80e90e97ada5c2fa27f82aad3751..f5152af07470fc6a9e28f3ab53bd64d69eba79f6 100644 (file)
@@ -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;
     }
index c6e1a2fe3ecb87f5857ee7977feb267f35fd4ffb..c1d62ab64d5eedcf4bf871e95e296b3059baac1f 100644 (file)
@@ -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');
   }