pitneybowes_gsp - Version 1.1.0

Version Notes

Patch release for Magento Connect.

1. Added logic to cancel the order in the PB system when a PB order is cancelled in Magento.

2. Fixed the incremental catalog/product export to only include products and/or category files when one or both are edited in magento (example: if the incremental update is set to every hour and only a single product was updated in any way during the wait period, that product will be included in the next incremental catalog update. The same is true for categories that were updated within the wait period.)

3. Fixed an issue when empty catalog and category export csv files were created even though there were no updates made.

Download this release

Release Info

Developer Raymond Lai
Extension pitneybowes_gsp
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.3 to 1.1.0

Files changed (42) hide show
  1. ReadMe.txt +11 -1
  2. app/code/local/Pb/Pbgsp/Block/Adminhtml/Sales/Order/Invoice/Totals.php +4 -3
  3. app/code/local/Pb/Pbgsp/Block/Adminhtml/Sales/Order/Totals.php +4 -3
  4. app/code/local/Pb/Pbgsp/Block/Checkout/Shipping/Method/Available.php +4 -3
  5. app/code/local/Pb/Pbgsp/Block/Form.php +4 -3
  6. app/code/local/Pb/Pbgsp/Block/Sales/Order/Invoice/Totals.php +4 -3
  7. app/code/local/Pb/Pbgsp/Block/Sales/Order/Totals.php +4 -3
  8. app/code/local/Pb/Pbgsp/Model/Api.php +31 -3
  9. app/code/local/Pb/Pbgsp/Model/Carrier/ShippingMethod.php +4 -3
  10. app/code/local/Pb/Pbgsp/Model/Catalog/Category.php +10 -5
  11. app/code/local/Pb/Pbgsp/Model/Catalog/Cron.php +47 -15
  12. app/code/local/Pb/Pbgsp/Model/Catalog/File.php +65 -16
  13. app/code/local/Pb/Pbgsp/Model/Catalog/Product.php +9 -4
  14. app/code/local/Pb/Pbgsp/Model/Credentials.php +4 -3
  15. app/code/local/Pb/Pbgsp/Model/Creditmemo/Duty.php +4 -3
  16. app/code/local/Pb/Pbgsp/Model/Handlingoptions.php +4 -3
  17. app/code/local/Pb/Pbgsp/Model/Helper.php +4 -3
  18. app/code/local/Pb/Pbgsp/Model/Inboundparcel.php +4 -3
  19. app/code/local/Pb/Pbgsp/Model/Inboundparcel.php_bk +20 -0
  20. app/code/local/Pb/Pbgsp/Model/Invoice/Duty.php +4 -3
  21. app/code/local/Pb/Pbgsp/Model/Messages.php +4 -3
  22. app/code/local/Pb/Pbgsp/Model/Mysql4/Inboundparcel.php +4 -3
  23. app/code/local/Pb/Pbgsp/Model/Mysql4/Inboundparcel/Collection.php +4 -3
  24. app/code/local/Pb/Pbgsp/Model/Mysql4/Ordernumber.php +4 -3
  25. app/code/local/Pb/Pbgsp/Model/Mysql4/Ordernumber/Collection.php +4 -3
  26. app/code/local/Pb/Pbgsp/Model/Mysql4/Variable.php +4 -3
  27. app/code/local/Pb/Pbgsp/Model/Mysql4/Variable/Collection.php +4 -3
  28. app/code/local/Pb/Pbgsp/Model/Observer.php +31 -3
  29. app/code/local/Pb/Pbgsp/Model/Observer.php_bk +347 -0
  30. app/code/local/Pb/Pbgsp/Model/Ordernumber.php +4 -3
  31. app/code/local/Pb/Pbgsp/Model/Pdf/Tax.php +4 -3
  32. app/code/local/Pb/Pbgsp/Model/Quote/Duty.php +4 -3
  33. app/code/local/Pb/Pbgsp/Model/Resource/Mysql4/Setup.php +4 -3
  34. app/code/local/Pb/Pbgsp/Model/Sales/Order/Shipment.php +4 -3
  35. app/code/local/Pb/Pbgsp/Model/Util.php +4 -3
  36. app/code/local/Pb/Pbgsp/Model/Variable.php +4 -3
  37. app/code/local/Pb/Pbgsp/data/pb_pbgsp_setup/data-install-1.0.0.php +4 -3
  38. app/code/local/Pb/Pbgsp/etc/config.xml +11 -2
  39. app/code/local/Pb/Pbgsp/etc/config.xml_bk +511 -0
  40. app/code/local/Pb/Pbgsp/sql/pbgsp_setup/mysql4-install-1.0.0.php +4 -3
  41. app/code/local/Pb/Pbgsp/sql/pbgsp_setup/mysql4-upgrade-1.0.0-1.0.1.php +4 -3
  42. package.xml +9 -5
ReadMe.txt CHANGED
@@ -31,7 +31,16 @@ In order to take advantage of the file encryption setting in the extension confi
31
  ========================================================
32
  CHANGELOG
33
  ========================================================
34
- v. 1.0.2
 
 
 
 
 
 
 
 
 
35
 
36
  Added compatibility to run in php 5.6.x
37
 
@@ -40,6 +49,7 @@ v. 1.0.2
40
 
41
  Resolved issue where orders with shipments were not passing additional ASNs. Now an ASN is generated for each shipment per order
42
 
 
43
  v. 1.0.1
44
 
45
  Fixed a production issue when exportedFiles variable is null
31
  ========================================================
32
  CHANGELOG
33
  ========================================================
34
+ v. 1.1.0
35
+
36
+ Added logic to cancel the order in the PB system when a PB order is cancelled in Magento.
37
+
38
+ Fixed the incremental catalog/product export to only include products and/or category files when one or both are edited in magento (example: if the incremental update is set to every hour and only a single product was updated in any way during the wait period, that product will be included in the next incremental catalog update. The same is true for categories that were updated within the wait period.)
39
+
40
+ Fixed an issue when empty catalog and category export csv files were created even though there were no updates made.
41
+
42
+
43
+ v. 1.0.3
44
 
45
  Added compatibility to run in php 5.6.x
46
 
49
 
50
  Resolved issue where orders with shipments were not passing additional ASNs. Now an ASN is generated for each shipment per order
51
 
52
+
53
  v. 1.0.1
54
 
55
  Fixed a production issue when exportedFiles variable is null
app/code/local/Pb/Pbgsp/Block/Adminhtml/Sales/Order/Invoice/Totals.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
 
3
  /**
4
- * Product: Pb_Pbgsp (1.0.3)
5
- * Packaged: 2015-09-1T15:12:28+00:00
6
- * Last Modified: 2015-08-25T15:12:28+00:00
 
7
 
8
 
9
 
1
  <?php
2
 
3
  /**
4
+ * Product: Pb_Pbgsp (1.1.0)
5
+ * Packaged: 2015-09-9T12:10:00+00:00
6
+ * Last Modified: 2015-09-1T15:12:28+00:00
7
+
8
 
9
 
10
 
app/code/local/Pb/Pbgsp/Block/Adminhtml/Sales/Order/Totals.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
 
3
  /**
4
- * Product: Pb_Pbgsp (1.0.3)
5
- * Packaged: 2015-09-1T15:12:28+00:00
6
- * Last Modified: 2015-08-25T15:12:28+00:00
 
7
 
8
 
9
 
1
  <?php
2
 
3
  /**
4
+ * Product: Pb_Pbgsp (1.1.0)
5
+ * Packaged: 2015-09-9T12:10:00+00:00
6
+ * Last Modified: 2015-09-1T15:12:28+00:00
7
+
8
 
9
 
10
 
app/code/local/Pb/Pbgsp/Block/Checkout/Shipping/Method/Available.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
 
3
  /**
4
- * Product: Pb_Pbgsp (1.0.3)
5
- * Packaged: 2015-09-1T15:12:28+00:00
6
- * Last Modified: 2015-08-25T15:12:28+00:00
 
7
 
8
 
9
 
1
  <?php
2
 
3
  /**
4
+ * Product: Pb_Pbgsp (1.1.0)
5
+ * Packaged: 2015-09-9T12:10:00+00:00
6
+ * Last Modified: 2015-09-1T15:12:28+00:00
7
+
8
 
9
 
10
 
app/code/local/Pb/Pbgsp/Block/Form.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Block/Sales/Order/Invoice/Totals.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
 
3
  /**
4
- * Product: Pb_Pbgsp (1.0.3)
5
- * Packaged: 2015-09-1T15:12:28+00:00
6
- * Last Modified: 2015-08-25T15:12:28+00:00
 
7
 
8
 
9
 
1
  <?php
2
 
3
  /**
4
+ * Product: Pb_Pbgsp (1.1.0)
5
+ * Packaged: 2015-09-9T12:10:00+00:00
6
+ * Last Modified: 2015-09-1T15:12:28+00:00
7
+
8
 
9
 
10
 
app/code/local/Pb/Pbgsp/Block/Sales/Order/Totals.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Api.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
@@ -390,6 +391,33 @@ class Pb_Pbgsp_Model_Api
390
 
391
  }
392
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  }
394
 
395
  private static function logIfError($object,$action=null) {
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
391
 
392
  }
393
 
394
+ }
395
+
396
+ /* This is API method for cancel order in PB
397
+ Created by: Sudarshan
398
+ Date: 02/09/2015
399
+
400
+ */
401
+ public static function cancelOrder($cpOrderNumber) {
402
+
403
+ try {
404
+ Pb_Pbgsp_Model_Util::log('cancelling order in clearpath ',$cpOrderNumber);
405
+ $requestBody = array();
406
+ $url = Pb_Pbgsp_Model_Credentials::getOrderMgmtAPIUrl().'/orders/'.$cpOrderNumber.'/cancel';
407
+ $response = self::CallAPI('POST',$url,$requestBody);
408
+ $cancelOrderResponse = json_decode($response,true);
409
+ Pb_Pbgsp_Model_Util::log('Response of cancel order');
410
+ Pb_Pbgsp_Model_Util::log($cancelOrderResponse);
411
+ return $cancelOrderResponse;
412
+
413
+ }
414
+ catch(Exception $e) {
415
+ Pb_Pbgsp_Model_Util::log("Received unexpected exception from Pb while calling cancel Order.");
416
+ Pb_Pbgsp_Model_Util::logException($e);
417
+
418
+
419
+ }
420
+
421
  }
422
 
