Skip to content

Commit

Permalink
fix empty address ids
Browse files Browse the repository at this point in the history
  • Loading branch information
andrecedik committed Mar 12, 2018
1 parent 6239758 commit 0b7af93
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
== Changelog ==



= 1.6.4 =
* Enhanced: Rework handling of WP_Error when deleting a shipment
* Enhanced: Added method to shipment model so we can output error messages to the UI
Expand Down
4 changes: 2 additions & 2 deletions components/woo/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -945,11 +945,11 @@ public function create_shipment_label( $data ) {
$data['to']['email'] = $this->__get('billing_email');
}

if ( ! isset($data['from']['id']) ) {
if (! isset($data['from']['id']) || '' === $data['from']['id']) {

This comment has been minimized.

Copy link
@ScreamingDev

ScreamingDev Mar 15, 2018

Contributor

Vor 4 Monaten: if ( '' === $data['from']['id']) // sinngemäß

Vor 2 Wochen: if (! isset($data['from']['id']) // Wahrscheinlich, wegen Notices - aber das ist etwas ganz anderes als das obige

Jetzt:
if (! isset($data['from']['id']) || '' === $data['from']['id']) // Bringt die notice wieder, denn Wenn es nicht existiert, dann wird dessen Wert geprüft, aber etwas nicht-existentes schmeißt die bekannten notices.

Ich glaube du meintest:
if ( isset($data['from'], $data['from']['id']) && ! $data['from']['id'])
from gibt es, from.id gibt es (schützt vor notices), UND from.id ist 0, leerer string oder false.
Ja dann unset bitte

@andrecedik

This comment has been minimized.

Copy link
@andrecedik

andrecedik Mar 16, 2018

Author Contributor

Argh, alles klar. Vielen Dank. Werde ich noch mal anpassen 👍

unset( $data['from']['id'] );
}

if ( ! isset($data['to']['id']) ) {
if ( ! isset($data['to']['id']) || '' === $data['to']['id'] ) {
unset( $data['to']['id'] );
}

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: mahype, awesome-ug, andrecedik, screamingdev
Tags: woocommerce, shipping, tracking, stamps
Requires at least: 4.2.0
Tested up to: 4.9.1
Stable tag: 1.6.4
Stable tag: 1.6.5
Requires PHP: 5.4

This plugin integrates [shipcloud](http://bit.ly/shipcloud-for-woocommerce-en) into WooCommerce.
Expand Down Expand Up @@ -115,6 +115,9 @@ https://youtu.be/HE3jow15x8c

== Changelog ==

= 1.6.5 =
* Fixed: Creating shipping labels from prepared shipments not working because of address id.

= 1.6.4 =
* Enhanced: Rework handling of WP_Error when deleting a shipment
* Enhanced: Added method to shipment model so we can output error messages to the UI
Expand Down

0 comments on commit 0b7af93

Please sign in to comment.