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 2bb499b..e575199 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 @@ -13,6 +13,7 @@ class Wiass_REST_Delivery_Process_API { const DECLINE_REASON_FIELD_ID = 10; const UPLOADED_FILES_FIELD_ID = 12; + const USER_INPUT_STEP_NAME = 'Upload acceptance file'; const ACCEPT_STATUS_LABEL = 'accept'; const DECLINE_STATUS_LABEL = 'decline'; @@ -171,8 +172,13 @@ class Wiass_REST_Delivery_Process_API { return self::generate_wiaas_response('INTERNAL_SERVER_ERROR', 'error'); } + //Check if step is already completed, to not submit again $gf_api = new Gravity_Flow_API($entry['form_id']); $current_step = $gf_api->get_current_step($entry); + if ($current_step->get_name() !== self::USER_INPUT_STEP_NAME){ + return self::generate_wiaas_response('ACCEPTANCE_STATUS_UPDATED', 'success'); + } + if ( $current_step ) { $current_step->purge_assignees(); $current_step->update_step_status( 'complete' ); diff --git a/frontend/src/constants/ordersConstants.js b/frontend/src/constants/ordersConstants.js index 76c8c2c..b2d9b2e 100644 --- a/frontend/src/constants/ordersConstants.js +++ b/frontend/src/constants/ordersConstants.js @@ -85,7 +85,8 @@ export const orderMessages = { NO_FILES_UPLOADED: 'You need to upload the acceptance document', INTERNAL_SERVER_ERROR: 'Error occured. Please try again', - ACCEPTANCE_STATUS_MISSING: 'Acceptance action not selected' + ACCEPTANCE_STATUS_MISSING: 'Acceptance action not selected', + ACCEPTANCE_STATUS_UPDATED: 'Acceptance status updated' };