Merge pull request #28893 from woocommerce/tracker_return_string_values

Tracker return string values for order related data
This commit is contained in:
Peter Fabian 2021-01-28 13:17:04 +01:00 committed by GitHub
commit afbc0ab42d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 5 deletions

View File

@ -364,9 +364,11 @@ class WC_Tracker {
);
$first = time();
$processing_first = $first;
$first_time = $first;
$last = 0;
$processing_first = time();
$processing_last = 0;
$order_data = array();
$orders = wc_get_orders( $args );
$orders_count = count( $orders );
@ -445,10 +447,25 @@ class WC_Tracker {
$orders_count = count( $orders );
}
$order_data['first'] = gmdate( 'Y-m-d H:i:s', $first );
$order_data['last'] = gmdate( 'Y-m-d H:i:s', $last );
$order_data['processing_first'] = gmdate( 'Y-m-d H:i:s', $processing_first );
$order_data['processing_last'] = gmdate( 'Y-m-d H:i:s', $processing_last );
if ( $first !== $first_time ) {
$order_data['first'] = gmdate( 'Y-m-d H:i:s', $first );
}
if ( $processing_first !== $first_time ) {
$order_data['processing_first'] = gmdate( 'Y-m-d H:i:s', $processing_first );
}
if ( $last ) {
$order_data['last'] = gmdate( 'Y-m-d H:i:s', $last );
}
if ( $processing_last ) {
$order_data['processing_last'] = gmdate( 'Y-m-d H:i:s', $processing_last );
}
foreach ( $order_data as $key => $value ) {
$order_data[ $key ] = (string) $value;
}
return $order_data;
}