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

@@ -181,6 +181,8 @@ class Wiaas_Delivery_Process_Action {
$action_entry[$document_field->id] = $new_file;
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);
$workflow = new Gravity_Flow_API($action_form['id']);
$current_step = $workflow->get_current_step($action_entry);
if ($new_status === 'accept') {
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);
// 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);
}