423
  private static function logIfError($object,$action=null) {
app/code/local/Pb/Pbgsp/Model/Carrier/ShippingMethod.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
 
3
  /**
4
- * Product: Pb_Pbgsp (1.0.3)
5
- * Packaged: 2015-09-1T15:12:28+00:00
6
- * Last Modified: 2015-08-25T15:12:28+00:00
 
7
 
8
 
9
 
1
  <?php
2
 
3
  /**
4
+ * Product: Pb_Pbgsp (1.1.0)
5
+ * Packaged: 2015-09-9T12:10:00+00:00
6
+ * Last Modified: 2015-09-1T15:12:28+00:00
7
+
8
 
9
 
10
 
app/code/local/Pb/Pbgsp/Model/Catalog/Category.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
@@ -61,14 +62,18 @@ class Pb_Pbgsp_Model_Catalog_Category {
61
  }
62
  private function _shouldUpload($lastDiff) {
63
 
 
 
 
64
  Pb_Pbgsp_Model_Util::log($this->category->getPbPbgspUploadActive());
65
  if(!$this->category->getPbPbgspUploadActive()) return false;
66
  $lastUpload = $this -> category -> getPbPbgspUpload();
67
- //Pb_Pbgsp_Model_Util::log('Product '. $this -> getSKU() . ' lastUpload='. $lastUpload . ' '. date('m-d-Y H:i:s',$lastUpload));
 
68
  if (!$lastUpload) {
69
  // First upload.
70
  return true;
71
- } else if ($lastDiff <= $lastUpload - (30 * 60)) {
72
  // Added after the last diff
73
  return true;
74
  } else {
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
62
  }
63
  private function _shouldUpload($lastDiff) {
64
 
65
+ if(!$lastDiff)
66
+ return true; //full catalog upload
67
+
68
  Pb_Pbgsp_Model_Util::log($this->category->getPbPbgspUploadActive());
69
  if(!$this->category->getPbPbgspUploadActive()) return false;
70
  $lastUpload = $this -> category -> getPbPbgspUpload();
71
+ $updatedAt = $this->category->getUpdatedAt();
72
+ Pb_Pbgsp_Model_Util::log($this->getName()." lastUpload:$lastUpload UpdatedAt:$updatedAt");
73
  if (!$lastUpload) {
74
  // First upload.
75
  return true;
76
+ } else if ($lastUpload < $updatedAt) {
77
  // Added after the last diff
78
  return true;
79
  } else {
app/code/local/Pb/Pbgsp/Model/Catalog/Cron.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
@@ -39,14 +40,39 @@
39
  $configOptions->createDirIfNotExists($mageRoot.'/var/pbgsp');
40
  chmod($mageRoot . '/var/pbgsp/', 0777);
41
 
42
- if (!isset($this->lastFull) || $this->lastFull->getValue() < time() - $fullPeriod*24*3600) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  // Full catalog upload needed
44
  $this->uploadCatalog();
45
- } else if (!isset($this->lastDiff) && $this->lastFull->getValue() < time() - $diffPeriod*3600) {
46
  // First catalog diff upload
47
  $this->uploadCatalog($this->lastFull);
48
- } else if (isset($this->lastDiff) && ($this->lastDiff->getValue() < time() - $diffPeriod*3600 &&
49
- $this->lastFull->getValue() < time() - $diffPeriod*3600)) {
50
  // Catalog diff upload
51
  $this->uploadCatalog($this->lastDiff);
52
  }
@@ -60,6 +86,7 @@
60
  public function uploadCatalog($lastDiff = false) {
61
  if (!$lastDiff) {
62
  Pb_Pbgsp_Model_Util::log("Full catalog upload");
 
63
  $file = new Pb_Pbgsp_Model_Catalog_File();
64
  if (isset($this->lastFull)) {
65
  $this->lastFull->setValue(time());
@@ -68,9 +95,10 @@
68
  $this->lastFull->setName("lastFull");
69
  $this->lastFull->setValue(time());
70
  }
71
- $this->lastFull->save();
72
  } else {
73
  Pb_Pbgsp_Model_Util::log("catalog diff");
 
74
  $file = new Pb_Pbgsp_Model_Catalog_File($lastDiff->getValue());
75
  if (isset($this->lastDiff)) {
76
  $this->lastDiff->setValue(time());
@@ -79,19 +107,23 @@
79
  $this->lastDiff->setName("lastDiff");
80
  $this->lastDiff->setValue(time());
81
  }
82
- $this->lastDiff->save();
83
  }
84
 
85
  Pb_Pbgsp_Model_Util::log("RAY:Create Function Started");
86
 
87
- $file->createNew();
88
 
89
- Pb_Pbgsp_Model_Util::log("RAY:Create Function Complete");
90
 
91
- Pb_Pbgsp_Model_Util::log("RAY:upload Started");
92
- $file->upload();
93
- $file->logProdWithoutCategories();
94
- Pb_Pbgsp_Model_Util::log("RAY:upload Complete");
 
 
 
 
95
  }
96
 
97
  public function processStatusNotifications() {
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
40
  $configOptions->createDirIfNotExists($mageRoot.'/var/pbgsp');
41
  chmod($mageRoot . '/var/pbgsp/', 0777);
42
 
43
+ $lastFull = '';
44
+ $lastDiff = '';
45
+ $currentTime = time();
46
+
47
+ $fullPeriodSeconds = $fullPeriod*24*3600;
48
+ $diffPeriodSeconds = $diffPeriod*3600;
49
+ if(isset($this->lastFull))
50
+ $lastFull = $this->lastFull->getValue();
51
+ if(isset($this->lastDiff))
52
+ $lastDiff = $this->lastDiff->getValue();
53
+
54
+ // Pb_Pbgsp_Model_Util::log("Current time:" . date('m-d-Y H:i:s',$currentTime)."\n");
55
+ // Pb_Pbgsp_Model_Util::log("Lastfull:".date('m-d-Y H:i:s',$lastFull)."\n" );
56
+ // Pb_Pbgsp_Model_Util::log("LastDiff:".date('m-d-Y H:i:s',$lastDiff)."\n");
57
+ // Pb_Pbgsp_Model_Util::log("fullPeriodSeconds:$fullPeriodSeconds\n");
58
+ // Pb_Pbgsp_Model_Util::log("diffPeriodSeconds:$diffPeriodSeconds\n");
59
+
60
+ $fulPeriodDiff = $currentTime - $fullPeriodSeconds;
61
+ $diffPeriodDiff = $currentTime - $diffPeriodSeconds;
62
+ // Pb_Pbgsp_Model_Util::log("fulPeriodDiff :" . $fulPeriodDiff ."\n");
63
+ // Pb_Pbgsp_Model_Util::log("diffPeriodDiff : ". $diffPeriodDiff . "\n");
64
+ // Pb_Pbgsp_Model_Util::log("lastFull - fulPeriodDiff : ". ($lastFull - $fulPeriodDiff ) . "\n");
65
+ // Pb_Pbgsp_Model_Util::log("lastFull - diffPeriodDiff : ". ($lastFull - $diffPeriodDiff ) . "\n");
66
+ // Pb_Pbgsp_Model_Util::log("lastDiff - diffPeriodDiff : ". ($lastDiff - $diffPeriodDiff ) . "\n");
67
+
68
+ if (!isset($this->lastFull) || $this->lastFull->getValue() < time() - $fullPeriodSeconds) {
69
  // Full catalog upload needed
70
  $this->uploadCatalog();
71
+ } else if (!isset($this->lastDiff) && $this->lastFull->getValue() < time() - $diffPeriodSeconds) {
72
  // First catalog diff upload
73
  $this->uploadCatalog($this->lastFull);
74
+ } else if (isset($this->lastDiff) && ($this->lastDiff->getValue() < time() - $diffPeriodSeconds &&
75
+ $this->lastFull->getValue() < time() - $diffPeriodSeconds)) {
76
  // Catalog diff upload
77
  $this->uploadCatalog($this->lastDiff);
78
  }
86
  public function uploadCatalog($lastDiff = false) {
87
  if (!$lastDiff) {
88
  Pb_Pbgsp_Model_Util::log("Full catalog upload");
89
+ Pb_Pbgsp_Model_Util::log("Full catalog upload\n");
90
  $file = new Pb_Pbgsp_Model_Catalog_File();
91
  if (isset($this->lastFull)) {
92
  $this->lastFull->setValue(time());
95
  $this->lastFull->setName("lastFull");
96
  $this->lastFull->setValue(time());
97
  }
98
+
99
  } else {
100
  Pb_Pbgsp_Model_Util::log("catalog diff");
101
+ Pb_Pbgsp_Model_Util::log("catalog diff\n");
102
  $file = new Pb_Pbgsp_Model_Catalog_File($lastDiff->getValue());
103
  if (isset($this->lastDiff)) {
104
  $this->lastDiff->setValue(time());
107
  $this->lastDiff->setName("lastDiff");
108
  $this->lastDiff->setValue(time());
109
  }
110
+
111
  }
112
 
113
  Pb_Pbgsp_Model_Util::log("RAY:Create Function Started");
114
 
115
+ $file->createNew();
116
 
117
+ Pb_Pbgsp_Model_Util::log("RAY:Create Function Complete");
118
 
119
+ Pb_Pbgsp_Model_Util::log("RAY:upload Started");
120
+ $file->upload();
121
+ if($this->lastFull)
122
+ $this->lastFull->save();
123
+ if($this->lastDiff)
124
+ $this->lastDiff->save();
125
+ $file->logProdWithoutCategories();
126
+ Pb_Pbgsp_Model_Util::log("RAY:upload Complete");
127
  }
128
 
129
  public function processStatusNotifications() {
app/code/local/Pb/Pbgsp/Model/Catalog/File.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
 
3
  /**
4
- * Product: Pb_Pbgsp (1.0.3)
5
- * Packaged: 2015-09-1T15:12:28+00:00
6
- * Last Modified: 2015-08-25T15:12:28+00:00
 
7
 
8
  * File: app/code/local/Pb/Pbgsp/Model/Catalog/File.php
9
  * Copyright: Copyright (c) 2015 Pitney Bowes <info@pb.com> / All rights reserved.
@@ -146,6 +147,7 @@ class Pb_Pbgsp_Model_Catalog_File {
146
  ->addAttributeToSelect('name')
147
  ->addAttributeToSelect('pb_pbgsp_upload_active')
148
  ->addAttributeToSelect('pb_pbgsp_upload')
 
149
  ->addFieldToFilter('path', array('like'=> "1/$rootId/%"));
150
  $addedCategories[] = $rootCat;
151
 
@@ -180,6 +182,12 @@ class Pb_Pbgsp_Model_Catalog_File {
180
  fclose($this->file);
181
  $this->_stripPartFromFileName($part);
182
  //fwrite($this->file,"</CategoryList>\n<CommodityList>\n");
 
 
 
 
 
 
183
  $fileRecordCount=0;
184
  $part=1;
185
  $this->_createNewCommoditiyFile($part);
@@ -205,6 +213,7 @@ class Pb_Pbgsp_Model_Catalog_File {
205
  ->addAttributeToSelect('product_url')
206
  ->addAttributeToSelect('type_id')
207
  ->addAttributeToSelect('pb_pbgsp_upload')
 
208
  // ->addUrlRewrite($category->getId()) //this will add the url rewrite.
209
  ->addAttributeToSelect('price')
210
  ->addAttributeToSelect('weight');
@@ -280,6 +289,9 @@ class Pb_Pbgsp_Model_Catalog_File {
280
  fflush($this->file);
281
 
282
  $this->_stripPartFromFileName($part);
 
 
 
283
  }
284
 
285
  private function _getCatNamePath($categories,$cateIds) {
@@ -384,9 +396,13 @@ class Pb_Pbgsp_Model_Catalog_File {
384
  public function processStatusNotifications() {
385
  try {
386
 
 
387
  $adminEmail = Pb_Pbgsp_Model_Credentials::getAdminEmail();
388
- if(!isset($adminEmail) || $adminEmail=='')
 
389
  return;
 
 
390
 
391
  $notificationDir = $this->_getNotificationDir();
392
  $this->_downloadStatusNotifications($notificationDir);
@@ -481,7 +497,9 @@ class Pb_Pbgsp_Model_Catalog_File {
481
 
482
  $credentials = $this->_getSftpCredentials();
483
  try {
 
484
  $sftpDumpFile = new Varien_Io_Sftp();
 
485
  $sftpDumpFile->open(
486
  $credentials
487
  );
@@ -495,8 +513,14 @@ class Pb_Pbgsp_Model_Catalog_File {
495
  //Pb_Pbgsp_Model_Util::log($files);
496
 
497
  $exportedFiles = $this->_getLastExportedFileNames();
498
- if(!$exportedFiles)
 
 
 
499
  return;
 
 
 
500
  foreach($files as $file) {
501
  foreach($exportedFiles as $exportedFile) {
502
  if($exportedFile == '')
@@ -505,6 +529,7 @@ class Pb_Pbgsp_Model_Catalog_File {
505
  if($this->_startsWith($file['text'],$fileNameWithoutExtension)) {
506
  $dest = $notificationDir.'/'.$file['text'];
507
  $sftpDumpFile->read($file['text'],$dest);
 
508
  }
509
  }
510
 
@@ -512,9 +537,12 @@ class Pb_Pbgsp_Model_Catalog_File {
512
  $sftpDumpFile->close();
513
  }
514
  catch (Exception $e) {
515
- Pb_Pbgsp_Model_Util::log($e->getTraceAsString());
516
- Pb_Pbgsp_Model_Util::log("Pb Module could not connect to sftp server: ".$credentials['host']." Wrong username/password. Postponing catalog upload.");
517
- return;
 
 
 
518
  }
519
 
520
  }
@@ -555,13 +583,13 @@ class Pb_Pbgsp_Model_Catalog_File {
555
 
556
  $tmpDir = $this->_getTempDir();
557
  $exportedFiles = array_diff(scandir($tmpDir), array('..', '.'));
558
- if (count($this->productIds) == 0) {
559
- // No new products to send, don't send anything.
560
- Pb_Pbgsp_Model_Util::log("No new products to send, don't send anything.");
561
- $this->_removeExportedFiles($exportedFiles);
562
-
563
- return;
564
- }
565
 
566
  Pb_Pbgsp_Model_Util::log("Pb catalog file upload started");
567
  try {
@@ -603,6 +631,7 @@ class Pb_Pbgsp_Model_Catalog_File {
603
  $sftpDumpFile->close();
604
 
605
  } catch (Exception $e) {
 
606
  Pb_Pbgsp_Model_Util::log($e->getTraceAsString());
607
  Pb_Pbgsp_Model_Util::log("Pb Module could not connect to sftp server: ".$credentials['host']." Wrong username/password. Postponing catalog upload.");
608
  return;
@@ -631,9 +660,11 @@ class Pb_Pbgsp_Model_Catalog_File {
631
  }
632
  private function _getLastExportedFileNames() {
633
  $exportedFilesVariable = $this->_getExportedFilesVariable();
634
- if(!isset($exportedFilesVariable) || $exportedFilesVariable->getValue() != '')
 
635
  return false;
636
  $exportedFiles = explode('|',$exportedFilesVariable->getValue());
 
637
  return $exportedFiles;
638
  }
639
  private function _logExportedFileInDB($exportedFiles) {
@@ -670,6 +701,24 @@ class Pb_Pbgsp_Model_Catalog_File {
670
  }
671
 
672
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
 
674
 
675
 
1
  <?php
2
 
3
  /**
4
+ * Product: Pb_Pbgsp (1.1.0)
5
+ * Packaged: 2015-09-9T12:10:00+00:00
6
+ * Last Modified: 2015-09-1T15:12:28+00:00
7
+
8
 
9
  * File: app/code/local/Pb/Pbgsp/Model/Catalog/File.php
10
  * Copyright: Copyright (c) 2015 Pitney Bowes <info@pb.com> / All rights reserved.
147
  ->addAttributeToSelect('name')
148
  ->addAttributeToSelect('pb_pbgsp_upload_active')
149
  ->addAttributeToSelect('pb_pbgsp_upload')
150
+ ->addAttributeToSelect('updated_at')
151
  ->addFieldToFilter('path', array('like'=> "1/$rootId/%"));
152
  $addedCategories[] = $rootCat;
153
 
182
  fclose($this->file);
183
  $this->_stripPartFromFileName($part);
184
  //fwrite($this->file,"</CategoryList>\n<CommodityList>\n");
185
+ if(count($this->uploadedCategories) == 0) {
186
+ //remove empty category files.
187
+ $tmpDir = $this->_getTempDir();
188
+ $exportedFiles = array_diff(scandir($tmpDir), array('..', '.'));
189
+ $this->_removeExportedFiles($exportedFiles);
190
+ }
191
  $fileRecordCount=0;
192
  $part=1;
193
  $this->_createNewCommoditiyFile($part);
213
  ->addAttributeToSelect('product_url')
214
  ->addAttributeToSelect('type_id')
215
  ->addAttributeToSelect('pb_pbgsp_upload')
216
+ ->addAttributeToSelect('updated_at')
217
  // ->addUrlRewrite($category->getId()) //this will add the url rewrite.
218
  ->addAttributeToSelect('price')
219
  ->addAttributeToSelect('weight');
289
  fflush($this->file);
290
 
291
  $this->_stripPartFromFileName($part);
292
+ if(count($this->productIds) == 0) {
293
+ $this->_removeExportedFilesByeType('catalog');
294
+ }
295
  }
296
 
297
  private function _getCatNamePath($categories,$cateIds) {
396
  public function processStatusNotifications() {
397
  try {
398
 
399
+ Pb_Pbgsp_Model_Util::log("Processing status notifications");
400
  $adminEmail = Pb_Pbgsp_Model_Credentials::getAdminEmail();
401
+ if(!isset($adminEmail) || $adminEmail=='') {
402
+ Pb_Pbgsp_Model_Util::log("Admin email is not set quiting status notification process.");
403
  return;
404
+ }
405
+
406
 
407
  $notificationDir = $this->_getNotificationDir();
408
  $this->_downloadStatusNotifications($notificationDir);
497
 
498
  $credentials = $this->_getSftpCredentials();
499
  try {
500
+ //Pb_Pbgsp_Model_Util::log($credentials);
501
  $sftpDumpFile = new Varien_Io_Sftp();
502
+ Pb_Pbgsp_Model_Util::log("Connecting SFTP to download notification files.");
503
  $sftpDumpFile->open(
504
  $credentials
505
  );
513
  //Pb_Pbgsp_Model_Util::log($files);
514
 
515
  $exportedFiles = $this->_getLastExportedFileNames();
516
+ Pb_Pbgsp_Model_Util::log("Last exported files.");
517
+ Pb_Pbgsp_Model_Util::log($exportedFiles);
518
+ if(!$exportedFiles) {
519
+ Pb_Pbgsp_Model_Util::log("exportedFiles is null");
520
  return;
521
+ }
522
+
523
+
524
  foreach($files as $file) {
525
  foreach($exportedFiles as $exportedFile) {
526
  if($exportedFile == '')
529
  if($this->_startsWith($file['text'],$fileNameWithoutExtension)) {
530
  $dest = $notificationDir.'/'.$file['text'];
531
  $sftpDumpFile->read($file['text'],$dest);
532
+ Pb_Pbgsp_Model_Util::log($file['text']. " downloaded from server");
533
  }
534
  }
535
 
537
  $sftpDumpFile->close();
538
  }
539
  catch (Exception $e) {
540
+ Pb_Pbgsp_Model_Util::log($e->getMessage());
541
+ //Pb_Pbgsp_Model_Util::log($e->getTraceAsString());
542
+
543
+ Pb_Pbgsp_Model_Util::log("Pb Module could not connect to sftp server: ".$credentials['host']." Wrong username/password. Postponing Status Notification process.");
544
+ Pb_Pbgsp_Model_Util::log($credentials);
545
+ throw $e;
546
  }
547
 
548
  }
583
 
584
  $tmpDir = $this->_getTempDir();
585
  $exportedFiles = array_diff(scandir($tmpDir), array('..', '.'));
586
+ // if (count($this->productIds) == 0) {
587
+ // // No new products to send, don't send anything.
588
+ // Pb_Pbgsp_Model_Util::log("No new products to send, don't send anything.");
589
+ // $this->_removeExportedFiles($exportedFiles);
590
+ //
591
+ // return;
592
+ // }
593
 
594
  Pb_Pbgsp_Model_Util::log("Pb catalog file upload started");
595
  try {
631
  $sftpDumpFile->close();
632
 
633
  } catch (Exception $e) {
634
+ Pb_Pbgsp_Model_Util::log($e->getMessage());
635
  Pb_Pbgsp_Model_Util::log($e->getTraceAsString());
636
  Pb_Pbgsp_Model_Util::log("Pb Module could not connect to sftp server: ".$credentials['host']." Wrong username/password. Postponing catalog upload.");
637
  return;
660
  }
661
  private function _getLastExportedFileNames() {
662
  $exportedFilesVariable = $this->_getExportedFilesVariable();
663
+
664
+ if(!isset($exportedFilesVariable) || $exportedFilesVariable->getValue() == '')
665
  return false;
666
  $exportedFiles = explode('|',$exportedFilesVariable->getValue());
667
+
668
  return $exportedFiles;
669
  }
670
  private function _logExportedFileInDB($exportedFiles) {
701
  }
702
 
703
 
704
+ private function _removeExportedFilesByeType($fileType) {
705
+ $tmpDir = $this->_getTempDir();
706
+ $exportedFiles = array_diff(scandir($tmpDir), array('..', '.'));
707
+ foreach($exportedFiles as $exportedFile) {
708
+ $fileName = $tmpDir . $exportedFile;
709
+ if(is_dir($fileName))
710
+ continue;
711
+ if(strpos($fileName,$fileType) !== false) {
712
+
713
+ unlink($fileName);
714
+ $fileName = str_replace(".gpg","",$fileName);//remove unencrypted file
715
+ if(is_file($fileName))
716
+ unlink($fileName);
717
+ }
718
+
719
+
720
+ }
721
+ }
722
 
723
 
724
 
app/code/local/Pb/Pbgsp/Model/Catalog/Product.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
@@ -179,12 +180,16 @@ class Pb_Pbgsp_Model_Catalog_Product {
179
  */
180
  public function shouldUpload($lastDiff) {
181
 
 
 
182
  $lastUpload = $this -> product -> getPbPbgspUpload();
 
 
183
  //Pb_Pbgsp_Model_Util::log('Product '. $this -> getSKU() . ' lastUpload='. $lastUpload . ' '. date('m-d-Y H:i:s',$lastUpload));
184
  if (!$lastUpload) {
185
  // First upload.
186
  return true;
187
- } else if ($lastDiff <= $lastUpload - (30 * 60)) {
188
  // Added after the last diff
189
  return true;
190
  } else {
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
180
  */
181
  public function shouldUpload($lastDiff) {
182
 
183
+ if(!$lastDiff)
184
+ return true; // full catalog upload
185
  $lastUpload = $this -> product -> getPbPbgspUpload();
186
+ $updatedAt = $this->product->getUpdatedAt();
187
+ Pb_Pbgsp_Model_Util::log($this->getSKU()." lastUpload:$lastUpload UpdatedAt:$updatedAt");
188
  //Pb_Pbgsp_Model_Util::log('Product '. $this -> getSKU() . ' lastUpload='. $lastUpload . ' '. date('m-d-Y H:i:s',$lastUpload));
189
  if (!$lastUpload) {
190
  // First upload.
191
  return true;
192
+ } else if ($lastUpload < $updatedAt) {
193
  // Added after the last diff
194
  return true;
195
  } else {
app/code/local/Pb/Pbgsp/Model/Credentials.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Creditmemo/Duty.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Handlingoptions.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Helper.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Inboundparcel.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Inboundparcel.php_bk ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Product: Pb_Pbgsp (1.0.3)
4
+ * Packaged: 2015-09-1T15:12:28+00:00
5
+ * Last Modified: 2015-08-25T15:12:28+00:00
6
+
7
+
8
+
9
+ * File: app/code/local/Pb/Pbgsp/Model/Inboundparcel.php
10
+ * Copyright: Copyright (c) 2015 Pitney Bowes <info@pb.com> / All rights reserved.
11
+ */
12
+ class Pb_Pbgsp_Model_Inboundparcel extends Mage_Core_Model_Abstract {
13
+ public function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->_init('pb_pbgsp/inboundparcel');
17
+ }
18
+ }
19
+
20
+ ?>
app/code/local/Pb/Pbgsp/Model/Invoice/Duty.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Messages.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Mysql4/Inboundparcel.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Mysql4/Inboundparcel/Collection.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Mysql4/Ordernumber.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Mysql4/Ordernumber/Collection.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Mysql4/Variable.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Mysql4/Variable/Collection.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Observer.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
@@ -134,6 +135,33 @@ class Pb_Pbgsp_Model_Observer {
134
 
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  public function saveShippingMethod($observer) {
138
  // Pb_Pbgsp_Model_Util::log('Pb_Pbgsp_Model_Observer.saveShippingMethod');
139
  //TODO: If anything fails here I need to fail the checkout process.
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
135
 
136
  }
137
 
138
+ /* This observer method get called on cancel order event in Magento
139
+ Created by: Sudarshan
140
+ Date: 02/09/2015
141
+
142
+ */
143
+ public function cancelPbOrder($observer) {
144
+
145
+ $mageOrderNumber = $observer->getEvent()->getOrder()->getId();
146
+ $order = $observer->getEvent()->getOrder();
147
+
148
+ if ($this->isPbOrder($order)) {
149
+
150
+ $clearPathOrders = Mage::getModel("pb_pbgsp/ordernumber")-> getCollection();
151
+ $clearPathOrders -> addFieldToFilter('mage_order_number', $order -> getRealOrderId());
152
+ foreach ($clearPathOrders as $cpOrder) {
153
+ $cpOrderNumber = $cpOrder -> getCpOrderNumber();
154
+ if (Pb_Pbgsp_Model_Api::cancelOrder($cpOrderNumber)) {
155
+ Pb_Pbgsp_Model_Util::log(" $mageOrderNumber order is cancel in PB");
156
+ }
157
+ }
158
+ }
159
+ else {
160
+ Pb_Pbgsp_Model_Util::log("$mageOrderNumber not PB order");
161
+ }
162
+
163
+ }
164
+
165
  public function saveShippingMethod($observer) {
166
  // Pb_Pbgsp_Model_Util::log('Pb_Pbgsp_Model_Observer.saveShippingMethod');
167
  //TODO: If anything fails here I need to fail the checkout process.
app/code/local/Pb/Pbgsp/Model/Observer.php_bk ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Product: Pb_Pbgsp (1.0.3)
4
+ * Packaged: 2015-09-1T15:12:28+00:00
5
+ * Last Modified: 2015-08-25T15:12:28+00:00
6
+
7
+
8
+
9
+ * File: app/code/local/Pb/Pbgsp/Model/Observer.php
10
+ * Copyright: Copyright (c) 2015 Pitney Bowes <info@pb.com> / All rights reserved.
11
+ */
12
+ class Pb_Pbgsp_Model_Observer {
13
+ const MODULE_NAME = 'Pb_Pbgsp';
14
+ public function __construct() {
15
+ }
16
+
17
+ public function isPbOrder($address) {
18
+ $shipMethod = $address->getShippingMethod();
19
+ $len = strlen("pbgsp_");
20
+ if (strlen($shipMethod) > $len && substr($shipMethod,0,$len) == "pbgsp_") {
21
+ return true;
22
+ }
23
+ Pb_Pbgsp_Model_Util::log("Shipping method". $shipMethod);
24
+ return false;
25
+
26
+ }
27
+
28
+ public function productLoadAfter($observer) {
29
+ $event = $observer->getEvent();
30
+ $product = $event->getProduct();
31
+ $product->lockAttribute('pb_pbgsp_upload');
32
+ }
33
+ public function categoryLoadAfter($observer) {
34
+ $event = $observer->getEvent();
35
+ $category = $event->getCategory();
36
+ $category->lockAttribute('pb_pbgsp_upload');
37
+ }
38
+ public function getShipMethod($observer) {
39
+ Pb_Pbgsp_Model_Util::log('Pb_Pbgsp_Model_Observer.getShipMethod');
40
+ $shipMethod = $observer->getQuote()->getShippingAddress()->getShippingMethod();
41
+
42
+ return substr($shipMethod,strlen("pbgsp_"));
43
+ }
44
+
45
+ public function generateInboundParcelPreAdvice($observer) {
46
+
47
+ if(Pb_Pbgsp_Model_Credentials::isASNGenerationEnabled() == '1') {
48
+ try {
49
+ $shipment = $observer->getEvent()->getShipment();
50
+ $order = $shipment->getOrder();
51
+ /* @var $order Mage_Sales_Model_Order */
52
+
53
+ if(!$this->isPbOrder($order))
54
+ return;
55
+ //check if ASN already generated or not
56
+ $parcel = Mage::getModel("pb_pbgsp/inboundparcel")-> getCollection();
57
+ $parcel -> addFieldToFilter('mage_order_number', $order -> getRealOrderId());
58
+ // if(count($parcel) > 0)
59
+ // return;
60
+ Pb_Pbgsp_Model_Util::log("Generting ASN.");
61
+ $clearPathOrders = Mage::getModel("pb_pbgsp/ordernumber")-> getCollection();
62
+ $clearPathOrders -> addFieldToFilter('mage_order_number', $order -> getRealOrderId());
63
+ foreach ($clearPathOrders as $cpOrder) {
64
+ $cpOrderNumber = $cpOrder -> getCpOrderNumber();
65
+ $tracks = array();
66
+ $items = array();
67
+ foreach($shipment->getTracksCollection() as $track) {
68
+ $tracks[] = $track;
69
+ }
70
+ foreach($shipment->getItemsCollection() as $item) {
71
+
72
+ $items[] = $item;
73
+
74
+ }
75
+
76
+ $parcelResponse = Pb_Pbgsp_Model_Api::generateInboundParcelNumber($shipment,$items,$order,$cpOrderNumber);
77
+ if(array_key_exists('errors',$parcelResponse)) {
78
+ Pb_Pbgsp_Model_Util::log("Error generating inbound parcel");
79
+ Pb_Pbgsp_Model_Util::log($parcelResponse);
80
+ }
81
+ else {
82
+ $cpParcel = Mage::getModel('pb_pbgsp/inboundparcel');
83
+ $cpParcel->setInboundParcel($parcelResponse['parcelIdentifier']);
84
+ $cpParcel->setMageOrderNumber( $order->getRealOrderId());
85
+ $cpParcel->setPbOrderNumber( $cpOrderNumber);
86
+ $cpParcel->save();
87
+ Pb_Pbgsp_Model_Util::log('Inbound Parcel Number Saved');
88
+ }
89
+
90
+ }
91
+
92
+
93
+ }
94
+ catch(Exception $e) {
95
+ Pb_Pbgsp_Model_Util::log("Error creating inbound parcel. ");
96
+ Pb_Pbgsp_Model_Util::logException($e);
97
+ }
98
+ }
99
+
100
+ }
101
+ public function createPbOrder($observer) {
102
+ // Pb_Pbgsp_Model_Util::log('Pb_Pbgsp_Model_Observer.createPbOrder');
103
+ Mage::getSingleton("customer/session")->setPbDutyAndTax(0);
104
+ $mageOrderNumber = Mage::getSingleton('checkout/session')->getLastRealOrderId();
105
+ $order = Mage::getModel('sales/order')->loadByIncrementId($mageOrderNumber);
106
+ Pb_Pbgsp_Model_Util::log(" createPbOrder");
107
+ if ($this->isPbOrder($order)) {
108
+ $orderNumber = Mage::getSingleton("customer/session")->getPbOrderNumber();
109
+
110
+ // Save in DB
111
+
112
+ $orderNumber->setMageOrderNumber($mageOrderNumber);
113
+ //$orderNumber->setCpOrderNumber($cpOrderNumber);
114
+ Pb_Pbgsp_Model_Util::log($orderNumber->getHubId());
115
+ Pb_Pbgsp_Model_Util::log($orderNumber->getHubCountry());
116
+ $orderNumber->setConfirmed(false);
117
+ $orderNumber->setReferenced(false);
118
+ $orderNumber->save();
119
+ Pb_Pbgsp_Model_Util::log("calling PB confirm order for $mageOrderNumber");
120
+ if (Pb_Pbgsp_Model_Api::confirmOrder($orderNumber->getCpOrderNumber(),$order)) {
121
+ $orderNumber->setConfirmed(true);
122
+ $orderNumber->setReferenced(true);
123
+ $orderNumber->save();
124
+ Pb_Pbgsp_Model_Util::log(" $mageOrderNumber order is confirmed in PB");
125
+ }
126
+ // if (Pb_Pbgsp_Model_Api::setOrderReference($cpOrderNumber,$mageOrderNumber)) {
127
+ // $orderNumber->setReferenced(true);
128
+ // $orderNumber->save();
129
+ // }
130
+ }
131
+ else {
132
+ Pb_Pbgsp_Model_Util::log("$mageOrderNumber not PB order");
133
+ }
134
+
135
+ }
136
+
137
+ public function saveShippingMethod($observer) {
138
+ // Pb_Pbgsp_Model_Util::log('Pb_Pbgsp_Model_Observer.saveShippingMethod');
139
+ //TODO: If anything fails here I need to fail the checkout process.
140
+ $address = $observer->getQuote()->getShippingAddress();
141
+ if ($this->isPbOrder($address)) {
142
+ Pb_Pbgsp_Model_Util::log(" PB order");
143
+ $items = Mage::getSingleton('checkout/cart')->getItems();
144
+ $shipMethod = $this->getShipMethod($observer);
145
+ $order = Pb_Pbgsp_Model_Api::createOrder($items,$shipMethod,$address);
146
+ if (!$order) {
147
+ Mage::throwException("Unable to create Pb order.");
148
+ }
149
+
150
+ $tax = $order['order']['totalImportation']['total']['value'];
151
+ if(Pb_Pbgsp_Model_Credentials::isFreeTaxEnabled())
152
+ $tax = 0;
153
+ Mage::getSingleton("customer/session")->setPbDutyAndTax($tax);
154
+
155
+ $orderNumber = Mage::getModel("pb_pbgsp/ordernumber");
156
+
157
+ $orderNumber->setCpOrderNumber($order["orderId"]);
158
+ $orderNumber->setHubId($order["shipToHub"]['hubId']);
159
+ $orderNumber->setHubStreet1($order["shipToHub"]['hubAddress']['street1']);
160
+ $orderNumber->setHubStreet2($order["shipToHub"]['hubAddress']['street2']);
161
+
162
+ $orderNumber->setHubProvinceOrState($order["shipToHub"]['hubAddress']['provinceOrState']);
163
+ $orderNumber->setHubCountry($order["shipToHub"]['hubAddress']['country']);
164
+ $orderNumber->setHubPostalCode($order["shipToHub"]['hubAddress']['postalOrZipCode']);
165
+ $orderNumber->setHubCity($order["shipToHub"]['hubAddress']['city']);
166
+ Mage::getSingleton("customer/session")->setPbOrderNumber($orderNumber);
167
+ } else {
168
+ Pb_Pbgsp_Model_Util::log(" not clearpath order");
169
+ Mage::getSingleton("customer/session")->setPbDutyAndTax(false);
170
+ Mage::getSingleton("customer/session")->setPbOrderNumber(false);
171
+ }
172
+ }
173
+
174
+ public function addDutiesOnEstimation($observer){
175
+ //Pb_Pbgsp_Model_Util::log('Pb_Pbgsp_Model_Observer.addDutiesOnEstimation');
176
+ Mage::getSingleton("customer/session")->setPbDutyAndTax(false);//Added by BigPixel to clear previous values, 10/20/2013
177
+ $clearPathMethods = Mage::getSingleton('checkout/session')->getPbMethods();
178
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
179
+ $selectedMethod = null;
180
+ if($quote->getShippingAddress()){
181
+ $selectedMethod = $quote->getShippingAddress()->getShippingMethod();
182
+ }
183
+
184
+ if($selectedMethod){
185
+ $selectedMethod = preg_replace('/pbgsp_/', '',$selectedMethod);
186
+ foreach($clearPathMethods as $clearPathMethod){
187
+ Pb_Pbgsp_Model_Util::log('addDutiesOnEstimation method'.$clearPathMethod->getMethod().' and tax'.$clearPathMethod->getTax());
188
+ if($clearPathMethod->getMethod() == $selectedMethod){
189
+ Mage::getSingleton("customer/session")->setPbDutyAndTax($clearPathMethod->getTax());
190
+ }
191
+ }
192
+ }
193
+ }
194
+
195
+ public function modifyOrderView($observer = NULL) {
196
+
197
+ //return;
198
+ if (!$observer) {
199
+ return;
200
+ }
201
+ if (Mage::getStoreConfig('advanced/modules_disable_output/'.self::MODULE_NAME))
202
+ return;
203
+ $transport = $observer->getEvent()->getTransport();
204
+ $layoutName = $observer->getEvent()->getBlock()->getNameInLayout();
205
+ if ('order_info' == $layoutName) {
206
+
207
+ if (!Mage::getStoreConfig('advanced/modules_disable_output/'.self::MODULE_NAME)) {
208
+
209
+
210
+ $cpOrderNumber = $this->_getCpOrderNumber($observer->getEvent()->getBlock()->getOrder());
211
+ if($cpOrderNumber) {
212
+ $html = "<div class='entry-edit'>
213
+ <div class='entry-edit-head'>
214
+ <h4 class='icon-head '>Pitney Bowes Shipments</h4>
215
+ </div>
216
+ <fieldset>
217
+ <strong>PB Order Number</strong>
218
+ <span>".$cpOrderNumber->getCpOrderNumber()."</span><br/>
219
+ <strong>Hub ID</strong>
220
+ <span>".$cpOrderNumber->getHubId()."</span><br/>
221
+ <strong>Hub Street 1</strong>
222
+ <span>".$cpOrderNumber->getHubStreet1()."</span><br/>
223
+ <strong>Hub Street 2</strong>
224
+ <span>".$cpOrderNumber->getHubStreet2()."</span><br/>
225
+
226
+ <strong>Postal Code</strong>
227
+ <span>".$cpOrderNumber->getHubPostalCode()."</span><br/>
228
+ <strong>Hub Province/State</strong>
229
+ <span>".$cpOrderNumber->getHubProvinceOrState()."</span><br/>
230
+ <strong>Hub City</strong>
231
+ <span>".$cpOrderNumber->getHubCity()."</span><br/>
232
+ <strong>Hub Country</strong>
233
+ <span>".$cpOrderNumber->getHubCountry()."</span><br/>
234
+ </fieldset>
235
+ </div>";
236
+ $transport['html'] = $transport['html'] . $html;
237
+ }
238
+
239
+
240
+ }
241
+ }
242
+ else if('email/order/shipment/track.phtml' == $observer->getEvent()->getBlock()->getTemplate()) {
243
+ if(!Mage::getStoreConfig('carriers/pbgsp/trackinglink'))
244
+ return;
245
+
246
+ $cpord = $this->_getCPORD($observer->getEvent()->getBlock()->getOrder());
247
+ if($cpord) {
248
+ $staging = 0;
249
+ if(strpos(Pb_Pbgsp_Model_Credentials::getCheckoutUrl(),'cpsandbox') >=0)
250
+ $staging = 1;
251
+ $transport['html'] = "<a href='http://tracking.ecommerce.pb.com/track/$cpord?staging=$staging'>Track your order</a>";
252
+ }
253
+
254
+ }
255
+ else if('shipping.tracking.popup' == $layoutName) {
256
+ if(!Mage::getStoreConfig('carriers/pbgsp/trackinglink'))
257
+ return;
258
+
259
+ $helper = Mage::helper('shipping');
260
+ $data = $helper->decodeTrackingHash($observer->getEvent()->getBlock()->getRequest()->getParam('hash'));
261
+
262
+ $orderId = null;
263
+ if($data['key'] == 'order_id')
264
+ $orderId = $data['id'];
265
+ else if($data['key'] == 'ship_id') {
266
+ /* @var $model Mage_Sales_Model_Order_Shipment */
267
+ $model = Mage::getModel('sales/order_shipment');
268
+ $ship = $model->load($data['id']);
269
+ $orderId = $model->getOrderId();
270
+ }
271
+ else if($data['key'] == 'track_id') {
272
+ $track = Mage::getModel('sales/order_shipment_track')->load($data['id']);
273
+ $orderId = $track->getOrderId();
274
+ }
275
+ if(!$orderId)
276
+ return;
277
+ $cpord = $this->_getCPORD(Mage::getModel('sales/order')->load($orderId));
278
+ if($cpord) {
279
+ $staging = 0;
280
+ if(strpos(Pb_Pbgsp_Model_Credentials::getCheckoutUrl(),'cpsandbox') >=0)
281
+ $staging = 1;
282
+ $script = "<script lang='javascript'>
283
+ window.location = 'http://tracking.ecommerce.pb.com/track/$cpord?staging=$staging';
284
+ </script>
285
+ ";
286
+ $transport['html'] = $script;
287
+ }
288
+
289
+ }
290
+ else
291
+ // if( 'checkout.onepage.review' == $layoutName
292
+ // || 'checkout.onepage.review.info.totals' == $layoutName
293
+ // || 'checkout.cart.totals' == $layoutName)
294
+ {
295
+ //replace "Shipping & Handling" to "Transportation Charges" and "Duty & Taxes" to "Importation Charges"
296
+ $html = $transport['html'];
297
+ $pbTitle = Mage::getStoreConfig('carriers/pbgsp/title');
298
+ if(strpos($html,$pbTitle) !== false) {
299
+ $html = str_replace("Shipping &amp; Handling","Transportation Charges",$html);
300
+ $html = str_replace("Shipping & Handling","Transportation Charges",$html);
301
+ $html = str_replace("Duty & Taxes","Importation Charges",$html);
302
+ $html = str_replace("Duty &amp; Taxes","Importation Charges",$html);
303
+ $transport['html'] = $html;
304
+ }
305
+
306
+ }
307
+ // else {
308
+ //
309
+ // }
310
+ // else {
311
+ // $html = $transport['html'];
312
+ // if(strpos('Shipping & Handling',$html) >= 0)
313
+ // Pb_Pbgsp_Model_Util::log("Found in $layoutName");
314
+ // }
315
+
316
+ return $this;
317
+ }
318
+ private function _getCPORD($order)
319
+ {
320
+ if($order) {
321
+ $cpOrder = $this->_getCpOrderNumber($order);
322
+ if($cpOrder) {
323
+ return $cpOrder -> getCpOrderNumber();
324
+ }
325
+
326
+ }
327
+
328
+ return false;
329
+ }
330
+ private function _getCpOrderNumber($order)
331
+ {
332
+ if($order) {
333
+ // $clearPathOrders = Mage::getModel("pb_pbgsp/ordernumber")-> getCollection();
334
+ //
335
+ // $clearPathOrders -> addFieldToFilter('mage_order_number', $order -> getRealOrderId());
336
+ // foreach ($clearPathOrders as $cpOrder) {
337
+ // return $cpOrder ;
338
+ //
339
+ // }
340
+ $cpOrder = Mage::getModel("pb_pbgsp/ordernumber")->load($order -> getRealOrderId(),'mage_order_number');
341
+ return $cpOrder;
342
+ }
343
+
344
+ return false;
345
+ }
346
+ }
347
+ ?>
app/code/local/Pb/Pbgsp/Model/Ordernumber.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Pdf/Tax.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Quote/Duty.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
2
 
3
  /**
4
- * Product: Pb_Pbgsp (1.0.3)
5
- * Packaged: 2015-09-1T15:12:28+00:00
6
- * Last Modified: 2015-08-25T15:12:28+00:00
 
7
 
8
 
9
 
1
  <?php
2
 
3
  /**
4
+ * Product: Pb_Pbgsp (1.1.0)
5
+ * Packaged: 2015-09-9T12:10:00+00:00
6
+ * Last Modified: 2015-09-1T15:12:28+00:00
7
+
8
 
9
 
10
 
app/code/local/Pb/Pbgsp/Model/Resource/Mysql4/Setup.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Sales/Order/Shipment.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Util.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/Model/Variable.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/data/pb_pbgsp_setup/data-install-1.0.0.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
  * File: app/code/local/Pb/Pbgsp/sql/pbgsp_setup/mysql4-install-1.0.0.php
8
  * Copyright: Copyright (c) 2015 Pitney Bowes <info@pb.com> / All rights reserved.
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
  * File: app/code/local/Pb/Pbgsp/sql/pbgsp_setup/mysql4-install-1.0.0.php
9
  * Copyright: Copyright (c) 2015 Pitney Bowes <info@pb.com> / All rights reserved.
app/code/local/Pb/Pbgsp/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Pb_Pbgsp>
5
- <version>1.0.1</version>
6
  </Pb_Pbgsp>
7
  </modules>
8
  <global>
@@ -495,7 +495,16 @@
495
  </Pb_Pbgsp_CreateParcel>
496
  </observers>
497
  </sales_order_shipment_save_after>
498
- </events>
 
 
 
 
 
 
 
 
 
499
  <!--<translate>-->
500
  <!--<modules>-->
501
  <!--<translations>-->
2
  <config>
3
  <modules>
4
  <Pb_Pbgsp>
5
+ <version>1.1.0</version>
6
  </Pb_Pbgsp>
7
  </modules>
8
  <global>
495
  </Pb_Pbgsp_CreateParcel>
496
  </observers>
497
  </sales_order_shipment_save_after>
498
+ <order_cancel_after>
499
+ <observers>
500
+ <Pb_Pbgsp_CreateParcel>
501
+ <type>model</type>
502
+ <class>pb_pbgsp/observer</class>
503
+ <method>cancelPbOrder</method>
504
+ </Pb_Pbgsp_CreateParcel>
505
+ </observers>
506
+ </order_cancel_after>
507
+ </events>
508
  <!--<translate>-->
509
  <!--<modules>-->
510
  <!--<translations>-->
app/code/local/Pb/Pbgsp/etc/config.xml_bk ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Pb_Pbgsp>
5
+ <version>1.0.1</version>
6
+ </Pb_Pbgsp>
7
+ </modules>
8
+ <global>
9
+ <!--<template>-->
10
+ <!--<email>-->
11
+ <!--<sales_email_pb_shipment_template>-->
12
+ <!--<label>Pitney Bowes Custom Shipment Email</label>-->
13
+ <!--<file>pbgsp_shipment_new.html</file>-->
14
+ <!--<type>html</type>-->
15
+ <!--</sales_email_pb_shipment_template>-->
16
+ <!--</email>-->
17
+ <!--</template>-->
18
+ <blocks>
19
+ <PB_Pbgsp>
20
+ <class>Pb_Pbgsp_Block</class>
21
+ </PB_Pbgsp>
22
+ <sales>
23
+ <rewrite>
24
+ <order_totals>Pb_Pbgsp_Block_Sales_Order_Totals</order_totals>
25
+ <order_invoice_totals>Pb_Pbgsp_Block_Sales_Order_Invoice_Totals</order_invoice_totals>
26
+
27
+ </rewrite>
28
+ </sales>
29
+ <adminhtml>
30
+ <rewrite>
31
+ <sales_order_totals>Pb_Pbgsp_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
32
+ <sales_order_invoice_totals>Pb_Pbgsp_Block_Adminhtml_Sales_Order_Invoice_Totals</sales_order_invoice_totals>
33
+
34
+ </rewrite>
35
+ </adminhtml>
36
+ <checkout>
37
+ <rewrite>
38
+ <onepage_shipping_method_available>Pb_Pbgsp_Block_Checkout_Shipping_Method_Available</onepage_shipping_method_available>
39
+ </rewrite>
40
+ </checkout>
41
+ </blocks>
42
+ <models>
43
+ <pb_pbgsp>
44
+ <class>Pb_Pbgsp_Model</class>
45
+ <resourceModel>pb_pbgsp_mysql4</resourceModel>
46
+ </pb_pbgsp>
47
+ <pb_pbgsp_mysql4>
48
+ <class>Pb_Pbgsp_Model_Mysql4</class>
49
+ <entities>
50
+ <variable>
51
+ <table>pbgsp_variable</table>
52
+ </variable>
53
+ <ordernumber>
54
+ <table>pbgsp_ordernumber</table>
55
+ </ordernumber>
56
+ <inboundparcel>
57
+ <table>pbgsp_inbound_parcel</table>
58
+ </inboundparcel>
59
+ </entities>
60
+ </pb_pbgsp_mysql4>
61
+ <sales>
62
+ <rewrite>
63
+ <order_invoice_total_tax>Pb_Pbgsp_Model_Invoice_Duty</order_invoice_total_tax>
64
+ <order_creditmemo_total_tax>Pb_Pbgsp_Model_Creditmemo_Duty</order_creditmemo_total_tax>
65
+ <order_shipment>Pb_Pbgsp_Model_Sales_Order_Shipment</order_shipment>
66
+ </rewrite>
67
+ </sales>
68
+ </models>
69
+ <resources>
70
+ <pbgsp_setup>
71
+ <setup>
72
+ <module>Pb_Pbgsp</module>
73
+ <class>Pb_Pbgsp_Model_Resource_Mysql4_Setup</class>
74
+ </setup>
75
+ <connection>
76
+ <use>core_setup</use>
77
+ </connection>
78
+ </pbgsp_setup>
79
+ <pb_pbgsp_write>
80
+ <connection>
81
+ <use>core_write</use>
82
+ </connection>
83
+ </pb_pbgsp_write>
84
+ <pb_pbgsp_read>
85
+ <connection>
86
+ <use>core_read</use>
87
+ </connection>
88
+ </pb_pbgsp_read>
89
+ </resources>
90
+ <events>
91
+ <!--<checkout_submit_all_after>&lt;!&ndash; added by Kamran 7/2/2014 &ndash;&gt;-->
92
+ <!--<observers>-->
93
+ <!--<Pb_Pbgsp_Model_CheckoutSubmitAllAfter>-->
94
+ <!--<type>model</type>-->
95
+ <!--<class>pb_pbgsp/observer</class>-->
96
+ <!--<method>createOrderAdminAfter</method>-->
97
+ <!--</Pb_Pbgsp_Model_CheckoutSubmitAllAfter>-->
98
+ <!--</observers>-->
99
+ <!--</checkout_submit_all_after>-->
100
+ <core_block_abstract_to_html_after>
101
+ <observers>
102
+ <Pb_Pbgsp_Model_OrderView>
103
+ <type>model</type>
104
+ <class>pb_pbgsp/observer</class>
105
+ <method>modifyOrderView</method>
106
+ </Pb_Pbgsp_Model_OrderView>
107
+ </observers>
108
+ </core_block_abstract_to_html_after>
109
+ <checkout_controller_onepage_save_shipping_method>
110
+ <observers>
111
+ <Pb_Pbgsp_Model_SaveShippingOne>
112
+ <type>model</type>
113
+ <class>pb_pbgsp/observer</class>
114
+ <method>saveShippingMethod</method>
115
+ </Pb_Pbgsp_Model_SaveShippingOne>
116
+ </observers>
117
+ </checkout_controller_onepage_save_shipping_method>
118
+ <checkout_onepage_controller_success_action>
119
+ <observers>
120
+ <Pb_Pbgsp_Model_CheckoutCompleteOne>
121
+ <type>model</type>
122
+ <class>pb_pbgsp/observer</class>
123
+ <method>createPbOrder</method>
124
+ </Pb_Pbgsp_Model_CheckoutCompleteOne>
125
+ </observers>
126
+ </checkout_onepage_controller_success_action>
127
+ <controller_action_postdispatch_checkout_cart_estimateUpdatePost>
128
+ <observers>
129
+ <Pb_Pbgsp_Estimated_Shipping>
130
+ <type>model</type>
131
+ <class>pb_pbgsp/observer</class>
132
+ <method>addDutiesOnEstimation</method>
133
+ </Pb_Pbgsp_Estimated_Shipping>
134
+ </observers>
135
+ </controller_action_postdispatch_checkout_cart_estimateUpdatePost>
136
+ <catalog_product_load_after>
137
+ <observers>
138
+ <Pb_Pbgsp_Product_Last_Export>
139
+ <type>model</type>
140
+ <class>pb_pbgsp/observer</class>
141
+ <method>productLoadAfter</method>
142
+ </Pb_Pbgsp_Product_Last_Export>
143
+ </observers>
144
+ </catalog_product_load_after>
145
+ <catalog_category_load_after>
146
+ <observers>
147
+ <Pb_Pbgsp_Product_Last_Export>
148
+ <type>model</type>
149
+ <class>pb_pbgsp/observer</class>
150
+ <method>categoryLoadAfter</method>
151
+ </Pb_Pbgsp_Product_Last_Export>
152
+ </observers>
153
+ </catalog_category_load_after>
154
+ </events>
155
+ <sales>
156
+ <quote>
157
+ <totals>
158
+ <tax>
159
+ <class>Pb_Pbgsp_Model_Quote_Duty</class>
160
+ <before>grand_total</before>
161
+ <after>shipping</after>
162
+ </tax>
163
+ </totals>
164
+ </quote>
165
+ </sales>
166
+ <pdf>
167
+ <totals>
168
+ <tax translate="title">
169
+ <title>Tax</title>
170
+ <source_field>tax_amount</source_field>
171
+ <model>pb_pbgsp/pdf_tax</model>
172
+ <font_size>7</font_size>
173
+ <display_zero>0</display_zero>
174
+ <sort_order>300</sort_order>
175
+ </tax>
176
+ </totals>
177
+ </pdf>
178
+
179
+ </global>
180
+ <resources>
181
+ <sales_setup>
182
+ <setup>
183
+ <module>Pb_Pbgsp</module>
184
+ <class>Pb_Pbgsp_Model_Entity_Setup</class>
185
+ </setup>
186
+ </sales_setup>
187
+ </resources>
188
+
189
+ <!--<frontend>-->
190
+ <!--<layout>-->
191
+ <!--<updates>-->
192
+ <!--<pbcheckout>-->
193
+ <!--<file>pbcheckout.xml</file>-->
194
+ <!--</pbcheckout>-->
195
+ <!--</updates>-->
196
+ <!--</layout>-->
197
+ <!--<routers>-->
198
+ <!--<Pb_Pbgsp>-->
199
+ <!--<use>standard</use>-->
200
+ <!--<args>-->
201
+ <!--<module>Pb_Pbgsp</module>-->
202
+ <!--<frontName>pbgsp</frontName>-->
203
+ <!--&lt;!&ndash; loads ../controller/IndexController in http://..../magento/index.php/testController &ndash;&gt;-->
204
+ <!--</args>-->
205
+ <!--</Pb_Pbgsp>-->
206
+ <!--</routers>-->
207
+ <!--<translate>-->
208
+ <!--<modules>-->
209
+ <!--<translations>-->
210
+ <!--<files>-->
211
+ <!--<default>Pb_Pbgsp.csv</default>-->
212
+ <!--</files>-->
213
+ <!--</translations>-->
214
+ <!--</modules>-->
215
+ <!--</translate>-->
216
+ <!--</frontend>-->
217
+
218
+ <default>
219
+ <carriers>
220
+ <pbgsp>
221
+ <active>1</active>
222
+ <sallowspecific>0</sallowspecific>
223
+ <model>Pb_Pbgsp_Model_Carrier_ShippingMethod</model>
224
+ <specificerrmsg>
225
+ This shipping method is currently unavailable.
226
+ If you would like to ship using this shipping
227
+ method, please contact us.
228
+ </specificerrmsg>
229
+ <handling_type>F</handling_type>
230
+ <catalog_diff>1</catalog_diff>
231
+ <catalog_full>1</catalog_full>
232
+ <catalog_size>10000</catalog_size>
233
+ <catalog_encryption_enabled>0</catalog_encryption_enabled>
234
+ <asn_generation_enabled>1</asn_generation_enabled>
235
+ <suppress_domestic_tracking>1</suppress_domestic_tracking>
236
+ <notify_catalog_ok>0</notify_catalog_ok>
237
+ <notify_catalog_err>1</notify_catalog_err>
238
+ <custom_shipment_email_subject><![CDATA[{{var store.getFrontendName()}}: Shipment confirmation for Order # {{var order.increment_id}}]]>
239
+ </custom_shipment_email_subject>
240
+ <custom_shipment_email_template><![CDATA[<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{htmlescape var=$order.getCustomerName()}}</h1>
241
+ <p style="font-size:12px; line-height:16px; margin:0;">
242
+ Thank you for your order from {{var store.getFrontendName()}}.
243
+ You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>.
244
+
245
+ </p>
246
+ <p style="font-size:12px; line-height:16px; margin:0;">
247
+ Your shipping confirmation is below. Thank you again for your business.
248
+ </p>
249
+
250
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #{{var order.increment_id}} has been shipped from local warehouse to international shipment hub from where it will be shipped to your country.</h2>
251
+
252
+ ]]>
253
+ </custom_shipment_email_template>
254
+ <separate_log_file>0</separate_log_file>
255
+
256
+ <shipping_services>
257
+ <POSTAL_PRIORITY>
258
+ <title>Standard</title>
259
+ <enabled>0</enabled>
260
+ </POSTAL_PRIORITY>
261
+ <FEDEX_ECONOMY>
262
+ <title>Express</title>
263
+ <enabled>1</enabled>
264
+ </FEDEX_ECONOMY>
265
+ <FEDEX_PRIORITY>
266
+ <title>Express Plus</title>
267
+ <enabled>1</enabled>
268
+ </FEDEX_PRIORITY>
269
+ <AE_STANDARD>
270
+ <title>Premier</title>
271
+ <enabled>1</enabled>
272
+ </AE_STANDARD>
273
+ <AU_STANDARD>
274
+ <title>Premier</title>
275
+ <enabled>1</enabled>
276
+ </AU_STANDARD>
277
+ <CN_STANDARD>
278
+ <title>Premier</title>
279
+ <enabled>1</enabled>
280
+ </CN_STANDARD>
281
+ <CPC_EXPRESS>
282
+ <title>Premier Plus</title>
283
+ <enabled>1</enabled>
284
+ </CPC_EXPRESS>
285
+ <CPC_STANDARD>
286
+ <title>Premier</title>
287
+ <enabled>1</enabled>
288
+ </CPC_STANDARD>
289
+ <EU_STANDARD>
290
+ <title>Premier</title>
291
+ <enabled>1</enabled>
292
+ </EU_STANDARD>
293
+ <HK_STANDARD>
294
+ <title>Premier</title>
295
+ <enabled>1</enabled>
296
+ </HK_STANDARD>
297
+ <KR_STANDARD>
298
+ <title>Premier</title>
299
+ <enabled>1</enabled>
300
+ </KR_STANDARD>
301
+ <NZ_STANDARD>
302
+ <title>Premier</title>
303
+ <enabled>1</enabled>
304
+ </NZ_STANDARD>
305
+ <PH_STANDARD>
306
+ <title>Premier</title>
307
+ <enabled>1</enabled>
308
+ </PH_STANDARD>
309
+ <SG_STANDARD>
310
+ <title>Premier</title>
311
+ <enabled>1</enabled>
312
+ </SG_STANDARD>
313
+ <TH_STANDARD>
314
+ <title>Premier</title>
315
+ <enabled>1</enabled>
316
+ </TH_STANDARD>
317
+ <TW_STANDARD>
318
+ <title>Premier</title>
319
+ <enabled>1</enabled>
320
+ </TW_STANDARD>
321
+ </shipping_services>
322
+ <error_messages>
323
+ <_1005001>
324
+ <display>The shipping address is invalid.</display>
325
+ </_1005001>
326
+ <_1005002>
327
+ <display>The consignee information is invalid.</display>
328
+ </_1005002>
329
+ <_1005003>
330
+ <display>The COP transportation information is invalid.</display>
331
+ </_1005003>
332
+ <_1005004>
333
+ <display>The requested return currency is invalid.</display>
334
+ </_1005004>
335
+ <_1005005>
336
+ <display>The request currency is not supported for the target country.</display>
337
+ </_1005005>
338
+ <_1005006>
339
+ <display>The order cannot be shipped by the method selected.</display>
340
+ </_1005006>
341
+ <_1005007>
342
+ <display>The order value has exceeded the allowed value.</display>
343
+ </_1005007>
344
+ <_1005008>
345
+ <display>Invalid fields in parcels.</display>
346
+ </_1005008>
347
+ <_1005009>
348
+ <display>Invalid fields in commoditySources.</display>
349
+ </_1005009>
350
+ <_1005010>
351
+ <display>This basket is over the dollar value for international shipping. Please remove some items before proceeding.</display>
352
+ </_1005010>
353
+ <_1005011>
354
+ <display>There are errors at the Quote Item Level.</display>
355
+ </_1005011>
356
+ <_1005012>
357
+ <display>The order exceeded the weight limit.</display>
358
+ </_1005012>
359
+ <_1005013>
360
+ <display>The shipping address has missing fields.</display>
361
+ </_1005013>
362
+ <_1005014>
363
+ <display>Missing fields in basket.</display>
364
+ </_1005014>
365
+ <_1005015>
366
+ <display>Invalid fields in basket.</display>
367
+ </_1005015>
368
+ <_1005016>
369
+ <display>The consignee information is missing.</display>
370
+ </_1005016>
371
+ <_1005017>
372
+ <display>The COP transportation information is missing.</display>
373
+ </_1005017>
374
+ <_1005018>
375
+ <display>Shipping Speed unavailable.</display>
376
+ </_1005018>
377
+ <_1005018>
378
+ <display>Shipping Speed unavailable.</display>
379
+ </_1005018>
380
+ <_1005019>
381
+ <display>Missing Basket.</display>
382
+ </_1005019>
383
+ <_1005020>
384
+ <display>Missing Parcel Fields.</display>
385
+ </_1005020>
386
+ <_1005021>
387
+ <display>Missing fields in the basket commodity source.</display>
388
+ </_1005021>
389
+ <_1005022>
390
+ <display>Invalid Parcel Fields.</display>
391
+ </_1005022>
392
+ <_1006001>
393
+ <display>The commodity was invalid.</display>
394
+ </_1006001>
395
+ <_1006002>
396
+ <display>The commodity is too large to ship (length, width or height).</display>
397
+ </_1006002>
398
+ <_1006003>
399
+ <display>The commodity cannot be shipped to the COD.</display>
400
+ </_1006003>
401
+ <_1006004>
402
+ <display>The commodity has a negative price.</display>
403
+ </_1006004>
404
+ <_1006005>
405
+ <display>The commodity’s price was too low and did not have a dutiable value.</display>
406
+ </_1006005>
407
+ <_1006006>
408
+ <display>The item price exceeds maximum.</display>
409
+ </_1006006>
410
+ <_1006007>
411
+ <display>Item weight exceeds maximum.</display>
412
+ </_1006007>
413
+ <_1006008>
414
+ <display>Invalid commodity rated data. Commodity cannot be shipped at this time. This is an internal error and should be raised to PB immediately. .</display>
415
+ </_1006008>
416
+ <_1006009>
417
+ <display>The Commodity is restricted for this Country of Destination.</display>
418
+ </_1006009>
419
+ <_10060010>
420
+ <display>Commodity cannot be quoted.</display>
421
+ </_10060010>
422
+ <_10060011>
423
+ <display>Commodity cannot shipped to the address specified.</display>
424
+ </_10060011>
425
+ <_1007001>
426
+ <display>Order value exceeded on this line.</display>
427
+ </_1007001>
428
+ <_1007002>
429
+ <display>Line too large to ship (length, width or height of the shipping box).</display>
430
+ </_1007002>
431
+ <_1007003>
432
+ <display>The quantity is invalid or missing.</display>
433
+ </_1007003>
434
+ <_1007004>
435
+ <display>Weight Value exceeded on this line.</display>
436
+ </_1007004>
437
+ <_1007005>
438
+ <display>Errors in the kitContents.</display>
439
+ </_1007005>
440
+ <_1007006>
441
+ <display>Missing fields in basket line.</display>
442
+ </_1007006>
443
+ <_1007007>
444
+ <display>Invalid fields in basket line.</display>
445
+ </_1007007>
446
+ <_1007008>
447
+ <display>Quantity exceeded for Country of Destination.</display>
448
+ </_1007008>
449
+ </error_messages>
450
+ </pbgsp>
451
+ </carriers>
452
+ </default>
453
+
454
+ <!-- Please modify this part for CRON JOB
455
+ For more information on Magento Cron Job, please visit the following url:
456
+ http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job#built-in_cron_jobs
457
+ -->
458
+ <crontab>
459
+ <jobs>
460
+ <pb_pbgsp>
461
+ <schedule>
462
+ <cron_expr>30 * * * *</cron_expr>
463
+ </schedule>
464
+ <run>
465
+ <model>pb_pbgsp/catalog_cron::catalogSync</model>
466
+ </run>
467
+ </pb_pbgsp>
468
+ <pb_notifications>
469
+ <schedule>
470
+ <cron_expr>20 * * * *</cron_expr>
471
+ </schedule>
472
+ <run>
473
+ <model>pb_pbgsp/catalog_cron::processStatusNotifications</model>
474
+ </run>
475
+ </pb_notifications>
476
+ </jobs>
477
+ </crontab>
478
+ <adminhtml>
479
+ <events>
480
+ <!--<sales_order_save_commit_after>-->
481
+ <!--<observers>-->
482
+ <!--<Pb_Pbgsp_CreateParcel>-->
483
+ <!--<type>model</type>-->
484
+ <!--<class>pb_pbgsp/observer</class>-->
485
+ <!--<method>generateInboundParcelPreAdvice</method>-->
486
+ <!--</Pb_Pbgsp_CreateParcel>-->
487
+ <!--</observers>-->
488
+ <!--</sales_order_save_commit_after>-->
489
+ <sales_order_shipment_save_after>
490
+ <observers>
491
+ <Pb_Pbgsp_CreateParcel>
492
+ <type>model</type>
493
+ <class>pb_pbgsp/observer</class>
494
+ <method>generateInboundParcelPreAdvice</method>
495
+ </Pb_Pbgsp_CreateParcel>
496
+ </observers>
497
+ </sales_order_shipment_save_after>
498
+ </events>
499
+ <!--<translate>-->
500
+ <!--<modules>-->
501
+ <!--<translations>-->
502
+ <!--<files>-->
503
+ <!--<default>Pb_Pbgsp.csv</default>-->
504
+ <!--</files>-->
505
+ <!--</translations>-->
506
+ <!--</modules>-->
507
+ <!--</translate>-->
508
+ </adminhtml>
509
+
510
+ </config>
511
+
app/code/local/Pb/Pbgsp/sql/pbgsp_setup/mysql4-install-1.0.0.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
app/code/local/Pb/Pbgsp/sql/pbgsp_setup/mysql4-upgrade-1.0.0-1.0.1.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
  /**
3
- * Product: Pb_Pbgsp (1.0.3)
4
- * Packaged: 2015-09-1T15:12:28+00:00
5
- * Last Modified: 2015-08-25T15:12:28+00:00
 
6
 
7
 
8
 
1
  <?php
2
  /**
3
+ * Product: Pb_Pbgsp (1.1.0)
4
+ * Packaged: 2015-09-9T12:10:00+00:00
5
+ * Last Modified: 2015-09-1T15:12:28+00:00
6
+
7
 
8
 
9
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>pitneybowes_gsp</name>
4
- <version>1.0.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>
@@ -24,12 +24,16 @@ To learn more, go to &lt;a href="http://www.pb.com/ecom"&gt;http://www.pb.com/ec
24
  </description>
25
  <notes>Patch release for Magento Connect.&#xD;
26
  &#xD;
27
- 1. Added compatibility to run in php 5.6.x &#xD;
 
 
 
 
28
  </notes>
29
  <authors><author><name>Raymond Lai</name><user>r3lai</user><email>raymond.lai@pb.com</email></author></authors>
30
- <date>2015-09-01</date>
31
- <time>14:00:28</time>
32
- <contents><target name="magelocal"><dir name="Pb"><dir name="Pbgsp"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Invoice"><file name="Totals.php" hash="5729ef35e0d5b5169fe1f2df768cfc90"/></dir><file name="Totals.php" hash="2d2c9b96e8ff872bb6cb0c215f662136"/></dir></dir></dir><dir name="Checkout"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="5bacd3499beb6b51ebdb194aad9d0d81"/></dir></dir></dir><file name="Form.php" hash="a47d85b1475121bd2807bd46f0f9bea7"/><dir name="Sales"><dir name="Order"><dir name="Invoice"><file name="Totals.php" hash="17aea44fb0c0a3f7cdc387bf48d63d83"/></dir><file name="Totals.php" hash="ab45e407fda85eade5a78abba3936438"/></dir></dir></dir><dir name="Model"><file name="Api.php" hash="93e1169d82d93bf87a3104a121ad8fe6"/><dir name="Carrier"><file name="ShippingMethod.php" hash="a3d9a814f18008836b3efc8085612893"/></dir><dir name="Catalog"><file name="Category.php" hash="a6c4588eafba5c07143f8df8b17afec6"/><file name="Cron.php" hash="1e3adeb6114ba180b4761e52e03300cc"/><file name="File.php" hash="a6a5eccd24b67966fbcf64353ac8d88c"/><file name="Product.php" hash="cd4a721d64e19652fd4c10244154e46a"/></dir><file name="Credentials.php" hash="6c82fac0d3d1e00ba0385963809dd7ef"/><dir name="Creditmemo"><file name="Duty.php" hash="74e5628248244a926075d6be298a701a"/></dir><file name="Handlingoptions.php" hash="7bb3ec54956010d7a9f76d57b90e412b"/><file name="Helper.php" hash="6f5571cf56e7bdb93616f26fc577fa6d"/><file name="Inboundparcel.php" hash="2eb5ccbb316b527a034808f090ff98db"/><dir name="Invoice"><file name="Duty.php" hash="f02d6ab7786864467946b924b544ccec"/></dir><file name="Messages.php" hash="24dc9bc170fdf77c7846c493a90e003d"/><dir name="Mysql4"><dir name="Inboundparcel"><file name="Collection.php" hash="a621601118262beb7987c5174658e58e"/></dir><file name="Inboundparcel.php" hash="b331929da71aa9a350b017f163511514"/><dir name="Ordernumber"><file name="Collection.php" hash="adc47bdd5635ffc4a1cbd853a184384b"/></dir><file name="Ordernumber.php" hash="9252b9a383ee8308bd816184c23f7585"/><dir name="Variable"><file name="Collection.php" hash="ea9246deb738136e360e78a5d767cdf6"/></dir><file name="Variable.php" hash="42944333611ac890a5ad69c4ea1d5e18"/></dir><file name="Observer.php" hash="c458ac3550ba95916f350703054aee58"/><file name="Ordernumber.php" hash="6be30597ab59461955989db13e2ad222"/><dir name="Pdf"><file name="Tax.php" hash="37928ac79f1df8478a0443481dbf1812"/></dir><dir name="Quote"><file name="Duty.php" hash="6212b9d6d13fa6308be26258d7556b5b"/></dir><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="8bfe25d9abf012676a5df01e635103dc"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Shipment.php" hash="fd3513b69a2f648f62dcfcb0ecc45f02"/></dir></dir><file name="Util.php" hash="2ec986a8a53813cd78a43d8ec0f257db"/><file name="Variable.php" hash="ec2d892e10386f8dab17edff79863b23"/></dir><file name="README" hash="e7ad1d9a7ba016753e381a9ca92b696e"/><dir name="data"><dir name="pb_pbgsp_setup"><file name="data-install-1.0.0.php" hash="d972293cdbf3b18b02ea8553ee073fae"/></dir></dir><dir name="etc"><file name="config.xml" hash="cd07d8dcac33bc08cc62eb66e7bd8761"/><file name="system.xml" hash="32456da492543f56536323a99fd4cc00"/></dir><dir name="sql"><dir name="pbgsp_setup"><file name="mysql4-install-1.0.0.php" hash="23b4c71dffa85b0031e1585aaa362ed5"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="b5ef7ba8af7d1bc89b8d92aca6c0dd61"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pb_Pbgsp.xml" hash="8475d60d4719f8ea7761a4ca39016e48"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Pb_Clearpath.csv" hash="aa4b7a650feb1709a34b6c053b56811c"/><dir name="template"><dir name="email"><file name="pbgsp_shipment_new.html" hash="2cc5cdbeaa719f4dab6a7c9e29fd6574"/></dir></dir></dir></target><target name="mageweb"><dir name="."><file name="ReadMe.txt" hash="d848909c198484c430b55b1d5636a73e"/></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.1.0</min><max>5.6.0</max></php></required></dependencies>
35
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>pitneybowes_gsp</name>
4
+ <version>1.1.0</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>
24
  </description>
25
  <notes>Patch release for Magento Connect.&#xD;
26
  &#xD;
27
+ 1. Added logic to cancel the order in the PB system when a PB order is cancelled in Magento.&#xD;
28
+ &#xD;
29
+ 2. Fixed the incremental catalog/product export to only include products and/or category files when one or both are edited in magento (example: if the incremental update is set to every hour and only a single product was updated in any way during the wait period, that product will be included in the next incremental catalog update. The same is true for categories that were updated within the wait period.)&#xD;
30
+ &#xD;
31
+ 3. Fixed an issue when empty catalog and category export csv files were created even though there were no updates made.&#xD;
32
  </notes>
33
  <authors><author><name>Raymond Lai</name><user>r3lai</user><email>raymond.lai@pb.com</email></author></authors>
34
+ <date>2015-09-09</date>
35
+ <time>18:18:38</time>
36
+ <contents><target name="magelocal"><dir name="Pb"><dir name="Pbgsp"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Invoice"><file name="Totals.php" hash="1525a5aa7a7c199912f1ef508232a5eb"/></dir><file name="Totals.php" hash="8cdced54ef497758edbb43849186fdad"/></dir></dir></dir><dir name="Checkout"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="4b79ef22466822e713f8240d46d2127a"/></dir></dir></dir><file name="Form.php" hash="b496459300f91fb5894995d0daa1f457"/><dir name="Sales"><dir name="Order"><dir name="Invoice"><file name="Totals.php" hash="daa1fe4da1f6c1298d4426bfc39742e2"/></dir><file name="Totals.php" hash="9a4b9addcb445e40059b65d95b18ba72"/></dir></dir></dir><dir name="Model"><file name="Api.php" hash="be6e411cc1dca8c937deaabc126d5e32"/><dir name="Carrier"><file name="ShippingMethod.php" hash="89703a8d4fa716377082f0fd34b167f7"/></dir><dir name="Catalog"><file name="Category.php" hash="00e269b491d3ee9666215a30254737a2"/><file name="Cron.php" hash="3c365b533196241747a4e0177eeff918"/><file name="File.php" hash="3f9d0b1242c47906aa6af42922840732"/><file name="Product.php" hash="97e76a479479f5fa1a0dbedbb2203220"/></dir><file name="Credentials.php" hash="65dce863b7fee3f2df478b4260ca4c95"/><dir name="Creditmemo"><file name="Duty.php" hash="7815dd2b82c1a60e63e41f2a6c4dff87"/></dir><file name="Handlingoptions.php" hash="217ddc325d671164e5d5f145423d67a9"/><file name="Helper.php" hash="795423e236d634d01fe6a4e1cbed4964"/><file name="Inboundparcel.php" hash="bc51c0979d196022bdfb6509582abf4c"/><file name="Inboundparcel.php_bk" hash="2eb5ccbb316b527a034808f090ff98db"/><dir name="Invoice"><file name="Duty.php" hash="a07a227473081a32ed0fa0d0f4ed249c"/></dir><file name="Messages.php" hash="58434fde192b5fa71940f6ec91799e6c"/><dir name="Mysql4"><dir name="Inboundparcel"><file name="Collection.php" hash="dfd07df56e0a4fd49c618f2bc3d8ee67"/></dir><file name="Inboundparcel.php" hash="aff5a9f952a4a68e57a9d521bd43b58c"/><dir name="Ordernumber"><file name="Collection.php" hash="39c7806b5cb45822bd32c52817ea130d"/></dir><file name="Ordernumber.php" hash="512d9bb922117e3294a5b2a1b11f8eb8"/><dir name="Variable"><file name="Collection.php" hash="0828513828ad25da1786852704205678"/></dir><file name="Variable.php" hash="8f7eefc9210e962d0e40528db099e125"/></dir><file name="Observer.php" hash="db59fa2233a04787e2ba42f652fde006"/><file name="Observer.php_bk" hash="c458ac3550ba95916f350703054aee58"/><file name="Ordernumber.php" hash="2dda66faf24caed1879482ae85824642"/><dir name="Pdf"><file name="Tax.php" hash="a15b6f92132cb18895d0f1840dcab76e"/></dir><dir name="Quote"><file name="Duty.php" hash="c90d97a91077aef85db610e44c0fd58a"/></dir><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="69f5acb17286282da264c71e94265d9e"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Shipment.php" hash="0ea6e1d5b46c29b3f4a31f5a2964ded6"/></dir></dir><file name="Util.php" hash="a7a35511104303f78f397a66baf32ffe"/><file name="Variable.php" hash="b1359b968627e7d6bde94f9d5c037573"/></dir><file name="README" hash="e7ad1d9a7ba016753e381a9ca92b696e"/><dir name="data"><dir name="pb_pbgsp_setup"><file name="data-install-1.0.0.php" hash="8793a87c4ce037f199ed62fd846130f4"/></dir></dir><dir name="etc"><file name="config.xml" hash="6b8b0929521c82a90ab49d4d7b680132"/><file name="config.xml_bk" hash="cd07d8dcac33bc08cc62eb66e7bd8761"/><file name="system.xml" hash="32456da492543f56536323a99fd4cc00"/></dir><dir name="sql"><dir name="pbgsp_setup"><file name="mysql4-install-1.0.0.php" hash="5222cd523c1edc10c58ed1267f495a99"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="ddfa97743989444a2e7624e3a2e473e2"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pb_Pbgsp.xml" hash="8475d60d4719f8ea7761a4ca39016e48"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Pb_Clearpath.csv" hash="aa4b7a650feb1709a34b6c053b56811c"/><dir name="template"><dir name="email"><file name="pbgsp_shipment_new.html" hash="2cc5cdbeaa719f4dab6a7c9e29fd6574"/></dir></dir></dir></target><target name="mageweb"><dir name="."><file name="ReadMe.txt" hash="3592b6511d44b1e385fa92736adf06e8"/></dir></target></contents>
37
  <compatible/>
38
  <dependencies><required><php><min>5.1.0</min><max>5.6.0</max></php></required></dependencies>
39
  </package>