Billys_Billing_Invoicer - Version 1.2.4

Version Notes

Improved customer email recognition

Download this release

Release Info

Developer Billy's Billing
Extension Billys_Billing_Invoicer
Version 1.2.4
Comparing to
See all releases


Code changes from version 1.2.3 to 1.2.4

app/code/community/BillysBilling/Invoicer/Model/Observer.php CHANGED
@@ -60,7 +60,7 @@ class BillysBilling_Invoicer_Model_Observer {
60
  */
61
  private function createInvoice($order) {
62
  // Get contact ID
63
- $contactId = $this->insertIgnore("contacts", $order->getBillingAddress());
64
  if ($contactId == null) {
65
  return false;
66
  }
@@ -145,12 +145,13 @@ class BillysBilling_Invoicer_Model_Observer {
145
  *
146
  * @param $type string "contacts" or "products"
147
  * @param $data BillingAddress object or Item object
148
- *
 
149
  * @return int ID of inserted or found entry
150
  */
151
- private function insertIgnore($type, $data) {
152
  // Format data
153
- $data = $this->formatArray($type, $data);
154
 
155
  // Check for existing contact
156
  $responseArray = array();
@@ -190,9 +191,10 @@ class BillysBilling_Invoicer_Model_Observer {
190
  *
191
  * @param $type string "contacts" or "products"
192
  * @param $data BillingAddress object or Item object
 
193
  * @return array of either contact or product
194
  */
195
- private function formatArray($type, $data) {
196
  if ($type == "contacts") {
197
  // Set name depending on company or not
198
  if ($data->getCompany()) {
@@ -200,6 +202,11 @@ class BillysBilling_Invoicer_Model_Observer {
200
  } else {
201
  $name = $data->getName();
202
  }
 
 
 
 
 
203
 
204
  return array(
205
  'name' => $name,
@@ -210,11 +217,11 @@ class BillysBilling_Invoicer_Model_Observer {
210
  'state' => $data->getRegion(),
211
  'phone' => $data->getTelephone(),
212
  'fax' => $data->getFax(),
213
- 'externalId' => $data->getEmail(),
214
  'persons' => array(
215
  array(
216
  'name' => $data->getName(),
217
- 'email' => $data->getEmail(),
218
  'phone' => $data->getTelephone()
219
  )
220
  )
60
  */
61
  private function createInvoice($order) {
62
  // Get contact ID
63
+ $contactId = $this->insertIgnore("contacts", $order->getBillingAddress(), $order);
64
  if ($contactId == null) {
65
  return false;
66
  }
145
  *
146
  * @param $type string "contacts" or "products"
147
  * @param $data BillingAddress object or Item object
148
+ * @param null $order
149
+ *
150
  * @return int ID of inserted or found entry
151
  */
152
+ private function insertIgnore($type, $data, $order = null) {
153
  // Format data
154
+ $data = $this->formatArray($type, $data, $order);
155
 
156
  // Check for existing contact
157
  $responseArray = array();
191
  *
192
  * @param $type string "contacts" or "products"
193
  * @param $data BillingAddress object or Item object
194
+ * @param null $order
195
  * @return array of either contact or product
196
  */
197
+ private function formatArray($type, $data, $order = null) {
198
  if ($type == "contacts") {
199
  // Set name depending on company or not
200
  if ($data->getCompany()) {
202
  } else {
203
  $name = $data->getName();
204
  }
205
+
206
+ $email = $data->getEmail();
207
+ if (!$email) {
208
+ $email = $order->getCustomerEmail();
209
+ }
210
 
211
  return array(
212
  'name' => $name,
217
  'state' => $data->getRegion(),
218
  'phone' => $data->getTelephone(),
219
  'fax' => $data->getFax(),
220
+ 'externalId' => $email,
221
  'persons' => array(
222
  array(
223
  'name' => $data->getName(),
224
+ 'email' => $email,
225
  'phone' => $data->getTelephone()
226
  )
227
  )
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Billys_Billing_Invoicer</name>
4
- <version>1.2.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -15,11 +15,11 @@
15
  This extension has been tested with the latest releases of version 1.5, 1.6, 1.7, and 1.8.&#xD;
16
  &#xD;
17
  When this extension has been installed, you should go to System Configuration and access the Billy's Billing configuration page. From here you enter an API key (you can get this from organization settings in Billy's Billing) and save the configuration. When this is done, you will be able to change the dropdown boxes for shipping product, sales account, VAT model, and bank account. After they have been selected, you are ready to use the extension.</description>
18
- <notes>Expanded PHP support to include 5.2</notes>
19
  <authors><author><name>Billy's Billing</name><user>billysbilling</user><email>michael@billysbilling.com</email></author></authors>
20
- <date>2014-01-31</date>
21
- <time>12:41:09</time>
22
- <contents><target name="magecommunity"><dir name="BillysBilling"><dir name="Invoicer"><dir name="Helper"><file name="Data.php" hash="2e73f30c86e3cb150b91856d2efeebf4"/></dir><dir name="Model"><file name="Accounts.php" hash="a6861ea516d74d199d52be6e4a8eeb1c"/><file name="Observer.php" hash="a5890839698891916f2d5b3bb0bdc05b"/><file name="Products.php" hash="86953a3321a191587b6da1ab57626c53"/><file name="VatModels.php" hash="e87151fe22f857340476d1d4ebaeb31c"/><file name="YesNo.php" hash="0948b76080b9829e733980dad3649fd9"/><dir name="billysbilling-php"><dir name="Billy"><file name="Client.php" hash="b947948ae0063e2a121751782f44c751"/><file name="Exception.php" hash="239b2ecc8821b6e55faef561d0f3089c"/><file name="Request.php" hash="60d6c8d0661ff97cfc828cc785e7c942"/></dir><file name="bootstrap.php" hash="95d828828c4fdf4d338407f4a270c397"/></dir><file name=".DS_Store" hash="ca785700948b047adfbbc0be14cc757c"/></dir><dir name="etc"><file name="config.xml" hash="cccab1c9918bb815482290a750a48266"/><file name="system.xml" hash="9d2ed460ff9d16ce45539e83034513a4"/></dir><file name=".DS_Store" hash="0321a487d2882bd14b9b6ba789812495"/></dir><file name=".DS_Store" hash="be7a0a0fbf3672d076eac1f6bf183e1d"/></dir></target><target name="mageetc"><dir name="modules"><file name="BillysBilling_Invoicer.xml" hash="4b11b30f403a358332323f04da27d1d4"/></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>5.2.0</min><max>5.4.22</max></php></required></dependencies>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Billys_Billing_Invoicer</name>
4
+ <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
15
  This extension has been tested with the latest releases of version 1.5, 1.6, 1.7, and 1.8.&#xD;
16
  &#xD;
17
  When this extension has been installed, you should go to System Configuration and access the Billy's Billing configuration page. From here you enter an API key (you can get this from organization settings in Billy's Billing) and save the configuration. When this is done, you will be able to change the dropdown boxes for shipping product, sales account, VAT model, and bank account. After they have been selected, you are ready to use the extension.</description>
18
+ <notes>Improved customer email recognition</notes>
19
  <authors><author><name>Billy's Billing</name><user>billysbilling</user><email>michael@billysbilling.com</email></author></authors>
20
+ <date>2014-02-09</date>
21
+ <time>21:52:53</time>
22
+ <contents><target name="magecommunity"><dir name="BillysBilling"><dir name="Invoicer"><dir name="Helper"><file name="Data.php" hash="2e73f30c86e3cb150b91856d2efeebf4"/></dir><dir name="Model"><file name="Accounts.php" hash="a6861ea516d74d199d52be6e4a8eeb1c"/><file name="Observer.php" hash="81ed7c3196decf0da567b9adcbfcf49f"/><file name="Products.php" hash="86953a3321a191587b6da1ab57626c53"/><file name="VatModels.php" hash="e87151fe22f857340476d1d4ebaeb31c"/><file name="YesNo.php" hash="0948b76080b9829e733980dad3649fd9"/><dir name="billysbilling-php"><dir name="Billy"><file name="Client.php" hash="b947948ae0063e2a121751782f44c751"/><file name="Exception.php" hash="239b2ecc8821b6e55faef561d0f3089c"/><file name="Request.php" hash="60d6c8d0661ff97cfc828cc785e7c942"/></dir><file name="bootstrap.php" hash="95d828828c4fdf4d338407f4a270c397"/></dir><file name=".DS_Store" hash="ca785700948b047adfbbc0be14cc757c"/></dir><dir name="etc"><file name="config.xml" hash="cccab1c9918bb815482290a750a48266"/><file name="system.xml" hash="9d2ed460ff9d16ce45539e83034513a4"/></dir><file name=".DS_Store" hash="0321a487d2882bd14b9b6ba789812495"/></dir><file name=".DS_Store" hash="be7a0a0fbf3672d076eac1f6bf183e1d"/></dir></target><target name="mageetc"><dir name="modules"><file name="BillysBilling_Invoicer.xml" hash="4b11b30f403a358332323f04da27d1d4"/></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>5.2.0</min><max>5.4.22</max></php></required></dependencies>
25
  </package>