do not submit custommer acceptance if already submitted

This commit is contained in:
GotPPay
2018-08-27 23:30:25 +02:00
parent 9f653bb920
commit 2d24f82698
2 changed files with 8 additions and 1 deletions

View File

@@ -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' );

View File

@@ -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'
};