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(
$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)));
$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;