show link to delivery process page

This commit is contained in:
Bilal Catic
2018-11-03 07:13:30 +01:00
parent 01b35dbac5
commit 24e8515b30
2 changed files with 19 additions and 2 deletions

View File

@@ -55,10 +55,11 @@ class Wiaas_Admin_Order_Process_Flow {
echo '<input type="hidden" id="wiaas_order_id" name="wiaas_order_id" value="' . $order_id . '"/>';
}else{
$workflow_url = "";
$current_step = Wiaas_Delivery_Process::get_active_step($order_id);
$workflow_url = $current_step->get_entry_url();
echo '<div>
<a href=' . $workflow_url . '>Go to process flow</a>
<a href=' . $workflow_url . '>Go to delivery process page</a>
</div>';
}
}

View File

@@ -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
*