diff --git a/backend/app/plugins/wiaas/includes/admin/delivery-process/class-wiaas-admin-delivery-process-flow.php b/backend/app/plugins/wiaas/includes/admin/delivery-process/class-wiaas-admin-delivery-process-flow.php index bb43021..b138e65 100644 --- a/backend/app/plugins/wiaas/includes/admin/delivery-process/class-wiaas-admin-delivery-process-flow.php +++ b/backend/app/plugins/wiaas/includes/admin/delivery-process/class-wiaas-admin-delivery-process-flow.php @@ -55,10 +55,11 @@ class Wiaas_Admin_Order_Process_Flow { echo ''; }else{ - $workflow_url = ""; + $current_step = Wiaas_Delivery_Process::get_active_step($order_id); + $workflow_url = $current_step->get_entry_url(); echo '
'; } } diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php b/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php index 328a2d0..9e9a4de 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php @@ -98,6 +98,22 @@ class Wiaas_Delivery_Process { return $result; } + public static function get_active_step($order_id){ + $process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id'); + if (empty($process_entry_id)) { + return null; + } + + $process_instance = GFAPI::get_entry($process_entry_id); + $api = new Gravity_Flow_API($process_instance['form_id']); + $steps_info = $api->get_steps(); + + foreach ( $steps_info as $step_info ) { + return $api->get_step( $step_info->get_id(), $process_instance ); + } + return null; + } + /** * Retrieves delivery process instance for order *