clean and notice fixes CRM-12966
authorKurund Jalmi <kurund@civicrm.org>
Thu, 4 Jul 2013 22:37:58 +0000 (04:07 +0530)
committerKurund Jalmi <kurund@civicrm.org>
Thu, 4 Jul 2013 22:37:58 +0000 (04:07 +0530)
CRM/Badge/BAO/Badge.php
CRM/Event/Form/Task/Badge.php

index 19bf2aa38b44045da447ad0e768de0d39b528051..821813ba268ffad56f39e783ad1ca4a31fd4df11 100644 (file)
@@ -86,10 +86,13 @@ class CRM_Badge_BAO_Badge {
 
     if (CRM_Utils_Array::value('rowElements', $layout['data'])) {
       foreach($layout['data']['rowElements'] as $key => $element) {
-        $value = $row[$element];
-        // hack to fix date field display format
-        if (strpos($element,'_date')) {
-          $value = CRM_Utils_Date::customFormat($value, "%e %b");
+        $value = '';
+        if ($element) {
+          $value = $row[$element];
+          // hack to fix date field display format
+          if (strpos($element, '_date')) {
+            $value = CRM_Utils_Date::customFormat($value, "%e %b");
+          }
         }
 
         $formattedRow['token'][$key] = array(
@@ -131,8 +134,13 @@ class CRM_Badge_BAO_Badge {
     $x = $this->pdf->GetAbsX();
     $y = $this->pdf->GetY();
 
-    $this->printImage($formattedRow['image_1']);
-    //$this->printImage($formattedRow['image_2']);
+    if (CRM_Utils_Array::value('image_1', $formattedRow)) {
+      $this->printImage($formattedRow['image_1']);
+    }
+
+    if (CRM_Utils_Array::value('image_2', $formattedRow)) {
+      //$this->printImage($formattedRow['image_2']);
+    }
 
     $this->pdf->SetLineStyle(array('width' => 0.1, 'cap' => 'round', 'join' => 'round',
       'dash' => '2,2', 'color' => array(0, 0, 200)));
index 403c80f3310fc0a8cda4c96197b5adcf52e3df7f..bc748ca228397709ef5c4b96fc4400efb555bd0b 100644 (file)
@@ -118,20 +118,23 @@ class CRM_Event_Form_Task_Badge extends CRM_Event_Form_Task {
     $returnProperties = array();
     if (!empty($layoutInfo['data']['token'])) {
       foreach ($layoutInfo['data']['token'] as $index => $value) {
-        $token = CRM_Utils_Token::getTokens($value);
-        if (key($token) == 'contact') {
-          $element = $token['contact'][0];
-        }
-        else {
-          $element = $token['event'][0];
-          //FIX ME - we need to standardize event token names
-          if (!strpos($element, 'event_')) {
-            $element = 'event_' .$element;
+        $element = '';
+        if ($value) {
+          $token = CRM_Utils_Token::getTokens($value);
+          if (key($token) == 'contact') {
+            $element = $token['contact'][0];
+          }
+          else {
+            $element = $token['event'][0];
+            //FIX ME - we need to standardize event token names
+            if (!strpos($element, 'event_')) {
+              $element = 'event_' . $element;
+            }
           }
-        }
 
-        // build returnproperties for query
-        $returnProperties[$element] = 1;
+          // build returnproperties for query
+          $returnProperties[$element] = 1;
+        }
 
         // add actual field name to row element
         $layoutInfo['data']['rowElements'][$index] = $element;