From: Kurund Jalmi Date: Sun, 7 Jul 2013 14:21:11 +0000 (+0530) Subject: added barcode support, CRM-12966 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7fd8017a064cd5afc6468492ab70d7fb06122006;p=civicrm-core.git added barcode support, CRM-12966 --- diff --git a/CRM/Badge/BAO/Badge.php b/CRM/Badge/BAO/Badge.php index 129edb39ca..fa22b24ccd 100644 --- a/CRM/Badge/BAO/Badge.php +++ b/CRM/Badge/BAO/Badge.php @@ -116,6 +116,9 @@ class CRM_Badge_BAO_Badge { $formattedRow['barcode'] = $layout['data']['barcode_alignment']; } + // finally assign all the row values, so that we can use it for barcode etc + $formattedRow['values'] = $row; + return $formattedRow; } @@ -161,6 +164,29 @@ class CRM_Badge_BAO_Badge { $this->pdf->SetXY($x, $y + $this->pdf->height - 5); $this->pdf->Cell($this->pdf->width, 0, $formattedRow['token'][4]['value'], $this->border, 2, $formattedRow['token'][4]['text_alignment']); + + if (CRM_Utils_Array::value('barcode', $formattedRow)) { + $style = array( + 'position' => $formattedRow['barcode'], + 'align' => $formattedRow['barcode'], + 'stretch' => FALSE, + 'fitwidth' => TRUE, + 'cellfitalign' => '', + 'border' => FALSE, + 'hpadding' => 'auto', + 'vpadding' => 'auto', + 'fgcolor' => array(0, 0, 0), + 'bgcolor' => FALSE, + 'text' => FALSE, + 'font' => 'helvetica', + 'fontsize' => 8, + 'stretchtext' => 0, + ); + + $payload = $formattedRow['values']['contact_id'] . '-' . $formattedRow['values']['participant_id']; + $this->pdf->SetXY($x, $y + $this->pdf->height - 5); + $this->pdf->write1DBarcode($payload, "C128A", $x, $this->pdf->getY() - 6, 50, 10, 0.4, $style, 'B'); + } } /** diff --git a/CRM/Event/Form/Task/Badge.php b/CRM/Event/Form/Task/Badge.php index bc748ca228..c4a5d1839a 100644 --- a/CRM/Event/Form/Task/Badge.php +++ b/CRM/Event/Form/Task/Badge.php @@ -142,7 +142,7 @@ class CRM_Event_Form_Task_Badge extends CRM_Event_Form_Task { } // add additional required fields for query execution - $additionalFields = array('participant_register_date', 'participant_id'); + $additionalFields = array('participant_register_date', 'participant_id', 'event_id', 'contact_id'); foreach ($additionalFields as $field) { $returnProperties[$field] = 1; }