FireGento_Pdf - Version 1.3.0

Version Notes

- [FEATURE] support for downloading invoice/creditmemo/shipping PDFs from the customer account page
- [FEATURE] support for downloadable items
- [FEATURE] added Swiss locale
- [FEATURE] possibility to upload custom fonts
- [FEATURE] possibility to swap position of customer address and invoice details
- [FEATURE] possibility to define custom filename patterns for invoice, creditmemo and shipping PDFs
- [FEATURE] added event `firegento_pdf_imprint_load_after` to change certain imprint data
- [FEATURE] possibility to resize the logo
- [FEATURE] added more fields to imprint which are provided by [MageSetup](https://github.com/firegento/firegento-magesetup)
- [BUGFIX] fixed tax display which was wrong in certain cases
- [BUGFIX] fixed custom column order when used with bundle products
- [BUGFIX] fixed number format of tax rates (with bad black magic, improvements are welcome!) (#101)
- [MISC] improved wording in system.xml
- [MISC] changed mage-hackathon-installer from required to suggestion, because there are more installers out there
- [MISC] updated autogenerated documentation
- [MISC] corrected code style
- [MISC] implemented a few first unit tests
- [MISC] add recommendation for Mage_LocaleFallback in readme

Download this release

Release Info

Developer FireGento Team
Extension FireGento_Pdf
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.0 to 1.3.0

Files changed (28) hide show
  1. app/code/community/FireGento/Pdf/Helper/Data.php +144 -10
  2. app/code/community/FireGento/Pdf/Model/Creditmemo.php +1 -1
  3. app/code/community/FireGento/Pdf/Model/Engine/Abstract.php +464 -139
  4. app/code/community/FireGento/Pdf/Model/Engine/Creditmemo/Default.php +6 -3
  5. app/code/community/FireGento/Pdf/Model/Engine/Invoice/Default.php +7 -4
  6. app/code/community/FireGento/Pdf/Model/Engine/Shipment/Default.php +19 -12
  7. app/code/community/FireGento/Pdf/Model/Invoice.php +1 -1
  8. app/code/community/FireGento/Pdf/Model/Items/Bundle.php +62 -22
  9. app/code/community/FireGento/Pdf/Model/Items/Default.php +3 -3
  10. app/code/community/FireGento/Pdf/Model/Items/Downloadable.php +215 -0
  11. app/code/community/FireGento/Pdf/Model/Observer.php +4 -4
  12. app/code/community/FireGento/Pdf/Model/Shipment.php +1 -1
  13. app/code/community/FireGento/Pdf/Model/System/Config/Backend/Font.php +47 -0
  14. app/code/community/FireGento/Pdf/Model/System/Config/Source/Headerblocks.php +59 -0
  15. app/code/community/FireGento/Pdf/Model/Tax/Sales/Pdf/Grandtotal.php +10 -5
  16. app/code/community/FireGento/Pdf/Test/Model/CreditmemoTest.php +22 -0
  17. app/code/community/FireGento/Pdf/Test/Model/InvoiceTest.php +22 -0
  18. app/code/community/FireGento/Pdf/Test/Model/SalesObjectTestAbstract.php +112 -0
  19. app/code/community/FireGento/Pdf/Test/Model/ShipmentTest.php +22 -0
  20. app/code/community/FireGento/Pdf/controllers/Adminhtml/Sales/Order/CreditmemoController.php +58 -0
  21. app/code/community/FireGento/Pdf/controllers/Adminhtml/Sales/Order/InvoiceController.php +58 -0
  22. app/code/community/FireGento/Pdf/controllers/Adminhtml/Sales/Order/ShipmentController.php +59 -0
  23. app/code/community/FireGento/Pdf/controllers/Sales/OrderController.php +68 -13
  24. app/code/community/FireGento/Pdf/etc/config.xml +28 -4
  25. app/code/community/FireGento/Pdf/etc/system.xml +121 -4
  26. app/locale/de_AT/FireGento_Pdf.csv +1 -1
  27. app/locale/de_DE/FireGento_Pdf.csv +21 -15
  28. package.xml +23 -16
app/code/community/FireGento/Pdf/Helper/Data.php CHANGED
@@ -20,6 +20,7 @@
20
  * @version $Id:$
21
  * @since 0.1.0
22
  */
 
23
  /**
24
  * Dummy data helper for translation issues.
25
  *
@@ -37,6 +38,15 @@ class FireGento_Pdf_Helper_Data extends Mage_Core_Helper_Abstract
37
  const XML_PATH_SALES_PDF_INVOICE_SHOW_CUSTOMER_NUMBER = 'sales_pdf/invoice/show_customer_number';
38
  const XML_PATH_SALES_PDF_SHIPMENT_SHOW_CUSTOMER_NUMBER = 'sales_pdf/shipment/show_customer_number';
39
  const XML_PATH_SALES_PDF_CREDITMEMO_SHOW_CUSTOMER_NUMBER = 'sales_pdf/creditmemo/show_customer_number';
 
 
 
 
 
 
 
 
 
40
 
41
  /**
42
  * Return the order id or false if order id should not be displayed on document.
@@ -83,31 +93,47 @@ class FireGento_Pdf_Helper_Data extends Mage_Core_Helper_Abstract
83
  }
84
 
85
  /**
86
- * @param mixed $store
87
  *
88
- * @return bool
 
 
89
  */
90
  public function isLogoFullWidth($store)
91
  {
92
- $configSetting = Mage::getStoreConfig(self::XML_PATH_FIREGENTO_PDF_LOGO_POSITION, $store);
93
- return $configSetting == FireGento_Pdf_Model_System_Config_Source_Logo::FULL_WIDTH;
 
 
 
94
  }
95
 
96
  /**
97
- * @param string $mode
98
- * @param mixed $store
 
 
99
  *
100
- * @return bool
101
  */
102
  public function showCustomerNumber($mode = 'invoice', $store)
103
  {
104
  switch ($mode) {
105
  case 'invoice':
106
- return Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_SHOW_CUSTOMER_NUMBER, $store);
 
 
 
107
  case 'shipment':
108
- return Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_SHIPMENT_SHOW_CUSTOMER_NUMBER, $store);
 
 
 
109
  case 'creditmemo':
110
- return Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_CREDITMEMO_SHOW_CUSTOMER_NUMBER, $store);
 
 
 
111
  }
112
  return true; // backwards compatibility
113
  }
@@ -144,4 +170,112 @@ class FireGento_Pdf_Helper_Data extends Mage_Core_Helper_Abstract
144
 
145
  return array($width, $height);
146
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
20
  * @version $Id:$
21
  * @since 0.1.0
22
  */
23
+
24
  /**
25
  * Dummy data helper for translation issues.
26
  *
38
  const XML_PATH_SALES_PDF_INVOICE_SHOW_CUSTOMER_NUMBER = 'sales_pdf/invoice/show_customer_number';
39
  const XML_PATH_SALES_PDF_SHIPMENT_SHOW_CUSTOMER_NUMBER = 'sales_pdf/shipment/show_customer_number';
40
  const XML_PATH_SALES_PDF_CREDITMEMO_SHOW_CUSTOMER_NUMBER = 'sales_pdf/creditmemo/show_customer_number';
41
+ const XML_PATH_SALES_PDF_INVOICE_FILENAME_EXPORT_PATTERN = 'sales_pdf/invoice/filename_export_pattern';
42
+ const XML_PATH_SALES_PDF_SHIPMENT_FILENAME_EXPORT_PATTERN = 'sales_pdf/shipment/filename_export_pattern';
43
+ const XML_PATH_SALES_PDF_CREDITMEMO_FILENAME_EXPORT_PATTERN = 'sales_pdf/creditmemo/filename_export_pattern';
44
+
45
+ const XML_PATH_REGULAR_FONT = 'sales_pdf/firegento_pdf_fonts/regular_font';
46
+ const XML_PATH_BOLD_FONT = 'sales_pdf/firegento_pdf_fonts/bold_font';
47
+ const XML_PATH_ITALIC_FONT = 'sales_pdf/firegento_pdf_fonts/italic_font';
48
+
49
+ const FONT_PATH_IN_MEDIA = '/firegento_pdf/fonts';
50
 
51
  /**
52
  * Return the order id or false if order id should not be displayed on document.
93
  }
94
 
95
  /**
96
+ * Whether the logo should be shown in full width.
97
  *
98
+ * @param mixed $store store to get information from
99
+ *
100
+ * @return bool whether the logo should be shown in full width
101
  */
102
  public function isLogoFullWidth($store)
103
  {
104
+ $configSetting = Mage::getStoreConfig(
105
+ self::XML_PATH_FIREGENTO_PDF_LOGO_POSITION, $store
106
+ );
107
+ $fullWidth = FireGento_Pdf_Model_System_Config_Source_Logo::FULL_WIDTH;
108
+ return $configSetting == $fullWidth;
109
  }
110
 
111
  /**
112
+ * Whether the customer number should be shown.
113
+ *
114
+ * @param string $mode the mode of this document like invoice, shipment or creditmemo
115
+ * @param mixed $store store to get information from
116
  *
117
+ * @return bool whether the customer number should be shown
118
  */
119
  public function showCustomerNumber($mode = 'invoice', $store)
120
  {
121
  switch ($mode) {
122
  case 'invoice':
123
+ return Mage::getStoreConfigFlag(
124
+ self::XML_PATH_SALES_PDF_INVOICE_SHOW_CUSTOMER_NUMBER,
125
+ $store
126
+ );
127
  case 'shipment':
128
+ return Mage::getStoreConfigFlag(
129
+ self::XML_PATH_SALES_PDF_SHIPMENT_SHOW_CUSTOMER_NUMBER,
130
+ $store
131
+ );
132
  case 'creditmemo':
133
+ return Mage::getStoreConfigFlag(
134
+ self::XML_PATH_SALES_PDF_CREDITMEMO_SHOW_CUSTOMER_NUMBER,
135
+ $store
136
+ );
137
  }
138
  return true; // backwards compatibility
139
  }
170
 
171
  return array($width, $height);
172
  }
173
+
174
+ /**
175
+ * Return export pattern config value
176
+ *
177
+ * @param string $type the type of this document like invoice, shipment or creditmemo
178
+ *
179
+ * @return string
180
+ */
181
+ public function getExportPattern($type)
182
+ {
183
+ switch ($type) {
184
+ case 'invoice':
185
+ return Mage::getStoreConfig(
186
+ self::XML_PATH_SALES_PDF_INVOICE_FILENAME_EXPORT_PATTERN
187
+ );
188
+ case 'shipment':
189
+ return Mage::getStoreConfig(
190
+ self::XML_PATH_SALES_PDF_SHIPMENT_FILENAME_EXPORT_PATTERN
191
+ );
192
+ case 'creditmemo':
193
+ return Mage::getStoreConfig(
194
+ self::XML_PATH_SALES_PDF_CREDITMEMO_FILENAME_EXPORT_PATTERN
195
+ );
196
+ }
197
+ return true;
198
+ }
199
+
200
+ /**
201
+ * Gets the variables which can be used as a placeholder in the filename.
202
+ *
203
+ * @param Mage_Core_Model_Abstract $model the model instance
204
+ *
205
+ * @return array with the variables which can be use as placeholders in the filename
206
+ */
207
+ public function getModelVars($model)
208
+ {
209
+ if (!$model instanceof Mage_Sales_Model_Order) {
210
+ switch ($model) {
211
+ case $model instanceof Mage_Sales_Model_Order_Invoice:
212
+ $specificVars = array(
213
+ '{{invoice_id}}' => $model->getIncrementId()
214
+ );
215
+ break;
216
+ case $model instanceof Mage_Sales_Model_Order_Shipment:
217
+ $specificVars = array(
218
+ '{{shipment_id}}' => $model->getIncrementId()
219
+ );
220
+ break;
221
+ case $model instanceof Mage_Sales_Model_Order_Creditmemo:
222
+ $specificVars = array(
223
+ '{{creditmemo_id}}' => $model->getIncrementId()
224
+ );
225
+ }
226
+ $order = $model->getOrder();
227
+ $commonVars = array(
228
+ '{{order_id}}' => $order->getIncrementId(),
229
+ '{{customer_id}}' => $order->getCustomerId(),
230
+ '{{customer_name}}' => $order->getCustomerName(),
231
+ '{{customer_firstname}}' => $order->getCustomerFirstname(),
232
+ '{{customer_lastname}}' => $order->getCustomerLastname()
233
+ );
234
+ return array_merge($specificVars, $commonVars);
235
+ } else {
236
+ return array(
237
+ '{{order_id}}' => $model->getIncrementId(),
238
+ '{{customer_id}}' => $model->getCustomerId(),
239
+ '{{customer_name}}' => $model->getCustomerName(),
240
+ '{{customer_firstname}}' => $model->getCustomerFirstname(),
241
+ '{{customer_lastname}}' => $model->getCustomerLastname()
242
+ );
243
+ }
244
+ }
245
+
246
+ /**
247
+ * The filename of the exported file.
248
+ *
249
+ * @param string $type the type of this document like invoice, shipment or creditmemo
250
+ * @param Mage_Core_Model_Abstract $model the model instance
251
+ *
252
+ * @return string the filename of the exported file
253
+ */
254
+ public function getExportFilename($type, $model)
255
+ {
256
+ $type = (!$type) ? 'invoice' : $type;
257
+ $pattern = $this->getExportPattern($type);
258
+ if (!$pattern) {
259
+ $date = Mage::getSingleton('core/date');
260
+ $pattern = $type . $date->date('Y-m-d_H-i-s');
261
+ }
262
+ if (substr($pattern, -4) != '.pdf') {
263
+ $pattern = $pattern . '.pdf';
264
+ }
265
+
266
+ $path = strftime($pattern, strtotime($model->getCreatedAt()));
267
+ $vars = $this->getModelVars($model);
268
+
269
+ return strtr($path, $vars);
270
+ }
271
+
272
+ /**
273
+ * Returns the path where the fonts reside.
274
+ *
275
+ * @return string the path where the fonts reside
276
+ */
277
+ public function getFontPath()
278
+ {
279
+ return Mage::getBaseDir('media') . self::FONT_PATH_IN_MEDIA;
280
+ }
281
  }
app/code/community/FireGento/Pdf/Model/Creditmemo.php CHANGED
@@ -65,7 +65,7 @@ class FireGento_Pdf_Model_Creditmemo
65
  /**
66
  * get pdf object
67
  *
68
- * @param array $creditmemos creditmemos to render
69
  *
70
  * @return Zend_Pdf
71
  */
65
  /**
66
  * get pdf object
67
  *
68
+ * @param array|Varien_Data_Collection $creditmemos creditmemos to render
69
  *
70
  * @return Zend_Pdf
71
  */
app/code/community/FireGento/Pdf/Model/Engine/Abstract.php CHANGED
@@ -20,6 +20,7 @@
20
  * @version $Id:$
21
  * @since 0.1.0
22
  */
 
23
  /**
24
  * Abstract pdf model.
25
  *
@@ -31,7 +32,8 @@
31
  * @version $Id:$
32
  * @since 0.1.0
33
  */
34
- abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Order_Pdf_Abstract
 
