get_steps();
/**
* Disable if:
* - actions for customer config validation is not done
* - action for customer acceptance is active or completed
*/
$is_disabled = false;
foreach ($steps as $step) {
if (Wiaas_Delivery_Process_Action::process_step_has_customer_validate_questionnaires_action($step) &&
$step->get_status() !== 'complete') {
$is_disabled = true;
break;
}
if (Wiaas_Delivery_Process_Action::process_step_has_customer_acceptance_action($step) &&
($step->get_id() === $current_step->get_id() || $step->get_status() === 'complete')) {
$is_disabled = true;
break;
}
}
$order_id = $entry['wiaas_delivery_order_id'];
$suppliers = Wiaas_Order::get_suppliers($order_id);
$final_estimated_date = Wiaas_Order::get_final_estimated_date($order_id);
$final_confirmed_date = Wiaas_Order::get_final_confirmed_date($order_id);
$earliest_installation_date = Wiaas_Order::get_earliest_installation_date($order_id);
require 'views/html-order-suppliers-delivery-dates.php';
}
public static function maybe_process_admin_step_change_action($feedback, $admin_action, $form, $entry) {
$admin_action = rgpost( 'wiaas_delivery_process_navigation_action' );
if ($admin_action === 'complete') {
$api = new Gravity_Flow_API( $form['id'] );
$current_step = $api->get_current_step($entry);
if ( $current_step ) {
$current_step->purge_assignees();
$current_step->update_step_status( 'complete' );
}
$api->process_workflow($entry['id']);
$feedback = esc_html__( 'Workflow Complete', 'wiaas' );
return $feedback;
}
list( $base_admin_action, $action_id ) = rgexplode( '|', $admin_action, 2 );
if ( $base_admin_action == 'send_to_step' ) {
$step_id = $action_id;
$api = new Gravity_Flow_API( $form['id'] );
$api->send_to_step( $entry, $step_id );
$entry = GFAPI::get_entry( $entry['id'] );
$new_step = $api->get_current_step( $entry );
$feedback = $new_step ?
sprintf( esc_html__( 'Sent to step: %s', 'wiaas' ), $new_step->get_name() ) :
esc_html__( 'Workflow Complete', 'wiaas' );
}
return $feedback;
}
public static function maybe_display_delivery_process_navigation($form, $entry, $current_step) {
if(! GFAPI::current_user_can_any( 'gravityflow_workflow_detail_admin_actions' ) ||
empty( $current_step ) ||
Wiaas_Delivery_Process_Action::is_action_form($form) ) {
return;
}
$steps = gravity_flow()->get_steps($form['id'], $entry);
// get next step id
$next_step = gravity_flow()->get_next_step($current_step, $entry, $form);
$next_step_id = empty($next_step) ? null : $next_step->get_id();
// get previous step id
foreach ($steps as $step) {
$next = gravity_flow()->get_next_step($step, $entry, $form);
if ($next && $next->get_id() === $current_step->get_id()) {
$previous_step = $step;
}
}
$previous_step_id = empty($previous_step) ? null : $previous_step->get_id();
// bail out if none exist
if ( empty($next_step_id) && empty($previous_step_id) ) {
return;
}
/**
* @reference Gravity_Flow::maybe_process_admin_action for used field names
* which are being checked there
*
*/
?>
class="button button-primary wiaas_delivery_step_nav"
style="float:right;" value="PREV STEP">
id];
}
}
// display process steps
$workflow_api = new Gravity_Flow_API($form['id']);
$steps = $workflow_api->get_steps();
?>
Order placed
Assign process
$step) {
if (! $step->is_active()) {
continue;
}
$is_step_completed = $step->get_status() === 'complete' || $step->get_status() === 'approved';
$is_current_step = $current_step && $step->get_id() === $current_step->get_id();
if ($is_current_step) {
$style = 'color: #FD8049;';
} else if ($is_step_completed) {
$style = 'color: #34C388;';
} else {
$style = 'opacity: 0.5; color: #CCC;';
}
?>
get_name(), 'wiaas') ?>
target_form_id );
if (empty($action_form)) {
echo '';
continue;
}
$page_size = 20;
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
array( 'key' => 'wiaas_delivery_process_id',
'value' => $entry['id']
),
),
);
$sorting = array( 'key' => 'date_created', 'direction' => 'DESC' );
$paging = array( 'offset' => 0, 'page_size' => $page_size );
$entries = GFAPI::get_entries( $action_form['id'], $search_criteria, $sorting, $paging );
if (empty($entries)) {
echo '';
continue;
}
?>
';
foreach ($entries as $action_entry) {
self::_display_step_action_entry($action_form, $action_entry);
}
?>
get_current_step($action_entry);
$entry_url = add_query_arg( array(
'page' => 'gravityflow-inbox',
'view' => 'entry',
'id' => $action_entry['form_id'],
'lid' => $action_entry['id']
), admin_url() );
?>
type === 'wiaas_order') {
continue;
}
if ($field->type === 'workflow_discussion') {
echo '| ' . $field->format_discussion_value($action_entry[$field->id]) . ' |
';
continue;
}
$value = $field->get_value_entry_detail($action_entry[$field->id]);
$label = $field->get_field_label(false, $action_entry[$field->id]);
echo '' .
'| ' . $label . ' : | ' .
'' . $value . ' | ' .
'
';
}
?>
|
get_status($action_entry) :
$current_action_step->get_status_label($current_action_step->get_status()) . ': ' . $current_action_step->get_name();;
echo '' .
' ' .
'';
?>
|