Fix customer acceptance flow

This commit is contained in:
Almira Krdzic
2018-11-05 10:53:54 +01:00
parent 0d62e7da4b
commit b02f0881d3
2 changed files with 14 additions and 17 deletions

View File

@@ -201,11 +201,6 @@ class Wiaas_Delivery_Process {
$action_entry = $action_entries[0]; $action_entry = $action_entries[0];
Wiaas_Delivery_Process_Action::update_customer_acceptance_status($action_entry['id'], $status, $reason); Wiaas_Delivery_Process_Action::update_customer_acceptance_status($action_entry['id'], $status, $reason);
if ($status === 'accept') {
Wiaas_Delivery_Process_Action::complete_action_step($action_entry['id']);
}
} }
} }
@@ -232,8 +227,6 @@ class Wiaas_Delivery_Process {
public static function upload_customer_questionnaire($order_id, $action_entry_id) { public static function upload_customer_questionnaire($order_id, $action_entry_id) {
Wiaas_Delivery_Process_Action::upload_customer_questionnaire($action_entry_id); Wiaas_Delivery_Process_Action::upload_customer_questionnaire($action_entry_id);
Wiaas_Delivery_Process_Action::complete_action_step($action_entry_id);
} }
public static function upload_customer_acceptance_document($order_id) { public static function upload_customer_acceptance_document($order_id) {
@@ -252,11 +245,6 @@ class Wiaas_Delivery_Process {
$success = Wiaas_Delivery_Process_Action::upload_customer_acceptance_document($action_entry['id']); $success = Wiaas_Delivery_Process_Action::upload_customer_acceptance_document($action_entry['id']);
if ($success) {
Wiaas_Delivery_Process_Action::complete_action_step($action_entry['id']);
}
return $success; return $success;
} }

View File

@@ -181,6 +181,8 @@ class Wiaas_Delivery_Process_Action {
$action_entry[$document_field->id] = $new_file; $action_entry[$document_field->id] = $new_file;
GFAPI::update_entry($action_entry); GFAPI::update_entry($action_entry);
self::complete_action_step($action_entry_id);
} }
/** /**
@@ -221,12 +223,10 @@ class Wiaas_Delivery_Process_Action {
GFAPI::update_entry($action_entry); GFAPI::update_entry($action_entry);
$workflow = new Gravity_Flow_API($action_form['id']); if ($new_status === 'accept') {
$current_step = $workflow->get_current_step($action_entry);
if ($current_step && $current_step->get_t) Wiaas_Delivery_Process_Action::complete_action_step($action_entry['id']);
}
Wiaas_Delivery_Process_Action::complete_action_step($action_entry['id']);
} }
/** /**
@@ -267,6 +267,15 @@ class Wiaas_Delivery_Process_Action {
$result = GFAPI::update_entry($action_entry); $result = GFAPI::update_entry($action_entry);
// complete step if current step is customer acceptance user input
$workflow = new Gravity_Flow_API($action_form['id']);
$current_step = $workflow->get_current_step($action_entry);
if ($current_step->get_type() === 'user_input' && ! is_wp_error($result)) {
Wiaas_Delivery_Process_Action::complete_action_step($action_entry['id']);
}
return ! is_wp_error($result); return ! is_wp_error($result);
} }