Added get_order_statuses to REST controllers where it's required.

This commit is contained in:
Peter Fabian 2018-11-27 16:39:11 +01:00
parent c1af1da752
commit f9a46423e0
3 changed files with 45 additions and 0 deletions

View File

@ -299,4 +299,19 @@ class WC_Admin_REST_Reports_Categories_Controller extends WC_REST_Reports_Contro
return $params; return $params;
} }
/**
* Get order statuses without prefixes.
*
* @return array
*/
protected function get_order_statuses() {
$order_statuses = array();
foreach ( array_keys( wc_get_order_statuses() ) as $status ) {
$order_statuses[] = str_replace( 'wc-', '', $status );
}
return $order_statuses;
}
} }

View File

@ -383,4 +383,19 @@ class WC_Admin_REST_Reports_Orders_Stats_Controller extends WC_REST_Reports_Cont
return $params; return $params;
} }
/**
* Get order statuses without prefixes.
*
* @return array
*/
protected function get_order_statuses() {
$order_statuses = array();
foreach ( array_keys( wc_get_order_statuses() ) as $status ) {
$order_statuses[] = str_replace( 'wc-', '', $status );
}
return $order_statuses;
}
} }

View File

@ -292,4 +292,19 @@ class WC_Admin_REST_Reports_Products_Controller extends WC_REST_Reports_Controll
return $params; return $params;
} }
/**
* Get order statuses without prefixes.
*
* @return array
*/
protected function get_order_statuses() {
$order_statuses = array();
foreach ( array_keys( wc_get_order_statuses() ) as $status ) {
$order_statuses[] = str_replace( 'wc-', '', $status );
}
return $order_statuses;
}
} }