Add descriptive comments

This commit is contained in:
Almira Krdzic
2018-10-17 14:02:35 +02:00
parent 6c27afabfc
commit 4d13ee40bc
4 changed files with 95 additions and 33 deletions

View File

@@ -21,8 +21,6 @@ class Wiaas_Order {
add_filter('woocommerce_register_post_type_shop_order', array(__CLASS__, 'manage_order_settings'));
add_action('woocommerce_new_order', array( __CLASS__, 'assign_order_to_organization' ));
add_filter('woocommerce_rest_check_permissions', array( __CLASS__, 'check_order_access'), 10, 4);
add_filter('woocommerce_rest_prepare_shop_order_object', array(__CLASS__, 'transform_rest_order'), 999, 3);
@@ -70,25 +68,6 @@ class Wiaas_Order {
return $comment_data;
}
/**
* Assignees order to corresponding user organization when order is created.
*
* @param $order_id
*/
public static function assign_order_to_organization($order_id) {
// assign order to customer organization
$customer_id = wiaas_get_current_user_organization_id();
Wiaas_User_Organization::assign_post_to_organization($order_id, $customer_id);
$order = wc_get_order($order_id);
// assign order to commercial lead organization
$commercial_lead_id = absint($order->get_meta('_wiaas_commercial_lead_id', true));
if ($commercial_lead_id) {
Wiaas_User_Organization::assign_post_to_organization($order_id, $commercial_lead_id);
}
}
/**
* Checks if current user has access to requested order/{orderId} via woocommerce REST API.
* Endpoint `/orders` is filtered correctly by groups, but endpoint `/orders/{orderId}` will return order even if