Merge pull request #14710 from woocommerce/pr/14707

woocommerce_payment_complete_order_status args
This commit is contained in:
Mike Jolley 2017-04-26 11:09:50 +01:00 committed by GitHub
commit 9d7403f2a9
2 changed files with 3 additions and 3 deletions

View File

@ -255,7 +255,7 @@ class WC_Order extends WC_Abstract_Order {
* @since 3.0.0
*/
public function maybe_set_date_paid() {
if ( ! $this->get_date_paid( 'edit' ) && $this->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? 'processing' : 'completed', $this->get_id() ) ) ) {
if ( ! $this->get_date_paid( 'edit' ) && $this->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? 'processing' : 'completed', $this->get_id(), $this ) ) ) {
$this->set_date_paid( current_time( 'timestamp' ) );
}
}
@ -730,7 +730,7 @@ class WC_Order extends WC_Abstract_Order {
public function get_date_paid( $context = 'view' ) {
$date_paid = $this->get_prop( 'date_paid', $context );
if ( 'view' === $context && ! $date_paid && version_compare( $this->get_version( 'edit' ), '3.0', '<' ) && $this->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? 'processing' : 'completed', $this->get_id() ) ) ) {
if ( 'view' === $context && ! $date_paid && version_compare( $this->get_version( 'edit' ), '3.0', '<' ) && $this->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? 'processing' : 'completed', $this->get_id(), $this ) ) ) {
// In view context, return a date if missing.
$date_paid = $this->get_date_created( 'edit' );
}

View File

@ -142,7 +142,7 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement
*/
public function update( &$order ) {
// Before updating, ensure date paid is set if missing.
if ( ! $order->get_date_paid( 'edit' ) && version_compare( $order->get_version( 'edit' ), '3.0', '<' ) && $order->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $order->needs_processing() ? 'processing' : 'completed', $order->get_id() ) ) ) {
if ( ! $order->get_date_paid( 'edit' ) && version_compare( $order->get_version( 'edit' ), '3.0', '<' ) && $order->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $order->needs_processing() ? 'processing' : 'completed', $order->get_id(), $order ) ) ) {
$order->set_date_paid( $order->get_date_created( 'edit' ) );
}