From af482104a05c559f491b58a933646195fe08a261 Mon Sep 17 00:00:00 2001 From: GotPPay Date: Mon, 20 Aug 2018 01:29:51 +0200 Subject: [PATCH] fix bug with non existing entry --- .../api/class-wiaas-rest-delivery-process-api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/app/plugins/wiaas/includes/api/class-wiaas-rest-delivery-process-api.php b/backend/app/plugins/wiaas/includes/api/class-wiaas-rest-delivery-process-api.php index f33dd17..9cd5c42 100644 --- a/backend/app/plugins/wiaas/includes/api/class-wiaas-rest-delivery-process-api.php +++ b/backend/app/plugins/wiaas/includes/api/class-wiaas-rest-delivery-process-api.php @@ -119,7 +119,7 @@ class Wiass_REST_Delivery_Process_API { } $entry = GFAPI::get_entry($data['entry_id']); - if (!$entry){ + if (is_wp_error($entry)){ return self::generate_error('Customer acceptance entry not found', 404); } @@ -153,12 +153,12 @@ class Wiass_REST_Delivery_Process_API { public static function submit_customer_acceptance($data){ if (!is_user_logged_in()){ - return self::generate_error('You don\'t have permission to read this entry', 401); + return self::generate_error('You don\'t have permission to update this entry', 401); } $entry = GFAPI::get_entry($data['entry_id']); - if (!$entry){ - return self::generate_wiaas_response('INTERNAL_SERVER_ERROR', 'error'); + if (is_wp_error($entry)){ + return self::generate_error('Customer acceptance entry not found', 404); } $status = $_POST['actionType'];