35
  {
36
  public $margin = array('left' => 45, 'right' => 540);
37
  public $colors = array();
@@ -71,11 +73,15 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
71
  *
72
  * @return Zend_Pdf_Page
73
  */
74
- public function drawLineBlocks(Zend_Pdf_Page $page, array $draw, array $pageSettings = array())
75
- {
 
 
 
76
  foreach ($draw as $itemsProp) {
77
  if (!isset($itemsProp['lines']) || !is_array($itemsProp['lines'])) {
78
- Mage::throwException(Mage::helper('sales')->__('Invalid draw line data. Please define "lines" array'));
 
79
  }
80
  $lines = $itemsProp['lines'];
81
  $height = isset($itemsProp['height']) ? $itemsProp['height'] : 10;
@@ -85,14 +91,12 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
85
  foreach ($lines as $line) {
86
  $maxHeight = 0;
87
  foreach ($line as $column) {
88
- $lineSpacing = !empty($column['height']) ? $column['height'] : $height;
 
89
  if (!is_array($column['text'])) {
90
  $column['text'] = array($column['text']);
91
  }
92
- $top = 0;
93
- foreach ($column['text'] as $part) {
94
- $top += $lineSpacing; // TODO what about count($column['text']) * $lineSpacing
95
- }
96
 
97
  $maxHeight = $top > $maxHeight ? $top : $maxHeight;
98
  }
@@ -102,7 +106,8 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
102
  }
103
 
104
  if ($this->y - $itemsProp['shift'] < 50
105
- || (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1
 
106
  && $this->y - $itemsProp['shift'] < 100)
107
  ) {
108
  $page = $this->newPage($pageSettings);
@@ -111,12 +116,15 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
111
  foreach ($lines as $line) {
112
  $maxHeight = 0;
113
  foreach ($line as $column) {
114
- $fontSize = empty($column['font_size']) ? 7 : $column['font_size'];
 
115
  if (!empty($column['font_file'])) {
116
- $font = Zend_Pdf_Font::fontWithPath($column['font_file']);
 
117
  $page->setFont($font, $fontSize);
118
  } else {
119
- $fontStyle = empty($column['font']) ? 'regular' : $column['font'];
 
120
  switch ($fontStyle) {
121
  case 'bold':
122
  $font = $this->_setFontBold($page, $fontSize);
@@ -125,7 +133,8 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
125
  $font = $this->_setFontItalic($page, $fontSize);
126
  break;
127
  default:
128
- $font = $this->_setFontRegular($page, $fontSize);
 
129
  break;
130
  }
131
  }
@@ -134,23 +143,29 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
134
  $column['text'] = array($column['text']);
135
  }
136
 
137
- $lineSpacing = !empty($column['height']) ? $column['height'] : $height;
 
138
  $top = 0;
139
  foreach ($column['text'] as $part) {
140
  $feed = $column['feed'];
141
- $textAlign = empty($column['align']) ? 'left' : $column['align'];
 
142
  $width = empty($column['width']) ? 0 : $column['width'];
143
  switch ($textAlign) {
144
  case 'right':
145
  if ($width) {
146
- $feed = $this->getAlignRight($part, $feed, $width, $font, $fontSize);
 
147
  } else {
148
- $feed = $feed - $this->widthForStringUsingFontSize($part, $font, $fontSize);
 
 
149
  }
150
  break;
151
  case 'center':
152
  if ($width) {
153
- $feed = $this->getAlignCenter($part, $feed, $width, $font, $fontSize);
 
154
  }
155
  break;
156
  }
@@ -205,16 +220,19 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
205
  /**
206
  * Insert sender address bar
207
  *
208
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
209
  *
210
  * @return void
211
  */
212
  protected function _insertSenderAddessBar(&$page)
213
  {
214
- if (Mage::getStoreConfig('sales_pdf/firegento_pdf/sender_address_bar') != '') {
 
 
215
  $this->_setFontRegular($page, 6);
216
  $page->drawText(
217
- trim(Mage::getStoreConfig('sales_pdf/firegento_pdf/sender_address_bar')), $this->margin['left'],
 
218
  $this->y, $this->encoding
219
  );
220
  }
@@ -223,7 +241,7 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
223
  /**
224
  * Insert logo
225
  *
226
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
227
  * @param mixed $store store to get data from
228
  *
229
  * @return void
@@ -238,7 +256,9 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
238
  }
239
 
240
  /**
241
- * @param mixed $store
 
 
242
  *
243
  * @return bool
244
  */
@@ -250,32 +270,45 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
250
  /**
251
  * Inserts the logo if it is positioned left, center or right.
252
  *
253
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
254
  * @param mixed $store store to get data from
255
  *
256
  * @return void
257
  */
258
  protected function _insertLogoPositioned(&$page, $store = null)
259
  {
260
- $maxwidth = ($this->margin['right'] - $this->margin['left']);
 
 
 
 
 
 
 
261
  $maxheight = 100;
262
 
263
  $image = Mage::getStoreConfig('sales/identity/logo', $store);
264
- if ($image and file_exists(Mage::getBaseDir('media', $store) . '/sales/store/logo/' . $image)) {
265
- $image = Mage::getBaseDir('media', $store) . '/sales/store/logo/' . $image;
 
 
 
266
 
267
- list ($width, $height) = Mage::helper('firegento_pdf')->getScaledImageSize($image, $maxwidth, $maxheight);
 
268
 
269
  if (is_file($image)) {
270
  $image = Zend_Pdf_Image::imageWithPath($image);
271
 
272
- $logoPosition = Mage::getStoreConfig('sales_pdf/firegento_pdf/logo_position', $store);
 
 
273
 
274
  switch ($logoPosition) {
275
  case 'center':
276
  $startLogoAt
277
- =
278
- $this->margin['left'] + (($this->margin['right'] - $this->margin['left']) / 2) - $width / 2;
279
  break;
280
  case 'right':
281
  $startLogoAt = $this->margin['right'] - $width;
@@ -289,7 +322,8 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
289
  $position['x2'] = $position['x1'] + $width;
290
  $position['y2'] = $position['y1'] + $height;
291
 
292
- $page->drawImage($image, $position['x1'], $position['y1'], $position['x2'], $position['y2']);
 
293
  }
294
  }
295
  }
@@ -297,30 +331,43 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
297
  /**
298
  * inserts the logo from complete left to right
299
  *
300
- * @param Zend_Pdf_Page $page
301
- * @param mixed $store
302
  *
303
  * @todo merge _insertLogoPositioned and _insertLogoFullWidth
304
  */
305
  protected function _insertLogoFullWidth(&$page, $store = null)
306
  {
307
- $maxwidth = 594;
 
 
 
 
 
308
  $maxheight = 300;
309
 
310
  $image = Mage::getStoreConfig('sales/identity/logo', $store);
311
- if ($image and file_exists(Mage::getBaseDir('media', $store) . '/sales/store/logo/' . $image)) {
312
- $image = Mage::getBaseDir('media', $store) . '/sales/store/logo/' . $image;
 
 
 
313
 
314
- list ($width, $height) = Mage::helper('firegento_pdf')->getScaledImageSize($image, $maxwidth, $maxheight);
 
315
 
316
  if (is_file($image)) {
317
  $image = Zend_Pdf_Image::imageWithPath($image);
318
 
319
- $logoPosition = Mage::getStoreConfig('sales_pdf/firegento_pdf/logo_position', $store);
 
 
320
 
321
  switch ($logoPosition) {
322
  case 'center':
323
- $startLogoAt = $this->margin['left'] + (($this->margin['right'] - $this->margin['left']) / 2) - $width / 2;
 
 
324
  break;
325
  case 'right':
326
  $startLogoAt = $this->margin['right'] - $width;
@@ -334,19 +381,25 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
334
  $position['x2'] = $position['x1'] + $width;
335
  $position['y2'] = $position['y1'] + $height;
336
 
337
- $page->drawImage($image, $position['x1'], $position['y1'], $position['x2'], $position['y2']);
 
338
  $this->_marginTop = $height - 130;
339
  }
340
  }
341
  }
342
 
343
  /**
344
- * @param Zend_Pdf_Page $page
345
- * @param Mage_Sales_Model_Abstract $source
346
- * @param Mage_Sales_Model_Order $order
 
 
347
  */
348
- protected function insertAddressesAndHeader(Zend_Pdf_Page $page, Mage_Sales_Model_Abstract $source, Mage_Sales_Model_Order $order)
349
- {
 
 
 
350
  // Add logo
351
  $this->insertLogo($page, $source->getStore());
352
 
@@ -372,7 +425,7 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
372
  /**
373
  * Inserts the customer address. The default address is the billing address.
374
  *
375
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
376
  * @param Mage_Sales_Model_Order $order Order object
377
  *
378
  * @return void
@@ -380,17 +433,37 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
380
  protected function _insertCustomerAddress(&$page, $order)
381
  {
382
  $this->_setFontRegular($page, 9);
383
- $billing = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
 
384
  foreach ($billing as $line) {
385
- $page->drawText(trim(strip_tags($line)), $this->margin['left'], $this->y, $this->encoding);
 
 
386
  $this->Ln(12);
387
  }
388
  }
389
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  /**
391
  * Insert Header
392
  *
393
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
394
  * @param Mage_Sales_Model_Order $order Order object
395
  * @param object $document Document object
396
  *
@@ -411,14 +484,15 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
411
  } else {
412
  $title = 'Creditmemo';
413
  }
414
- $page->drawText(Mage::helper('firegento_pdf')->__($title), $this->margin['left'], $this->y, $this->encoding);
 
415
 
416
  $this->_setFontRegular($page);
417
 
418
  $this->y += 80;
419
- $labelRightOffset = 180;
420
 
421
- $valueRightOffset = 10;
422
  $font = $this->_setFontRegular($page, 10);
423
  $width = 80;
424
  $numberOfLines = 0;
@@ -433,14 +507,16 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
433
  $numberTitle = 'Creditmemo number:';
434
  }
435
  $page->drawText(
436
- Mage::helper('firegento_pdf')->__($numberTitle), ($this->margin['right'] - $labelRightOffset), $this->y,
 
437
  $this->encoding
438
  );
439
 
440
  $incrementId = $document->getIncrementId();
441
  $page->drawText(
442
  $incrementId,
443
- ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize($incrementId, $font, 10)),
 
444
  $this->y, $this->encoding
445
  );
446
  $this->Ln();
@@ -450,11 +526,13 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
450
  $putOrderId = $this->_putOrderId($order);
451
  if ($putOrderId) {
452
  $page->drawText(
453
- Mage::helper('firegento_pdf')->__('Order number:'), ($this->margin['right'] - $labelRightOffset),
 
454
  $this->y, $this->encoding
455
  );
456
  $page->drawText(
457
- $putOrderId, ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize(
 
458
  $putOrderId, $font, 10
459
  )), $this->y, $this->encoding
460
  );
@@ -463,14 +541,18 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
463
  }
464
 
465
  // Customer Number
466
- if($this->_showCustomerNumber($order->getStore())) {
467
  $page->drawText(
468
- Mage::helper('firegento_pdf')->__('Customer number:'), ($this->margin['right'] - $labelRightOffset), $this->y, $this->encoding);
 
 
 
469
  $numberOfLines++;
470
 
471
  if ($order->getCustomerId() != '') {
472
 
473
- $prefix = Mage::getStoreConfig('sales_pdf/invoice/customeridprefix');
 
474
 
475
  if (!empty($prefix)) {
476
  $customerid = $prefix . $order->getCustomerId();
@@ -478,26 +560,40 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
478
  $customerid = $order->getCustomerId();
479
  }
480
 
481
- $page->drawText($customerid, ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize($customerid, $font, 10)), $this->y, $this->encoding);
 
 
 
 
 
482
  $this->Ln();
483
  $numberOfLines++;
484
  } else {
485
- $page->drawText('-', ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize('-', $font, 10)), $this->y, $this->encoding);
 
 
 
 
 
486
  $this->Ln();
487
  $numberOfLines++;
488
  }
489
  }
490
 
491
  // Customer IP
492
- if (!Mage::getStoreConfigFlag('sales/general/hide_customer_ip', $order->getStoreId())) {
 
 
493
  $page->drawText(
494
- Mage::helper('firegento_pdf')->__('Customer IP:'), ($this->margin['right'] - $labelRightOffset),
 
495
  $this->y, $this->encoding
496
  );
497
  $customerIP = $order->getData('remote_ip');
498
  $font = $this->_setFontRegular($page, 10);
499
  $page->drawText(
500
- $customerIP, ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize(
 
501
  $customerIP, $font, 10
502
  )), $this->y, $this->encoding
503
  );
@@ -506,13 +602,17 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
506
  }
507
 
508
  $page->drawText(
509
- Mage::helper('firegento_pdf')->__(($mode == 'invoice') ? 'Invoice date:' : 'Date:'),
510
- ($this->margin['right'] - $labelRightOffset), $this->y, $this->encoding
 
 
511
  );
512
- $documentDate = Mage::helper('core')->formatDate($document->getCreatedAtDate(), 'medium', false);
 
513
  $page->drawText(
514
  $documentDate,
515
- ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize($documentDate, $font, 10)),
 
516
  $this->y, $this->encoding
517
  );
518
  $this->Ln();
@@ -525,21 +625,27 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
525
  == FireGento_Pdf_Model_System_Config_Source_Payment::POSITION_HEADER);
526
  if ($putPaymentMethod) {
527
  $page->drawText(
528
- Mage::helper('firegento_pdf')->__('Payment method:'), ($this->margin['right'] - $labelRightOffset),
 
529
  $this->y, $this->encoding
530
  );
531
  $paymentMethodArray = $this->_prepareText(
532
- $order->getPayment()->getMethodInstance()->getTitle(), $page, $font, 10, $width
 
533
  );
534
  $page->drawText(
535
- array_shift($paymentMethodArray), ($this->margin['right'] - $valueRightOffset - $width), $this->y,
 
536
  $this->encoding
537
  );
538
  $this->Ln();
539
  $numberOfLines++;
540
- $paymentMethodArray = $this->_prepareText(implode(" ", $paymentMethodArray), $page, $font, 10, 2 * $width);
 
541
  foreach ($paymentMethodArray as $methodString) {
542
- $page->drawText($methodString, $this->margin['right'] - $labelRightOffset, $this->y, $this->encoding);
 
 
543
  $this->Ln();
544
  $numberOfLines++;
545
  }
@@ -548,19 +654,25 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
548
 
549
  // Shipping method.
550
  $putShippingMethod = ($mode == 'invoice'
551
- && Mage::getStoreConfig('sales_pdf/invoice/shipping_method_position')
 
552
  == FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_HEADER
553
  || $mode == 'shipment'
554
- && Mage::getStoreConfig('sales_pdf/shipment/shipping_method_position')
 
555
  == FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_HEADER);
556
  if ($putShippingMethod) {
557
  $page->drawText(
558
- Mage::helper('firegento_pdf')->__('Shipping method:'), ($this->margin['right'] - $labelRightOffset),
 
559
  $this->y, $this->encoding
560
  );
561
- $shippingMethodArray = $this->_prepareText($order->getShippingDescription(), $page, $font, 10, $width);
 
 
562
  $page->drawText(
563
- array_shift($shippingMethodArray), ($this->margin['right'] - $valueRightOffset - $width), $this->y,
 
564
  $this->encoding
565
  );
566
  $this->Ln();
@@ -569,7 +681,9 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
569
  implode(" ", $shippingMethodArray), $page, $font, 10, 2 * $width
570
  );
571
  foreach ($shippingMethodArray as $methodString) {
572
- $page->drawText($methodString, $this->margin['right'] - $labelRightOffset, $this->y, $this->encoding);
 
 
573
  $this->Ln();
574
  $numberOfLines++;
575
  }
@@ -591,13 +705,16 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
591
  }
592
 
593
  /**
594
- * @param mixed $store
 
 
595
  *
596
  * @return bool
597
  */
598
  protected function _showCustomerNumber($store)
599
  {
600
- return Mage::helper('firegento_pdf')->showCustomerNumber($this->mode, $store);
 
601
  }
602
 
603
  /**
@@ -639,8 +756,12 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
639
  *
640
  * @return Zend_Pdf_Page
641
  */
642
- protected function _drawItem(Varien_Object $item, Zend_Pdf_Page $page, Mage_Sales_Model_Order $order, $position = 1)
643
- {
 
 
 
 
644
  $type = $item->getOrderItem()->getProductType();
645
 
646
  $renderer = $this->_getRenderer($type);
@@ -674,8 +795,9 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
674
 
675
  if ($shippingTaxAmount > 0) {
676
  $shippingTaxRate
677
- =
678
- $order->getShippingTaxAmount() * 100 / ($order->getShippingInclTax() - $order->getShippingTaxAmount());
 
679
  }
680
 
681
  $groupedTax = array();
@@ -690,11 +812,11 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
690
 
691
  array_push(
692
  $items['items'], array(
693
- 'row_invoiced' => $order->getShippingInvoiced(),
694
- 'tax_inc_subtotal' => false,
695
- 'tax_percent' => $shippingTaxRate,
696
- 'tax_amount' => $shippingTaxAmount
697
- )
698
  );
699
 
700
  foreach ($items['items'] as $item) {
@@ -711,10 +833,14 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
711
  if (!isset($item['tax_inc_subtotal'])) {
712
  $item['tax_inc_subtotal'] = 0;
713
  }
714
- if (((float)$item['tax_amount'] > 0) && ((float)$item['row_invoiced'] > 0)) {
 
 
715
  $_percent = round($item["tax_percent"], 0);
716
  }
717
- if (!array_key_exists('tax_inc_subtotal', $item) || $item['tax_inc_subtotal']) {
 
 
718
  $totalTax += $item['tax_amount'];
719
  }
720
  if (($item['tax_amount']) && $_percent) {
@@ -740,11 +866,15 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
740
  $total->setFontSize(10);
741
  // fix Magento 1.8 bug, so that taxes for shipping do not appear twice
742
  // see https://github.com/firegento/firegento-pdf/issues/106
743
- $uniqueTotalsForDisplay = array_map('unserialize', array_unique(array_map('serialize', $total->getTotalsForDisplay())));
 
 
 
744
  foreach ($uniqueTotalsForDisplay as $totalData) {
 
745
  $lineBlock['lines'][] = array(
746
  array(
747
- 'text' => $totalData['label'],
748
  'feed' => 470,
749
  'align' => 'right',
750
  'font_size' => $totalData['font_size']
@@ -766,9 +896,9 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
766
  /**
767
  * Insert Notes
768
  *
769
- * @param Zend_Pdf_Page $page Current Page Object of Zend_PDF
770
- * @param Mage_Sales_Model_Order $order order to get note from
771
- * @param Mage_Sales_Model_Abstract $model invoice/shipment/creditmemo
772
  *
773
  * @return \Zend_Pdf_Page
774
  */
@@ -783,7 +913,11 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
783
  $result->setNotes($notes);
784
  Mage::dispatchEvent(
785
  'firegento_pdf_' . $this->getMode() . '_insert_note',
786
- array('order' => $order, $this->getMode() => $model, 'result' => $result)
 
 
 
 
787
  );
788
  $notes = array_merge($notes, $result->getNotes());
789
 
@@ -800,14 +934,16 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
800
  foreach ($this->_prepareText($note, $page, $font, 10) as $tmpNote) {
801
  // create a new page if necessary
802
  if ($this->y < 50
803
- || (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1
 
804
  && $this->y < 100)
805
  ) {
806
  $page = $this->newPage(array());
807
  $this->y = $this->y - 60;
808
  $font = $this->_setFontRegular($page, $fontSize);
809
  }
810
- $page->drawText($tmpNote, $this->margin['left'], $this->y + 30, $this->encoding);
 
811
  $this->Ln(15);
812
  }
813
  }
@@ -817,18 +953,27 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
817
  /**
818
  * draw footer on pdf
819
  *
820
- * @param Zend_Pdf_Page $page page to draw on
821
  * @param mixed $store store to get infos from
822
  */
823
  protected function _addFooter(&$page, $store = null)
824
  {
825
  // get the imprint of the store if a store is set
826
  if (!empty($store)) {
827
- $this->_imprint = Mage::getStoreConfig('general/imprint', $store);
 
 
 
 
 
 
 
828
  }
829
 
830
  // Add footer if GermanSetup is installed.
831
- if ($this->_imprint && Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1) {
 
 
832
  $this->y = 110;
833
  $this->_insertFooter($page);
834
 
@@ -841,7 +986,7 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
841
  /**
842
  * Insert footer
843
  *
844
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
845
  *
846
  * @return void
847
  */
@@ -849,7 +994,8 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
849
  {
850
  $page->setLineColor($this->colors['black']);
851
  $page->setLineWidth(0.5);
852
- $page->drawLine($this->margin['left'] - 20, $this->y - 5, $this->margin['right'] + 30, $this->y - 5);
 
853
 
854
  $this->Ln(15);
855
  $this->_insertFooterAddress($page);
@@ -863,28 +1009,39 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
863
  $this->_insertFooterBlock($page, $fields, 70, 40, 140);
864
 
865
  $fields = array(
866
- 'bank_name' => Mage::helper('firegento_pdf')->__('Bank name:'),
867
- 'bank_account' => Mage::helper('firegento_pdf')->__('Account:'),
868
- 'bank_code_number' => Mage::helper('firegento_pdf')->__('Bank number:'),
869
- 'bank_account_owner' => Mage::helper('firegento_pdf')->__('Account owner:'),
 
 
 
 
870
  'swift' => Mage::helper('firegento_pdf')->__('SWIFT:'),
871
  'iban' => Mage::helper('firegento_pdf')->__('IBAN:')
872
  );
873
  $this->_insertFooterBlock($page, $fields, 215, 50, 150);
874
 
875
  $fields = array(
876
- 'tax_number' => Mage::helper('firegento_pdf')->__('Tax number:'),
 
877
  'vat_id' => Mage::helper('firegento_pdf')->__('VAT-ID:'),
878
- 'register_number' => Mage::helper('firegento_pdf')->__('Register number:'),
879
- 'ceo' => Mage::helper('firegento_pdf')->__('CEO:')
 
 
 
 
 
880
  );
881
- $this->_insertFooterBlock($page, $fields, 355, 60, $this->margin['right'] - 365 - 10);
 
882
  }
883
 
884
  /**
885
  * Insert footer block
886
  *
887
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
888
  * @param array $fields Fields of footer
889
  * @param int $colposition Starting colposition
890
  * @param int $valadjust Margin between label and value
@@ -893,8 +1050,13 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
893
  *
894
  * @return void
895
  */
896
- protected function _insertFooterBlock(&$page, $fields, $colposition = 0, $valadjust = 30, $colwidth = null)
897
- {
 
 
 
 
 
898
  $fontSize = 7;
899
  $font = $this->_setFontRegular($page, $fontSize);
900
  $y = $this->y;
@@ -907,16 +1069,23 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
907
  continue;
908
  }
909
  // draw the label
910
- $page->drawText($label, $this->margin['left'] + $colposition, $y, $this->encoding);
 
911
  // prepare the value: wrap it if necessary
912
  $val = $this->_imprint[$field];
913
  $width = $colwidth;
914
  if (!empty($colwidth)) {
915
  // calculate the maximum width for the value
916
- $width = $this->margin['left'] + $colposition + $colwidth - ($this->margin['left'] + $valposition);
 
917
  }
918
- foreach ($this->_prepareText($val, $page, $font, $fontSize, $width) as $tmpVal) {
919
- $page->drawText($tmpVal, $this->margin['left'] + $valposition, $y, $this->encoding);
 
 
 
 
 
920
  $y -= 12;
921
  }
922
  }
@@ -924,10 +1093,10 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
924
  }
925
 
926
  /**
927
- * Insert addess of store owner
928
  *
929
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
930
- * @param mixed $store store to get infos from
931
  *
932
  * @return void
933
  */
@@ -938,28 +1107,42 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
938
  $y = $this->y;
939
  $address = '';
940
 
941
- foreach ($this->_prepareText($this->_imprint['company_first'], $page, $font, $fontSize, 90) as $companyFirst) {
 
 
 
942
  $address .= $companyFirst . "\n";
943
  }
944
 
945
  if (array_key_exists('company_second', $this->_imprint)) {
946
- foreach ($this->_prepareText($this->_imprint['company_second'], $page, $font, $fontSize, 90) as $companySecond) {
 
 
 
947
  $address .= $companySecond . "\n";
948
  }
949
  }
950
 
951
- $address .= $this->_imprint['street'] . "\n";
952
- $address .= $this->_imprint['zip'] . " ";
953
- $address .= $this->_imprint['city'] . "\n";
 
 
 
 
 
 
954
 
955
- if (array_key_exists('country', $this->_imprint)) {
956
- $countryName = Mage::getModel('directory/country')->loadByCode($this->_imprint['country'])->getName();
 
957
  $address .= Mage::helper('core')->__($countryName);
958
  }
959
 
960
  foreach (explode("\n", $address) as $value) {
961
  if ($value !== '') {
962
- $page->drawText(trim(strip_tags($value)), $this->margin['left'] - 20, $y, $this->encoding);
 
963
  $y -= 12;
964
  }
965
  }
@@ -968,7 +1151,7 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
968
  /**
969
  * Insert page counter
970
  *
971
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
972
  *
973
  * @return void
974
  */
@@ -976,8 +1159,11 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
976
  {
977
  $font = $this->_setFontRegular($page, 9);
978
  $page->drawText(
979
- Mage::helper('firegento_pdf')->__('Page') . ' ' . $this->pagecounter,
980
- $this->margin['right'] - 23 - $this->widthForStringUsingFontSize($this->pagecounter, $font, 9), $this->y,
 
 
 
981
  $this->encoding
982
  );
983
  }
@@ -989,6 +1175,9 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
989
  */
990
  public function getFontRegular()
991
  {
 
 
 
992
  return Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
993
  }
994
 
@@ -1014,6 +1203,9 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
1014
  */
1015
  public function getFontBold()
1016
  {
 
 
 
1017
  return Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
1018
  }
1019
 
@@ -1039,7 +1231,12 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
1039
  */
1040
  public function getFontItalic()
1041
  {
1042
- return Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_ITALIC);
 
 
 
 
 
1043
  }
1044
 
1045
  /**
@@ -1077,11 +1274,15 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
1077
  $currentLine = '';
1078
  // calculate the page's width with respect to the margins
1079
  if (empty($width)) {
1080
- $width = $page->getWidth() - $this->margin['left'] - ($page->getWidth() - $this->margin['right']);
 
 
1081
  }
1082
  $textChunks = explode(' ', $text);
1083
  foreach ($textChunks as $textChunk) {
1084
- if ($this->widthForStringUsingFontSize($currentLine . ' ' . $textChunk, $font, $fontSize) < $width) {
 
 
1085
  // do not add whitespace on first line
1086
  if (!empty($currentLine)) {
1087
  $currentLine .= ' ';
@@ -1097,4 +1298,128 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
1097
  $lines .= $currentLine;
1098
  return explode("\n", $lines);
1099
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1100
  }
20
  * @version $Id:$
21
  * @since 0.1.0
22
  */
23
+
24
  /**
25
  * Abstract pdf model.
26
  *
32
  * @version $Id:$
33
  * @since 0.1.0
34
  */
35
+ abstract class FireGento_Pdf_Model_Engine_Abstract
36
+ extends Mage_Sales_Model_Order_Pdf_Abstract
37
  {
38
  public $margin = array('left' => 45, 'right' => 540);
39
  public $colors = array();
73
  *
74
  * @return Zend_Pdf_Page
75
  */
76
+ public function drawLineBlocks(
77
+ Zend_Pdf_Page $page,
78
+ array $draw,
79
+ array $pageSettings = array()
80
+ ) {
81
  foreach ($draw as $itemsProp) {
82
  if (!isset($itemsProp['lines']) || !is_array($itemsProp['lines'])) {
83
+ Mage::throwException(Mage::helper('sales')
84
+ ->__('Invalid draw line data. Please define "lines" array'));
85
  }
86
  $lines = $itemsProp['lines'];
87
  $height = isset($itemsProp['height']) ? $itemsProp['height'] : 10;
91
  foreach ($lines as $line) {
92
  $maxHeight = 0;
93
  foreach ($line as $column) {
94
+ $lineSpacing = !empty($column['height'])
95
+ ? $column['height'] : $height;
96
  if (!is_array($column['text'])) {
97
  $column['text'] = array($column['text']);
98
  }
99
+ $top = count($column['text']) * $lineSpacing;
 
 
 
100
 
101
  $maxHeight = $top > $maxHeight ? $top : $maxHeight;
102
  }
106
  }
107
 
108
  if ($this->y - $itemsProp['shift'] < 50
109
+ || (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer')
110
+ == 1
111
  && $this->y - $itemsProp['shift'] < 100)
112
  ) {
113
  $page = $this->newPage($pageSettings);
116
  foreach ($lines as $line) {
117
  $maxHeight = 0;
118
  foreach ($line as $column) {
119
+ $fontSize = empty($column['font_size']) ? 7
120
+ : $column['font_size'];
121
  if (!empty($column['font_file'])) {
122
+ $font
123
+ = Zend_Pdf_Font::fontWithPath($column['font_file']);
124
  $page->setFont($font, $fontSize);
125
  } else {
126
+ $fontStyle = empty($column['font']) ? 'regular'
127
+ : $column['font'];
128
  switch ($fontStyle) {
129
  case 'bold':
130
  $font = $this->_setFontBold($page, $fontSize);
133
  $font = $this->_setFontItalic($page, $fontSize);
134
  break;
135
  default:
136
+ $font = $this->_setFontRegular($page,
137
+ $fontSize);
138
  break;
139
  }
140
  }
143
  $column['text'] = array($column['text']);
144
  }
145
 
146
+ $lineSpacing = !empty($column['height']) ? $column['height']
147
+ : $height;
148
  $top = 0;
149
  foreach ($column['text'] as $part) {
150
  $feed = $column['feed'];
151
+ $textAlign = empty($column['align']) ? 'left'
152
+ : $column['align'];
153
  $width = empty($column['width']) ? 0 : $column['width'];
154
  switch ($textAlign) {
155
  case 'right':
156
  if ($width) {
157
+ $feed = $this->getAlignRight($part, $feed,
158
+ $width, $font, $fontSize);
159
  } else {
160
+ $feed = $feed
161
+ - $this->widthForStringUsingFontSize($part,
162
+ $font, $fontSize);
163
  }
164
  break;
165
  case 'center':
166
  if ($width) {
167
+ $feed = $this->getAlignCenter($part, $feed,
168
+ $width, $font, $fontSize);
169
  }
170
  break;
171
  }
220
  /**
221
  * Insert sender address bar
222
  *
223
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
224
  *
225
  * @return void
226
  */
227
  protected function _insertSenderAddessBar(&$page)
228
  {
229
+ if (Mage::getStoreConfig('sales_pdf/firegento_pdf/sender_address_bar')
230
+ != ''
231
+ ) {
232
  $this->_setFontRegular($page, 6);
233
  $page->drawText(
234
+ trim(Mage::getStoreConfig('sales_pdf/firegento_pdf/sender_address_bar')),
235
+ $this->margin['left'] + $this->getHeaderblockOffset(),
236
  $this->y, $this->encoding
237
  );
238
  }
241
  /**
242
  * Insert logo
243
  *
244
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
245
  * @param mixed $store store to get data from
246
  *
247
  * @return void
256
  }
257
 
258
  /**
259
+ * is the setting to show the logo full width?
260
+ *
261
+ * @param mixed $store store we want the config setting from
262
  *
263
  * @return bool
264
  */
270
  /**
271
  * Inserts the logo if it is positioned left, center or right.
272
  *
273
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
274
  * @param mixed $store store to get data from
275
  *
276
  * @return void
277
  */
278
  protected function _insertLogoPositioned(&$page, $store = null)
279
  {
280
+ $imageRatio
281
+ = (int)Mage::getStoreConfig('sales_pdf/firegento_pdf/logo_ratio',
282
+ $store);
283
+ $imageRatio = (empty($imageRatio)) ? 1 : $imageRatio;
284
+
285
+ $maxwidth
286
+ = ($this->margin['right'] - $this->margin['left']) * $imageRatio
287
+ / 100;
288
  $maxheight = 100;
289
 
290
  $image = Mage::getStoreConfig('sales/identity/logo', $store);
291
+ if ($image and file_exists(Mage::getBaseDir('media', $store)
292
+ . '/sales/store/logo/' . $image)
293
+ ) {
294
+ $image = Mage::getBaseDir('media', $store) . '/sales/store/logo/'
295
+ . $image;
296
 
297
+ list ($width, $height) = Mage::helper('firegento_pdf')
298
+ ->getScaledImageSize($image, $maxwidth, $maxheight);
299
 
300
  if (is_file($image)) {
301
  $image = Zend_Pdf_Image::imageWithPath($image);
302
 
303
+ $logoPosition
304
+ = Mage::getStoreConfig('sales_pdf/firegento_pdf/logo_position',
305
+ $store);
306
 
307
  switch ($logoPosition) {
308
  case 'center':
309
  $startLogoAt
310
+ = $this->margin['left'] + (($this->margin['right']
311
+ - $this->margin['left']) / 2) - $width / 2;
312
  break;
313
  case 'right':
314
  $startLogoAt = $this->margin['right'] - $width;
322
  $position['x2'] = $position['x1'] + $width;
323
  $position['y2'] = $position['y1'] + $height;
324
 
325
+ $page->drawImage($image, $position['x1'], $position['y1'],
326
+ $position['x2'], $position['y2']);
327
  }
328
  }
329
  }
331
  /**
332
  * inserts the logo from complete left to right
333
  *
334
+ * @param Zend_Pdf_Page &$page current Zend_Pdf_Page object
335
+ * @param mixed $store store we need the config setting from
336
  *
337
  * @todo merge _insertLogoPositioned and _insertLogoFullWidth
338
  */
339
  protected function _insertLogoFullWidth(&$page, $store = null)
340
  {
341
+ $imageRatio
342
+ = (int)Mage::getStoreConfig('sales_pdf/firegento_pdf/logo_ratio',
343
+ $store);
344
+ $imageRatio = (empty($imageRatio)) ? 1 : $imageRatio;
345
+
346
+ $maxwidth = 594 * $imageRatio / 100;
347
  $maxheight = 300;
348
 
349
  $image = Mage::getStoreConfig('sales/identity/logo', $store);
350
+ if ($image and file_exists(Mage::getBaseDir('media', $store)
351
+ . '/sales/store/logo/' . $image)
352
+ ) {
353
+ $image = Mage::getBaseDir('media', $store) . '/sales/store/logo/'
354
+ . $image;
355
 
356
+ list ($width, $height) = Mage::helper('firegento_pdf')
357
+ ->getScaledImageSize($image, $maxwidth, $maxheight);
358
 
359
  if (is_file($image)) {
360
  $image = Zend_Pdf_Image::imageWithPath($image);
361
 
362
+ $logoPosition
363
+ = Mage::getStoreConfig('sales_pdf/firegento_pdf/logo_position',
364
+ $store);
365
 
366
  switch ($logoPosition) {
367
  case 'center':
368
+ $startLogoAt = $this->margin['left'] +
369
+ (($this->margin['right'] - $this->margin['left'])
370
+ / 2) - $width / 2;
371
  break;
372
  case 'right':
373
  $startLogoAt = $this->margin['right'] - $width;
381
  $position['x2'] = $position['x1'] + $width;
382
  $position['y2'] = $position['y1'] + $height;
383
 
384
+ $page->drawImage($image, $position['x1'], $position['y1'],
385
+ $position['x2'], $position['y2']);
386
  $this->_marginTop = $height - 130;
387
  }
388
  }
389
  }
390
 
391
  /**
392
+ * insert customer address and all header like customer number, etc.
393
+ *
394
+ * @param Zend_Pdf_Page $page current Zend_Pdf_Page
395
+ * @param Mage_Sales_Model_Abstract $source source for the address information
396
+ * @param Mage_Sales_Model_Order $order order to print the document for
397
  */
398
+ protected function insertAddressesAndHeader(
399
+ Zend_Pdf_Page $page,
400
+ Mage_Sales_Model_Abstract $source,
401
+ Mage_Sales_Model_Order $order
402
+ ) {
403
  // Add logo
404
  $this->insertLogo($page, $source->getStore());
405
 
425
  /**
426
  * Inserts the customer address. The default address is the billing address.
427
  *
428
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
429
  * @param Mage_Sales_Model_Order $order Order object
430
  *
431
  * @return void
433
  protected function _insertCustomerAddress(&$page, $order)
434
  {
435
  $this->_setFontRegular($page, 9);
436
+ $billing = $this->_formatAddress($order->getBillingAddress()
437
+ ->format('pdf'));
438
  foreach ($billing as $line) {
439
+ $page->drawText(trim(strip_tags($line)),
440
+ $this->margin['left'] + $this->getHeaderblockOffset(), $this->y,
441
+ $this->encoding);
442
  $this->Ln(12);
443
  }
444
  }
445
 
446
+ /**
447
+ * get the offset to position the address block left or right
448
+ *
449
+ * @return int
450
+ */
451
+ protected function getHeaderblockOffset()
452
+ {
453
+ if (Mage::getStoreConfig('sales_pdf/firegento_pdf/headerblocks_position')
454
+ == FireGento_Pdf_Model_System_Config_Source_Headerblocks::LEFT
455
+ ) {
456
+ $offsetAdjustment = 0;
457
+ } else {
458
+ $offsetAdjustment = 315;
459
+ }
460
+ return $offsetAdjustment;
461
+ }
462
+
463
  /**
464
  * Insert Header
465
  *
466
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
467
  * @param Mage_Sales_Model_Order $order Order object
468
  * @param object $document Document object
469
  *
484
  } else {
485
  $title = 'Creditmemo';
486
  }
487
+ $page->drawText(Mage::helper('firegento_pdf')->__($title),
488
+ $this->margin['left'], $this->y, $this->encoding);
489
 
490
  $this->_setFontRegular($page);
491
 
492
  $this->y += 80;
493
+ $labelRightOffset = 180 + $this->getHeaderblockOffset();
494
 
495
+ $valueRightOffset = 10 + $this->getHeaderblockOffset();
496
  $font = $this->_setFontRegular($page, 10);
497
  $width = 80;
498
  $numberOfLines = 0;
507
  $numberTitle = 'Creditmemo number:';
508
  }
509
  $page->drawText(
510
+ Mage::helper('firegento_pdf')->__($numberTitle),
511
+ ($this->margin['right'] - $labelRightOffset), $this->y,
512
  $this->encoding
513
  );
514
 
515
  $incrementId = $document->getIncrementId();
516
  $page->drawText(
517
  $incrementId,
518
+ ($this->margin['right'] - $valueRightOffset
519
+ - $this->widthForStringUsingFontSize($incrementId, $font, 10)),
520
  $this->y, $this->encoding
521
  );
522
  $this->Ln();
526
  $putOrderId = $this->_putOrderId($order);
527
  if ($putOrderId) {
528
  $page->drawText(
529
+ Mage::helper('firegento_pdf')->__('Order number:'),
530
+ ($this->margin['right'] - $labelRightOffset),
531
  $this->y, $this->encoding
532
  );
533
  $page->drawText(
534
+ $putOrderId, ($this->margin['right'] - $valueRightOffset
535
+ - $this->widthForStringUsingFontSize(
536
  $putOrderId, $font, 10
537
  )), $this->y, $this->encoding
538
  );
541
  }
542
 
543
  // Customer Number
544
+ if ($this->_showCustomerNumber($order->getStore())) {
545
  $page->drawText(
546
+ Mage::helper('firegento_pdf')->__('Customer number:'),
547
+ ($this->margin['right'] - $labelRightOffset),
548
+ $this->y, $this->encoding
549
+ );
550
  $numberOfLines++;
551
 
552
  if ($order->getCustomerId() != '') {
553
 
554
+ $prefix
555
+ = Mage::getStoreConfig('sales_pdf/invoice/customeridprefix');
556
 
557
  if (!empty($prefix)) {
558
  $customerid = $prefix . $order->getCustomerId();
560
  $customerid = $order->getCustomerId();
561
  }
562
 
563
+ $page->drawText(
564
+ $customerid, ($this->margin['right'] - $valueRightOffset
565
+ - $this->widthForStringUsingFontSize(
566
+ $customerid, $font, 10
567
+ )), $this->y, $this->encoding
568
+ );
569
  $this->Ln();
570
  $numberOfLines++;
571
  } else {
572
+ $page->drawText(
573
+ '-',
574
+ ($this->margin['right'] - $valueRightOffset
575
+ - $this->widthForStringUsingFontSize('-', $font, 10)),
576
+ $this->y, $this->encoding
577
+ );
578
  $this->Ln();
579
  $numberOfLines++;
580
  }
581
  }
582
 
583
  // Customer IP
584
+ if (!Mage::getStoreConfigFlag('sales/general/hide_customer_ip',
585
+ $order->getStoreId())
586
+ ) {
587
  $page->drawText(
588
+ Mage::helper('firegento_pdf')->__('Customer IP:'),
589
+ ($this->margin['right'] - $labelRightOffset),
590
  $this->y, $this->encoding
591
  );
592
  $customerIP = $order->getData('remote_ip');
593
  $font = $this->_setFontRegular($page, 10);
594
  $page->drawText(
595
+ $customerIP, ($this->margin['right'] - $valueRightOffset
596
+ - $this->widthForStringUsingFontSize(
597
  $customerIP, $font, 10
598
  )), $this->y, $this->encoding
599
  );
602
  }
603
 
604
  $page->drawText(
605
+ Mage::helper('firegento_pdf')->__(($mode == 'invoice')
606
+ ? 'Invoice date:' : 'Date:'),
607
+ ($this->margin['right'] - $labelRightOffset), $this->y,
608
+ $this->encoding
609
  );
610
+ $documentDate = Mage::helper('core')
611
+ ->formatDate($document->getCreatedAtDate(), 'medium', false);
612
  $page->drawText(
613
  $documentDate,
614
+ ($this->margin['right'] - $valueRightOffset
615
+ - $this->widthForStringUsingFontSize($documentDate, $font, 10)),
616
  $this->y, $this->encoding
617
  );
618
  $this->Ln();
625
  == FireGento_Pdf_Model_System_Config_Source_Payment::POSITION_HEADER);
626
  if ($putPaymentMethod) {
627
  $page->drawText(
628
+ Mage::helper('firegento_pdf')->__('Payment method:'),
629
+ ($this->margin['right'] - $labelRightOffset),
630
  $this->y, $this->encoding
631
  );
632
  $paymentMethodArray = $this->_prepareText(
633
+ $order->getPayment()->getMethodInstance()->getTitle(), $page,
634
+ $font, 10, $width
635
  );
636
  $page->drawText(
637
+ array_shift($paymentMethodArray),
638
+ ($this->margin['right'] - $valueRightOffset - $width), $this->y,
639
  $this->encoding
640
  );
641
  $this->Ln();
642
  $numberOfLines++;
643
+ $paymentMethodArray = $this->_prepareText(implode(" ",
644
+ $paymentMethodArray), $page, $font, 10, 2 * $width);
645
  foreach ($paymentMethodArray as $methodString) {
646
+ $page->drawText($methodString,
647
+ $this->margin['right'] - $labelRightOffset, $this->y,
648
+ $this->encoding);
649
  $this->Ln();
650
  $numberOfLines++;
651
  }
654
 
655
  // Shipping method.
656
  $putShippingMethod = ($mode == 'invoice'
657
+ &&
658
+ Mage::getStoreConfig('sales_pdf/invoice/shipping_method_position')
659
  == FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_HEADER
660
  || $mode == 'shipment'
661
+ &&
662
+ Mage::getStoreConfig('sales_pdf/shipment/shipping_method_position')
663
  == FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_HEADER);
664
  if ($putShippingMethod) {
665
  $page->drawText(
666
+ Mage::helper('firegento_pdf')->__('Shipping method:'),
667
+ ($this->margin['right'] - $labelRightOffset),
668
  $this->y, $this->encoding
669
  );
670
+ $shippingMethodArray
671
+ = $this->_prepareText($order->getShippingDescription(), $page,
672
+ $font, 10, $width);
673
  $page->drawText(
674
+ array_shift($shippingMethodArray),
675
+ ($this->margin['right'] - $valueRightOffset - $width), $this->y,
676
  $this->encoding
677
  );
678
  $this->Ln();
681
  implode(" ", $shippingMethodArray), $page, $font, 10, 2 * $width
682
  );
683
  foreach ($shippingMethodArray as $methodString) {
684
+ $page->drawText($methodString,
685
+ $this->margin['right'] - $labelRightOffset, $this->y,
686
+ $this->encoding);
687
  $this->Ln();
688
  $numberOfLines++;
689
  }
705
  }
706
 
707
  /**
708
+ * do we show the customber number on this document
709
+ *
710
+ * @param mixed $store store from whom we need the config setting
711
  *
712
  * @return bool
713
  */
714
  protected function _showCustomerNumber($store)
715
  {
716
+ return Mage::helper('firegento_pdf')
717
+ ->showCustomerNumber($this->mode, $store);
718
  }
719
 
720
  /**
756
  *
757
  * @return Zend_Pdf_Page
758
  */
759
+ protected function _drawItem(
760
+ Varien_Object $item,
761
+ Zend_Pdf_Page $page,
762
+ Mage_Sales_Model_Order $order,
763
+ $position = 1
764
+ ) {
765
  $type = $item->getOrderItem()->getProductType();
766
 
767
  $renderer = $this->_getRenderer($type);
795
 
796
  if ($shippingTaxAmount > 0) {
797
  $shippingTaxRate
798
+ = $order->getShippingTaxAmount() * 100
799
+ / ($order->getShippingInclTax()
800
+ - $order->getShippingTaxAmount());
801
  }
802
 
803
  $groupedTax = array();
812
 
813
  array_push(
814
  $items['items'], array(
815
+ 'row_invoiced' => $order->getShippingInvoiced(),
816
+ 'tax_inc_subtotal' => false,
817
+ 'tax_percent' => $shippingTaxRate,
818
+ 'tax_amount' => $shippingTaxAmount
819
+ )
820
  );
821
 
822
  foreach ($items['items'] as $item) {
833
  if (!isset($item['tax_inc_subtotal'])) {
834
  $item['tax_inc_subtotal'] = 0;
835
  }
836
+ if (((float)$item['tax_amount'] > 0)
837
+ && ((float)$item['row_invoiced'] > 0)
838
+ ) {
839
  $_percent = round($item["tax_percent"], 0);
840
  }
841
+ if (!array_key_exists('tax_inc_subtotal', $item)
842
+ || $item['tax_inc_subtotal']
843
+ ) {
844
  $totalTax += $item['tax_amount'];
845
  }
846
  if (($item['tax_amount']) && $_percent) {
866
  $total->setFontSize(10);
867
  // fix Magento 1.8 bug, so that taxes for shipping do not appear twice
868
  // see https://github.com/firegento/firegento-pdf/issues/106
869
+ $uniqueTotalsForDisplay = array_map(
870
+ 'unserialize', array_unique(array_map('serialize',
871
+ $total->getTotalsForDisplay()))
872
+ );
873
  foreach ($uniqueTotalsForDisplay as $totalData) {
874
+ $label = $this->fixNumberFormat($totalData['label']);
875
  $lineBlock['lines'][] = array(
876
  array(
877
+ 'text' => $label,
878
  'feed' => 470,
879
  'align' => 'right',
880
  'font_size' => $totalData['font_size']
896
  /**
897
  * Insert Notes
898
  *
899
+ * @param Zend_Pdf_Page $page Current Page Object of Zend_PDF
900
+ * @param Mage_Sales_Model_Order &$order order to get note from
901
+ * @param Mage_Sales_Model_Abstract &$model invoice/shipment/creditmemo
902
  *
903
  * @return \Zend_Pdf_Page
904
  */
913
  $result->setNotes($notes);
914
  Mage::dispatchEvent(
915
  'firegento_pdf_' . $this->getMode() . '_insert_note',
916
+ array(
917
+ 'order' => $order,
918
+ $this->getMode() => $model,
919
+ 'result' => $result
920
+ )
921
  );
922
  $notes = array_merge($notes, $result->getNotes());
923
 
934
  foreach ($this->_prepareText($note, $page, $font, 10) as $tmpNote) {
935
  // create a new page if necessary
936
  if ($this->y < 50
937
+ || (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer')
938
+ == 1
939
  && $this->y < 100)
940
  ) {
941
  $page = $this->newPage(array());
942
  $this->y = $this->y - 60;
943
  $font = $this->_setFontRegular($page, $fontSize);
944
  }
945
+ $page->drawText($tmpNote, $this->margin['left'], $this->y + 30,
946
+ $this->encoding);
947
  $this->Ln(15);
948
  }
949
  }
953
  /**
954
  * draw footer on pdf
955
  *
956
+ * @param Zend_Pdf_Page &$page page to draw on
957
  * @param mixed $store store to get infos from
958
  */
959
  protected function _addFooter(&$page, $store = null)
960
  {
961
  // get the imprint of the store if a store is set
962
  if (!empty($store)) {
963
+ $imprintObject = new Varien_Object();
964
+ $imprintObject->setImprint(Mage::getStoreConfig('general/imprint',
965
+ $store));
966
+ Mage::dispatchEvent('firegento_pdf_imprint_load_after', array(
967
+ 'transport_object' => $imprintObject
968
+ )
969
+ );
970
+ $this->_imprint = $imprintObject->getImprint();
971
  }
972
 
973
  // Add footer if GermanSetup is installed.
974
+ if ($this->_imprint
975
+ && Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1
976
+ ) {
977
  $this->y = 110;
978
  $this->_insertFooter($page);
979
 
986
  /**
987
  * Insert footer
988
  *
989
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
990
  *
991
  * @return void
992
  */
994
  {
995
  $page->setLineColor($this->colors['black']);
996
  $page->setLineWidth(0.5);
997
+ $page->drawLine($this->margin['left'] - 20, $this->y - 5,
998
+ $this->margin['right'] + 30, $this->y - 5);
999
 
1000
  $this->Ln(15);
1001
  $this->_insertFooterAddress($page);
1009
  $this->_insertFooterBlock($page, $fields, 70, 40, 140);
1010
 
1011
  $fields = array(
1012
+ 'bank_name' => Mage::helper('firegento_pdf')
1013
+ ->__('Bank name:'),
1014
+ 'bank_account' => Mage::helper('firegento_pdf')
1015
+ ->__('Account:'),
1016
+ 'bank_code_number' => Mage::helper('firegento_pdf')
1017
+ ->__('Bank number:'),
1018
+ 'bank_account_owner' => Mage::helper('firegento_pdf')
1019
+ ->__('Account owner:'),
1020
  'swift' => Mage::helper('firegento_pdf')->__('SWIFT:'),
1021
  'iban' => Mage::helper('firegento_pdf')->__('IBAN:')
1022
  );
1023
  $this->_insertFooterBlock($page, $fields, 215, 50, 150);
1024
 
1025
  $fields = array(
1026
+ 'tax_number' => Mage::helper('firegento_pdf')
1027
+ ->__('Tax number:'),
1028
  'vat_id' => Mage::helper('firegento_pdf')->__('VAT-ID:'),
1029
+ 'register_number' => Mage::helper('firegento_pdf')
1030
+ ->__('Register number:'),
1031
+ 'ceo' => Mage::helper('firegento_pdf')->__('CEO:'),
1032
+ 'city' => Mage::helper('firegento_pdf')
1033
+ ->__('Registered seat:'),
1034
+ 'court' => Mage::helper('firegento_pdf')
1035
+ ->__('Register court:'),
1036
  );
1037
+ $this->_insertFooterBlock($page, $fields, 355, 60,
1038
+ $this->margin['right'] - 365 - 10);
1039
  }
1040
 
1041
  /**
1042
  * Insert footer block
1043
  *
1044
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
1045
  * @param array $fields Fields of footer
1046
  * @param int $colposition Starting colposition
1047
  * @param int $valadjust Margin between label and value
1050
  *
1051
  * @return void
1052
  */
1053
+ protected function _insertFooterBlock(
1054
+ &$page,
1055
+ $fields,
1056
+ $colposition = 0,
1057
+ $valadjust = 30,
1058
+ $colwidth = null
1059
+ ) {
1060
  $fontSize = 7;
1061
  $font = $this->_setFontRegular($page, $fontSize);
1062
  $y = $this->y;
1069
  continue;
1070
  }
1071
  // draw the label
1072
+ $page->drawText($label, $this->margin['left'] + $colposition,
1073
+ $y, $this->encoding);
1074
  // prepare the value: wrap it if necessary
1075
  $val = $this->_imprint[$field];
1076
  $width = $colwidth;
1077
  if (!empty($colwidth)) {
1078
  // calculate the maximum width for the value
1079
+ $width = $this->margin['left'] + $colposition + $colwidth
1080
+ - ($this->margin['left'] + $valposition);
1081
  }
1082
+ foreach (
1083
+ $this->_prepareText($val, $page, $font, $fontSize, $width)
1084
+ as $tmpVal
1085
+ ) {
1086
+ $page->drawText($tmpVal,
1087
+ $this->margin['left'] + $valposition, $y,
1088
+ $this->encoding);
1089
  $y -= 12;
1090
  }
1091
  }
1093
  }
1094
 
1095
  /**
1096
+ * Insert address of store owner
1097
  *
1098
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
1099
+ * @param mixed $store store to get info from
1100
  *
1101
  * @return void
1102
  */
1107
  $y = $this->y;
1108
  $address = '';
1109
 
1110
+ foreach (
1111
+ $this->_prepareText($this->_imprint['company_first'], $page, $font,
1112
+ $fontSize, 90) as $companyFirst
1113
+ ) {
1114
  $address .= $companyFirst . "\n";
1115
  }
1116
 
1117
  if (array_key_exists('company_second', $this->_imprint)) {
1118
+ foreach (
1119
+ $this->_prepareText($this->_imprint['company_second'], $page,
1120
+ $font, $fontSize, 90) as $companySecond
1121
+ ) {
1122
  $address .= $companySecond . "\n";
1123
  }
1124
  }
1125
 
1126
+ if (array_key_exists('street', $this->_imprint)) {
1127
+ $address .= $this->_imprint['street'] . "\n";
1128
+ }
1129
+ if (array_key_exists('zip', $this->_imprint)) {
1130
+ $address .= $this->_imprint['zip'] . " ";
1131
+ }
1132
+ if (array_key_exists('city', $this->_imprint)) {
1133
+ $address .= $this->_imprint['city'] . "\n";
1134
+ }
1135
 
1136
+ if (!empty($this->_imprint['country'])) {
1137
+ $countryName = Mage::getModel('directory/country')
1138
+ ->loadByCode($this->_imprint['country'])->getName();
1139
  $address .= Mage::helper('core')->__($countryName);
1140
  }
1141
 
1142
  foreach (explode("\n", $address) as $value) {
1143
  if ($value !== '') {
1144
+ $page->drawText(trim(strip_tags($value)),
1145
+ $this->margin['left'] - 20, $y, $this->encoding);
1146
  $y -= 12;
1147
  }
1148
  }
1151
  /**
1152
  * Insert page counter
1153
  *
1154
+ * @param Zend_Pdf_Page &$page Current page object of Zend_Pdf
1155
  *
1156
  * @return void
1157
  */
1159
  {
1160
  $font = $this->_setFontRegular($page, 9);
1161
  $page->drawText(
1162
+ Mage::helper('firegento_pdf')->__('Page') . ' '
1163
+ . $this->pagecounter,
1164
+ $this->margin['right'] - 23
1165
+ - $this->widthForStringUsingFontSize($this->pagecounter, $font, 9),
1166
+ $this->y,
1167
  $this->encoding
1168
  );
1169
  }
1175
  */
1176
  public function getFontRegular()
1177
  {
1178
+ if ($this->getRegularFont() && $this->regularFontFileExists()) {
1179
+ return Zend_Pdf_Font::fontWithPath($this->getRegularFontFile());
1180
+ }
1181
  return Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
1182
  }
1183
 
1203
  */
1204
  public function getFontBold()
1205
  {
1206
+ if ($this->getBoldFont() && $this->boldFontFileExists()) {
1207
+ return Zend_Pdf_Font::fontWithPath($this->getBoldFontFile());
1208
+ }
1209
  return Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
1210
  }
1211
 
1231
  */
1232
  public function getFontItalic()
1233
  {
1234
+ if ($this->getItalicFont() && $this->italicFontFileExists()) {
1235
+ return Zend_Pdf_Font::fontWithPath($this->getItalicFontFile());
1236
+ }
1237
+ return Zend_Pdf_Font::fontWithName(
1238
+ Zend_Pdf_Font::FONT_HELVETICA_ITALIC
1239
+ );
1240
  }
1241
 
1242
  /**
1274
  $currentLine = '';
1275
  // calculate the page's width with respect to the margins
1276
  if (empty($width)) {
1277
+ $width
1278
+ = $page->getWidth() - $this->margin['left'] - ($page->getWidth()
1279
+ - $this->margin['right']);
1280
  }
1281
  $textChunks = explode(' ', $text);
1282
  foreach ($textChunks as $textChunk) {
1283
+ if ($this->widthForStringUsingFontSize($currentLine . ' '
1284
+ . $textChunk, $font, $fontSize) < $width
1285
+ ) {
1286
  // do not add whitespace on first line
1287
  if (!empty($currentLine)) {
1288
  $currentLine .= ' ';
1298
  $lines .= $currentLine;
1299
  return explode("\n", $lines);
1300
  }
1301
+
1302
+ /**
1303
+ * Fix the percentage for taxes which come with four decimal places
1304
+ * from magento core.
1305
+ *
1306
+ * @param string $label tax label which contains the badly formatted tax percentage
1307
+ *
1308
+ * @return string
1309
+ */
1310
+ private function fixNumberFormat($label)
1311
+ {
1312
+ $pattern = "/(.*)\((\d{1,2}\.\d{4}%)\)/";
1313
+ if (preg_match($pattern, $label, $matches)) {
1314
+ $percentage = Zend_Locale_Format::toNumber(
1315
+ $matches[2],
1316
+ array(
1317
+ 'locale' => Mage::app()->getLocale()->getLocale(),
1318
+ 'precision' => 2,
1319
+ )
1320
+ );
1321
+ return $matches[1] . '(' . $percentage . '%)';
1322
+ }
1323
+ return $label;
1324
+ }
1325
+
1326
+ /**
1327
+ * get bold font file
1328
+ *
1329
+ * @return string
1330
+ */
1331
+ private function getBoldFontFile()
1332
+ {
1333
+ return Mage::helper('firegento_pdf')->getFontPath() . DS
1334
+ . $this->getBoldFont();
1335
+ }
1336
+
1337
+ /**
1338
+ * get bold font path
1339
+ *
1340
+ * @return string
1341
+ */
1342
+ private function getBoldFont()
1343
+ {
1344
+ return Mage::getStoreConfig(
1345
+ FireGento_Pdf_Helper_Data::XML_PATH_BOLD_FONT
1346
+ );
1347
+ }
1348
+
1349
+ /**
1350
+ * check whether font file exists for bold font
1351
+ *
1352
+ * @return bool
1353
+ */
1354
+ private function boldFontFileExists()
1355
+ {
1356
+ return file_exists($this->getBoldFontFile());
1357
+ }
1358
+
1359
+ /**
1360
+ * get italic font path
1361
+ *
1362
+ * @return string
1363
+ */
1364
+ private function getItalicFont()
1365
+ {
1366
+ return Mage::getStoreConfig(
1367
+ FireGento_Pdf_Helper_Data::XML_PATH_ITALIC_FONT
1368
+ );
1369
+ }
1370
+
1371
+ /**
1372
+ * check whether italic font file exists
1373
+ *
1374
+ * @return bool
1375
+ */
1376
+ private function ItalicFontFileExists()
1377
+ {
1378
+ return file_exists($this->getItalicFontFile());
1379
+ }
1380
+
1381
+ /**
1382
+ * get italic font file
1383
+ *
1384
+ * @return string
1385
+ */
1386
+ private function getItalicFontFile()
1387
+ {
1388
+ return Mage::helper('firegento_pdf')->getFontPath() . DS
1389
+ . $this->getItalicFont();
1390
+ }
1391
+
1392
+
1393
+ /**
1394
+ * get the regular font path
1395
+ *
1396
+ * @return string
1397
+ */
1398
+ private function getRegularFont()
1399
+ {
1400
+ return Mage::getStoreConfig(
1401
+ FireGento_Pdf_Helper_Data::XML_PATH_REGULAR_FONT
1402
+ );
1403
+ }
1404
+
1405
+ /**
1406
+ * check whether font file exists for regular font
1407
+ *
1408
+ * @return bool
1409
+ */
1410
+ private function regularFontFileExists()
1411
+ {
1412
+ return file_exists($this->getRegularFontFile());
1413
+ }
1414
+
1415
+ /**
1416
+ * get the path to the font file for regular font
1417
+ *
1418
+ * @return string
1419
+ */
1420
+ private function getRegularFontFile()
1421
+ {
1422
+ return Mage::helper('firegento_pdf')->getFontPath() . DS
1423
+ . $this->getRegularFont();
1424
+ }
1425
  }
app/code/community/FireGento/Pdf/Model/Engine/Creditmemo/Default.php CHANGED
@@ -58,10 +58,9 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
58
  $pdf = new Zend_Pdf();
59
  $this->_setPdf($pdf);
60
 
61
- // pagecounter is 0 at the beginning, because it is incremented in newPage()
62
- $this->pagecounter = 0;
63
-
64
  foreach ($creditmemos as $creditmemo) {
 
 
65
  if ($creditmemo->getStoreId()) {
66
  Mage::app()->getLocale()->emulate($creditmemo->getStoreId());
67
  Mage::app()->setCurrentStore($creditmemo->getStoreId());
@@ -203,6 +202,10 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
203
  'model' => 'firegento_pdf/items_bundle',
204
  'renderer' => null
205
  );
 
 
 
 
206
  }
207
 
208
  }
58
  $pdf = new Zend_Pdf();
59
  $this->_setPdf($pdf);
60
 
 
 
 
61
  foreach ($creditmemos as $creditmemo) {
62
+ // pagecounter is 0 at the beginning, because it is incremented in newPage()
63
+ $this->pagecounter = 0;
64
  if ($creditmemo->getStoreId()) {
65
  Mage::app()->getLocale()->emulate($creditmemo->getStoreId());
66
  Mage::app()->setCurrentStore($creditmemo->getStoreId());
202
  'model' => 'firegento_pdf/items_bundle',
203
  'renderer' => null
204
  );
205
+ $this->_renderers['downloadable'] = array(
206
+ 'model' => 'firegento_pdf/items_downloadable',
207
+ 'renderer' => null
208
+ );
209
  }
210
 
211
  }
app/code/community/FireGento/Pdf/Model/Engine/Invoice/Default.php CHANGED
@@ -58,10 +58,9 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
58
  $pdf = new Zend_Pdf();
59
  $this->_setPdf($pdf);
60
 
61
- // pagecounter is 0 at the beginning, because it is incremented in newPage()
62
- $this->pagecounter = 0;
63
-
64
  foreach ($invoices as $invoice) {
 
 
65
  if ($invoice->getStoreId()) {
66
  Mage::app()->getLocale()->emulate($invoice->getStoreId());
67
  Mage::app()->setCurrentStore($invoice->getStoreId());
@@ -115,7 +114,7 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
115
  /**
116
  * Insert Table Header for Items
117
  *
118
- * @param Zend_Pdf_Page $page current page object of Zend_PDF
119
  *
120
  * @return void
121
  */
@@ -211,6 +210,10 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
211
  'model' => 'firegento_pdf/items_bundle',
212
  'renderer' => null
213
  );
 
 
 
 
214
  }
215
 
216
  }
58
  $pdf = new Zend_Pdf();
59
  $this->_setPdf($pdf);
60
 
 
 
 
61
  foreach ($invoices as $invoice) {
62
+ // pagecounter is 0 at the beginning, because it is incremented in newPage()
63
+ $this->pagecounter = 0;
64
  if ($invoice->getStoreId()) {
65
  Mage::app()->getLocale()->emulate($invoice->getStoreId());
66
  Mage::app()->setCurrentStore($invoice->getStoreId());
114
  /**
115
  * Insert Table Header for Items
116
  *
117
+ * @param Zend_Pdf_Page &$page current page object of Zend_PDF
118
  *
119
  * @return void
120
  */
210
  'model' => 'firegento_pdf/items_bundle',
211
  'renderer' => null
212
  );
213
+ $this->_renderers['downloadable'] = array(
214
+ 'model' => 'firegento_pdf/items_downloadable',
215
+ 'renderer' => null
216
+ );
217
  }
218
 
219
  }
app/code/community/FireGento/Pdf/Model/Engine/Shipment/Default.php CHANGED
@@ -20,6 +20,7 @@
20
  * @version $Id:$
21
  * @since 0.1.0
22
  */
 
23
  /**
24
  * Shipment model rewrite.
25
  *
@@ -31,7 +32,8 @@
31
  * @version $Id:$
32
  * @since 0.1.0
33
  */
34
- class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_Engine_Abstract
 
35
  {
36
 
37
  /**
@@ -58,10 +60,9 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
58
  $pdf = new Zend_Pdf();
59
  $this->_setPdf($pdf);
60
 
61
- // pagecounter is 0 at the beginning, because it is incremented in newPage()
62
- $this->pagecounter = 0;
63
-
64
  foreach ($shipments as $shipment) {
 
 
65
  if ($shipment->getStoreId()) {
66
  Mage::app()->getLocale()->emulate($shipment->getStoreId());
67
  Mage::app()->setCurrentStore($shipment->getStoreId());
@@ -86,7 +87,8 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
86
  }
87
 
88
  if ($this->y < 50
89
- || (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1
 
90
  && $this->y < 100)
91
  ) {
92
  $page = $this->newPage(array());
@@ -111,17 +113,19 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
111
  /**
112
  * Inserts the customer's shipping address.
113
  *
114
- * @param Zend_Pdf_Page $page Current page object of Zend_Pdf
115
- * @param Mage_Sales_Model_Order $order Order object
116
  *
117
  * @return void
118
  */
119
  protected function _insertCustomerAddress(&$page, $order)
120
  {
121
  $this->_setFontRegular($page, 9);
122
- $shipping = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
 
123
  foreach ($shipping as $line) {
124
- $page->drawText(trim(strip_tags($line)), $this->margin['left'], $this->y, $this->encoding);
 
125
  $this->Ln(12);
126
  }
127
  }
@@ -136,7 +140,8 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
136
  $page->setFillColor($this->colors['grey1']);
137
  $page->setLineColor($this->colors['grey1']);
138
  $page->setLineWidth(1);
139
- $page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'] - 10, $this->y - 15);
 
140
 
141
  $page->setFillColor($this->colors['black']);
142
  $this->_setFontRegular($page, 9);
@@ -173,10 +178,12 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
173
  {
174
  $this->_setFontRegular($page, 9);
175
 
176
- $billing = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
 
177
 
178
  foreach ($billing as $line) {
179
- $page->drawText(trim(strip_tags($line)), $this->margin['left'], $this->y, $this->encoding);
 
180
  $this->Ln(12);
181
  }
182
  }
20
  * @version $Id:$
21
  * @since 0.1.0
22
  */
23
+
24
  /**
25
  * Shipment model rewrite.
26
  *
32
  * @version $Id:$
33
  * @since 0.1.0
34
  */
35
+ class FireGento_Pdf_Model_Engine_Shipment_Default
36
+ extends FireGento_Pdf_Model_Engine_Abstract
37
  {
38
 
39
  /**
60
  $pdf = new Zend_Pdf();
61
  $this->_setPdf($pdf);
62
 
 
 
 
63
  foreach ($shipments as $shipment) {
64
+ // pagecounter is 0 at the beginning, because it is incremented in newPage()
65
+ $this->pagecounter = 0;
66
  if ($shipment->getStoreId()) {
67
  Mage::app()->getLocale()->emulate($shipment->getStoreId());
68
  Mage::app()->setCurrentStore($shipment->getStoreId());
87
  }
88
 
89
  if ($this->y < 50
90
+ || (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer')
91
+ == 1
92
  && $this->y < 100)
93
  ) {
94
  $page = $this->newPage(array());
113
  /**
114
  * Inserts the customer's shipping address.
115
  *
116
+ * @param Zend_Pdf_Page &$page current page object of Zend_Pdf
117
+ * @param Mage_Sales_Model_Order $order order object
118
  *
119
  * @return void
120
  */
121
  protected function _insertCustomerAddress(&$page, $order)
122
  {
123
  $this->_setFontRegular($page, 9);
124
+ $shipping = $this->_formatAddress($order->getShippingAddress()
125
+ ->format('pdf'));
126
  foreach ($shipping as $line) {
127
+ $page->drawText(trim(strip_tags($line)), $this->margin['left'],
128
+ $this->y, $this->encoding);
129
  $this->Ln(12);
130
  }
131
  }
140
  $page->setFillColor($this->colors['grey1']);
141
  $page->setLineColor($this->colors['grey1']);
142
  $page->setLineWidth(1);
143
+ $page->drawRectangle($this->margin['left'], $this->y,
144
+ $this->margin['right'] - 10, $this->y - 15);
145
 
146
  $page->setFillColor($this->colors['black']);
147
  $this->_setFontRegular($page, 9);
178
  {
179
  $this->_setFontRegular($page, 9);
180
 
181
+ $billing = $this->_formatAddress($order->getShippingAddress()
182
+ ->format('pdf'));
183
 
184
  foreach ($billing as $line) {
185
+ $page->drawText(trim(strip_tags($line)), $this->margin['left'],
186
+ $this->y, $this->encoding);
187
  $this->Ln(12);
188
  }
189
  }
app/code/community/FireGento/Pdf/Model/Invoice.php CHANGED
@@ -69,7 +69,7 @@ class FireGento_Pdf_Model_Invoice
69
  /**
70
  * get pdf for invoices
71
  *
72
- * @param array $invoices invoices to render pdfs for
73
  *
74
  * @return mixed
75
  */
69
  /**
70
  * get pdf for invoices
71
  *
72
+ * @param array|Varien_Data_Collection $invoices invoices to render pdfs for
73
  *
74
  * @return mixed
75
  */
app/code/community/FireGento/Pdf/Model/Items/Bundle.php CHANGED
@@ -116,10 +116,8 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
116
 
117
  /* in case Product name is longer than 80 chars - it is written in a few lines */
118
  if ($_item->getOrderItem()->getParentItem()) {
119
- $feed = 40;
120
  $name = $this->getValueHtml($_item);
121
  } else {
122
- $feed = 35;
123
  $name = $_item->getName();
124
  }
125
  $line[] = array(
@@ -130,35 +128,78 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
130
 
131
  // draw prices
132
  if ($this->canShowPriceInfo($_item)) {
133
- $price = $order->formatPriceTxt($_item->getPrice());
134
- $line[] = array(
135
- 'text' => $price,
136
- 'feed' => $pdf->margin['right'] - 160,
137
  'align' => 'right',
138
- 'font_size' => $fontSize
 
139
  );
140
- $line[] = array(
141
- 'text' => $_item->getQty() * 1,
142
- 'feed' => $pdf->margin['right'] - 120,
 
143
  'align' => 'right',
144
- 'font_size' => $fontSize
 
145
  );
146
 
147
- $tax = $order->formatPriceTxt($_item->getTaxAmount());
148
- $line[] = array(
149
- 'text' => $tax,
150
- 'feed' => $pdf->margin['right'] - 60,
151
  'align' => 'right',
152
- 'font_size' => $fontSize
 
153
  );
154
 
155
- $rowTotal = $order->formatPriceTxt($_item->getRowTotal());
156
- $line[] = array(
157
- 'text' => $rowTotal,
158
- 'feed' => $pdf->margin['right'] - 10,
159
  'align' => 'right',
160
- 'font_size' => $fontSize
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
163
 
164
  $drawItems[$optionId]['lines'][] = $line;
@@ -203,7 +244,6 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
203
  }
204
 
205
  $page = $pdf->drawLineBlocks($page, $drawItems, array('table_header' => true));
206
-
207
  $this->setPage($page);
208
  }
209
  }
116
 
117
  /* in case Product name is longer than 80 chars - it is written in a few lines */
118
  if ($_item->getOrderItem()->getParentItem()) {
 
119
  $name = $this->getValueHtml($_item);
120
  } else {
 
121
  $name = $_item->getName();
122
  }
123
  $line[] = array(
128
 
129
  // draw prices
130
  if ($this->canShowPriceInfo($_item)) {
131
+ $columns = array();
132
+ // prepare qty
133
+ $columns['qty'] = array(
134
+ 'text' => $item->getQty() * 1,
135
  'align' => 'right',
136
+ 'font_size' => $fontSize,
137
+ '_width' => 30
138
  );
139
+
140
+ // prepare price
141
+ $columns['price'] = array(
142
+ 'text' => $order->formatPriceTxt($item->getPrice()),
143
  'align' => 'right',
144
+ 'font_size' => $fontSize,
145
+ '_width' => 60
146
  );
147
 
148
+ // prepare price_incl_tax
149
+ $columns['price_incl_tax'] = array(
150
+ 'text' => $order->formatPriceTxt($item->getPriceInclTax()),
 
151
  'align' => 'right',
152
+ 'font_size' => $fontSize,
153
+ '_width' => 60
154
  );
155
 
156
+ // prepare tax
157
+ $columns['tax'] = array(
158
+ 'text' => $order->formatPriceTxt($item->getTaxAmount() + $item->getHiddenTaxAmount()),
 
159
  'align' => 'right',
160
+ 'font_size' => $fontSize,
161
+ '_width' => 50
162
+ );
163
+
164
+ // prepare tax_rate
165
+ $columns['tax_rate'] = array(
166
+ 'text' => round($item->getOrderItem()->getTaxPercent(), 2) . '%',
167
+ 'align' => 'right',
168
+ 'font_size' => $fontSize,
169
+ '_width' => 50
170
+ );
171
+
172
+ // prepare subtotal
173
+ $columns['subtotal'] = array(
174
+ 'text' => $order->formatPriceTxt($item->getRowTotal()),
175
+ 'align' => 'right',
176
+ 'font_size' => $fontSize,
177
+ '_width' => 50
178
  );
179
+
180
+ // prepare subtotal_incl_tax
181
+ $columns['subtotal_incl_tax'] = array(
182
+ 'text' => $order->formatPriceTxt($item->getRowTotalInclTax()),
183
+ 'align' => 'right',
184
+ 'font_size' => $fontSize,
185
+ '_width' => 70
186
+ );
187
+
188
+ // draw columns in specified order
189
+ $columnsOrder = explode(',', Mage::getStoreConfig('sales_pdf/invoice/item_price_column_order'));
190
+ // draw starting from right
191
+ $columnsOrder = array_reverse($columnsOrder);
192
+ $columnOffset = 0;
193
+ foreach ($columnsOrder as $columnName) {
194
+ $columnName = trim($columnName);
195
+ if (array_key_exists($columnName, $columns)) {
196
+ $column = $columns[$columnName];
197
+ $column['feed'] = $pdf->margin['right'] - $columnOffset;
198
+ $columnOffset += $column['_width'];
199
+ unset($column['_width']);
200
+ $line[] = $column;
201
+ }
202
+ }
203
  }
204
 
205
  $drawItems[$optionId]['lines'][] = $line;
244
  }
245
 
246
  $page = $pdf->drawLineBlocks($page, $drawItems, array('table_header' => true));
 
247
  $this->setPage($page);
248
  }
249
  }
app/code/community/FireGento/Pdf/Model/Items/Default.php CHANGED
@@ -117,7 +117,7 @@ class FireGento_Pdf_Model_Items_Default extends Mage_Sales_Model_Order_Pdf_Items
117
 
118
  // prepare tax
119
  $columns['tax'] = array(
120
- 'text' => $order->formatPriceTxt($item->getTaxAmount()),
121
  'align' => 'right',
122
  'font_size' => $fontSize,
123
  '_width' => 50
@@ -133,7 +133,7 @@ class FireGento_Pdf_Model_Items_Default extends Mage_Sales_Model_Order_Pdf_Items
133
 
134
  // prepare subtotal
135
  $columns['subtotal'] = array(
136
- 'text' => $order->formatPriceTxt($item->getPrice() * $item->getQty() * 1),
137
  'align' => 'right',
138
  'font_size' => $fontSize,
139
  '_width' => 50
@@ -141,7 +141,7 @@ class FireGento_Pdf_Model_Items_Default extends Mage_Sales_Model_Order_Pdf_Items
141
 
142
  // prepare subtotal_incl_tax
143
  $columns['subtotal_incl_tax'] = array(
144
- 'text' => $order->formatPriceTxt(($item->getPrice() * $item->getQty() * 1) + $item->getTaxAmount()),
145
  'align' => 'right',
146
  'font_size' => $fontSize,
147
  '_width' => 70
117
 
118
  // prepare tax
119
  $columns['tax'] = array(
120
+ 'text' => $order->formatPriceTxt($item->getTaxAmount() + $item->getHiddenTaxAmount()),
121
  'align' => 'right',
122
  'font_size' => $fontSize,
123
  '_width' => 50
133
 
134
  // prepare subtotal
135
  $columns['subtotal'] = array(
136
+ 'text' => $order->formatPriceTxt($item->getRowTotal()),
137
  'align' => 'right',
138
  'font_size' => $fontSize,
139
  '_width' => 50
141
 
142
  // prepare subtotal_incl_tax
143
  $columns['subtotal_incl_tax'] = array(
144
+ 'text' => $order->formatPriceTxt($item->getRowTotalInclTax()),
145
  'align' => 'right',
146
  'font_size' => $fontSize,
147
  '_width' => 70
app/code/community/FireGento/Pdf/Model/Items/Downloadable.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of a FireGento e.V. module.
4
+ *
5
+ * This FireGento e.V. module is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU General Public License version 3 as
7
+ * published by the Free Software Foundation.
8
+ *
9
+ * This script is distributed in the hope that it will be useful, but WITHOUT
10
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
+ *
13
+ * PHP version 5
14
+ *
15
+ * @category FireGento
16
+ * @package FireGento_Pdf
17
+ * @author FireGento Team <team@firegento.com>
18
+ * @copyright 2013 FireGento Team (http://www.firegento.com)
19
+ * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
20
+ */
21
+
22
+ /**
23
+ * Class FireGento_Pdf_Model_Items_Downloadable
24
+ *
25
+ * @category FireGento
26
+ * @package FireGento_Pdf
27
+ * @author FireGento Team <team@firegento.com>
28
+ */
29
+ class FireGento_Pdf_Model_Items_Downloadable
30
+ extends Mage_Downloadable_Model_Sales_Order_Pdf_Items_Invoice
31
+ {
32
+ /**
33
+ * Draw item line.
34
+ *
35
+ * @param int $position position of the product
36
+ *
37
+ * @return void
38
+ */
39
+ public function draw($position = 1)
40
+ {
41
+ $order = $this->getOrder();
42
+ $item = $this->getItem();
43
+ $pdf = $this->getPdf();
44
+ $page = $this->getPage();
45
+ $lines = array();
46
+
47
+ $fontSize = 9;
48
+
49
+ // draw Position Number
50
+ $lines[0] = array(
51
+ array(
52
+ 'text' => $position,
53
+ 'feed' => $pdf->margin['left'] + 10,
54
+ 'align' => 'right',
55
+ 'font_size' => $fontSize
56
+ )
57
+ );
58
+
59
+ // draw SKU
60
+ $lines[0][] = array(
61
+ 'text' => Mage::helper('core/string')
62
+ ->str_split($this->getSku($item), 19),
63
+ 'feed' => $pdf->margin['left'] + 25,
64
+ 'font_size' => $fontSize
65
+ );
66
+
67
+ // draw Product name
68
+ $lines[0][] = array(
69
+ 'text' => Mage::helper('core/string')
70
+ ->str_split($item->getName(), 40, true, true),
71
+ 'feed' => $pdf->margin['left'] + 130,
72
+ 'font_size' => $fontSize
73
+ );
74
+
75
+ $options = $this->getItemOptions();
76
+ if ($options) {
77
+ foreach ($options as $option) {
78
+ $optionTxt = $option['label'] . ': ';
79
+ // append option value
80
+ if ($option['value']) {
81
+ $optionTxt .= isset($option['print_value'])
82
+ ? $option['print_value'] : strip_tags($option['value']);
83
+ }
84
+ $optionArray = $pdf->_prepareText($optionTxt, $page,
85
+ $pdf->getFontRegular(), $fontSize, 215);
86
+ $lines[][] = array(
87
+ 'text' => $optionArray,
88
+ 'feed' => $pdf->margin['left'] + 135
89
+ );
90
+ }
91
+ }
92
+
93
+ // downloadable Items
94
+ $_purchasedItems = $this->getLinks()->getPurchasedItems();
95
+
96
+ // draw Links title
97
+ $lines[][] = array(
98
+ 'text' => Mage::helper('core/string')
99
+ ->str_split($this->getLinksTitle(), 70, true, true),
100
+ 'feed' => $pdf->margin['left'] + 130,
101
+ 'font' => 'italic',
102
+ );
103
+
104
+ // draw Links
105
+ foreach ($_purchasedItems as $_link) {
106
+ $lines[][] = array(
107
+ 'text' => Mage::helper('core/string')
108
+ ->str_split($_link->getLinkTitle(), 50, true, true),
109
+ 'feed' => $pdf->margin['left'] + 135
110
+ );
111
+ }
112
+
113
+
114
+ $columns = array();
115
+ // prepare qty
116
+ $columns['qty'] = array(
117
+ 'text' => $item->getQty() * 1,
118
+ 'align' => 'right',
119
+ 'font_size' => $fontSize,
120
+ '_width' => 30
121
+ );
122
+
123
+ // prepare price
124
+ $columns['price'] = array(
125
+ 'text' => $order->formatPriceTxt($item->getPrice()),
126
+ 'align' => 'right',
127
+ 'font_size' => $fontSize,
128
+ '_width' => 60
129
+ );
130
+
131
+ // prepare price_incl_tax
132
+ $columns['price_incl_tax'] = array(
133
+ 'text' => $order->formatPriceTxt($item->getPriceInclTax()),
134
+ 'align' => 'right',
135
+ 'font_size' => $fontSize,
136
+ '_width' => 60
137
+ );
138
+
139
+ // prepare tax
140
+ $columns['tax'] = array(
141
+ 'text' => $order->formatPriceTxt($item->getTaxAmount()),
142
+ 'align' => 'right',
143
+ 'font_size' => $fontSize,
144
+ '_width' => 50
145
+ );
146
+
147
+ // prepare tax_rate
148
+ $columns['tax_rate'] = array(
149
+ 'text' => round($item->getOrderItem()->getTaxPercent(), 2)
150
+ . '%',
151
+ 'align' => 'right',
152
+ 'font_size' => $fontSize,
153
+ '_width' => 50
154
+ );
155
+
156
+ // prepare subtotal
157
+ $columns['subtotal'] = array(
158
+ 'text' => $order->formatPriceTxt($item->getPrice()
159
+ * $item->getQty() * 1),
160
+ 'align' => 'right',
161
+ 'font_size' => $fontSize,
162
+ '_width' => 50
163
+ );
164
+
165
+ // prepare subtotal_incl_tax
166
+ $columns['subtotal_incl_tax'] = array(
167
+ 'text' => $order->formatPriceTxt(($item->getPrice()
168
+ * $item->getQty() * 1) + $item->getTaxAmount()),
169
+ 'align' => 'right',
170
+ 'font_size' => $fontSize,
171
+ '_width' => 70
172
+ );
173
+
174
+ // draw columns in specified order
175
+ $columnsOrder = explode(',',
176
+ Mage::getStoreConfig('sales_pdf/invoice/item_price_column_order'));
177
+ // draw starting from right
178
+ $columnsOrder = array_reverse($columnsOrder);
179
+ $columnOffset = 0;
180
+ foreach ($columnsOrder as $columnName) {
181
+ $columnName = trim($columnName);
182
+ if (array_key_exists($columnName, $columns)) {
183
+ $column = $columns[$columnName];
184
+ $column['feed'] = $pdf->margin['right'] - $columnOffset;
185
+ $columnOffset += $column['_width'];
186
+ unset($column['_width']);
187
+ $lines[0][] = $column;
188
+ }
189
+ }
190
+
191
+ if (Mage::getStoreConfig('sales_pdf/invoice/show_item_discount')
192
+ && 0 < $item->getDiscountAmount()
193
+ ) {
194
+ // print discount
195
+ $text = Mage::helper('firegento_pdf')->__(
196
+ 'You get a discount of %s.',
197
+ $order->formatPriceTxt($item->getDiscountAmount())
198
+ );
199
+ $lines[][] = array(
200
+ 'text' => $text,
201
+ 'align' => 'right',
202
+ 'feed' => $pdf->margin['right'] - $columnOffset
203
+ );
204
+ }
205
+
206
+ $lineBlock = array(
207
+ 'lines' => $lines,
208
+ 'height' => 15
209
+ );
210
+
211
+ $page = $pdf->drawLineBlocks($page, array($lineBlock),
212
+ array('table_header' => true));
213
+ $this->setPage($page);
214
+ }
215
+ }
app/code/community/FireGento/Pdf/Model/Observer.php CHANGED
@@ -52,7 +52,7 @@ class FireGento_Pdf_Model_Observer
52
  }
53
 
54
  /**
55
- * add inovoice date notice to pdf
56
  *
57
  * @param Varien_Event_Observer $observer observer object
58
  *
@@ -156,7 +156,7 @@ class FireGento_Pdf_Model_Observer
156
  *
157
  * @param Varien_Event_Observer $observer observer object
158
  *
159
- * @return $this
160
  */
161
  public function addInvoiceComments(Varien_Event_Observer $observer)
162
  {
@@ -186,9 +186,9 @@ class FireGento_Pdf_Model_Observer
186
  /**
187
  * Adds a barcode representing the order number to the shipment if activated.
188
  *
189
- * @param Varien_Event_Observer $observer
190
  *
191
- * @return $this
192
  */
193
  public function addBarcode(Varien_Event_Observer $observer)
194
  {
52
  }
53
 
54
  /**
55
+ * add invoice date notice to pdf
56
  *
57
  * @param Varien_Event_Observer $observer observer object
58
  *
156
  *
157
  * @param Varien_Event_Observer $observer observer object
158
  *
159
+ * @return FireGento_Pdf_Model_Observer
160
  */
161
  public function addInvoiceComments(Varien_Event_Observer $observer)
162
  {
186
  /**
187
  * Adds a barcode representing the order number to the shipment if activated.
188
  *
189
+ * @param Varien_Event_Observer $observer observer which is passed by magento
190
  *
191
+ * @return FireGento_Pdf_Model_Observer
192
  */
193
  public function addBarcode(Varien_Event_Observer $observer)
194
  {
app/code/community/FireGento/Pdf/Model/Shipment.php CHANGED
@@ -66,7 +66,7 @@ class FireGento_Pdf_Model_Shipment
66
  /**
67
  * get PDF object
68
  *
69
- * @param array $shipments shipments to generate pdfs for
70
  *
71
  * @return mixed
72
  */
66
  /**
67
  * get PDF object
68
  *
69
+ * @param array|Varien_Data_Collection $shipments shipments to generate pdfs for
70
  *
71
  * @return mixed
72
  */
app/code/community/FireGento/Pdf/Model/System/Config/Backend/Font.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of a FireGento e.V. module.
4
+ *
5
+ * This FireGento e.V. module is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU General Public License version 3 as
7
+ * published by the Free Software Foundation.
8
+ *
9
+ * This script is distributed in the hope that it will be useful, but WITHOUT
10
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
+ *
13
+ * PHP version 5
14
+ *
15
+ * @category FireGento
16
+ * @package FireGento_Pdf
17
+ * @author FireGento Team <team@firegento.com>
18
+ * @copyright 2013 FireGento Team (http://www.firegento.com)
19
+ * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
20
+ */
21
+
22
+ /**
23
+ * Class FireGento_Pdf_Model_System_Config_Backend_Font
24
+ *
25
+ * @category FireGento
26
+ * @package FireGento_Pdf
27
+ * @author FireGento Team <team@firegento.com>
28
+ */
29
+ class FireGento_Pdf_Model_System_Config_Backend_Font
30
+ extends Mage_Adminhtml_Model_System_Config_Backend_File
31
+ {
32
+ private $_allowedExtensions
33
+ = array(
34
+ 'otf',
35
+ 'ttf',
36
+ );
37
+
38
+ /**
39
+ * Returns the allowed font extensions.
40
+ *
41
+ * @return array containing the allowed font extensions
42
+ */
43
+ protected function _getAllowedExtensions()
44
+ {
45
+ return $this->_allowedExtensions;
46
+ }
47
+ }
app/code/community/FireGento/Pdf/Model/System/Config/Source/Headerblocks.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the FIREGENTO project.
4
+ *
5
+ * FireGento_Pdf is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU General Public License version 3 as
7
+ * published by the Free Software Foundation.
8
+ *
9
+ * This script is distributed in the hope that it will be useful, but WITHOUT
10
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
+ *
13
+ * PHP version 5
14
+ *
15
+ * @category FireGento
16
+ * @package FireGento_Pdf
17
+ * @author FireGento Team <team@firegento.com>
18
+ * @copyright 2013 FireGento Team (http://www.firegento.com)
19
+ * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
20
+ * @version $Id:$
21
+ * @since 0.1.0
22
+ */
23
+ /**
24
+ * Logo position source model.
25
+ *
26
+ * @category FireGento
27
+ * @package FireGento_Pdf
28
+ * @author FireGento Team <team@firegento.com>
29
+ * @copyright 2013 FireGento Team (http://www.firegento.com)
30
+ * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
31
+ * @version $Id:$
32
+ * @since 0.1.0
33
+ */
34
+ class FireGento_Pdf_Model_System_Config_Source_Headerblocks
35
+ {
36
+ const LEFT = 'left';
37
+ const RIGHT = 'right';
38
+
39
+ /**
40
+ * Return array of possible positions.
41
+ *
42
+ * @return array
43
+ */
44
+ public function toOptionArray()
45
+ {
46
+ $positions = array(
47
+ self::LEFT => Mage::helper('firegento_pdf')->__('Left'),
48
+ self::RIGHT => Mage::helper('firegento_pdf')->__('Right'),
49
+ );
50
+ $options = array();
51
+ foreach ($positions as $k => $v) {
52
+ $options[] = array(
53
+ 'value' => $k,
54
+ 'label' => $v
55
+ );
56
+ }
57
+ return $options;
58
+ }
59
+ }
app/code/community/FireGento/Pdf/Model/Tax/Sales/Pdf/Grandtotal.php CHANGED
@@ -33,6 +33,7 @@ class FireGento_Pdf_Model_Tax_Sales_Pdf_Grandtotal extends Mage_Tax_Model_Sales_
33
  {
34
 
35
  const NO_SUM_ON_DETAILS = 'tax/sales_display/no_sum_on_details';
 
36
 
37
  /**
38
  * Check if tax amount should be included to grandtotals block
@@ -51,6 +52,7 @@ class FireGento_Pdf_Model_Tax_Sales_Pdf_Grandtotal extends Mage_Tax_Model_Sales_
51
  $store = $this->getOrder()->getStore();
52
  $config = Mage::getSingleton('tax/config');
53
  $noDisplaySumOnDetails = Mage::getStoreConfig(self::NO_SUM_ON_DETAILS, $store);
 
54
  if (!$config->displaySalesTaxWithGrandTotal($store)) {
55
  return parent::getTotalsForDisplay();
56
  }
@@ -61,11 +63,14 @@ class FireGento_Pdf_Model_Tax_Sales_Pdf_Grandtotal extends Mage_Tax_Model_Sales_
61
  $tax = $this->getOrder()->formatPriceTxt($this->getSource()->getTaxAmount());
62
  $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
63
 
64
- $totals = array(array(
65
- 'amount' => $this->getAmountPrefix() . $amountExclTax,
66
- 'label' => Mage::helper('tax')->__('Grand Total (Excl. Tax)') . ':',
67
- 'font_size' => $fontSize
68
- ));
 
 
 
69
 
70
  /**
71
  * if display_sales_full_summary = 1
33
  {
34
 
35
  const NO_SUM_ON_DETAILS = 'tax/sales_display/no_sum_on_details';
36
+ const HIDE_GRANDTOTAL_EXCL_TAX = 'tax/sales_display/hide_grandtotal_excl_tax';
37
 
38
  /**
39
  * Check if tax amount should be included to grandtotals block
52
  $store = $this->getOrder()->getStore();
53
  $config = Mage::getSingleton('tax/config');
54
  $noDisplaySumOnDetails = Mage::getStoreConfig(self::NO_SUM_ON_DETAILS, $store);
55
+ $hideGrandTotalExclTax = Mage::getStoreConfig(self::HIDE_GRANDTOTAL_EXCL_TAX, $store);
56
  if (!$config->displaySalesTaxWithGrandTotal($store)) {
57
  return parent::getTotalsForDisplay();
58
  }
63
  $tax = $this->getOrder()->formatPriceTxt($this->getSource()->getTaxAmount());
64
  $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
65
 
66
+ $totals = array();
67
+ if (!$hideGrandTotalExclTax) {
68
+ $totals[] = array(
69
+ 'amount' => $this->getAmountPrefix() . $amountExclTax,
70
+ 'label' => Mage::helper('tax')->__('Grand Total (Excl. Tax)') . ':',
71
+ 'font_size' => $fontSize
72
+ );
73
+ }
74
 
75
  /**
76
  * if display_sales_full_summary = 1
app/code/community/FireGento/Pdf/Test/Model/CreditmemoTest.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class FireGento_Pdf_Test_Model_CreditmemoTest extends FireGento_Pdf_Test_Model_SalesObjectTestAbstract
5
+ {
6
+ protected $class = 'FireGento_Pdf_Model_Creditmemo';
7
+
8
+ public function getEngineXmlConfigPath()
9
+ {
10
+ return 'sales_pdf/creditmemo/engine';
11
+ }
12
+
13
+ public function getExpectedDefaultEngineClass()
14
+ {
15
+ return 'Mage_Sales_Model_Order_Pdf_Creditmemo';
16
+ }
17
+
18
+ public function getOrderObjectClassName()
19
+ {
20
+ return 'Mage_Sales_Model_Order_Creditmemo';
21
+ }
22
+ }
app/code/community/FireGento/Pdf/Test/Model/InvoiceTest.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class FireGento_Pdf_Test_Model_InvoiceTest extends FireGento_Pdf_Test_Model_SalesObjectTestAbstract
5
+ {
6
+ protected $class = 'FireGento_Pdf_Model_Invoice';
7
+
8
+ public function getEngineXmlConfigPath()
9
+ {
10
+ return 'sales_pdf/invoice/engine';
11
+ }
12
+
13
+ public function getExpectedDefaultEngineClass()
14
+ {
15
+ return 'Mage_Sales_Model_Order_Pdf_Invoice';
16
+ }
17
+
18
+ public function getOrderObjectClassName()
19
+ {
20
+ return 'Mage_Sales_Model_Order_Invoice';
21
+ }
22
+ }
app/code/community/FireGento/Pdf/Test/Model/SalesObjectTestAbstract.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ abstract class FireGento_Pdf_Test_Model_SalesObjectTestAbstract
5
+ extends EcomDev_PHPUnit_Test_Case
6
+ {
7
+ protected $class = '';
8
+
9
+ /**
10
+ * @test
11
+ */
12
+ public function itShouldExist()
13
+ {
14
+ $this->assertTrue(class_exists($this->class));
15
+ }
16
+
17
+ /**
18
+ * @test
19
+ * @depends itShouldExist
20
+ */
21
+ public function itShouldHaveAMethodGetEngine()
22
+ {
23
+ try {
24
+ new ReflectionMethod($this->class, 'getEngine');
25
+ } catch (ReflectionException $e) {
26
+ $this->fail($e->getMessage());
27
+ }
28
+ }
29
+
30
+ abstract function getEngineXmlConfigPath();
31
+
32
+ abstract function getExpectedDefaultEngineClass();
33
+
34
+ abstract public function getOrderObjectClassName();
35
+
36
+ /**
37
+ * @test
38
+ * @depends itShouldHaveAMethodGetEngine
39
+ */
40
+ public function itShouldReturnADefaultEngineModel()
41
+ {
42
+ $this->app()->getStore()->setConfig($this->getEngineXmlConfigPath(), 'invalid');
43
+ $instance = new $this->class;
44
+ $result = $this->callMethod($instance, 'getEngine');
45
+ $this->assertInstanceOf($this->getExpectedDefaultEngineClass(), $result);
46
+ }
47
+
48
+ /**
49
+ * @test
50
+ * @depends itShouldExist
51
+ */
52
+ public function itShouldhaveAMethodGetPdf()
53
+ {
54
+ $instance = new $this->class;
55
+ $this->assertTrue(is_callable(array($instance, 'getPdf')));
56
+ }
57
+
58
+ /**
59
+ * @test
60
+ * @depends itShouldhaveAMethodGetPdf
61
+ */
62
+ public function itShouldReturnAZendPdf()
63
+ {
64
+ $instance = new $this->class;
65
+
66
+ $mockAddress = $this->getMock('Mage_Sales_Model_Order_Address');
67
+
68
+ $mockPaymentMethod = $this->getMockForAbstractClass('Mage_Payment_Model_Method_Abstract');
69
+
70
+ $mockPaymentInfo = $this->getMock('Mage_Sales_Model_Order_Payment');
71
+ $mockPaymentInfo->expects($this->any())
72
+ ->method('getMethodInstance')
73
+ ->will($this->returnValue($mockPaymentMethod));
74
+
75
+ $mockOrder = $this->getMock('Mage_Sales_Model_Order');
76
+ $mockOrder->expects($this->any())
77
+ ->method('getBillingAddress')
78
+ ->will($this->returnValue($mockAddress));
79
+ $mockOrder->expects($this->any())
80
+ ->method('getShippingAddress')
81
+ ->will($this->returnValue($mockAddress));
82
+
83
+ $mockOrder->expects($this->any())
84
+ ->method('getPayment')
85
+ ->will($this->returnValue($mockPaymentInfo));
86
+
87
+ $mockObj = $this->getMockBuilder($this->getOrderObjectClassName())
88
+ ->disableOriginalConstructor()
89
+ ->getMock();
90
+ $mockObj->expects($this->any())
91
+ ->method('getOrder')
92
+ ->will($this->returnValue($mockOrder));
93
+ $mockObj->expects($this->any())
94
+ ->method('getAllItems')
95
+ ->will($this->returnValue(array()));
96
+
97
+ $result = $instance->getPdf(array($mockObj));
98
+ $this->assertInstanceOf('Zend_Pdf', $result);
99
+ }
100
+
101
+
102
+ protected function callMethod($object, $method, array $args = null)
103
+ {
104
+ $method = new ReflectionMethod($object, $method);
105
+ $method->setAccessible(true);
106
+ if (isset($args)) {
107
+ return $method->invokeArgs($object, $args);
108
+ } else {
109
+ return $method->invoke($object);
110
+ }
111
+ }
112
+ }
app/code/community/FireGento/Pdf/Test/Model/ShipmentTest.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class FireGento_Pdf_Test_Model_ShipmentTest extends FireGento_Pdf_Test_Model_SalesObjectTestAbstract
5
+ {
6
+ protected $class = 'FireGento_Pdf_Model_Shipment';
7
+
8
+ public function getEngineXmlConfigPath()
9
+ {
10
+ return 'sales_pdf/invoice/shipment';
11
+ }
12
+
13
+ public function getExpectedDefaultEngineClass()
14
+ {
15
+ return 'Mage_Sales_Model_Order_Pdf_Shipment';
16
+ }
17
+
18
+ public function getOrderObjectClassName()
19
+ {
20
+ return 'Mage_Sales_Model_Order_Shipment';
21
+ }
22
+ }
app/code/community/FireGento/Pdf/controllers/Adminhtml/Sales/Order/CreditmemoController.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of a FireGento e.V. module.
4
+ *
5
+ * This FireGento e.V. module is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU General Public License version 3 as
7
+ * published by the Free Software Foundation.
8
+ *
9
+ * This script is distributed in the hope that it will be useful, but WITHOUT
10
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
+ *
13
+ * PHP version 5
14
+ *
15
+ * @category FireGento
16
+ * @package FireGento_Pdf
17
+ * @author FireGento Team <team@firegento.com>
18
+ * @copyright 2013 FireGento Team (http://www.firegento.com)
19
+ * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
20
+ */
21
+ require('Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php');
22
+
23
+ /**
24
+ * Class FireGento_Pdf_Adminhtml_Sales_Order_CreditmemoController
25
+ *
26
+ * @category FireGento
27
+ * @package FireGento_Pdf
28
+ * @author FireGento Team <team@firegento.com>
29
+ */
30
+ class FireGento_Pdf_Adminhtml_Sales_Order_CreditmemoController
31
+ extends Mage_Adminhtml_Sales_Order_CreditmemoController
32
+ {
33
+
34
+ /**
35
+ * Create pdf for current creditmemo
36
+ */
37
+ public function printAction()
38
+ {
39
+ $this->_initCreditmemo();
40
+ /** @see Mage_Adminhtml_Sales_Order_InvoiceController */
41
+ if ($creditmemoId = $this->getRequest()->getParam('creditmemo_id')) {
42
+ if ($creditmemo = Mage::getModel('sales/order_creditmemo')
43
+ ->load($creditmemoId)
44
+ ) {
45
+ $pdf = Mage::getModel('sales/order_pdf_creditmemo')
46
+ ->getPdf(array($creditmemo));
47
+ $this->_prepareDownloadResponse(
48
+ Mage::helper('firegento_pdf')
49
+ ->getExportFilename('creditmemo', $creditmemo),
50
+ $pdf->render(), 'application/pdf'
51
+ );
52
+ }
53
+ } else {
54
+ $this->_forward('noRoute');
55
+ }
56
+ }
57
+
58
+ }
app/code/community/FireGento/Pdf/controllers/Adminhtml/Sales/Order/InvoiceController.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of a FireGento e.V. module.
4
+ *
5
+ * This FireGento e.V. module is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU General Public License version 3 as
7
+ * published by the Free Software Foundation.
8
+ *
9
+ * This script is distributed in the hope that it will be useful, but WITHOUT
10
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
+ *
13
+ * PHP version 5
14
+ *
15
+ * @category FireGento
16
+ * @package FireGento_Pdf
17
+ * @author FireGento Team <team@firegento.com>
18
+ * @copyright 2013 FireGento Team (http://www.firegento.com)
19
+ * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
20
+ */
21
+
22
+ require('Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php');
23
+
24
+ /**
25
+ * Class FireGento_Pdf_Adminhtml_Sales_Order_InvoiceController
26
+ *
27
+ * @category FireGento
28
+ * @package FireGento_Pdf
29
+ * @author FireGento Team <team@firegento.com>
30
+ */
31
+ class FireGento_Pdf_Adminhtml_Sales_Order_InvoiceController
32
+ extends Mage_Adminhtml_Sales_Order_InvoiceController
33
+ {
34
+
35
+ /**
36
+ * Create pdf for current invoice
37
+ */
38
+ public function printAction()
39
+ {
40
+ $this->_initInvoice();
41
+ if ($invoiceId = $this->getRequest()->getParam('invoice_id')) {
42
+ if ($invoice = Mage::getModel('sales/order_invoice')
43
+ ->load($invoiceId)
44
+ ) {
45
+ $pdf = Mage::getModel('sales/order_pdf_invoice')
46
+ ->getPdf(array($invoice));
47
+ $this->_prepareDownloadResponse(
48
+ Mage::helper('firegento_pdf')
49
+ ->getExportFilename('invoice', $invoice),
50
+ $pdf->render(), 'application/pdf'
51
+ );
52
+ }
53
+ } else {
54
+ $this->_forward('noRoute');
55
+ }
56
+ }
57
+
58
+ }
app/code/community/FireGento/Pdf/controllers/Adminhtml/Sales/Order/ShipmentController.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of a FireGento e.V. module.
4
+ *
5
+ * This FireGento e.V. module is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU General Public License version 3 as
7
+ * published by the Free Software Foundation.
8
+ *
9
+ * This script is distributed in the hope that it will be useful, but WITHOUT
10
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
+ *
13
+ * PHP version 5
14
+ *
15
+ * @category FireGento
16
+ * @package FireGento_Pdf
17
+ * @author FireGento Team <team@firegento.com>
18
+ * @copyright 2013 FireGento Team (http://www.firegento.com)
19
+ * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
20
+ */
21
+
22
+ require('Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php');
23
+
24
+ /**
25
+ * Class FireGento_Pdf_Adminhtml_Sales_Order_ShipmentController
26
+ *
27
+ * @category FireGento
28
+ * @package FireGento_Pdf
29
+ * @author FireGento Team <team@firegento.com>
30
+ */
31
+ class FireGento_Pdf_Adminhtml_Sales_Order_ShipmentController
32
+ extends Mage_Adminhtml_Sales_Order_ShipmentController
33
+ {
34
+
35
+ /**
36
+ * Create pdf for current shipment
37
+ */
38
+ public function printAction()
39
+ {
40
+ /** @see Mage_Adminhtml_Sales_Order_InvoiceController */
41
+ if ($shipmentId = $this->getRequest()->getParam('invoice_id')
42
+ ) { // invoice_id o_0
43
+ if ($shipment = Mage::getModel('sales/order_shipment')
44
+ ->load($shipmentId)
45
+ ) {
46
+ $pdf = Mage::getModel('sales/order_pdf_shipment')
47
+ ->getPdf(array($shipment));
48
+ $this->_prepareDownloadResponse(
49
+ Mage::helper('firegento_pdf')
50
+ ->getExportFilename('shipment', $shipment),
51
+ $pdf->render(), 'application/pdf'
52
+ );
53
+ }
54
+ } else {
55
+ $this->_forward('noRoute');
56
+ }
57
+ }
58
+
59
+ }
app/code/community/FireGento/Pdf/controllers/Sales/OrderController.php CHANGED
@@ -22,6 +22,7 @@
22
  */
23
 
24
  require_once 'Mage/Sales/controllers/OrderController.php';
 
25
  /**
26
  * Sales orders controller
27
  *
@@ -35,41 +36,95 @@ require_once 'Mage/Sales/controllers/OrderController.php';
35
  */
36
  class FireGento_Pdf_Sales_OrderController extends Mage_Sales_OrderController
37
  {
 
 
 
 
 
38
  /**
39
  * Print PDF Invoice Action
40
  *
 
 
41
  * @return void
42
  */
43
  public function printInvoiceAction()
44
  {
45
- $invoiceId = (int) $this->getRequest()->getParam('invoice_id');
46
- if ($invoiceId) {
47
- $invoice = Mage::getModel('sales/order_invoice')->load($invoiceId);
48
- $order = $invoice->getOrder();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  } else {
50
- $orderId = (int) $this->getRequest()->getParam('order_id');
51
  $order = Mage::getModel('sales/order')->load($orderId);
52
  }
53
 
54
  if ($this->_canViewOrder($order)) {
55
  if (isset($orderId)) {
56
- // Create a pdf file from all invoices of requested order.
57
- $invoices = Mage::getResourceModel('sales/order_invoice_collection')
 
 
58
  ->addAttributeToSelect('*')
59
  ->addAttributeToFilter('order_id', $orderId)
60
  ->load();
61
  } else {
62
- // Create a single invoice pdf.
63
- $invoices = array($invoice);
64
  }
65
 
66
- // Store current area and set to adminhtml for invoice generation.
67
  $currentArea = Mage::getDesign()->getArea();
68
  Mage::getDesign()->setArea('adminhtml');
69
 
70
- $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices);
71
- $this->_prepareDownloadResponse('invoice' . Mage::getSingleton('core/date')->date('Y-m-d_H-i-s') .
72
- '.pdf', $pdf->render(), 'application/pdf');
 
 
 
73
 
74
  // Restore area.
75
  Mage::getDesign()->setArea($currentArea);
22
  */
23
 
24
  require_once 'Mage/Sales/controllers/OrderController.php';
25
+
26
  /**
27
  * Sales orders controller
28
  *
36
  */
37
  class FireGento_Pdf_Sales_OrderController extends Mage_Sales_OrderController
38
  {
39
+ protected $_types
40
+ = array(
41
+ 'invoice', 'creditmemo', 'shipment'
42
+ );
43
+
44
  /**
45
  * Print PDF Invoice Action
46
  *
47
+ * it changes the standard action with html output to pdf output
48
+ *
49
  * @return void
50
  */
51
  public function printInvoiceAction()
52
  {
53
+ $this->printDocument('invoice');
54
+ }
55
+
56
+ /**
57
+ * Print PDF Creditmemo action
58
+ *
59
+ * it changes the standard action with html output to pdf output
60
+ *
61
+ * @return void
62
+ */
63
+
64
+ public function printCreditmemoAction()
65
+ {
66
+ $this->printDocument('creditmemo');
67
+ }
68
+
69
+ /**
70
+ * Print PDF Shipment Action
71
+ *
72
+ * it changes the standard action with html output to pdf output
73
+ *
74
+ * @return void
75
+ */
76
+ public function printShipmentAction()
77
+ {
78
+ $this->printDocument('shipment');
79
+ }
80
+
81
+ /**
82
+ * Create invoice, creditmemo or shipment pdf
83
+ *
84
+ * @param string $type which document should be created? invoice, creditmemo or shipment
85
+ */
86
+ public function printDocument($type)
87
+ {
88
+ if (!in_array($type, $this->_types)) {
89
+ Mage::throwException('Type not found in type table.');
90
+ }
91
+ /* @var $order Mage_Sales_Model_Order */
92
+ $documentId = (int)$this->getRequest()->getParam($type . '_id');
93
+ $document = null;
94
+ if ($documentId) {
95
+ /* @var $document Mage_Sales_Model_Abstract */
96
+ $document = Mage::getModel('sales/order_' . $type);
97
+ $document->load($documentId);
98
+ $order = $document->getOrder();
99
  } else {
100
+ $orderId = (int)$this->getRequest()->getParam('order_id');
101
  $order = Mage::getModel('sales/order')->load($orderId);
102
  }
103
 
104
  if ($this->_canViewOrder($order)) {
105
  if (isset($orderId)) {
106
+ // Create a pdf file from all $type s of requested order.
107
+ /* @var $documentsCollection Mage_Sales_Model_Resource_Order_Collection_Abstract */
108
+ $documentsCollection = Mage::getResourceModel('sales/order_' . $type . '_collection');
109
+ $documentsCollection
110
  ->addAttributeToSelect('*')
111
  ->addAttributeToFilter('order_id', $orderId)
112
  ->load();
113
  } else {
114
+ // Create a single $type pdf.
115
+ $documentsCollection = array($document);
116
  }
117
 
118
+ // Store current area and set to adminhtml for $type generation.
119
  $currentArea = Mage::getDesign()->getArea();
120
  Mage::getDesign()->setArea('adminhtml');
121
 
122
+ /* @var $pdfGenerator Mage_Sales_Model_Order_Pdf_Abstract */
123
+ $pdfGenerator = Mage::getModel('sales/order_pdf_' . $type);
124
+ $pdf = $pdfGenerator->getPdf($documentsCollection);
125
+ $this->_prepareDownloadResponse(
126
+ Mage::helper('firegento_pdf')->getExportFilename($type, $document), $pdf->render(), 'application/pdf'
127
+ );
128
 
129
  // Restore area.
130
  Mage::getDesign()->setArea($currentArea);
app/code/community/FireGento/Pdf/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <FireGento_Pdf>
5
- <version>1.2.0</version>
6
  </FireGento_Pdf>
7
  </modules>
8
  <global>
@@ -106,10 +106,31 @@
106
  </modules>
107
  </translate>
108
  </adminhtml>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  <default>
110
  <sales_pdf>
 
 
 
111
  <invoice>
112
- <engine />
113
  <show_customer_number>1</show_customer_number>
114
  <show_date_notice>0</show_date_notice>
115
  <maturity/>
@@ -121,17 +142,20 @@
121
  <show_item_discount>0</show_item_discount>
122
  </invoice>
123
  <shipment>
124
- <engine />
125
  <show_customer_number>1</show_customer_number>
126
  <shipping_method_position/>
127
  <note/>
128
  <order_id_as_barcode>0</order_id_as_barcode>
129
  </shipment>
130
  <creditmemo>
131
- <engine />
132
  <show_customer_number>1</show_customer_number>
133
  <note/>
134
  </creditmemo>
 
 
 
135
  </sales_pdf>
136
  <tax>
137
  <sales_display>
2
  <config>
3
  <modules>
4
  <FireGento_Pdf>
5
+ <version>1.3.0</version>
6
  </FireGento_Pdf>
7
  </modules>
8
  <global>
106
  </modules>
107
  </translate>
108
  </adminhtml>
109
+ <admin>
110
+ <routers>
111
+ <adminhtml>
112
+ <args>
113
+ <modules>
114
+ <firegento_pdf before="Mage_Adminhtml">FireGento_Pdf_Adminhtml</firegento_pdf>
115
+ </modules>
116
+ </args>
117
+ </adminhtml>
118
+ </routers>
119
+ </admin>
120
+ <phpunit>
121
+ <suite>
122
+ <modules>
123
+ <FireGento_Pdf>1</FireGento_Pdf>
124
+ </modules>
125
+ </suite>
126
+ </phpunit>
127
  <default>
128
  <sales_pdf>
129
+ <firegento_pdf>
130
+ <headerblocks_position>left</headerblocks_position>
131
+ </firegento_pdf>
132
  <invoice>
133
+ <engine/>
134
  <show_customer_number>1</show_customer_number>
135
  <show_date_notice>0</show_date_notice>
136
  <maturity/>
142
  <show_item_discount>0</show_item_discount>
143
  </invoice>
144
  <shipment>
145
+ <engine/>
146
  <show_customer_number>1</show_customer_number>
147
  <shipping_method_position/>
148
  <note/>
149
  <order_id_as_barcode>0</order_id_as_barcode>
150
  </shipment>
151
  <creditmemo>
152
+ <engine/>
153
  <show_customer_number>1</show_customer_number>
154
  <note/>
155
  </creditmemo>
156
+ <firegento_pdf>
157
+ <logo_ratio>100</logo_ratio>
158
+ </firegento_pdf>
159
  </sales_pdf>
160
  <tax>
161
  <sales_display>
app/code/community/FireGento/Pdf/etc/system.xml CHANGED
@@ -29,7 +29,7 @@
29
  <sales_display>
30
  <fields>
31
  <no_sum_on_details translate="label">
32
- <label>Don't display Tax Total if display Summary is on</label>
33
  <frontend_type>select</frontend_type>
34
  <source_model>adminhtml/system_config_source_yesno</source_model>
35
  <sort_order>700</sort_order>
@@ -37,6 +37,15 @@
37
  <show_in_website>1</show_in_website>
38
  <show_in_store>1</show_in_store>
39
  </no_sum_on_details>
 
 
 
 
 
 
 
 
 
40
  </fields>
41
  </sales_display>
42
  </groups>
@@ -44,6 +53,7 @@
44
  <sales_pdf>
45
  <groups>
46
  <invoice>
 
47
  <fields>
48
  <engine translate="label">
49
  <label>PDF Engine</label>
@@ -137,9 +147,19 @@
137
  <show_in_website>1</show_in_website>
138
  <show_in_store>1</show_in_store>
139
  </show_item_discount>
 
 
 
 
 
 
 
 
 
140
  </fields>
141
  </invoice>
142
  <shipment>
 
143
  <fields>
144
  <engine translate="label">
145
  <label>PDF Engine</label>
@@ -188,9 +208,19 @@
188
  <show_in_store>1</show_in_store>
189
  <comment>Prints the order ID as a barcode on the right hand side.</comment>
190
  </order_id_as_barcode>
 
 
 
 
 
 
 
 
 
191
  </fields>
192
  </shipment>
193
  <creditmemo>
 
194
  <fields>
195
  <engine translate="label">
196
  <label>PDF Engine</label>
@@ -219,15 +249,25 @@
219
  <show_in_store>1</show_in_store>
220
  <comment>Printed on every credit memo.</comment>
221
  </note>
 
 
 
 
 
 
 
 
 
222
  </fields>
223
  </creditmemo>
224
  <firegento_pdf translate="label">
225
  <label>PDF Creation</label>
226
  <frontend_type>text</frontend_type>
227
- <sort_order>0</sort_order>
228
  <show_in_default>1</show_in_default>
229
  <show_in_website>1</show_in_website>
230
  <show_in_store>1</show_in_store>
 
231
  <fields>
232
  <sender_address_bar translate="label">
233
  <label>Sender Address Bar</label>
@@ -236,17 +276,19 @@
236
  <show_in_default>1</show_in_default>
237
  <show_in_website>1</show_in_website>
238
  <show_in_store>1</show_in_store>
 
239
  </sender_address_bar>
240
- <show_footer translate="label">
241
  <label>Show Footer</label>
242
  <frontend_type>select</frontend_type>
243
  <source_model>adminhtml/system_config_source_yesno</source_model>
 
244
  <sort_order>200</sort_order>
245
  <show_in_default>1</show_in_default>
246
  <show_in_website>1</show_in_website>
247
  <show_in_store>1</show_in_store>
248
  </show_footer>
249
- <logo_position translate="label">
250
  <label>Logo Position</label>
251
  <frontend_type>select</frontend_type>
252
  <source_model>firegento_pdf/system_config_source_logo</source_model>
@@ -256,8 +298,83 @@
256
  <show_in_store>1</show_in_store>
257
  <comment><![CDATA[Full width means that the logo starts at the upper left corner and is drawn to the right edge. There is no left or right margin for printing.]]></comment>
258
  </logo_position>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  </fields>
260
  </firegento_pdf>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  </groups>
262
  </sales_pdf>
263
  </sections>
29
  <sales_display>
30
  <fields>
31
  <no_sum_on_details translate="label">
32
+ <label>Display Tax Total if display Summary is on</label>
33
  <frontend_type>select</frontend_type>
34
  <source_model>adminhtml/system_config_source_yesno</source_model>
35
  <sort_order>700</sort_order>
37
  <show_in_website>1</show_in_website>
38
  <show_in_store>1</show_in_store>
39
  </no_sum_on_details>
40
+ <hide_grandtotal_excl_tax translate="label">
41
+ <label>Hide Grand Total excl. Tax if display Summary is on</label>
42
+ <frontend_type>select</frontend_type>
43
+ <source_model>adminhtml/system_config_source_yesno</source_model>
44
+ <sort_order>702</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </hide_grandtotal_excl_tax>
49
  </fields>
50
  </sales_display>
51
  </groups>
53
  <sales_pdf>
54
  <groups>
55
  <invoice>
56
+ <sort_order>300</sort_order>
57
  <fields>
58
  <engine translate="label">
59
  <label>PDF Engine</label>
147
  <show_in_website>1</show_in_website>
148
  <show_in_store>1</show_in_store>
149
  </show_item_discount>
150
+ <filename_export_pattern translate="label comment">
151
+ <label>Filename Export Pattern</label>
152
+ <frontend_type>text</frontend_type>
153
+ <sort_order>120</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>1</show_in_website>
156
+ <show_in_store>1</show_in_store>
157
+ <comment>available placeholders: {{invoice_id}}, {{order_id}}, {{customer_id}}, {{customer_name}}, {{customer_firstname}}, {{customer_lastname}} and strftime() date formats like "%Y"</comment>
158
+ </filename_export_pattern>
159
  </fields>
160
  </invoice>
161
  <shipment>
162
+ <sort_order>400</sort_order>
163
  <fields>
164
  <engine translate="label">
165
  <label>PDF Engine</label>
208
  <show_in_store>1</show_in_store>
209
  <comment>Prints the order ID as a barcode on the right hand side.</comment>
210
  </order_id_as_barcode>
211
+ <filename_export_pattern translate="label comment">
212
+ <label>Filename Export Pattern</label>
213
+ <frontend_type>text</frontend_type>
214
+ <sort_order>120</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ <comment>available placeholders: {{shipment_id}}, {{order_id}}, {{customer_id}}, {{customer_name}}, {{customer_firstname}}, {{customer_lastname}} and strftime() date formats like "%Y"</comment>
219
+ </filename_export_pattern>
220
  </fields>
221
  </shipment>
222
  <creditmemo>
223
+ <sort_order>500</sort_order>
224
  <fields>
225
  <engine translate="label">
226
  <label>PDF Engine</label>
249
  <show_in_store>1</show_in_store>
250
  <comment>Printed on every credit memo.</comment>
251
  </note>
252
+ <filename_export_pattern translate="label comment">
253
+ <label>Filename Export Pattern</label>
254
+ <frontend_type>text</frontend_type>
255
+ <sort_order>120</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>1</show_in_store>
259
+ <comment>available placeholders: {{creditmemo_id}}, {{order_id}}, {{customer_id}}, {{customer_name}}, {{customer_firstname}}, {{customer_lastname}} and strftime() date formats like "%Y"</comment>
260
+ </filename_export_pattern>
261
  </fields>
262
  </creditmemo>
263
  <firegento_pdf translate="label">
264
  <label>PDF Creation</label>
265
  <frontend_type>text</frontend_type>
266
+ <sort_order>100</sort_order>
267
  <show_in_default>1</show_in_default>
268
  <show_in_website>1</show_in_website>
269
  <show_in_store>1</show_in_store>
270
+ <expanded>0</expanded>
271
  <fields>
272
  <sender_address_bar translate="label">
273
  <label>Sender Address Bar</label>
276
  <show_in_default>1</show_in_default>
277
  <show_in_website>1</show_in_website>
278
  <show_in_store>1</show_in_store>
279
+ <comment>Show address above shipping/invoice address</comment>
280
  </sender_address_bar>
281
+ <show_footer translate="label comment">
282
  <label>Show Footer</label>
283
  <frontend_type>select</frontend_type>
284
  <source_model>adminhtml/system_config_source_yesno</source_model>
285
+ <comment><![CDATA[Show Imprint. Compatible with <a href="http://www.magentocommerce.com/magento-connect/firegento-magesetup.html">MageSetup</a> or GermanSetup (not anymore maintained, replaced by MageSetup)]]></comment>
286
  <sort_order>200</sort_order>
287
  <show_in_default>1</show_in_default>
288
  <show_in_website>1</show_in_website>
289
  <show_in_store>1</show_in_store>
290
  </show_footer>
291
+ <logo_position translate="label comment">
292
  <label>Logo Position</label>
293
  <frontend_type>select</frontend_type>
294
  <source_model>firegento_pdf/system_config_source_logo</source_model>
298
  <show_in_store>1</show_in_store>
299
  <comment><![CDATA[Full width means that the logo starts at the upper left corner and is drawn to the right edge. There is no left or right margin for printing.]]></comment>
300
  </logo_position>
301
+ <logo_ratio translate="label">
302
+ <label>Logo Ratio</label>
303
+ <frontend_type>text</frontend_type>
304
+ <frontend_class>validate-number-range number-range-1-100</frontend_class>
305
+ <sort_order>400</sort_order>
306
+ <show_in_default>1</show_in_default>
307
+ <show_in_website>1</show_in_website>
308
+ <show_in_store>1</show_in_store>
309
+ <comment><![CDATA[Resize or not the size of your logo in the header. Value possible from 1 (minimum size) to 100 (full size). Values in percent.]]></comment>
310
+ </logo_ratio>
311
+ <headerblocks_position translate="label">
312
+ <label>Header Blocks Position</label>
313
+ <frontend_type>select</frontend_type>
314
+ <source_model>firegento_pdf/system_config_source_headerblocks</source_model>
315
+ <comment><![CDATA[Left: Customer address left, Invoice details right. Right: Invoice details left, Customer address right.]]></comment>
316
+ </headerblocks_position>
317
  </fields>
318
  </firegento_pdf>
319
+ <firegento_pdf_fonts>
320
+ <label>Fonts for PDF Creation</label>
321
+ <frontend_type>text</frontend_type>
322
+ <sort_order>200</sort_order>
323
+ <show_in_default>1</show_in_default>
324
+ <show_in_website>1</show_in_website>
325
+ <show_in_store>1</show_in_store>
326
+ <fields>
327
+ <upload_fonts translate="label comment">
328
+ <label>Upload own fonts</label>
329
+ <comment><![CDATA[You can upload your own fonts (*.ttf, *.otf) instead of using Zends Helvetica]]></comment>
330
+ <source_model>adminhtml/system_config_source_yesno</source_model>
331
+ <frontend_type>select</frontend_type>
332
+ <sort_order>400</sort_order>
333
+ <show_in_default>1</show_in_default>
334
+ <show_in_website>1</show_in_website>
335
+ <show_in_store>1</show_in_store>
336
+ </upload_fonts>
337
+ <regular_font translate="label">
338
+ <label>Regular font</label>
339
+ <frontend_type>file</frontend_type>
340
+ <backend_model>firegento_pdf/system_config_backend_font</backend_model>
341
+ <upload_dir>media/firegento_pdf/fonts</upload_dir>
342
+ <sort_order>500</sort_order>
343
+ <show_in_default>1</show_in_default>
344
+ <show_in_website>1</show_in_website>
345
+ <show_in_store>1</show_in_store>
346
+ <depends>
347
+ <upload_fonts>1</upload_fonts>
348
+ </depends>
349
+ </regular_font>
350
+ <bold_font translate="label">
351
+ <label>Bold font</label>
352
+ <frontend_type>file</frontend_type>
353
+ <backend_model>firegento_pdf/system_config_backend_font</backend_model>
354
+ <upload_dir>media/firegento_pdf/fonts</upload_dir>
355
+ <sort_order>600</sort_order>
356
+ <show_in_default>1</show_in_default>
357
+ <show_in_website>1</show_in_website>
358
+ <show_in_store>1</show_in_store>
359
+ <depends>
360
+ <upload_fonts>1</upload_fonts>
361
+ </depends>
362
+ </bold_font>
363
+ <italic_font translate="label">
364
+ <label>Italic font</label>
365
+ <frontend_type>file</frontend_type>
366
+ <backend_model>firegento_pdf/system_config_backend_font</backend_model>
367
+ <upload_dir scope_info="1">media/firegento_pdf/fonts</upload_dir>
368
+ <sort_order>700</sort_order>
369
+ <show_in_default>1</show_in_default>
370
+ <show_in_website>1</show_in_website>
371
+ <show_in_store>1</show_in_store>
372
+ <depends>
373
+ <upload_fonts>1</upload_fonts>
374
+ </depends>
375
+ </italic_font>
376
+ </fields>
377
+ </firegento_pdf_fonts>
378
  </groups>
379
  </sales_pdf>
380
  </sections>
app/locale/de_AT/FireGento_Pdf.csv CHANGED
@@ -1,2 +1,2 @@
1
  "VAT-ID","UID"
2
- "Standard Germany","Standard Deutsch"
1
  "VAT-ID","UID"
2
+ "Standard Germany","Standard Deutsch"
app/locale/de_DE/FireGento_Pdf.csv CHANGED
@@ -1,7 +1,7 @@
1
  "Invoice maturity: %s days","Fälligkeit der Rechnung: %s Tage"
2
  "Invoice Maturity","Fälligkeit der Rechnung"
3
- "Days after the invoice is due. Leave this field blank to hide the message on the invoice.","Tage nach denen die Rechnung fällig ist. Feld leer lassen, um den Text auf der Rechnung zu verbergen."
4
- "Invoice is payable immediately","Die Rechnung ist sofort fällig"
5
  "Invoice date is equal to delivery date.","Rechnungsdatum ist gleich dem Lieferdatum."
6
  "Payment method:","Zahlungsart:"
7
  "Shipping method:","Versandart:"
@@ -19,7 +19,7 @@
19
  "SWIFT:","SWIFT:"
20
  "IBAN:","IBAN:"
21
  "Tax number:","Steuernummer:"
22
- "VAT-ID:","USt.Nr.:"
23
  "Register number:","HRB Nummer:"
24
  "CEO:","Geschäftsführer:"
25
  "Pos","Pos."
@@ -27,7 +27,7 @@
27
  "Description","Beschreibung"
28
  "Price (excl. tax)","Preis (Netto)"
29
  "Amount","Betrag"
30
- "Tax","MwSt."
31
  "Total","Summe"
32
  "Invoice","Rechnung"
33
  "Creditmemo","Gutschrift"
@@ -47,9 +47,9 @@
47
  "Guestorder","Gastbestellung"
48
  "PDF Engine","PDF Engine"
49
  "Note","Notiz"
50
- "Printed on every invoice.","Wird auf jeder Rechnung gedruckt."
51
- "Printed on every shipment.","Wird auf jedem Lieferschein gedruckt."
52
- "Printed on every credit memo.","Wird auf jeder Gutschrift gedruckt."
53
  "PDF Creation","PDF Erstellung"
54
  "Sender Address Bar","Absenderadresse"
55
  "Show Footer","Zeige Footer"
@@ -59,17 +59,17 @@
59
  "Right","Rechts"
60
  "Standard Magento","Standard Magento"
61
  "Standard Germany","Standard Deutschland"
62
- "Show Payment Method","Zahlungsart andrucken"
63
- "Hide payment method","Nicht andrucken"
64
  "Header","Dokumenten-Kopf"
65
  "Notes area","Notizbereich"
66
  "Position of payment method on invoice.","Position der Zahlungart auf der Rechnung."
67
- "Show Shipping Method","Versandart andrucken"
68
- "Hide shipping method","Nicht andrucken"
69
  "Position of shipping method on invoice.","Position der Versandart auf der Rechnung."
70
  "Position of shipping method on shipment.","Position der Versandart auf dem Lieferschein."
71
  "not to be listed","nicht aufzulisten"
72
- "Show Invoice Comments","Rechnungskommentare andrucken"
73
  "Show Item Discount","Rabatt auf Artikelebene anzeigen"
74
  "You get a discount of %s.","Sie erhalten einen Rabatt von %s."
75
  "Tax amount","Steuerbetrag"
@@ -79,10 +79,16 @@
79
  "Define the order by moving the following items using your mouse:","Legen Sie die Reihenfolge durch Verschieben der Einträge mit der Maus fest:"
80
  "Tax rate","Steuersatz"
81
  "Total (incl. tax)","Gesamt (brutto)"
82
- "Show Date Notice","Anzeige des Datum im Notizbereich"
83
  "Show Notice: Invoice date is equal to delivery date.","Zeige im Notizbereich: Rechnungsdatum ist gleich dem Lieferdatum."
84
- "Show Customer Number","Kundennummer andrucken"
85
  "Full width","volle Breite"
86
  "Full width means that the logo starts at the upper left corner and is drawn to the right edge. There is no left or right margin for printing.","""volle Breite"" bedeutet, dass das Logo über die komplette Seite von oben links bis zum rechten Rand gezogen wird. Es verbleibt kein Druckrand."
87
- "Show Order ID as Barcode","Bestellnummer als Barcode anzeigen"
88
  "Prints the order ID as a barcode on the right hand side.","Zeigt die Bestellnummer als Barcode auf der rechten Seite an."
 
 
 
 
 
 
1
  "Invoice maturity: %s days","Fälligkeit der Rechnung: %s Tage"
2
  "Invoice Maturity","Fälligkeit der Rechnung"
3
+ "Days after the invoice is due. Leave this field blank to hide the message on the invoice.","Tage, nach denen die Rechnung fällig ist. Feld leer lassen, um den Text auf der Rechnung zu verbergen."
4
+ "Invoice is payable immediately","Die Rechnung ist sofort fällig."
5
  "Invoice date is equal to delivery date.","Rechnungsdatum ist gleich dem Lieferdatum."
6
  "Payment method:","Zahlungsart:"
7
  "Shipping method:","Versandart:"
19
  "SWIFT:","SWIFT:"
20
  "IBAN:","IBAN:"
21
  "Tax number:","Steuernummer:"
22
+ "VAT-ID:","USt-IdNr.:"
23
  "Register number:","HRB Nummer:"
24
  "CEO:","Geschäftsführer:"
25
  "Pos","Pos."
27
  "Description","Beschreibung"
28
  "Price (excl. tax)","Preis (Netto)"
29
  "Amount","Betrag"
30
+ "Tax","USt."
31
  "Total","Summe"
32
  "Invoice","Rechnung"
33
  "Creditmemo","Gutschrift"
47
  "Guestorder","Gastbestellung"
48
  "PDF Engine","PDF Engine"
49
  "Note","Notiz"
50
+ "Printed on every invoice.","Wird auf jede Rechnung gedruckt."
51
+ "Printed on every shipment.","Wird auf jeden Lieferschein gedruckt."
52
+ "Printed on every credit memo.","Wird auf jede Gutschrift gedruckt."
53
  "PDF Creation","PDF Erstellung"
54
  "Sender Address Bar","Absenderadresse"
55
  "Show Footer","Zeige Footer"
59
  "Right","Rechts"
60
  "Standard Magento","Standard Magento"
61
  "Standard Germany","Standard Deutschland"
62
+ "Show Payment Method","Zahlungsart anzeigen"
63
+ "Hide payment method","Nicht anzeigen"
64
  "Header","Dokumenten-Kopf"
65
  "Notes area","Notizbereich"
66
  "Position of payment method on invoice.","Position der Zahlungart auf der Rechnung."
67
+ "Show Shipping Method","Versandart anzeigen"
68
+ "Hide shipping method","Nicht anzeigen"
69
  "Position of shipping method on invoice.","Position der Versandart auf der Rechnung."
70
  "Position of shipping method on shipment.","Position der Versandart auf dem Lieferschein."
71
  "not to be listed","nicht aufzulisten"
72
+ "Show Invoice Comments","Rechnungskommentare anzeigen"
73
  "Show Item Discount","Rabatt auf Artikelebene anzeigen"
74
  "You get a discount of %s.","Sie erhalten einen Rabatt von %s."
75
  "Tax amount","Steuerbetrag"
79
  "Define the order by moving the following items using your mouse:","Legen Sie die Reihenfolge durch Verschieben der Einträge mit der Maus fest:"
80
  "Tax rate","Steuersatz"
81
  "Total (incl. tax)","Gesamt (brutto)"
82
+ "Show Date Notice","Anzeige des Datums im Notizbereich"
83
  "Show Notice: Invoice date is equal to delivery date.","Zeige im Notizbereich: Rechnungsdatum ist gleich dem Lieferdatum."
84
+ "Show Customer Number","Kundennummer anzeigen"
85
  "Full width","volle Breite"
86
  "Full width means that the logo starts at the upper left corner and is drawn to the right edge. There is no left or right margin for printing.","""volle Breite"" bedeutet, dass das Logo über die komplette Seite von oben links bis zum rechten Rand gezogen wird. Es verbleibt kein Druckrand."
87
+ "Show Order ID as Barcode","Bestellnummer als Barcode anzeigen."
88
  "Prints the order ID as a barcode on the right hand side.","Zeigt die Bestellnummer als Barcode auf der rechten Seite an."
89
+ "Left: Customer address left, Invoice details right. Right: Invoice details left, Customer address right.","Links: Kundenadresse links, Rechnungsdetails rechts. Rechts: Rechnungsdetails links, Kundenadresse rechts"
90
+ "Show address above shipping/invoice address","Zeige Adresse über Empfängeradresse"
91
+ "Fonts for PDF Creation","Schriftarten für PDF Erstellung"
92
+ "You can upload your own fonts (*.ttf, *.otf) instead of using Zends Helvetica","Sie können eigene Schriften (*.ttf, *.otf) hochladen, statt Zends Helvetica zu benutzen."
93
+ "Registered seat:","Sitz:"
94
+ "Register court:","Amtsgericht:"
package.xml CHANGED
@@ -1,28 +1,35 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FireGento_Pdf</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
- <license>OSL 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>FireGento PDF overwrites standard PDF layouts for invoices, shipments and creditmemos.</summary>
10
  <description>FireGento PDF overwrites standard PDF layouts for invoices, shipments and creditmemos. Anyway, you can still use the standard Magento layout, because the extension is highly configurable.</description>
11
- <notes>- [FEATURE] 1.8 compatibility&#xD;
12
- - [FEATURE] added possibility to print order ID barcodes on shipment PDFs&#xD;
13
- - [FEATURE] added possibility to print shipment type on shipment PDFs&#xD;
14
- - [FEATURE] added universal event, so that developers can add custom stuff anywhere they want via observers&#xD;
15
- - [FEATURE] added possibility to use a full-width logo&#xD;
16
- - [FEATURE] configuration option whether to print the customer number&#xD;
17
- - [FEATURE] possibility to add invoice comments on invoice PDF&#xD;
18
- - [FEATURE] dutch translation&#xD;
19
- - [BUGFIX] fixed error when there is no country in the imprint&#xD;
20
- - [BUGFIX] print shipping address instead of invoice address on shipment PDF&#xD;
21
- - [MISC] respect FireGento coding guidelines</notes>
 
 
 
 
 
 
 
22
  <authors><author><name>FireGento Team</name><user>firegento</user><email>team@firegento.com</email></author></authors>
23
- <date>2014-01-27</date>
24
- <time>14:57:29</time>
25
- <contents><target name="magecommunity"><dir name="FireGento"><dir name="Pdf"><dir name="Block"><dir name="Adminhtml"><file name="ColumnOrder.php" hash="3799cb56858b9881d148a339ea49f8ca"/></dir></dir><dir name="Helper"><file name="Data.php" hash="dd642120d9bbabcffa22ba501a90683f"/></dir><dir name="Model"><file name="Creditmemo.php" hash="d63eabb984696be7cc619a945485dfc9"/><dir name="Engine"><file name="Abstract.php" hash="6768e733d5e76487301058f4e908aac5"/><dir name="Creditmemo"><file name="Default.php" hash="93676d7f82a7e1b19741dced06c26b99"/></dir><dir name="Invoice"><file name="Default.php" hash="67dea1237c31cb8562c863239d5aa998"/></dir><dir name="Shipment"><file name="Default.php" hash="a968f40a8be37f77bfe7162863561272"/></dir></dir><file name="Invoice.php" hash="28f21f48a6e00e124b185a8162e3869d"/><dir name="Items"><file name="Bundle.php" hash="9a363c8cdf303c451000e5cd2cf6b9f6"/><file name="Default.php" hash="d2c436f53efd3ada79e5640934503589"/><file name="Grouped.php" hash="5ae5053953c7dbdd65c6857c5e3ad2b6"/><dir name="Shipment"><file name="Bundle.php" hash="82db12612534c8169730cca30436d75b"/><file name="Default.php" hash="1a08b281fdabcfaa4ec1b7c7da62a7d8"/></dir></dir><file name="Observer.php" hash="b4dc50302e4c9d8e2bfc493e01b5ae91"/><file name="Shipment.php" hash="9887c67d5766db434b84aa86647c22b4"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Creditmemo"><file name="Engine.php" hash="e0bfb5661b6587163c36f83814f30fe4"/></dir><dir name="Invoice"><file name="Engine.php" hash="a75579d9a37243b4af6ee6c8c1738cca"/></dir><file name="Logo.php" hash="6a9684a27f972fb74799867518687821"/><file name="Payment.php" hash="2597e89d6bdc92f2074f64ed3c3f5f89"/><dir name="Shipment"><file name="Engine.php" hash="8c5b8eca2ac69b666b98999ccbb7df0a"/></dir><file name="Shipping.php" hash="70afa7e0021f152946f21c004fc1dbde"/></dir></dir></dir><dir name="Tax"><dir name="Sales"><dir name="Pdf"><file name="Grandtotal.php" hash="fe79c4aa5975058f5c2c8b29ecea127a"/></dir></dir></dir></dir><dir name="controllers"><dir name="Sales"><file name="OrderController.php" hash="36f4fe4daa6094d1d1ff8584b4c5aa6d"/></dir></dir><dir name="etc"><file name="config.xml" hash="08df399f9a1c5e6f07d99791f48f656d"/><file name="system.xml" hash="70547aa0c755c599f8a5122078186f88"/></dir><dir name="sql"><dir name="firegento_pdf_setup"><file name="upgrade-1.0.0-1.1.0.php" hash="fedb1a65f1b6c0f9c319f98cc97c26d3"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FireGento_Pdf.xml" hash="b50e6c2f168aff9a4fb983240f1d8941"/></dir></target><target name="magelocale"><dir><dir name="de_AT"><file name="FireGento_Pdf.csv" hash="53cdf83910c40cd3b4471d7d4c222211"/></dir><dir name="de_DE"><file name="FireGento_Pdf.csv" hash="5e589e0d40c9db5260f872590c6f107e"/></dir><dir name="nl_NL"><file name="FireGento_Pdf.csv" hash="7bf9bccd08a235991965297f5be94a86"/></dir></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
28
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FireGento_Pdf</name>
4
+ <version>1.3.0</version>
5
  <stability>stable</stability>
6
+ <license>GPL-3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>FireGento PDF overwrites standard PDF layouts for invoices, shipments and creditmemos.</summary>
10
  <description>FireGento PDF overwrites standard PDF layouts for invoices, shipments and creditmemos. Anyway, you can still use the standard Magento layout, because the extension is highly configurable.</description>
11
+ <notes>- [FEATURE] support for downloading invoice/creditmemo/shipping PDFs from the customer account page&#xD;
12
+ - [FEATURE] support for downloadable items&#xD;
13
+ - [FEATURE] added Swiss locale&#xD;
14
+ - [FEATURE] possibility to upload custom fonts&#xD;
15
+ - [FEATURE] possibility to swap position of customer address and invoice details&#xD;
16
+ - [FEATURE] possibility to define custom filename patterns for invoice, creditmemo and shipping PDFs&#xD;
17
+ - [FEATURE] added event `firegento_pdf_imprint_load_after` to change certain imprint data&#xD;
18
+ - [FEATURE] possibility to resize the logo&#xD;
19
+ - [FEATURE] added more fields to imprint which are provided by [MageSetup](https://github.com/firegento/firegento-magesetup)&#xD;
20
+ - [BUGFIX] fixed tax display which was wrong in certain cases&#xD;
21
+ - [BUGFIX] fixed custom column order when used with bundle products&#xD;
22
+ - [BUGFIX] fixed number format of tax rates (with bad black magic, improvements are welcome!) (#101)&#xD;
23
+ - [MISC] improved wording in system.xml&#xD;
24
+ - [MISC] changed mage-hackathon-installer from required to suggestion, because there are more installers out there&#xD;
25
+ - [MISC] updated autogenerated documentation&#xD;
26
+ - [MISC] corrected code style&#xD;
27
+ - [MISC] implemented a few first unit tests&#xD;
28
+ - [MISC] add recommendation for Mage_LocaleFallback in readme</notes>
29
  <authors><author><name>FireGento Team</name><user>firegento</user><email>team@firegento.com</email></author></authors>
30
+ <date>2014-11-10</date>
31
+ <time>08:44:13</time>
32
+ <contents><target name="magecommunity"><dir name="FireGento"><dir name="Pdf"><dir name="Block"><dir name="Adminhtml"><file name="ColumnOrder.php" hash="3799cb56858b9881d148a339ea49f8ca"/></dir></dir><dir name="Helper"><file name="Data.php" hash="5c818999d7d4716b69406218c4dbf20e"/></dir><dir name="Model"><file name="Creditmemo.php" hash="b481904a136cd17a290eba889547659c"/><dir name="Engine"><file name="Abstract.php" hash="9f1cf294d16a14512561716e2c34c49c"/><dir name="Creditmemo"><file name="Default.php" hash="27e9198d122b39907ab7f03f9513d09b"/></dir><dir name="Invoice"><file name="Default.php" hash="c0ee716b7e52ea71ee7085ddc7813ea8"/></dir><dir name="Shipment"><file name="Default.php" hash="7f2de1ca3a78f44418a33e70d843b172"/></dir></dir><file name="Invoice.php" hash="6054a1a0674c7cfec5b7e560fd77e67d"/><dir name="Items"><file name="Bundle.php" hash="177212fd03a8766211e21d136a08aeaa"/><file name="Default.php" hash="fb165608bb4b43eaae3a27ef2379d4b0"/><file name="Downloadable.php" hash="cffd8ec7c26cf5589ae25659a4f261c9"/><file name="Grouped.php" hash="5ae5053953c7dbdd65c6857c5e3ad2b6"/><dir name="Shipment"><file name="Bundle.php" hash="82db12612534c8169730cca30436d75b"/><file name="Default.php" hash="1a08b281fdabcfaa4ec1b7c7da62a7d8"/></dir></dir><file name="Observer.php" hash="11ac0345331d7e174e6178aadec1fdaa"/><file name="Shipment.php" hash="838d8ea25d64382e420a8abd36e145d8"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Font.php" hash="604a3100544af1bc7e248338339e7ece"/></dir><dir name="Source"><dir name="Creditmemo"><file name="Engine.php" hash="e0bfb5661b6587163c36f83814f30fe4"/></dir><file name="Headerblocks.php" hash="f2405f1216340dfd5c55cc0f7dd35a5f"/><dir name="Invoice"><file name="Engine.php" hash="a75579d9a37243b4af6ee6c8c1738cca"/></dir><file name="Logo.php" hash="6a9684a27f972fb74799867518687821"/><file name="Payment.php" hash="2597e89d6bdc92f2074f64ed3c3f5f89"/><dir name="Shipment"><file name="Engine.php" hash="8c5b8eca2ac69b666b98999ccbb7df0a"/></dir><file name="Shipping.php" hash="70afa7e0021f152946f21c004fc1dbde"/></dir></dir></dir><dir name="Tax"><dir name="Sales"><dir name="Pdf"><file name="Grandtotal.php" hash="3bbe2f3bbef6051386e40c1eed18fe7a"/></dir></dir></dir></dir><dir name="Test"><dir name="Model"><file name="CreditmemoTest.php" hash="1bebc7cd33c52742e0354ec58ed09356"/><file name="InvoiceTest.php" hash="de74dec4c2e52d4be8a6b8decc1790fe"/><file name="SalesObjectTestAbstract.php" hash="c0b36470e17bf79fea4b8110c3febb5e"/><file name="ShipmentTest.php" hash="46eca4b1e93db0779b17627600e5979f"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="CreditmemoController.php" hash="4d5e988b14b8a1f42f230166992cee79"/><file name="InvoiceController.php" hash="3b4c41187e39402ab71c091854494d67"/><file name="ShipmentController.php" hash="a07bb5a2e67f92445e0ab8399897d0a5"/></dir></dir></dir><dir name="Sales"><file name="OrderController.php" hash="b1f7b25611e8ffec94b89384646c1634"/></dir></dir><dir name="etc"><file name="config.xml" hash="82106cc40ff286c68bcc8a6e54fbf3dc"/><file name="system.xml" hash="4b6b4e5cc77701c2cd824e81f7c4a4fc"/></dir><dir name="sql"><dir name="firegento_pdf_setup"><file name="upgrade-1.0.0-1.1.0.php" hash="fedb1a65f1b6c0f9c319f98cc97c26d3"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FireGento_Pdf.xml" hash="b50e6c2f168aff9a4fb983240f1d8941"/></dir></target><target name="magelocale"><dir><dir name="de_AT"><file name="FireGento_Pdf.csv" hash="3372fa3812ac67d84a8024bd97e85ec7"/></dir><dir name="de_DE"><file name="FireGento_Pdf.csv" hash="8c420f68794b8973fac3805a7effd432"/></dir><dir name="nl_NL"><file name="FireGento_Pdf.csv" hash="7bf9bccd08a235991965297f5be94a86"/></dir></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
35
  </package>