Skip to content

Commit

Permalink
filter array value before checking empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Spreeuw committed Jul 18, 2017
1 parent 204ccdd commit 1bda030
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/documents/abstract-wcpdf-order-document.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,12 @@ public function set_date( $value, $order = null ) {

public function set_number( $value, $order = null ) {
$order = empty( $order ) ? $this->order : $order;
if ( empty( $value ) || ( is_array( $value ) && empty( array_filter ( $value ) ) ) ) {

if ( is_array( $value ) ) {
$filtered_value = array_filter( $value );
}

if ( empty( $value ) || ( is_array( $value ) && empty( $filtered_value ) ) ) {
$document_number = null;
} elseif ( is_array( $value ) ) {
// WCPDF 2.0 number data
Expand Down

0 comments on commit 1bda030

Please sign in to comment.