CRM-13130, fixed notices and using Avery 5395 as default for layout format
authorkurund <kurund@civicrm.org>
Wed, 31 Jul 2013 19:00:27 +0000 (00:30 +0530)
committerkurund <kurund@civicrm.org>
Wed, 31 Jul 2013 19:00:27 +0000 (00:30 +0530)
----------------------------------------
* CRM-13130: New Label Format entries do not store the 'name' property in values colum, and produce blank name badges
  http://issues.civicrm.org/jira/browse/CRM-13130

CRM/Badge/BAO/Badge.php
CRM/Core/BAO/LabelFormat.php

index 04ef2c42b7e067979178d26b686621ac277aba71..a5479676f53d85006dc7cf3fcbe78bc382ffa6d1 100644 (file)
@@ -128,6 +128,7 @@ class CRM_Badge_BAO_Badge {
   public function generateLabel($formattedRow) {
     switch ($formattedRow['labelFormat']) {
       case 'Avery 5395':
+      default:
         self::labelAvery5395($formattedRow);
         break;
     }
index e3637420ab02f53acc97f1127432ea7e198f87a3..e771be35d86521c21a1903fe1a70c9e26863ad3f 100644 (file)
@@ -511,6 +511,9 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue {
     // serialize label format fields into a single string to store in the 'value' column of the Option Value table
     $v = json_decode($this->value, TRUE);
     foreach (self::$optionValueFields as $name => $field) {
+      if (!isset($v[$name])) {
+        $v[$name] = NULL;
+      }
       $v[$name] = self::getValue($name, $values, $v[$name]);
     }
     $this->value = json_encode($v);