From: Kurund Jalmi Date: Fri, 12 Jul 2013 14:08:17 +0000 (+0530) Subject: patched Pratik's work on barcode position fixes, CRM-12967 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8afbd311438d87c9890ff643bac7b818d7a8ce7e;p=civicrm-core.git patched Pratik's work on barcode position fixes, CRM-12967 --- diff --git a/CRM/Badge/BAO/Badge.php b/CRM/Badge/BAO/Badge.php index 49f6922803..bb89d4abf0 100644 --- a/CRM/Badge/BAO/Badge.php +++ b/CRM/Badge/BAO/Badge.php @@ -180,8 +180,8 @@ class CRM_Badge_BAO_Badge { if (CRM_Utils_Array::value('barcode', $formattedRow)) { $style = array( - 'position' => $formattedRow['barcode'], - 'align' => $formattedRow['barcode'], + 'position' => '', + 'align' => '', 'stretch' => FALSE, 'fitwidth' => TRUE, 'cellfitalign' => '', @@ -196,13 +196,25 @@ class CRM_Badge_BAO_Badge { 'stretchtext' => 0, ); + // barcode position + $xAlign = $x; + if ($formattedRow['barcode'] == 'L') { + $xAlign += -12; + } + elseif ($formattedRow['barcode'] == 'R') { + $xAlign += 30; + } + elseif ($formattedRow['barcode'] == 'C') { + $xAlign += 15; + } + $data = $formattedRow['values']; $data['current_value'] = $formattedRow['values']['contact_id'] . '-' . $formattedRow['values']['participant_id']; // call hook alterBarcode CRM_Utils_Hook::alterBarcode($data); - $this->pdf->write1DBarcode($data['current_value'], 'C128', $x, $y + $this->pdf->height - 10, '', + $this->pdf->write1DBarcode($data['current_value'], 'C128', $xAlign, $y + $this->pdf->height - 10, '', 12, 0.4, $style, 'B'); } }