Asperience_Printorderline - Version 0.1.7

Version Notes

If you have ideas for improvements or find bugs, please send them to Jean-Sébastien Hederer at contact@asperience.fr, with Asperience_Printorderline as part of the subject line.

Download this release

Release Info

Developer Jean-Sébastien Hederer
Extension Asperience_Printorderline
Version 0.1.7
Comparing to
See all releases


Code changes from version 0.1.6 to 0.1.7

app/code/community/Asperience/Printorderline/Model/Order/Pdf/Order.php CHANGED
@@ -13,7 +13,7 @@ class Asperience_Printorderline_Model_Order_Pdf_Order extends Mage_Sales_Model_O
13
 
14
  public function getPdf($orders = array())
15
  {
16
- $this->_beforeGetPdf();
17
  $this->_initRenderer('order');
18
 
19
  $pdf = new Zend_Pdf();
@@ -61,21 +61,28 @@ class Asperience_Printorderline_Model_Order_Pdf_Order extends Mage_Sales_Model_O
61
  $ShippingDesc = wordwrap($ShippingDesc, $lgMaxMet, "|\n", 1);
62
  $ShippingDesc = explode('|', $ShippingDesc);
63
 
64
-
65
  //Billing informations
66
- $BillingCpn = $order->getBillingAddress()->getCompany();
67
- $BillingCpn = wordwrap($BillingCpn, $lgMaxAdd, "|\n", 1);
68
- $BillingCpn = explode('|', $BillingCpn);
 
 
 
 
 
69
 
70
  //Shipping informations
71
- $ShippingCpn = $order->getShippingAddress()->getCompany();
72
- $ShippingCpn = wordwrap($ShippingCpn, $lgMaxAdd, "|\n", 1);
73
- $ShippingCpn = explode('|', $ShippingCpn);
74
-
 
 
 
 
75
 
76
  $val = max(count($BillingCpn), count($ShippingCpn), (count($payment) + count($ShippingDesc)));
77
-
78
-
79
  $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
80
  $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
81
  $page->setLineWidth(0.5);
@@ -86,8 +93,16 @@ class Asperience_Printorderline_Model_Order_Pdf_Order extends Mage_Sales_Model_O
86
  $this->_setFontBold($page);
87
  $page->drawText(Mage::helper('printorderline')->__('N° ').$order->getRealOrderId(), 50, $this->y, 'UTF-8');
88
  $this->_setFontRegular($page);
89
- $page->drawText($order->getBillingAddress()->getName(), 160, $this->y, 'UTF-8');
90
- $page->drawText($order->getShippingAddress()->getName(), 330, $this->y, 'UTF-8');
 
 
 
 
 
 
 
 
91
  $page->drawText(Mage::helper('printorderline')->__('Tax: ').$order->formatPriceTxt($order->getTaxAmount()), 680, $this->y, 'UTF-8');
92
  $page->drawText(Mage::helper('printorderline')->__('Ship: ').$order->formatPriceTxt($order->getShippingAmount()), 740, $this->y, 'UTF-8');
93
 
13
 
14
  public function getPdf($orders = array())
15
  {
16
+ $this->_beforeGetPdf();
17
  $this->_initRenderer('order');
18
 
19
  $pdf = new Zend_Pdf();
61
  $ShippingDesc = wordwrap($ShippingDesc, $lgMaxMet, "|\n", 1);
62
  $ShippingDesc = explode('|', $ShippingDesc);
63
 
 
64
  //Billing informations
65
+ $billingAddress = $order->getBillingAddress();
66
+ if($billingAddress) {
67
+ $BillingCpn = $billingAddress->getCompany();
68
+ $BillingCpn = wordwrap($BillingCpn, $lgMaxAdd, "|\n", 1);
69
+ $BillingCpn = explode('|', $BillingCpn);
70
+ } else {
71
+ $BillingCpn = array();
72
+ }
73
 
74
  //Shipping informations
75
+ $shippingAddress = $order->getShippingAddress();
76
+ if($shippingAddress) {
77
+ $ShippingCpn = $shippingAddress->getCompany();
78
+ $ShippingCpn = wordwrap($ShippingCpn, $lgMaxAdd, "|\n", 1);
79
+ $ShippingCpn = explode('|', $ShippingCpn);
80
+ } else {
81
+ $ShippingCpn = array();
82
+ }
83
 
84
  $val = max(count($BillingCpn), count($ShippingCpn), (count($payment) + count($ShippingDesc)));
85
+
 
86
  $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
87
  $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
88
  $page->setLineWidth(0.5);
93
  $this->_setFontBold($page);
94
  $page->drawText(Mage::helper('printorderline')->__('N° ').$order->getRealOrderId(), 50, $this->y, 'UTF-8');
95
  $this->_setFontRegular($page);
96
+ if($billingAddress)
97
+ $billingAddressName = $billingAddress->getName();
98
+ else
99
+ $billingAddressName = '';
100
+ $page->drawText($billingAddressName, 160, $this->y, 'UTF-8');
101
+ if($shippingAddress)
102
+ $shippingAddressName = $shippingAddress->getName();
103
+ else
104
+ $shippingAddressName = '';
105
+ $page->drawText($shippingAddressName, 330, $this->y, 'UTF-8');
106
  $page->drawText(Mage::helper('printorderline')->__('Tax: ').$order->formatPriceTxt($order->getTaxAmount()), 680, $this->y, 'UTF-8');
107
  $page->drawText(Mage::helper('printorderline')->__('Ship: ').$order->formatPriceTxt($order->getShippingAmount()), 740, $this->y, 'UTF-8');
108
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Asperience_Printorderline</name>
4
- <version>0.1.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
@@ -12,9 +12,9 @@
12
  </description>
13
  <notes>If you have ideas for improvements or find bugs, please send them to Jean-S&#xE9;bastien Hederer at contact@asperience.fr, with Asperience_Printorderline as part of the subject line.</notes>
14
  <authors><author><name>Jean-S&#xE9;bastien Hederer</name><user>hedererjs</user><email>hedererjs@asperience.fr</email></author></authors>
15
- <date>2012-04-29</date>
16
- <time>21:20:47</time>
17
- <contents><target name="magecommunity"><dir name="Asperience"><dir name="Printorderline"><dir name="Helper"><file name="Data.php" hash="4973f68f8b95618a017857b21fa4d759"/></dir><dir name="Model"><file name="Observer.php" hash="750d022fe91669b990e5e4c1a518218d"/><dir name="Order"><dir name="Pdf"><file name="Order.php" hash="a03638b0ce0ee3c0dae0a5cff947bca8"/></dir></dir></dir><dir name="controllers"><file name="OrderController.php" hash="129ff200233f74a9ddfdf3537e09059f"/></dir><dir name="etc"><file name="config.xml" hash="b89dafbef379eb619321fb40ec4deb69"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Asperience_Printorderline.xml" hash="a9d761fb2d923dfc1adf93541ce19dd8"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Asperience_Printorderline.csv" hash="3e9fa70b536a43ac59099a7b6f190798"/></dir><dir name="fr_FR"><file name="Asperience_Printorderline.csv" hash="de0221c54a0cc8deb3dce66e147cd81c"/></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Asperience_Printorderline</name>
4
+ <version>0.1.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
12
  </description>
13
  <notes>If you have ideas for improvements or find bugs, please send them to Jean-S&#xE9;bastien Hederer at contact@asperience.fr, with Asperience_Printorderline as part of the subject line.</notes>
14
  <authors><author><name>Jean-S&#xE9;bastien Hederer</name><user>hedererjs</user><email>hedererjs@asperience.fr</email></author></authors>
15
+ <date>2012-08-14</date>
16
+ <time>22:55:41</time>
17
+ <contents><target name="magecommunity"><dir name="Asperience"><dir name="Printorderline"><dir name="Helper"><file name="Data.php" hash="4973f68f8b95618a017857b21fa4d759"/></dir><dir name="Model"><file name="Observer.php" hash="750d022fe91669b990e5e4c1a518218d"/><dir name="Order"><dir name="Pdf"><file name="Order.php" hash="4971941f0279c580f5397a2269006019"/></dir></dir></dir><dir name="controllers"><file name="OrderController.php" hash="129ff200233f74a9ddfdf3537e09059f"/></dir><dir name="etc"><file name="config.xml" hash="b89dafbef379eb619321fb40ec4deb69"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Asperience_Printorderline.xml" hash="a9d761fb2d923dfc1adf93541ce19dd8"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Asperience_Printorderline.csv" hash="3e9fa70b536a43ac59099a7b6f190798"/></dir><dir name="fr_FR"><file name="Asperience_Printorderline.csv" hash="de0221c54a0cc8deb3dce66e147cd81c"/></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>