From 5aca4e8572d186fbac47472dcbe9bb0e8fca8870 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Tue, 30 Oct 2018 17:20:56 +0100 Subject: [PATCH 01/14] delivery step actions --- .../wiaas/assets/js/wiaas-form-editor.js | 10 + .../class-wiaas-rest-delivery-process-api.php | 50 +++ .../includes/class-wiaas-delivery-process.php | 332 +++++++++----- .../wiaas/includes/class-wiaas-order.php | 1 + .../class-wiaas-date-list-field.php | 38 ++ .../class-wiaas-delivery-process-action.php | 84 ++++ .../class-wiaas-delivery-process-addon.php | 420 ++++++++++++++++++ .../class-wiaas-delivery-process-step.php | 230 ++++++---- ...lass-wiaas-field-order-bundle-document.php | 55 +++ .../class-wiaas-field-order-bundle-select.php | 109 +++++ .../class-wiaas-field-order-number.php | 53 +++ ...lass-wiaas-field-order-supplier-select.php | 78 ++++ .../class-wiaas-order-fields.php | 139 ++++++ .../class-wiaas-document-download.php | 29 ++ .../document/wiaas-document-functions.php | 40 ++ .../includes/order/wiaas-order-functions.php | 55 +++ .../orders/customerQuestionnairesActions.js | 68 +++ frontend/src/constants/ordersConstants.js | 4 + .../process/ValidateQuestionnaire.jsx | 21 +- .../process/ValidateQuestionnaireItem.jsx | 37 +- frontend/src/helpers/HtmlClient.js | 2 +- frontend/src/helpers/ProcessHelper.js | 5 +- .../src/reducers/orders/processReducers.js | 9 + 23 files changed, 1651 insertions(+), 218 deletions(-) create mode 100644 backend/app/plugins/wiaas/assets/js/wiaas-form-editor.js create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-date-list-field.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-number.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php create mode 100644 backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php create mode 100644 frontend/src/actions/orders/customerQuestionnairesActions.js diff --git a/backend/app/plugins/wiaas/assets/js/wiaas-form-editor.js b/backend/app/plugins/wiaas/assets/js/wiaas-form-editor.js new file mode 100644 index 0000000..fc6ddc0 --- /dev/null +++ b/backend/app/plugins/wiaas/assets/js/wiaas-form-editor.js @@ -0,0 +1,10 @@ +jQuery(document).bind('gform_load_field_settings', function (event, field, form) { + + var isBundleDoc = field.type === 'wiaas_order_bundle_document'; + + if (isBundleDoc) { + + jQuery('#wiaas-doc-type-filter').val(field.wiaasDocTypeFilter); + } + +}); \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/api/class-wiaas-rest-delivery-process-api.php b/backend/app/plugins/wiaas/includes/api/class-wiaas-rest-delivery-process-api.php index 76416f8..b510ba0 100644 --- a/backend/app/plugins/wiaas/includes/api/class-wiaas-rest-delivery-process-api.php +++ b/backend/app/plugins/wiaas/includes/api/class-wiaas-rest-delivery-process-api.php @@ -51,6 +51,19 @@ class Wiass_REST_Delivery_Process_API { 'callback' => array(__CLASS__, 'upload_file'), 'permission_callback' => 'is_user_logged_in' ) ); + + + register_rest_route( self::$namespace, 'customer-questionnaires/(?P\d+)', array( + 'methods' => 'GET', + 'callback' => array(__CLASS__, 'get_customer_questionnaires'), + //'permission_callback' => 'is_user_logged_in' + ) ); + + register_rest_route( self::$namespace, 'customer-questionnaires/(?P\d+)/upload/(?P\d+)', array( + 'methods' => 'POST', + 'callback' => array(__CLASS__, 'upload_customer_questionnaire'), + //'permission_callback' => 'is_user_logged_in' + ) ); } public static function get_next_actions_for_user() { @@ -97,6 +110,42 @@ class Wiass_REST_Delivery_Process_API { return rest_ensure_response($data); } + public function get_customer_questionnaires(WP_REST_Request $request) { + + $order_id = absint($request['order_id']); + + + $data = Wiaas_Delivery_Process::get_current_delivery_step_info($order_id); + + return rest_ensure_response($data); + } + + public function upload_customer_questionnaire(WP_REST_Request $request) { + + $action_id = absint($request['action_id']); + + try { + + $result = Wiaas_Document_Upload::upload_document_version(); + + $entry = GFAPI::get_entry($action_id); + + $document_field = GFCommon::get_fields_by_type(GFAPI::get_form($entry['form_id']), 'wiaas_order_bundle_document')[0]; + + $entry[$document_field->id] = $result; + + GFAPI::update_entry($entry); + + Wiaas_Delivery_Process::complete_action_step($action_id); + + return rest_ensure_response($result); + + } catch( Exception $e) { + } + + return wiaas_api_notice('INSTALLATION_ACCEPTED', 'success'); + } + public static function get_customer_acceptance(WP_REST_Request $request){ $entry = GFAPI::get_entry($request['entry_id']); if (is_wp_error($entry)){ @@ -121,6 +170,7 @@ class Wiass_REST_Delivery_Process_API { 'extension' => $file_name_with_extension_parts[1], 'url' => $file_url ); + array_push($acceptance_documents, $acceptance_documents_entry); } 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 34b58c3..e7413c9 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php @@ -21,42 +21,31 @@ class Wiaas_Delivery_Process { private static function _init_hooks() { add_action('woocommerce_new_order', array( __CLASS__, 'create_delivery_process_for_order' )); - add_filter( 'gform_entry_meta', array(__CLASS__, 'extend_gravity_form_entry_meta'), 10, 2 ); - add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_process_step'), 5, 3 ); - add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_order'), 10, 3 ); - - // Some temporary functions to make inbox page prettier - add_filter('gravityflow_inbox_submitter_name', array(__CLASS__, 'display_step_name_in_inbox'), 10, 3); - add_filter('gravityflow_approve_label_workflow_detail', array(__CLASS__, 'approval_step_approval_label'), 10, 2); - add_filter('gravityflow_reject_label_workflow_detail', array(__CLASS__, 'approval_step_reject_label'), 10, 2); } - public static function approval_step_approval_label($label, $step) { - if ($step->get_name() === 'Complete step') { - return esc_html__( 'Complete step', 'wiaas' ); - } - return $label; - } - - public static function approval_step_reject_label($label, $step) { - if ($step->get_name() === 'Complete step') { - return esc_html__( 'Cancel', 'wiaas' ); - } - return $label; - } - - public static function display_step_name_in_inbox($name, $entry, $form) { - return $entry['wiaas_delivery_step_name']; - } - /** * Registers our Delivery Process Step Type as available Gravity Flow Step Type */ private static function _register_delivery_process_step_type() { require_once( 'delivery-process/class-wiaas-delivery-process-step.php' ); + require_once( 'delivery-process/class-wiaas-delivery-process-addon.php' ); + + // order fields + require_once( 'delivery-process/class-wiaas-order-fields.php' ); + + require_once( 'delivery-process/class-wiaas-field-order-number.php' ); + require_once( 'delivery-process/class-wiaas-field-order-bundle-select.php' ); + require_once( 'delivery-process/class-wiaas-field-order-supplier-select.php' ); + require_once( 'delivery-process/class-wiaas-field-order-bundle-document.php' ); + + + require_once( 'delivery-process/class-wiaas-date-list-field.php' ); + Gravity_Flow_Steps::register( new Wiaas_Delivery_Process_Step() ); + + GFAddOn::register( 'Wiaas_Delivery_Process_Addon' ); } /** @@ -92,6 +81,9 @@ class Wiaas_Delivery_Process { public static function get_order_delivery_process($order_id) { $process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id'); + + $process_entry_id = 159; + if (!isset($process_entry_id)) { return null; } @@ -110,111 +102,241 @@ class Wiaas_Delivery_Process { 'steps' => array() ); + $current_step = $api->get_current_step($process_instance); + foreach ( $steps_info as $step_info ) { - $step = $api->get_step( $step_info->get_id(), $process_instance ); + $step = $api->get_step( $step_info->get_id(), $process_instance ); + + $action_code = 'manual'; + $action_form = GFAPI::get_form($step->target_form_id); + $has_action_form = $action_form !== false; + + if ($has_action_form) { + + $delivery_settings = rgar($action_form, 'wiaas_delivery_process'); + + $action_code = empty($delivery_settings['delivery_action_code']) ? 'manual' : $delivery_settings['delivery_action_code']; + } $info = $step->get_feed_meta(); + + $status = $step->get_status(); + + if ($current_step && $current_step->get_id() === $step->get_id()) { + $status = 'pending'; + } + + $delivery_process['steps'][] = array( 'step_id' => $step->get_id(), - 'step_form_entry_id' => $step->get_target_form_entry_id() ?: null, + 'process_id' => $process_entry_id, 'short_desc' => $info['step_name'], 'full_desc' => $info['description'], - 'action_code' => $step->get_delivery_action_type(), - 'step_type' => $step->get_delivery_action_type() === 'manual' ? 'manual' : 'extraAction', - 'status' => $step->get_status() ?: 'inactive', + 'action_code' => $action_code, + 'status' => $status, 'order_id' => $order_id, - 'actual_date' => $step->get_target_actual_date(), - 'comments' => $step->get_target_step_comments(), ); } return $delivery_process; } + public static function get_current_delivery_step_info($order_id) { + + $process_entry_id = 159; + + $process_instance = GFAPI::get_entry($process_entry_id); + $api = new Gravity_Flow_API($process_instance['form_id']); + + $current_step = $api->get_current_step($process_instance); + + if (!$current_step) { + return null; + } + + $current_step_info = array( + 'step_id' => $current_step->get_id(), + 'process_id' => $process_entry_id, + 'short_desc' => $current_step->get_name(), + 'action_code' => 'manual', + 'status' => $current_step->get_status(), + ); + + $action_form = GFAPI::get_form($current_step->target_form_id); + $has_action_form = $action_form !== false; + $delivery_settings = $action_form ? rgar($action_form, 'wiaas_delivery_process') : array(); + + $customer_allowed_actions = array( 'customer-acceptance', 'validate-questionnaire' ); + + if (! $has_action_form && ! in_array($delivery_settings['delivery_action_code'], $customer_allowed_actions)) { + + return $current_step_info; + } + + $current_step_info['action_code'] = $delivery_settings['delivery_action_code']; + + $current_step_info['actions'] = array(); + + $action_entry_ids = gform_get_meta( + $current_step->get_entry_id(), 'wiaas_delivery_step_' . $current_step->get_id() . '_action_entry_ids' + ); + + if (empty($action_entry_ids)) { + return $current_step_info; + } + + $order = wc_get_order($order_id); + + foreach ($action_entry_ids as $action_entry_id) { + + $action_entry = GFAPI::get_entry($action_entry_id); + + if (is_wp_error($action_entry)) { + + continue; + } + + $action_workflow_api = new Gravity_Flow_API($action_form['id']); + + $action_workflow_api->get_status($action_entry); + + $action_data = self::_collect_validate_questionnaire_action_info($action_form, $action_entry, $order); + + if (! empty($action_data)) { + + $current_step_info['actions'][] = $action_data; + } + } + + return $current_step_info; + } + + /** + * Complete action step + * + * @param int $action_id + */ + public static function complete_action_step($action_id) { + + $action_entry = GFAPI::get_entry($action_id); + + $action_form = GFAPI::get_form($action_entry['form_id']); + + $workflow = new Gravity_Flow_API($action_form['id']); + + $current_step = $workflow->get_current_step($action_entry); + + if ( $current_step ) { + + $assignees = $current_step->get_assignees(); + + foreach ($assignees as $assignee) { + + $current_step->process_assignee_status($assignee, 'complete', $action_form); + } + } + + gravity_flow()->process_workflow($action_form, $action_entry['id']); + } + + + private static function _collect_validate_questionnaire_action_info($action_form, $action_entry, $order) { + + // we need to collect document, bundle id and current status + $bundle_item_id = null; $document_info = array(); $status = null; + + $bundle_field = GFCommon::get_fields_by_type($action_form, 'wiaas_order_bundle')[0]; + + $bundle_item_id = absint(explode('|', $action_entry[$bundle_field->id])[1]); + + $bundle_item = $order->get_item($bundle_item_id); + + $documents = wiaas_get_order_item_documents($bundle_item, 'order_questionaire'); + $document = $documents[0]; + + $action_workflow_api = new Gravity_Flow_API($action_form['id']); + $action_step = $action_workflow_api->get_current_step($action_entry); + $status = 'validated'; + + if (! empty($action_step)) { + + if ($action_step->get_type() === 'approval') { + + $status = 'not-validated'; + } + + if ($action_step->get_type() === 'user_input') { + + $status = 'invalid'; + } + } + + return array( + 'item_id' => $bundle_item_id, + 'order_id' =>$order->get_id(), + 'action_id' => $action_entry['id'], + 'document' => $document, + 'status' => $status + ); + } + /** * Automatically create delivery process instance when order is created * @param $order_id */ public static function create_delivery_process_for_order($order_id) { $process_form = null; - $forms = GFFormsModel::search_forms( self::$process_form_title_prefix, true ); - $process_form = $forms[0]; - if(isset($process_form)) { - $order = wc_get_order( $order_id ); - $new_process_entry = array( - 'form_id' => $process_form->id, - '2' => $order->get_customer_id(), - 'wiaas_delivery_order_id' => $order_id, - ); - $process_entry_id = GFAPI::add_entry( $new_process_entry ); - add_post_meta($order_id, 'wiaas_delivery_process_id', $process_form->id); - add_post_meta($order_id, 'wiaas_delivery_process_entry_id', $process_entry_id); - } - } + $forms = GFAPI::get_forms(); + foreach ( $forms as $form ) { + $delivery_settings = rgar($form, 'wiaas_delivery_process'); + if ( ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'process'){ + $process_form = $form; - /** - * Extends Gravity Form entry metadata with 'wiaas_delivery_process_id' - * - * This way we can track for each delivery step its parent process - * @param $entry_meta - * - * @return mixed - */ - public static function extend_gravity_form_entry_meta($entry_meta) { - $entry_meta[ 'wiaas_delivery_process_id' ] = array( - 'label' => 'Wiaas Delivery Process Id', - 'is_numeric' => true, - 'update_entry_meta_callback' => null, - 'is_default_column' => false, // this column will be displayed by default on the entry list - 'filter' => array( - 'operators' => array( 'is' ), - ), - ); - - $entry_meta[ 'wiaas_delivery_order_id' ] = array( - 'label' => 'Wiaas Delivery Process Order Id', - 'is_numeric' => true, - 'update_entry_meta_callback' => null, - 'is_default_column' => false, // this column will be displayed by default on the entry list - 'filter' => array( - 'operators' => array( 'is' ), - ), - ); - - $entry_meta[ 'wiaas_delivery_step_name' ] = array( - 'label' => 'Wiaas Delivery Step name', - 'is_numeric' => false, - 'update_entry_meta_callback' => null, - 'is_default_column' => false, // this column will be displayed by default on the entry list - 'filter' => array( - 'operators' => array( 'is' ), - ), - ); - - return $entry_meta; - } - - /** - * Process parent process when single step workflow has completed - * @param $entry_id - * @param $form - * @param $final_status - */ - public static function maybe_complete_parent_process_step($entry_id, $form) { - $entry = GFAPI::get_entry($entry_id); - $parent_entry_id = $entry['wiaas_delivery_process_id']; - - if (empty($parent_entry_id)) { - return false; + break; + } } - $parent_entry_id = absint( $parent_entry_id ); - $parent_entry = GFAPI::get_entry( $parent_entry_id ); + if (empty($process_form)) { - $parent_api = new Gravity_Flow_API( $parent_entry['form_id'] ); - $parent_api->process_workflow( $parent_entry_id ); + return; + } + + $order = wc_get_order( $order_id ); + $order_field = GFCommon::get_fields_by_type($form, 'wiaas_order')[0]; + $order_field_id = $order_field->id; + + $new_process_entry = array( + 'form_id' => $process_form->id, + "$order_field_id" => $order_id, + 'wiaas_delivery_order_id' => $order_id, + ); + $process_entry_id = GFAPI::add_entry( $new_process_entry ); + + add_post_meta($order_id, 'wiaas_delivery_process_id', $process_form->id); + add_post_meta($order_id, 'wiaas_delivery_process_entry_id', $process_entry_id); } } add_action( 'gravityflow_loaded', array('Wiaas_Delivery_Process', 'init') ); + +function wiaas_gform_upload_path() { + + $pathdata = wp_upload_dir(); + + if ( empty( $pathdata['subdir'] ) ) { + $pathdata['path'] = $pathdata['path'] . wiaas_documents_base_dir(); + $pathdata['url'] = $pathdata['url'] . wiaas_documents_base_dir(); + $pathdata['subdir'] = wiaas_documents_base_dir(); + } else { + $new_subdir = wiaas_documents_base_dir() . $pathdata['subdir']; + + $pathdata['path'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['path'] ); + $pathdata['url'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['url'] ); + $pathdata['subdir'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['subdir'] ); + } + + return $pathdata; +} + +add_filter( 'gform_upload_path', 'wiaas_gform_upload_path', 10, 2 ); diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-order.php b/backend/app/plugins/wiaas/includes/class-wiaas-order.php index 2ae0029..084689c 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-order.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-order.php @@ -18,6 +18,7 @@ class Wiaas_Order { public static function init() { require_once dirname( __FILE__ ) . '/order/class-wiaas-order-project.php'; + require_once dirname( __FILE__ ) . '/order/wiaas-order-functions.php'; add_filter('woocommerce_register_post_type_shop_order', array(__CLASS__, 'manage_order_settings')); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-date-list-field.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-date-list-field.php new file mode 100644 index 0000000..767c08d --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-date-list-field.php @@ -0,0 +1,38 @@ +inputType = 'date'; + } + + public function get_list_input($has_columns, $column, $value, $form_id) { + + $tabindex = $this->get_tabindex(); + $disabled = $this->is_form_editor() ? 'disabled' : ''; + + return ""; + } + + public function get_value_entry_list( $value, $entry, $field_id, $columns, $form ) { + + return $this->get_value_entry_detail($value, '', false, 'html', 'screen' ); + } +} + +GF_Fields::register( new Wiaas_Dates_List_Field() ); \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php new file mode 100644 index 0000000..b13f83b --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php @@ -0,0 +1,84 @@ +target_form_id)) { + + return null; + } + + $action_form = GFAPI::get_form($step->target_form_id); + + if (! $action_form) { + + return null; + } + } + + public static function get_step_action_entries(Wiaas_Delivery_Process_Step $step) { + + $action_form = self::get_step_action_form($step); + + if (!$action_form) { + + return array(); + } + + $search_criteria = array( + 'status' => 'active', + 'field_filters' => array( + array( 'key' => 'wiaas_delivery_process_id', + 'value' => $step->get_entry_id() + ), + ), + ); + + $sorting = array( 'key' => 'date_created', 'direction' => 'DESC' ); + + return GFAPI::get_entries( $action_form, $search_criteria, $sorting ); + } + + public static function get_action_forms() { + + $forms = GFAPI::get_forms(); + + $action_forms = array(); + + foreach ( $forms as $form ) { + + $delivery_settings = rgar($form, 'wiaas_delivery_process'); + + if ( ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'action'){ + + $action_forms[] = $form; + } + } + + return $action_forms; + } + + public static function is_action_form($form) { + + $delivery_settings = rgar($form, 'wiaas_delivery_process'); + + return ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'action'; + } + + public static function get_customer_step_actions(Wiaas_Delivery_Process_Step $step) { + + + } +} + + +Wiaas_Delivery_Process_Action::init(); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php new file mode 100644 index 0000000..779fd98 --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php @@ -0,0 +1,420 @@ + 'Wiaas Delivery Process Id', + 'is_numeric' => true, + 'update_entry_meta_callback' => array( __CLASS__, 'update_entry_delivery_process_id' ), + 'is_default_column' => false, // this column will be displayed by default on the entry list + 'filter' => array( + 'operators' => array( 'is' ), + ), + ); + + $entry_meta[ 'wiaas_delivery_order_id' ] = array( + 'label' => 'Wiaas Delivery Process Order Id', + 'is_numeric' => true, + 'update_entry_meta_callback' => null, + 'is_default_column' => false, // this column will be displayed by default on the entry list + 'filter' => array( + 'operators' => array( 'is' ), + ), + ); + + $entry_meta[ 'wiaas_delivery_step_name' ] = array( + 'label' => 'Wiaas Delivery Step name', + 'is_numeric' => false, + 'update_entry_meta_callback' => null, + 'is_default_column' => false, // this column will be displayed by default on the entry list + 'filter' => array( + 'operators' => array( 'is' ), + ), + ); + + return $entry_meta; + } + + public static function update_entry_delivery_process_id($key, $entry, $form) { + + if ( isset( $_REQUEST['wiaas_delivery_process_id'] ) ) { + return absint( $_REQUEST['wiaas_delivery_process_id'] ); + } + + if ( isset( $entry[ $key ] ) ) { + return $entry[ $key ]; + } + + return ''; + } + + public function display_process_steps_details($form, $entry, $current_step) { + + $delivery_settings = rgar($form, 'wiaas_delivery_process'); + + if ($delivery_settings['delivery_form_type'] === 'action') { + return; + } + + $workflow_api = new Gravity_Flow_API($form['id']); + + $steps = $workflow_api->get_steps(); + + foreach ($steps as $index => $step) { + + if (! $step->is_active()) { + continue; + } + + $is_step_running = $step->get_status() === 'pending'; + $is_current_step = $step->get_id() === $current_step->get_id(); + + $disabled_style = $is_step_running ? '' : 'opacity: 0.5'; + + ?> + +
+ +

+ get_name(), 'wiaas') ?> +

+ + target_form_id ); + + if (empty($action_form)) { + + echo '
'; + + continue; + } + + $action_delivery_settings = rgar($action_form, 'wiaas_delivery_process'); + + ?> + +
+ + + + ' . + ' ' . $action_form['title'] . '', + $form_url ); + + echo $form_link; + } + + echo '


'; + + $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, $search_criteria, $sorting, $paging ); + + foreach ($entries as $action_entry) { + $this->_display_step_action_entry($action_form, $action_entry); + } + + ?> + +
+ +
+ + + + + get_current_step($action_entry); + + + ?> + + + type === 'wiaas_order') { + continue; + } + + if ($field->type === 'workflow_discussion') { + + echo ''; + + continue; + } + + $value = $field->get_value_entry_detail($action_entry[$field->id]); + $label = $field->get_field_label(false, $action_entry[$field->id]); + + echo '' . + '' . + '' . + ''; + } + + if (! empty($current_action_step)) { + + ?> + + + + + + + + +
' . $field->get_value_entry_detail($action_entry[$field->id]) . '
' . $label . ' : ' . $value . '
+ + View + get_status_label($current_action_step->get_status()) ?> + +
+ +
+ 'wiaas_form_editor_js', + 'src' => $plugin_url . '/assets/js/wiaas-form-editor.js', + 'enqueue' => array( + array( + 'admin_page' => array('form_editor'), + ), + ), + ) + ); + + return array_merge( parent::scripts(), $scripts ); + } + + + /** + * Add settings menu for form delivery process + * + * @param $tabs + * @param $form_id + * + * @return array + */ + public function add_form_settings_menu( $tabs, $form_id ) { + + $tabs[] = array( + 'name' => $this->_slug, + 'label' => esc_html__( 'Delivery Process', 'wiaas' ), + 'query' => array( 'fid' => null ) + ); + + return $tabs; + } + + + /** + * Add settings field for delivery process settings menu + * + * @param $form + * + * @return array + */ + public function form_settings_fields($form) { + + return array( + + array( + 'title' => esc_html__( 'Delivery Process', 'wiaas' ), + 'fields' => array( + array( + 'name' => 'delivery_form_type', + 'label' => esc_html__( 'Delivery Form Type', 'wiaas' ), + 'type' => 'delivery_form_type', + ), + array( + 'name' => 'delivery_action_code', + 'label' => esc_html__( 'Action code', 'wiaas' ), + 'type' => 'delivery_action_code', + ), + array( + 'name' => 'delivery_action_form_type', + 'label' => esc_html__( 'Automatic?', 'wiaas' ), + 'type' => 'delivery_action_form_automatic', + ) + ) + ) + ); + } + + public function settings_delivery_form_type() { + + $this->settings_select(array( + 'name' => 'delivery_form_type', + 'choices' => array( + array( 'value' => 'action', 'label' => 'Action Form' ), + array( 'value' => 'process', 'label' => 'Process Form' ) + ), + 'after_select' => '

Choose if this form will be used as process form or action form.

' . + '

Process form defines order delivery process workflow.

' . + '

Action form defines custom order data that is collected from delivery process participants.

' + )); + } + + public function settings_delivery_action_code() { + $this->settings_select(array( + 'name' => 'delivery_action_code', + 'choices' => array( + array( 'value' => '', 'label' => 'Select action code ...' ), + array( 'value' => 'customer-acceptance', 'label' => 'Customer acceptance' ), + array( 'value' => 'validate-questionnaire', 'label' => 'Validate Questionnaire' ), + array( 'value' => 'schedule-meeting', 'label' => 'Schedule meeting' ) + ), + 'after_select' => '

Choose action code for action form.

' + )); + } + + public function settings_delivery_action_form_automatic() { + + $this->settings_checkbox_and_select(array( + 'checkbox' => array( + 'label' => esc_html__( 'Enable', 'wiaas' ), + 'name' => 'automatic_action_entries_enabled', + 'defeault_value' => '0', + ), + 'select' => array( + 'name' => 'automatic_action_entries_type', + 'choices' => array( + array( + 'value' => 'single', + 'label' => esc_html__( 'Single entry', 'wiaas' ), + ), + array( + 'value' => 'bundle', + 'label' => esc_html__( 'Entry per bundle', 'wiaas' ), + ) + ), + 'after_select' => '

Automatic entries can be created once per order or per every bundle in order.

' . + '

Automatic entry will not be created if any required field cannot be populated.

', + ) + )); + } +} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php index 8c5b478..a7f385c 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php @@ -30,7 +30,7 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { * @return string */ public function get_label() { - return esc_html__( 'Wiaas Delivery Step', 'wiaas' ); + return esc_html__( 'Delivery Step', 'wiaas' ); } /** @@ -41,13 +41,12 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { $settings_api = $this->get_common_settings_api(); - $forms = $this->get_target_forms_choices(); + $forms = $this->get_action_forms_choices(); $form_choices[] = array( 'label' => esc_html__( 'Select a Form', 'wiaas' ), 'value' => '' ); foreach ( $forms as $form ) { - $form_choices[] = array( 'label' => $form->title, 'value' => $form->id ); + $form_choices[] = array( 'label' => $form['title'], 'value' => $form['id'] ); } - $settings = array( 'title' => esc_html__( 'Wiaas Delivery Step', 'wiaas' ), 'fields' => array( @@ -71,13 +70,23 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { 'type' => 'select', 'onchange' => "jQuery(this).closest('form').submit();", 'choices' => $form_choices, - ), + ) ), ); return $settings; } + public function update_step_status($status = false) { + + if ($status === 'cancelled') { + + $status = 'complete'; + } + + parent::update_step_status($status); + } + /** * Process Wiass Delivery Process Step * @@ -90,51 +99,54 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { $entry = $this->get_entry(); $target_form = GFAPI::get_form( $this->target_form_id ); - # if target form is not valid just finish the step + # if target form is not set we are done if (!$target_form) { - return true; + // return false since we wait for admin to process the step + return false; } - # create new entry for target form with populated value for customer-id from parent entry - $new_entry = array( - 'form_id' => $this->target_form_id, - 'wiaas_delivery_process_id' => $this->get_entry_id(), - 'wiaas_delivery_order_id' => $entry['wiaas_delivery_order_id'], - 'wiaas_delivery_step_name' => $this->get_name(), - ); + $delivery_settings = rgar($target_form, 'wiaas_delivery_process'); - $customer_id_value = null; + if (! $delivery_settings['automatic_action_entries_enabled']) { - if ( is_array( $form['fields'] ) ) { - foreach ( $form['fields'] as $field ) { - if (GFCommon::get_label( $field ) === 'customer-id') { - $customer_id_value = $entry[$field->id]; - break; - } - } + return false; + } + + $action_entries_ids = gform_get_meta($this->get_entry_id(), 'wiaas_delivery_step_' . $this->get_id() . '_action_entry_ids'); + + // if action entries present this step is reprocessing and we should not be creating new action entries + if (! empty($action_entries_ids)) { + // return false since we wait for admin to process the step + return false; } - if ( is_array( $target_form['fields'] ) ) { - foreach ( $target_form['fields'] as $field ) { - if (GFCommon::get_label( $field ) === 'customer-id') { - $new_entry[$field->id] = $customer_id_value; - break; - } - } + // create new entries for step action forms + $order_field = GFCommon::get_fields_by_type($form, 'wiaas_order')[0]; + $order_id = empty($order_field) ? null : absint($entry[$order_field->id]); + + // if process has not order we cannot create actions + if (empty($order_id)) { + // return false since we wait for admin to process the step + return false; } - $entry_id = GFAPI::add_entry( $new_entry ); - if ( is_wp_error( $entry_id ) ) { - $this->log_debug( __METHOD__ .'(): failed to add entry' ); - } else { - // store entry id - gform_update_meta($this->get_entry_id(), 'wiaas_delivery_step_' . $this->get_id() .'_entry_id', $entry_id); + $delivery_settings = rgar($target_form, 'wiaas_delivery_process'); + + switch ($delivery_settings['automatic_action_entries_type']) { + + case 'single': + $action_entries_ids = $this->_create_single_action_entry($target_form, $order_id); + break; + case 'bundle': + $action_entries_ids = $this->_create_per_bundle_action_entries($target_form, $order_id); } + gform_update_meta($this->get_entry_id(), 'wiaas_delivery_step_' . $this->get_id() . '_action_entry_ids', $action_entries_ids); + $note = $this->get_name() . ': ' . esc_html__( 'started.', 'wiaas' ); $this->add_note( $note ); - # return false since we wait for workflow of target entry to be complete first + // return false since we wait for admin to process the step return false; } @@ -147,24 +159,29 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { */ public function status_evaluation() { - # retrieve target form entry to check its workflow status - $target_form_entry = $this->get_target_form_entry(); + // return 'pending'; + } - # if there is no target form entry just complete the step - if(!$target_form_entry) { - return 'complete'; + public function workflow_detail_box($form, $args) { + parent::workflow_detail_box($form, $args); + + $target_form = GFAPI::get_form( $this->target_form_id ); + + if (empty( $target_form)) { + + return; } - # retrieve target form entry workflow status - $api = new Gravity_Flow_API( $this->target_form_id ); - $status = $api->get_status($target_form_entry); + ?> +

Step: get_name() ?>

+

Action:

+ get_form_id()) { - $entry_meta['wiaas_delivery_step_' . $this->get_id() .'_entry_id'] = null; + $entry_meta['wiaas_delivery_step_' . $this->get_id() . '_action_entry_ids'] = array(); } return $entry_meta; } @@ -181,8 +198,24 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { * Retrieves forms that are valid options for delivery step action * @return array */ - public function get_target_forms_choices() { - return GFFormsModel::search_forms(self::$delivery_action_form_title_prefix, true); + public function get_action_forms_choices() { + + $forms = GFAPI::get_forms(); + + $action_forms = array(); + + foreach ( $forms as $form ) { + + $delivery_settings = rgar($form, 'wiaas_delivery_process'); + + if ( ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'action'){ + + $action_forms[] = $form; + } + } + + + return $action_forms; } /** @@ -194,37 +227,6 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { return self::$delivery_action_types[$target_form['title']]; } - public function get_target_actual_date() { - $target_entry = $this->get_target_form_entry(); - $target_form = GFAPI::get_form( $this->target_form_id ); - - if (!is_wp_error($target_entry) && is_array($target_form['fields'])) { - foreach ( $target_form['fields'] as $field ) { - if (GFCommon::get_label( $field ) === 'Actual Date') { - return $target_entry[$field->id]; - } - } - } - - return null; - } - - public function get_target_step_comments() { - $notes = RGFormsModel::get_lead_notes( $this->get_target_form_entry_id() ); - - $comments = array(); - foreach ( $notes as $key => $note ) { - if ( $note->note_type !== 'gravityflow' ) { - $comments[] = array( - 'date' => $note->date_created, - 'text' => $note->value, - 'user' => $note->user_name - ); - } - } - return $comments; - } - /** * Retrieves target form entry created when step was started * @return array|null @@ -247,4 +249,70 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { return absint($value); } + + + private function _create_single_action_entry($target_form, $order_id) { + + $action_entries_ids = array(); + + $new_entry = Wiaas_Order_Fields::map_order_to_entry($order_id, $target_form); + + if (empty($new_entry)) { + // entry cannot be created + return $action_entries_ids; + } + + $new_entry = array_merge($new_entry,array( + 'form_id' => $this->target_form_id, + 'wiaas_delivery_process_id' => $this->get_entry_id(), + 'wiaas_delivery_order_id' => $order_id, + 'wiaas_delivery_step_name' => $this->get_name(), + )); + + $entry_id = GFAPI::add_entry( $new_entry ); + + if ( is_wp_error( $entry_id ) ) { + $this->log_debug( __METHOD__ .'(): failed to add entry' ); + } else { + // store entry id + $action_entries_ids[] = $entry_id; + } + + return $action_entries_ids; + } + + + private function _create_per_bundle_action_entries($target_form, $order_id) { + + $action_entries_ids = array(); + + $bundle_items = wiaas_get_order_standard_bundle_items($order_id); + + foreach ($bundle_items as $item) { + + $new_entry = Wiaas_Order_Fields::map_order_to_entry($order_id, $target_form, $item->get_id()); + + if (empty($new_entry)) { + // entry cannot be created + continue; + } + + $new_entry['form_id'] = $target_form['id']; + $new_entry['wiaas_delivery_process_id'] = $this->get_entry_id(); + $new_entry['wiaas_delivery_order_id'] = $order_id; + + $entry_id = GFAPI::add_entry( $new_entry ); + + if ( is_wp_error( $entry_id ) ) { + + $this->log_debug( __METHOD__ .'(): failed to add entry' ); + } else { + // store entry id + + $action_entries_ids[] = $entry_id; + } + } + + return $action_entries_ids; + } } diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php new file mode 100644 index 0000000..08d191e --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php @@ -0,0 +1,55 @@ +formId ); + $upload_root = trailingslashit( $upload_root ); + + // handle download for order documents not uploaded by gravity forms + if ( strpos( $file, $upload_root ) === false ) { + + return admin_url() . '?gf-wiaas-order-doc=' . urlencode($file); + } + + return parent::get_download_url( $file, $force_download ); + } + + public function sanitize_settings() { + parent::sanitize_settings(); + + $this->wiaasDocTypeFilter = sanitize_key($this->wiaasDocTypeFilter); + } +} + +GF_Fields::register( new Wiaas_Field_Order_Bundle_Document() ); \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php new file mode 100644 index 0000000..013c4df --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php @@ -0,0 +1,109 @@ +get_selected_bundle_display_name($value); + } + + + public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br ) { + return $this->get_selected_bundle_display_name($value); + } + + + public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { + return $this->get_selected_bundle_display_name($value); + } + + public function get_field_input( $form, $value = '', $entry = null ) { + + $this->choices = array(); + + $order_id = null; + + if (! empty($entry)) { + + $order_field = GFCommon::get_fields_by_type($form, array( 'wiaas_order' ) )[0]; + + $order_id = ! empty($order_field) ? $entry[$order_field->id] : null; + + } else if( ! empty($value)) { + + list ($order_id, $item_id) = explode('|', $value); + } + + if (! empty($order_id)) { + + $this->choices = $this->get_selected_bundle_display_name($order_id); + } + + return parent::get_field_input( $form, $value, $entry ); + } + + + /** + * Adds bundles as choices + */ + public function post_convert_field() { + + if ($this->is_form_editor()) { + + $this->choices = array(); + } + + if ( ! $this->is_form_editor() && ! empty( rgget('order_id') )) { + $this->choices = $this->get_bundles_as_choices(absint(rgget('order_id'))); + } + } + + + public function get_selected_bundle_display_name($value) { + + list ($order_id, $item_id) = explode('|', $value); + + if (! empty($order_id) && ! empty($item_id) && $order = wc_get_order($order_id)) { + + $item = $order->get_item($item_id); + + return $item->get_name(); + } + + return ''; + } + + + public function get_bundles_as_choices($order_id) { + + $choices = array(); + + if (! empty ($order_id) && $order = wc_get_order($order_id)) { + + $standard_bundle_items = wiaas_get_order_standard_bundle_items($order); + + foreach ($standard_bundle_items as $item) { + + $choices[] = array( + 'value' => $order_id . '|' . $item->get_id(), + 'text' => $item->get_name() + ); + } + } + + return $choices; + } +} + +GF_Fields::register( new Wiaas_Field_Order_Bundle_Select() ); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-number.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-number.php new file mode 100644 index 0000000..fed0ead --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-number.php @@ -0,0 +1,53 @@ +_get_selected_supplier_display_name($value); + } + + + public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br ) { + return $this->_get_selected_supplier_display_name($value); + } + + + public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { + return $this->_get_selected_supplier_display_name($value); + } + + + /** + * Adds bundles as choices + */ + public function post_convert_field() { + $this->choices = array(); + + if ( ! $this->is_form_editor() ) { + $this->choices = $this->_get_suppliers_as_choices(); + } + } + + + private function _get_selected_supplier_display_name($value) { + + list ($order_id, $supplier_id) = explode('|', $value); + + if (! empty($order_id) && ! empty($supplier_id) && $order = wc_get_order($order_id)) { + + return wiaas_get_organization_name($supplier_id); + } + + return ''; + } + + + private function _get_suppliers_as_choices() { + + $choices = array(); + + $order_id = absint(rgget('order_id')); + + if (! empty ($order_id) && $order = wc_get_order($order_id)) { + + $suppliers = wiaas_get_order_suppliers($order); + + foreach ($suppliers as $supplier_id => $supplier_name) { + + $choices[] = array( + 'value' => $order_id . '|' . $supplier_id, + 'text' => $supplier_name + ); + } + } + + return $choices; + } +} + +GF_Fields::register( new Wiaas_Field_Order_Supplier_Select() ); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php new file mode 100644 index 0000000..7874e74 --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php @@ -0,0 +1,139 @@ + + +
  • + + + + +
  • + + type) { + + case 'wiaas_order_bundle': + $value = $entry[$field->id]; + list ($order_id, $item_id) = explode('|', $value); + + if ( ! empty($order_id) && ! empty($item_id)) { + + return array( + 'id' => $item_id, + 'name' => $field->get_selected_bundle_display_name($value) + ); + } + + return null; + + case '': + + } + } + + + public static function map_order_to_entry($order_id, $form, $bundle_item_id = null) { + + + if (empty($form['fields']) || + empty(GFCommon::get_fields_by_type( $form, array('wiaas_order')) ) ) { + // form does not have order field so cannot be mapped + return false; + } + + $order = wc_get_order($order_id); + + $bundle_item = $order->get_item($bundle_item_id); + + $entry = array(); + + foreach ($form['fields'] as $field) { + + switch ($field->type) { + + case 'wiaas_order': + + $entry[(string) $field->id] = $order->get_id(); + + break; + + case 'wiaas_order_bundle': + + if ( empty($bundle_item) && $field->isRequired) { + // there is no data for required field so entry cannot be created + return false; + } + + if (! empty($bundle_item)) { + + $entry[(string) $field->id] = $order->get_id() . '|' . $bundle_item->get_id(); + } + + break; + + case 'wiaas_order_bundle_document': + + if ( empty($bundle_item) && $field->isRequired) { + // there is no data for required field so entry cannot be created + return false; + } + + if (! empty($bundle_item)) { + + $documents = wiaas_get_order_item_documents($bundle_item, $field->wiaasDocTypeFilter); + + if ( empty($documents) && $field->isRequired) { + // there is no data for required field so entry cannot be created + return false; + } + + if (! empty($documents)) { + + $document = $documents[0]; + + $entry[$field->id] = $document['version']; + } + } + + break; + + } + } + + return $entry; + } + +} + +Wiaas_Order_Fields::init(); diff --git a/backend/app/plugins/wiaas/includes/document/class-wiaas-document-download.php b/backend/app/plugins/wiaas/includes/document/class-wiaas-document-download.php index df4b6f0..916d113 100644 --- a/backend/app/plugins/wiaas/includes/document/class-wiaas-document-download.php +++ b/backend/app/plugins/wiaas/includes/document/class-wiaas-document-download.php @@ -12,6 +12,35 @@ class Wiaas_Document_Download { if ( isset($_GET['wiaasdoc']) ) { add_action( 'init', array( __CLASS__, 'admin_download' ) ); } + + if (isset($_GET['gf-wiaas-order-doc'])) { + + add_action( 'init', array( __CLASS__, 'admin_gf_order_document_download' ) ); + } + } + + /** + * Handle download for order documents by gravity flow steps + */ + public static function admin_gf_order_document_download() { + + if (!is_user_logged_in()) { + wp_die( __( 'No Access.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 403 ) ); + } + + // relative file path from upload dir for document + $version = urldecode($_GET['gf-wiaas-order-doc']); + + $file_path = wiaas_get_document_version_path($version); + + if (!file_exists($file_path)) { + wp_die( __( 'Document not found.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 404 ) ); + } + + WC_Download_Handler::download_file_force( + $file_path, + pathinfo( $file_path, PATHINFO_FILENAME ) . '.' . pathinfo( $file_path, PATHINFO_EXTENSION ) + ); } /** diff --git a/backend/app/plugins/wiaas/includes/document/wiaas-document-functions.php b/backend/app/plugins/wiaas/includes/document/wiaas-document-functions.php index a6d43f5..8a078ab 100644 --- a/backend/app/plugins/wiaas/includes/document/wiaas-document-functions.php +++ b/backend/app/plugins/wiaas/includes/document/wiaas-document-functions.php @@ -187,4 +187,44 @@ function wiaas_get_standard_package_order_item_documents($order, $package_item_i return $doc; }, $order_documents); +} + +/** + * Retrieve documents for order item + * + * @param $order_item + * @param string|null $doc_type + * + * @return array { + * $param string key Unique key used for frontend downloand + * $param string name Document name visible in download link + * $param string version Relative path from upload directory to physical document file + * $param string type Document type + * + * @reference Wiaas_Document + * } + */ +function wiaas_get_order_item_documents($order_item, $doc_type = null) { + + $documents = empty($order_item['wiaas_documents']) ? array() : $order_item['wiaas_documents']; + + if (empty($doc_type)) { + return $documents; + } + + $filtered_documents = array(); + + foreach ($documents as $document) { + + if ($document['type'] === $doc_type) { + $filtered_documents[] = $document; + } + } + + return $filtered_documents; +} + +function wiaas_get_order_item_document_admin_download_link($order_id, $item_id, $version) { + + } \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php b/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php new file mode 100644 index 0000000..4132ee4 --- /dev/null +++ b/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php @@ -0,0 +1,55 @@ +get_items(); + + $suppliers = get_terms(array( + 'taxonomy' => 'supplier', + 'fields' => 'id=>name', + 'hide_empty' => false + )); + + return $suppliers; +} + +/** + * Retrieve standard bundles from order + * + * @param int|WC_Order $order + * + * @return array + */ +function wiaas_get_order_standard_bundle_items($order) { + + if (is_numeric($order)) { + + $order = wc_get_order($order); + } + + $items = $order->get_items(); + + $standard_bundle_items = array(); + + foreach ($items as $item) { + + if (isset($item['wiaas_standard_package'])) { + + $standard_bundle_items[] = $item; + } + } + + return $standard_bundle_items; +} \ No newline at end of file diff --git a/frontend/src/actions/orders/customerQuestionnairesActions.js b/frontend/src/actions/orders/customerQuestionnairesActions.js new file mode 100644 index 0000000..6fe111f --- /dev/null +++ b/frontend/src/actions/orders/customerQuestionnairesActions.js @@ -0,0 +1,68 @@ +import { + API_SERVER +} from '../../config'; + +import { + UPLOAD_CUSTOMER_QUESTIONNAIRE, + REQUEST_CUSTOMER_QUESTIONNAIRES, + RECEIVE_CUSTOMER_QUESTIONNAIRES, + orderMessages, REQUEST_CUSTOMER_ACCEPTANCE, RECEIVE_CUSTOMER_ACCEPTANCE, UPLOAD_CUSTOMER_ACCEPTANCE +} from '../../constants/ordersConstants'; + +import { + updateMessages +} from '../notification/notificationActions'; +import HtmlClient from '../../helpers/HtmlClient'; +import {fetchCustomerAcceptance} from "./customerAcceptanceActions"; + +const htmlClient = new HtmlClient(); + + +const requestCustomerQuestionnaires = () => ({ + type: REQUEST_CUSTOMER_QUESTIONNAIRES +}); + +const receiveCustomerQuestionnaires = (json) => ({ + type: RECEIVE_CUSTOMER_QUESTIONNAIRES, + customerQuestionnaires: json +}); + +const uploadCustomerQuestionnaireAction = () => ({ + type: UPLOAD_CUSTOMER_QUESTIONNAIRE +}); + + +export const fetchCustomerQuestionnaires = (idOrder) => { + return dispatch => { + dispatch(requestCustomerQuestionnaires()); + return htmlClient.fetch({ + url: `${API_SERVER}/wp-json/wiaas/customer-questionnaires/${idOrder}`, + method: 'get' + }) + .then(response => { + if (typeof response.data !== 'undefined') { + dispatch(receiveCustomerQuestionnaires(response.data)); + } + }) + .catch(error => { + htmlClient.onError(error, dispatch); + }); + } +} + +export const uploadCustomerQuestionnaire = (orderId, actionId, file) => { + + return dispatch => { + dispatch(uploadCustomerQuestionnaireAction()); + return htmlClient.uploadFile(file, { + url: `${API_SERVER}/wp-json/wiaas/customer-questionnaires/${orderId}/upload/${actionId}`, + }).then(response => { + if (typeof response.data !== 'undefined') { + dispatch(updateMessages(response.data.messages, orderMessages)); + dispatch(fetchCustomerQuestionnaires(orderId)); + } + }).catch(error => { + htmlClient.onError(error, dispatch); + }); + } +} \ No newline at end of file diff --git a/frontend/src/constants/ordersConstants.js b/frontend/src/constants/ordersConstants.js index b2d9b2e..88fa7fc 100644 --- a/frontend/src/constants/ordersConstants.js +++ b/frontend/src/constants/ordersConstants.js @@ -46,6 +46,10 @@ export const SET_VIEW_ALL_ORDERS = MODULE + 'SET_VIEW_ALL_ORDERS'; export const REQUEST_ALL_SHIPPING_DATES_CONFIRMED = MODULE + 'REQUEST_ALL_SHIPPING_DATES_CONFIRMED'; export const RECEIVE_ALL_SHIPPING_DATES_CONFIRMED = MODULE + 'RECEIVE_ALL_SHIPPING_DATES_CONFIRMED'; +export const UPLOAD_CUSTOMER_QUESTIONNAIRE = MODULE + 'UPLOAD_CUSTOMER_QUESTIONNAIRE'; +export const REQUEST_CUSTOMER_QUESTIONNAIRES = MODULE + 'REQUEST_CUSTOMER_QUESTIONNAIRES'; +export const RECEIVE_CUSTOMER_QUESTIONNAIRES = MODULE + 'RECEIVE_CUSTOMER_QUESTIONNAIRES'; + export const orderMessages = { SYSTEM_ALLOWED_LANGUAGES_EMPTY: 'There are no languages added in the system.', ALLOWED_LANGUAGE: 'Allowed languages are:', diff --git a/frontend/src/containers/orders/components/process/ValidateQuestionnaire.jsx b/frontend/src/containers/orders/components/process/ValidateQuestionnaire.jsx index 08cb7b5..29e09a3 100644 --- a/frontend/src/containers/orders/components/process/ValidateQuestionnaire.jsx +++ b/frontend/src/containers/orders/components/process/ValidateQuestionnaire.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react'; import {connect} from 'react-redux'; -import {fetchCustomerDocuments, fetchValidationComments} from '../../../../actions/orders/processActions'; +import {fetchCustomerQuestionnaires} from '../../../../actions/orders/customerQuestionnairesActions'; import ValidateQuestionnaireItem from './ValidateQuestionnaireItem.jsx'; import '../../style/ValidateQuestionnaire.css'; @@ -8,7 +8,7 @@ class ValidateQuestionnaire extends Component { componentDidMount(){ const {idOrder, idProcessStep} = this.props.step; - //this.props.dispatch(fetchCustomerDocuments(idOrder, 'orderQuestionaire')); + this.props.dispatch(fetchCustomerQuestionnaires(idOrder)); //this.props.dispatch(fetchValidationComments(idOrder, idProcessStep, 'invalidQuestionnaireComment')); } @@ -18,18 +18,18 @@ class ValidateQuestionnaire extends Component { } render() { - const {customerDocuments, validationComments, orderPackages} = this.props; + const {customerQuestionnaires, orderPackages} = this.props; return (
    { - customerDocuments && - Object.keys(customerDocuments).map((idOrderPackagePair) => + customerQuestionnaires && customerQuestionnaires.actions && + customerQuestionnaires.actions.map((customerQuestionnaryAction) => { return this.findById(orderPackage, idOrderPackagePair)})} - key={'validate-questionnaire-' + idOrderPackagePair}/> + action={customerQuestionnaryAction} + key={'validate-questionnaire-' + customerQuestionnaryAction.action_id} + orderPackage={orderPackages.find( orderPackage => orderPackage.orderItemId === customerQuestionnaryAction.item_id)} + /> ) }
    @@ -38,8 +38,7 @@ class ValidateQuestionnaire extends Component { } const mapStateToProps = (state) => ({ - customerDocuments: state.processReducer.customerDocuments, - validationComments: state.processReducer.validationComments, + customerQuestionnaires: state.processReducer.customerQuestionnaires, orderPackages: state.processReducer.orderInfo.packages }); diff --git a/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx b/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx index ab6e811..568ae71 100644 --- a/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx +++ b/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx @@ -2,7 +2,7 @@ import React, {Component} from 'react'; import {connect} from 'react-redux'; import Dropzone from 'react-dropzone'; import {Row, Col} from 'reactstrap'; -import {reUploadOrderDocument, badFile} from '../../../../actions/orders/processActions'; +import {uploadCustomerQuestionnaire, badFile} from '../../../../actions/orders/customerQuestionnairesActions'; import {API_SERVER} from '../../../../config'; import FileDownloader from '../../../../helpers/FileDownloader'; import {orderTexts} from '../../../../constants/ordersConstants'; @@ -16,19 +16,21 @@ class ValidateQuestionnaireItem extends Component { fileHandler.download(fileUrl, fileName); } - uploadFile(idPackage, idOrder, idDocument,acceptedFiles, rejectedFiles) { + uploadFile(action,acceptedFiles, rejectedFiles) { if(acceptedFiles && acceptedFiles.length){ const file = acceptedFiles[0]; - this.props.dispatch(reUploadOrderDocument(idPackage, idOrder, idDocument, file)); + this.props.dispatch(uploadCustomerQuestionnaire(action.order_id, action.action_id, file)); } - if(rejectedFiles && rejectedFiles.length) { - this.props.dispatch(badFile()); - } + // if(rejectedFiles && rejectedFiles.length) { + // this.props.dispatch(badFile()); + // } } render() { - const {customerDocuments, validationComments, orderPackage} = this.props; + const {action, orderPackage} = this.props; + + const customerDocuments = [ action.document ]; return (
    @@ -37,25 +39,27 @@ class ValidateQuestionnaireItem extends Component {
    {orderPackage.packageName} { - customerDocuments.map(document =>
    + customerDocuments.map(document =>
    { - document.validation === 'invalid' + action.status === 'invalid' ?
    + {this.downloadDocument(document)}}> - {document.documentName} ({document.extension}) {' '} + {document.version} +
    - {document.validation.replace(/-/g,' ')}
    + {action.status.replace(/-/g,' ')}
    { - (validationComments && validationComments.length > 0) && + (action.comments && action.comments.length > 0) &&
    - {validationComments.map((comment, key) =>
    + {action.comments.map((comment, key) =>
    {comment.user} - {comment.addDate}
    {comment.comment}
    )} @@ -67,7 +71,7 @@ class ValidateQuestionnaireItem extends Component { multiple={false} accept=".pdf,.docx,.doc,.xlsx,.xls,.odt,.ods" activeClassName="upload-file-accept" - onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(document.idPackage, document.idOrder, document.idDocument, acceptedFiles, rejectedFiles)}}> + onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(action, acceptedFiles, rejectedFiles)}}>
    {orderTexts.labels.SELECT_OR_DROP}
    @@ -78,10 +82,11 @@ class ValidateQuestionnaireItem extends Component { {this.downloadDocument(document)}}> - {document.documentName} ({document.extension}) {' '} + {document.version} +
    - {document.validation.replace(/-/g,' ')}
    + {action.status.replace(/-/g,' ')}
    diff --git a/frontend/src/helpers/HtmlClient.js b/frontend/src/helpers/HtmlClient.js index bb9059c..31c7a6c 100644 --- a/frontend/src/helpers/HtmlClient.js +++ b/frontend/src/helpers/HtmlClient.js @@ -46,7 +46,7 @@ class HtmlClient { let formData = new FormData(); formData.append('file', file, file.name); - if(configParams) { + if(configParams && configParams.data) { Object.keys(configParams.data).forEach((paramKey) => { formData.append(paramKey, configParams.data[paramKey]); diff --git a/frontend/src/helpers/ProcessHelper.js b/frontend/src/helpers/ProcessHelper.js index 74d1c8e..4a068bb 100644 --- a/frontend/src/helpers/ProcessHelper.js +++ b/frontend/src/helpers/ProcessHelper.js @@ -3,17 +3,14 @@ import moment from "moment"; export const fromWiaasProcessStep = (step) => { return { actionCode: step.action_code, - actualDate: step.actual_date, - comments: step.comments, fullDesc: step.full_desc, idOrder: step.order_id, - idProcess: step.step_form_entry_id, //not sure about this + idProcess: step.process_id, //not sure about this idProcessStep: step.step_id, //not sure about this isNewCommentVisible: 1, //TODO : get this from backend isVisibleForCustomer: 1, //TODO : get this from backend now: moment().format("Do MMM YY"), shortDesc: step.short_desc, status: step.status, - stepType: step.step_type, } }; \ No newline at end of file diff --git a/frontend/src/reducers/orders/processReducers.js b/frontend/src/reducers/orders/processReducers.js index a240d4a..a43ca1a 100644 --- a/frontend/src/reducers/orders/processReducers.js +++ b/frontend/src/reducers/orders/processReducers.js @@ -4,6 +4,7 @@ import { RECEIVE_CUSTOMER_DOCUMENTS, RECEIVE_VALIDATION_COMMENTS, RECEIVE_CUSTOMER_ACCEPTANCE, + RECEIVE_CUSTOMER_QUESTIONNAIRES, RECEIVE_IS_COMPONENT_DISABLED, RECEIVE_IS_NEXT_STEP_WANTED, SET_EARLIEST_INSTALLATION_DATE, @@ -53,6 +54,14 @@ moduleReducers[RECEIVE_CUSTOMER_ACCEPTANCE] = (state, action) => { }); }; + +moduleReducers[RECEIVE_CUSTOMER_QUESTIONNAIRES] = (state, action) => { + + return Object.assign({}, state, { + customerQuestionnaires: action.customerQuestionnaires + }); +}; + moduleReducers[RECEIVE_IS_COMPONENT_DISABLED] = (state, action) => { const newState = {isComponentDisabled : {}}; newState.isComponentDisabled.installationScheduling = state.isComponentDisabled && state.isComponentDisabled.installationScheduling From 308c836460e0ae4e64346bdd5c573d30fb34e046 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Wed, 31 Oct 2018 10:23:59 +0100 Subject: [PATCH 02/14] handle order actions --- backend/app/plugins/wiaas/assets/css/menu.css | 43 +++ .../class-wiaas-admin-delivery-process.php | 196 ++++++++++ .../class-wiaas-rest-delivery-process-api.php | 198 ++-------- .../wiaas/includes/class-wiaas-admin.php | 3 + .../includes/class-wiaas-delivery-process.php | 341 +++++++++--------- .../class-wiaas-delivery-process-action.php | 249 ++++++++++++- .../class-wiaas-delivery-process-addon.php | 311 ++++------------ .../class-wiaas-delivery-process-step.php | 20 +- .../class-wiaas-field-order-bundle-select.php | 51 +-- .../class-wiaas-order-fields.php | 3 +- .../actions/dashboard/nextActionsActions.js | 2 +- .../orders/customerAcceptanceActions.js | 20 +- .../orders/customerQuestionnairesActions.js | 4 +- .../components/process/CustomerAcceptance.jsx | 16 +- .../process/ValidateQuestionnaire.jsx | 4 +- .../process/ValidateQuestionnaireItem.jsx | 13 +- frontend/src/helpers/OrderHelper.js | 9 +- 17 files changed, 834 insertions(+), 649 deletions(-) create mode 100644 backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php diff --git a/backend/app/plugins/wiaas/assets/css/menu.css b/backend/app/plugins/wiaas/assets/css/menu.css index 3c8fc24..da83ba0 100644 --- a/backend/app/plugins/wiaas/assets/css/menu.css +++ b/backend/app/plugins/wiaas/assets/css/menu.css @@ -19,3 +19,46 @@ .wc-order-preview footer { display: none; } + +.gravityflow-discussion-item{ + margin-bottom:10px; + padding: 6px; +} + +.gravityflow-dicussion-item-name { + color:black; + font-weight:bold; +} + +.gravityflow-dicussion-item-date { + color: #9b9b9b; + margin-left:8px; + font-size:90%; +} + +.rtl .gravityflow-dicussion-item-date { + margin-right:8px; + margin-left: 0; +} + +.gravityflow-dicussion-item-toggle-display { + float: right; +} + +.rtl .gravityflow-dicussion-item-toggle-display { + float: left; +} + +@media print { + .gravityflow-dicussion-item-hidden { + display:block !important; + } + + .gravityflow-dicussion-item-toggle-display { + display: none; + } +} + +.gravityflow-dicussion-item-value { + padding: 10px; +} diff --git a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php new file mode 100644 index 0000000..582eab6 --- /dev/null +++ b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php @@ -0,0 +1,196 @@ +id]; + } + } + + // display process steps + + $workflow_api = new Gravity_Flow_API($form['id']); + + $steps = $workflow_api->get_steps(); + + foreach ($steps as $index => $step) { + + if (! $step->is_active()) { + continue; + } + + $is_step_running = $step->get_status() === 'pending'; + $is_step_completed = $step->get_status() === 'complete'; + $is_current_step = $step->get_id() === $current_step->get_id(); + + //$disabled_style = $is_step_running ? '' : 'opacity: 0.5'; + $completed_style = $is_step_completed ? 'border-left: 4px solid #46b450;' : ''; + + ?> + +
    + +

    + get_name(), 'wiaas') ?> +

    + + target_form_id ); + + if (empty($action_form)) { + + echo '
    '; + + continue; + } + + $action_delivery_settings = rgar($action_form, 'wiaas_delivery_process'); + + ?> + +
    + + + + ' . + ' ' . $action_form['title'] . '', + $form_url ); + + echo $form_link; + } + + echo '


    '; + + $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, $search_criteria, $sorting, $paging ); + + foreach ($entries as $action_entry) { + self::_display_step_action_entry($action_form, $action_entry); + } + + ?> + +
    + +
    + + + +
    + get_current_step($action_entry); + + + ?> + + + type === 'wiaas_order') { + continue; + } + + if ($field->type === 'workflow_discussion') { + + echo ''; + + continue; + } + + $value = $field->get_value_entry_detail($action_entry[$field->id]); + $label = $field->get_field_label(false, $action_entry[$field->id]); + + echo '' . + '' . + '' . + ''; + } + + if (! empty($current_action_step)) { + + ?> + + + + + + + + +
    ' . $field->format_discussion_value($action_entry[$field->id]) . '
    ' . $label . ' :
    ' . $value . '
    + + get_name() . ' ' . $current_action_step->get_status_label($current_action_step->get_status()) ?> + +
    + +
    + 'GET', 'callback' => array(__CLASS__, 'get_next_actions_for_user'), 'permission_callback' => 'is_user_logged_in' ) ); - register_rest_route( self::$namespace, 'customer-acceptance/(?P\d+)', array( + register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P\d+)/customer-acceptance', array( 'methods' => 'GET', 'callback' => array(__CLASS__, 'get_customer_acceptance'), 'permission_callback' => 'is_user_logged_in' ) ); - register_rest_route( self::$namespace, 'customer-acceptance/(?P\d+)', array( + register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P\d+)/customer-acceptance', array( 'methods' => 'POST', 'callback' => array(__CLASS__, 'submit_customer_acceptance'), 'permission_callback' => 'is_user_logged_in' ) ); - register_rest_route( self::$namespace, 'customer-acceptance/(?P\d+)/upload-file' , array( + register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P\d+)/customer-acceptance/upload' , array( 'methods' => 'POST', - 'callback' => array(__CLASS__, 'upload_file'), + 'callback' => array(__CLASS__, 'upload_customer_acceptance'), 'permission_callback' => 'is_user_logged_in' ) ); - register_rest_route( self::$namespace, 'customer-questionnaires/(?P\d+)', array( + register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P\d+)/customer-questionnaires', array( 'methods' => 'GET', 'callback' => array(__CLASS__, 'get_customer_questionnaires'), - //'permission_callback' => 'is_user_logged_in' + 'permission_callback' => 'is_user_logged_in' ) ); - register_rest_route( self::$namespace, 'customer-questionnaires/(?P\d+)/upload/(?P\d+)', array( + register_rest_route( self::$namespace, '/' . self::$rest_base . '/(?P\d+)/customer-questionnaires/upload/(?P\d+)', array( 'methods' => 'POST', 'callback' => array(__CLASS__, 'upload_customer_questionnaire'), - //'permission_callback' => 'is_user_logged_in' + 'permission_callback' => 'is_user_logged_in' ) ); } @@ -114,132 +116,53 @@ class Wiass_REST_Delivery_Process_API { $order_id = absint($request['order_id']); - - $data = Wiaas_Delivery_Process::get_current_delivery_step_info($order_id); + $data = Wiaas_Delivery_Process::get_customer_questionnaires_data($order_id); return rest_ensure_response($data); } public function upload_customer_questionnaire(WP_REST_Request $request) { - $action_id = absint($request['action_id']); + $order_id = absint($request['order_id']); - try { + $action_entry_id = absint($request['action_entry_id']); - $result = Wiaas_Document_Upload::upload_document_version(); - - $entry = GFAPI::get_entry($action_id); - - $document_field = GFCommon::get_fields_by_type(GFAPI::get_form($entry['form_id']), 'wiaas_order_bundle_document')[0]; - - $entry[$document_field->id] = $result; - - GFAPI::update_entry($entry); - - Wiaas_Delivery_Process::complete_action_step($action_id); - - return rest_ensure_response($result); - - } catch( Exception $e) { - } + Wiaas_Delivery_Process::upload_customer_questionnaire($order_id, $action_entry_id); return wiaas_api_notice('INSTALLATION_ACCEPTED', 'success'); } public static function get_customer_acceptance(WP_REST_Request $request){ - $entry = GFAPI::get_entry($request['entry_id']); - if (is_wp_error($entry)){ - return wiaas_api_generate_error('Customer acceptance entry not found', 404); - } - $acceptance_documents = array(); - $uploaded_files = json_decode($entry[self::UPLOADED_FILES_FIELD_ID]); + $order_id = absint($request['order_id']); - foreach($uploaded_files as $file_url){ - //example of decoded url : - //http://localhost/wp/index.php?gf-download=2018/08/rokovi-1535378841.docx&form-id=1&field-id=12&hash=1be6c30f0eeff93563b352d15fe459d5ded12ee06c2c8f36fed66b42dedf2534 - - $decoded_url = urldecode($file_url); - $url_parts = explode('?', $decoded_url); - $file_name_base_parts = explode('&', $url_parts[1]); - $file_name_parts = explode('/', $file_name_base_parts[0]); - $file_name_with_extension_parts = explode('.', $file_name_parts[2]); + $data = Wiaas_Delivery_Process::get_customer_acceptance_data($order_id); - $acceptance_documents_entry = array( - 'name' => $file_name_with_extension_parts[0], - 'extension' => $file_name_with_extension_parts[1], - 'url' => $file_url - ); - - array_push($acceptance_documents, $acceptance_documents_entry); - } - - $acceptance_status = 0; - if ($entry[self::ACCEPTANCE_STATUS_FIELD_ID]){ - $acceptance_status = ($entry[self::ACCEPTANCE_STATUS_FIELD_ID] === 'accept') ? 1 : -1; - } - - return rest_ensure_response(array( - 'documents' => $acceptance_documents, - 'expiration' => $entry[self::EXPIRATION_DATE_FIELD_ID], - 'status' => $acceptance_status, - 'decline_reason' => $entry[self::DECLINE_REASON_FIELD_ID] - )); + return rest_ensure_response($data); } - public static function submit_customer_acceptance(WP_REST_Request $request){ - $entry = GFAPI::get_entry($request['entry_id']); - if (is_wp_error($entry)){ - return wiaas_api_generate_error('Customer acceptance entry not found', 404); - } + public static function submit_customer_acceptance(WP_REST_Request $request) { - $status = $request['actionType']; - $reason = $request['declineReason']; + $status = $request['action_type']; + $reason = $request['decline_reason']; if (!in_array($status, self::ACCEPTABLE_STATUS)){ return wiaas_api_notice('ACCEPTANCE_STATUS_MISSING', 'error'); } $installation_declined = ($status === self::DECLINE_STATUS_LABEL); - - $uploaded_files = json_decode($entry[self::UPLOADED_FILES_FIELD_ID]); - if ($installation_declined && $reason === ''){ return wiaas_api_notice('DECLINE_REASON_EMPTY', 'error'); } - if (!$installation_declined && (count($uploaded_files)===0)){ + + $order_id = $request['order_id']; + + if (! $installation_declined && ! Wiaas_Delivery_Process::is_customer_acceptance_uploaded($order_id)) { return wiaas_api_notice('ACCEPTANCE_NOT_UPLOADED', 'error'); } - $entry[self::DECLINE_REASON_FIELD_ID] = $reason; - $entry[self::ACCEPTANCE_STATUS_FIELD_ID] = $status; - - if (!GFAPI::update_entry( $entry )){ - return wiaas_api_notice('INTERNAL_SERVER_ERROR', 'error'); - } - - //Check if step is already completed, to not submit again - $gf_api = new Gravity_Flow_API($entry['form_id']); - $current_step = $gf_api->get_current_step($entry); - if ($current_step->get_name() !== self::USER_INPUT_STEP_NAME){ - return wiaas_api_notice('ACCEPTANCE_STATUS_UPDATED', 'success'); - } - - if ( $current_step ) { - $current_step->purge_assignees(); - $current_step->update_step_status( 'complete' ); - } - $entry_id = $entry['id']; - $new_step_id = $current_step->get_id() + 1; - $new_step = $gf_api->get_step( $new_step_id, $entry ); - $feedback = sprintf( esc_html__( 'Sent to step: %s', 'gravityflow' ), $new_step->get_name() ); - $gf_api->add_timeline_note( $entry_id, $feedback ); - $gf_api->log_activity( 'workflow', 'sent_to_step', $gf_api->form_id, $entry_id, $step_id ); - gform_update_meta( $entry_id, 'workflow_final_status', 'pending' ); - $new_step->start(); - $gf_api->process_workflow( $entry_id ); - + Wiaas_Delivery_Process::update_customer_acceptance_status($order_id, $status, $reason); if ($installation_declined){ return wiaas_api_notice('INSTALLATION_DECLINED', 'success'); @@ -247,75 +170,14 @@ class Wiass_REST_Delivery_Process_API { return wiaas_api_notice('INSTALLATION_ACCEPTED', 'success'); } - public static function upload_file(WP_REST_Request $request){ - $files = $request->get_file_params(); - if (!$files[self::FILE_KEY_NAME]){ - return wiaas_api_notice('NO_FILES_UPLOADED', 'error'); - } + public static function upload_customer_acceptance(WP_REST_Request $request){ - $entry = GFAPI::get_entry($request['entry_id']); - if (is_wp_error($entry)){ - return wiaas_api_generate_error('Customer acceptance entry not found', 404); - } + $order_id = $request['order_id']; - $form = GFAPI::get_form($entry['form_id']); - $form_upload_path = GFFormsModel::get_upload_path( $form['id'] ); + $success = Wiaas_Delivery_Process::upload_customer_acceptance_document($order_id); - $target_path = $form_upload_path . '/' . date('Y') . '/' . date('m') . '/'; - wp_mkdir_p( $target_path ); - GFCommon::recursive_add_index_file( $target_path ); - $upload_file_field = GFAPI::get_field($form['id'], self::UPLOADED_FILES_FIELD_ID); - $file_name = sanitize_file_name($files[self::FILE_KEY_NAME]['name']); - $file_path_details = pathinfo($file_name); - - if ( GFCommon::file_name_has_disallowed_extension( $file_name ) ) { - return wiaas_api_notice('INVALID_FILE_ACCEPTANCE', 'error'); - } - $allowed_extensions = ! empty( $upload_file_field->allowedExtensions ) ? GFCommon::clean_extensions( explode( ',', strtolower( $upload_file_field->allowedExtensions ) ) ) : array(); - if ( ! empty( $allowed_extensions ) ) { - if ( ! GFCommon::match_file_extension( $file_name, $allowed_extensions ) ) { - return wiaas_api_notice('INVALID_FILE_ACCEPTANCE', 'error'); - } - } - - $new_file_name = $file_path_details['filename'] . '-' . time() . '.' . $file_path_details['extension']; - - // Bypasses security checks when running unit tests. - if ( defined( 'WP_TEST_IN_PROGRESS' ) && WP_TEST_IN_PROGRESS ) { - return wiaas_api_notice('FILE_UPLOADED', 'success'); - } - - if ( move_uploaded_file($files[self::FILE_KEY_NAME]['tmp_name'], $target_path . $new_file_name ) ) { - GFFormsModel::set_permissions( $target_path . $new_file_name ); - } else { - return wiaas_api_notice('INTERNAL_SERVER_ERROR', 'error'); - } - - //Extract path relative to the root - //Last 6 strings (excluding last empty) are path relative to the root - $path_parts = explode('/', $target_path); - - $relative_path = ''; - $i = count($path_parts) - self::PATH_PARTS_TO_EXTRACT; - while($i < count($path_parts)-1){ - $relative_path = $relative_path . $path_parts[$i] . '/'; - $i++; - } - - $file_url = self::BASE_NAME . $relative_path . $new_file_name; - $url_for_download = $upload_file_field->get_download_url($file_url); - - $uploaded_files = json_decode($entry[self::UPLOADED_FILES_FIELD_ID]); - - if ($uploaded_files === NULL){ - $uploaded_files = []; - } - array_push($uploaded_files, $url_for_download); - - $entry[self::UPLOADED_FILES_FIELD_ID] = json_encode($uploaded_files); - - if (GFAPI::update_entry( $entry )) { + if ($success) { return wiaas_api_notice('FILE_UPLOADED','success'); } diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-admin.php b/backend/app/plugins/wiaas/includes/class-wiaas-admin.php index 39d0b48..1e61eef 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-admin.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-admin.php @@ -25,6 +25,9 @@ class Wiaas_Admin { require_once dirname(__FILE__) . '/admin/class-wiaas-admin-product.php'; + + require_once dirname(__FILE__) . '/admin/class-wiaas-admin-delivery-process.php'; + add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 ); } 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 e7413c9..f5d6dce 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php @@ -10,8 +10,6 @@ defined( 'ABSPATH' ) || exit; class Wiaas_Delivery_Process { - private static $process_form_title_prefix = 'DELIVERY PROCESS:'; - public static function init() { self::_register_delivery_process_step_type(); @@ -21,7 +19,7 @@ class Wiaas_Delivery_Process { private static function _init_hooks() { add_action('woocommerce_new_order', array( __CLASS__, 'create_delivery_process_for_order' )); - add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_order'), 10, 3 ); + // add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_order'), 10, 3 ); } /** @@ -31,6 +29,7 @@ class Wiaas_Delivery_Process { require_once( 'delivery-process/class-wiaas-delivery-process-step.php' ); require_once( 'delivery-process/class-wiaas-delivery-process-addon.php' ); + require_once( 'delivery-process/class-wiaas-delivery-process-action.php' ); // order fields require_once( 'delivery-process/class-wiaas-order-fields.php' ); @@ -71,6 +70,174 @@ class Wiaas_Delivery_Process { } } + public static function get_available_process_list_for_country($country_code) { + + $forms = GFAPI::get_forms(); + + $available_process_forms = array(); + + foreach ($forms as $form) { + + $delivery_settings = rgar($form, 'wiaas_delivery_process'); + + if ($delivery_settings['delivery_form_type'] === 'process' && + $delivery_settings['delivery_country'] === $country_code) { + + $available_process_forms[] = $form; + } + } + + return $available_process_forms; + } + + + public static function get_customer_acceptance_data($order_id) { + + $delivery_process_entry = self::get_order_delivery_process_entry($order_id); + + $data = array(); + + if (! empty($delivery_process_entry)) { + + $workflow = new Gravity_Flow_API($delivery_process_entry['form_id']); + + $step = $workflow->get_current_step($delivery_process_entry); + + if ($step && Wiaas_Delivery_Process_Action::process_step_has_customer_acceptance_action($step)) { + + $action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step); + + $action_entry = $action_entries[0]; + + $data[] = Wiaas_Delivery_Process_Action::get_customer_acceptance_action_data($action_entry['id']); + } + } + + return empty( $data ) ? $data : $data[0]; + } + + public static function get_customer_questionnaires_data($order_id) { + + $data = array(); + + $delivery_process_entry = self::get_order_delivery_process_entry($order_id); + + if (! empty($delivery_process_entry)) { + + $workflow = new Gravity_Flow_API($delivery_process_entry['form_id']); + + $step = $workflow->get_current_step($delivery_process_entry); + + if ($step && Wiaas_Delivery_Process_Action::process_step_has_customer_validate_questionnaires_action($step)) { + + $action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step); + + foreach ($action_entries as $action_entry) { + + $action_data = Wiaas_Delivery_Process_Action::get_customer_validate_questionnaires_action_data($action_entry['id']); + + if (! empty($action_data)) { + + $data[] = $action_data; + } + } + } + + } + + return $data; + } + + public static function update_customer_acceptance_status($order_id,$status, $reason) { + + $delivery_process_entry = self::get_order_delivery_process_entry($order_id); + + if (! empty($delivery_process_entry) ) { + + $workflow = new Gravity_Flow_API($delivery_process_entry['form_id']); + + $step = $workflow->get_current_step($delivery_process_entry); + + $action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step); + + $action_entry = $action_entries[0]; + + 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']); + } + } + } + + public static function is_customer_acceptance_uploaded($order_id) { + + $delivery_process_entry = self::get_order_delivery_process_entry($order_id); + + if (! empty($delivery_process_entry) ) { + + $workflow = new Gravity_Flow_API($delivery_process_entry['form_id']); + + $step = $workflow->get_current_step($delivery_process_entry); + + $action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step); + + $action_entry = $action_entries[0]; + + return Wiaas_Delivery_Process_Action::is_customer_acceptance_uploaded($action_entry['id']); + } + + return false; + } + + 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::complete_action_step($action_entry_id); + } + + public static function upload_customer_acceptance_document($order_id) { + + $delivery_process_entry = self::get_order_delivery_process_entry($order_id); + + if (! empty($delivery_process_entry) ) { + + $workflow = new Gravity_Flow_API($delivery_process_entry['form_id']); + + $step = $workflow->get_current_step($delivery_process_entry); + + $action_entries = Wiaas_Delivery_Process_Action::get_process_step_action_entries($step); + + $action_entry = $action_entries[0]; + + $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 false; + } + + + public static function get_order_delivery_process_entry($order_id) { + + $order = wc_get_order($order_id); + $process_entry_id = $order->get_meta('wiaas_delivery_process_entry_id', true); + + if (!isset($process_entry_id)) { + return array(); + } + + return GFAPI::get_entry($process_entry_id); + } + /** * Retrieves delivery process instance for order * @@ -82,9 +249,7 @@ class Wiaas_Delivery_Process { $process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id'); - $process_entry_id = 159; - - if (!isset($process_entry_id)) { + if (empty($process_entry_id)) { return null; } @@ -107,6 +272,11 @@ class Wiaas_Delivery_Process { foreach ( $steps_info as $step_info ) { $step = $api->get_step( $step_info->get_id(), $process_instance ); + if (! $step->is_visible_to_customer) { + + continue; + } + $action_code = 'manual'; $action_form = GFAPI::get_form($step->target_form_id); $has_action_form = $action_form !== false; @@ -141,144 +311,6 @@ class Wiaas_Delivery_Process { return $delivery_process; } - public static function get_current_delivery_step_info($order_id) { - - $process_entry_id = 159; - - $process_instance = GFAPI::get_entry($process_entry_id); - $api = new Gravity_Flow_API($process_instance['form_id']); - - $current_step = $api->get_current_step($process_instance); - - if (!$current_step) { - return null; - } - - $current_step_info = array( - 'step_id' => $current_step->get_id(), - 'process_id' => $process_entry_id, - 'short_desc' => $current_step->get_name(), - 'action_code' => 'manual', - 'status' => $current_step->get_status(), - ); - - $action_form = GFAPI::get_form($current_step->target_form_id); - $has_action_form = $action_form !== false; - $delivery_settings = $action_form ? rgar($action_form, 'wiaas_delivery_process') : array(); - - $customer_allowed_actions = array( 'customer-acceptance', 'validate-questionnaire' ); - - if (! $has_action_form && ! in_array($delivery_settings['delivery_action_code'], $customer_allowed_actions)) { - - return $current_step_info; - } - - $current_step_info['action_code'] = $delivery_settings['delivery_action_code']; - - $current_step_info['actions'] = array(); - - $action_entry_ids = gform_get_meta( - $current_step->get_entry_id(), 'wiaas_delivery_step_' . $current_step->get_id() . '_action_entry_ids' - ); - - if (empty($action_entry_ids)) { - return $current_step_info; - } - - $order = wc_get_order($order_id); - - foreach ($action_entry_ids as $action_entry_id) { - - $action_entry = GFAPI::get_entry($action_entry_id); - - if (is_wp_error($action_entry)) { - - continue; - } - - $action_workflow_api = new Gravity_Flow_API($action_form['id']); - - $action_workflow_api->get_status($action_entry); - - $action_data = self::_collect_validate_questionnaire_action_info($action_form, $action_entry, $order); - - if (! empty($action_data)) { - - $current_step_info['actions'][] = $action_data; - } - } - - return $current_step_info; - } - - /** - * Complete action step - * - * @param int $action_id - */ - public static function complete_action_step($action_id) { - - $action_entry = GFAPI::get_entry($action_id); - - $action_form = GFAPI::get_form($action_entry['form_id']); - - $workflow = new Gravity_Flow_API($action_form['id']); - - $current_step = $workflow->get_current_step($action_entry); - - if ( $current_step ) { - - $assignees = $current_step->get_assignees(); - - foreach ($assignees as $assignee) { - - $current_step->process_assignee_status($assignee, 'complete', $action_form); - } - } - - gravity_flow()->process_workflow($action_form, $action_entry['id']); - } - - - private static function _collect_validate_questionnaire_action_info($action_form, $action_entry, $order) { - - // we need to collect document, bundle id and current status - $bundle_item_id = null; $document_info = array(); $status = null; - - $bundle_field = GFCommon::get_fields_by_type($action_form, 'wiaas_order_bundle')[0]; - - $bundle_item_id = absint(explode('|', $action_entry[$bundle_field->id])[1]); - - $bundle_item = $order->get_item($bundle_item_id); - - $documents = wiaas_get_order_item_documents($bundle_item, 'order_questionaire'); - $document = $documents[0]; - - $action_workflow_api = new Gravity_Flow_API($action_form['id']); - $action_step = $action_workflow_api->get_current_step($action_entry); - $status = 'validated'; - - if (! empty($action_step)) { - - if ($action_step->get_type() === 'approval') { - - $status = 'not-validated'; - } - - if ($action_step->get_type() === 'user_input') { - - $status = 'invalid'; - } - } - - return array( - 'item_id' => $bundle_item_id, - 'order_id' =>$order->get_id(), - 'action_id' => $action_entry['id'], - 'document' => $document, - 'status' => $status - ); - } /** * Automatically create delivery process instance when order is created @@ -319,24 +351,3 @@ class Wiaas_Delivery_Process { } add_action( 'gravityflow_loaded', array('Wiaas_Delivery_Process', 'init') ); - -function wiaas_gform_upload_path() { - - $pathdata = wp_upload_dir(); - - if ( empty( $pathdata['subdir'] ) ) { - $pathdata['path'] = $pathdata['path'] . wiaas_documents_base_dir(); - $pathdata['url'] = $pathdata['url'] . wiaas_documents_base_dir(); - $pathdata['subdir'] = wiaas_documents_base_dir(); - } else { - $new_subdir = wiaas_documents_base_dir() . $pathdata['subdir']; - - $pathdata['path'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['path'] ); - $pathdata['url'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['url'] ); - $pathdata['subdir'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['subdir'] ); - } - - return $pathdata; -} - -add_filter( 'gform_upload_path', 'wiaas_gform_upload_path', 10, 2 ); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php index b13f83b..e1d1683 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php @@ -2,15 +2,14 @@ class Wiaas_Delivery_Process_Action { - public static function init() { + public static function is_action_form($form) { + $delivery_settings = rgar($form, 'wiaas_delivery_process'); + return ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'action'; } - /** - * @param Wiaas_Delivery_Process_Step $step - */ - public static function get_step_action_form(Wiaas_Delivery_Process_Step $step) { + public static function get_process_step_action_form($step) { if (empty($step->target_form_id)) { @@ -19,15 +18,36 @@ class Wiaas_Delivery_Process_Action { $action_form = GFAPI::get_form($step->target_form_id); - if (! $action_form) { - - return null; - } + return $action_form; } - public static function get_step_action_entries(Wiaas_Delivery_Process_Step $step) { + public static function get_process_step_action_form_action_code($step) { - $action_form = self::get_step_action_form($step); + $action_form = self::get_process_step_action_form($step); + + if (empty($action_form)) { + + return 'manual'; + } + + $delivery_settings = rgar($action_form, 'wiaas_delivery_process'); + + return empty($delivery_settings) ? 'manual' : $delivery_settings['delivery_action_code']; + } + + public static function process_step_has_customer_acceptance_action($step) { + + return self::get_process_step_action_form_action_code($step) === 'customer-acceptance'; + } + + public static function process_step_has_customer_validate_questionnaires_action($step) { + + return self::get_process_step_action_form_action_code($step) === 'validate-questionnaire'; + } + + public static function get_process_step_action_entries(Wiaas_Delivery_Process_Step $step) { + + $action_form = self::get_process_step_action_form($step); if (!$action_form) { @@ -35,7 +55,6 @@ class Wiaas_Delivery_Process_Action { } $search_criteria = array( - 'status' => 'active', 'field_filters' => array( array( 'key' => 'wiaas_delivery_process_id', 'value' => $step->get_entry_id() @@ -67,18 +86,210 @@ class Wiaas_Delivery_Process_Action { return $action_forms; } - public static function is_action_form($form) { + public static function complete_action_step($action_id) { - $delivery_settings = rgar($form, 'wiaas_delivery_process'); + $action_entry = GFAPI::get_entry($action_id); - return ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'action'; + $action_form = GFAPI::get_form($action_entry['form_id']); + + $workflow = new Gravity_Flow_API($action_form['id']); + + $current_step = $workflow->get_current_step($action_entry); + + if ( $current_step ) { + + $new_status = $current_step->get_type() === 'approval' ? 'approved' : 'complete'; + + $assignees = $current_step->get_assignees(); + + foreach ($assignees as $assignee) { + + $current_step->process_assignee_status($assignee, $new_status, $action_form); + } + } + + gravity_flow()->process_workflow($action_form, $action_entry['id']); } - public static function get_customer_step_actions(Wiaas_Delivery_Process_Step $step) { + public static function upload_customer_questionnaire($action_entry_id) { + $action_entry = GFAPI::get_entry($action_entry_id); + + $document_field = GFCommon::get_fields_by_type(GFAPI::get_form($action_entry['form_id']), 'wiaas_order_bundle_document')[0]; + + + $new_file = $document_field->get_single_file_value($action_entry['form_id'], 'file'); + + $action_entry[$document_field->id] = $new_file; + + GFAPI::update_entry($action_entry); + } + + public static function get_customer_acceptance_action_data($action_id) { + + $action_entry = GFAPI::get_entry($action_id); + + $action_form = GFAPI::get_form($action_entry['form_id']); + + + $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'fileupload')[0]; + $acceptance_field = GFCommon::get_fields_by_type($action_form, 'radio')[0]; + $decline_reason_field = GFCommon::get_fields_by_type($action_form, 'textarea')[0]; + $expiration_date_field = GFCommon::get_fields_by_type($action_form, 'date')[0]; + + $file_paths = json_decode($action_entry[$acceptance_documents_field->id]); + + $documents = array(); + + foreach ($file_paths as $file_path) { + + $info = pathinfo( $file_path ); + + $documents[] = array( + 'name' => $info['basename'], + 'url' => $acceptance_documents_field->get_download_url( $file_path, true ) + ); + } + + + return array( + 'action_id' => $action_entry['id'], + 'documents' => $documents, + 'expiration' => $action_entry[$expiration_date_field->id], + 'decline_reason' => $action_entry[$decline_reason_field->id], + 'status' => ($action_entry[$acceptance_field->id] === 'accept') ? 1 : -1 + ); + } + + public static function is_customer_acceptance_uploaded($action_id) { + + $action_entry = GFAPI::get_entry($action_id); + $action_form = GFAPI::get_form($action_entry['form_id']); + + + $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'fileupload')[0]; + + return ! empty( $action_entry[$acceptance_documents_field->id]); + } + + public static function update_customer_acceptance_status($action_id, $new_status, $reason) { + + $action_entry = GFAPI::get_entry($action_id); + $action_form = GFAPI::get_form($action_entry['form_id']); + + $acceptance_field = GFCommon::get_fields_by_type($action_form, 'radio')[0]; + $decline_reason_field = GFCommon::get_fields_by_type($action_form, 'textarea')[0]; + + $action_entry[$acceptance_field->id] = $new_status; + $action_entry[$decline_reason_field->id] = $reason; + + GFAPI::update_entry($action_entry); + } + + public static function upload_customer_acceptance_document($action_id) { + + $action_entry = GFAPI::get_entry($action_id); + $action_form = GFAPI::get_form($action_entry['form_id']); + + $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'fileupload')[0]; + + $old_value = $action_entry[$acceptance_documents_field->id]; + + $value = $acceptance_documents_field->get_single_file_value($action_form['id'], 'file'); + + if ($acceptance_documents_field->multipleFiles ) { + + $value = array( $value ); + + $old_value = json_decode( $old_value ); + + if (! empty($old_value)) { + + $old_value = is_array( $old_value ) ? $old_value : array( $old_value ); + + $value = array_merge( $value, $old_value ); + } + + $value = json_encode( $value ); + } + + $action_entry[$acceptance_documents_field->id] = $value; + + $result = GFAPI::update_entry($action_entry); + + return ! is_wp_error($result); + } + + public static function get_customer_validate_questionnaires_action_data($action_id) { + + $action_entry = GFAPI::get_entry($action_id); + + $action_form = GFAPI::get_form($action_entry['form_id']); + + $order_id = $action_entry['wiaas_delivery_order_id']; + $order = wc_get_order($order_id); + + + // we need to collect document, bundle id and current status + $bundle_item_id = null; $status = null; + + $bundle_field = GFCommon::get_fields_by_type($action_form, 'wiaas_order_bundle')[0]; + $bundle_item_id = absint(explode('|', $action_entry[$bundle_field->id])[1]); + + if (empty($bundle_item_id)) { + + return null; + } + $bundle_item = $order->get_item($bundle_item_id); + + $document_field = GFCommon::get_fields_by_type(GFAPI::get_form($action_entry['form_id']), 'wiaas_order_bundle_document')[0]; + $file_path = $action_entry[$document_field->id]; + + $info = pathinfo( $action_entry[$document_field->id] ); + + $document = array( + 'name' => $info['basename'], + 'url' => $document_field->get_download_url( $file_path, true ) + ); + + $discussion_field = GFCommon::get_fields_by_type(GFAPI::get_form($action_entry['form_id']), 'workflow_discussion')[0]; + $discussion_items = json_decode($action_entry[$discussion_field->id], ARRAY_A); + + $formated_comments = array(); + + if (is_array($discussion_items)) { + foreach ($discussion_items as $item) { + + $formated_comments[] = $discussion_field->format_discussion_item( $item, 'text', $action_id ); + } + } + + + $action_workflow_api = new Gravity_Flow_API($action_form['id']); + $action_step = $action_workflow_api->get_current_step($action_entry); + $status = 'validated'; + + if (! empty($action_step)) { + + if ($action_step->get_type() === 'approval') { + + $status = 'not-validated'; + } + + if ($action_step->get_type() === 'user_input') { + + $status = 'invalid'; + } + } + + return array( + 'item_id' => $bundle_item_id, + 'order_id' =>$order->get_id(), + 'action_id' => $action_entry['id'], + 'document' => $document, + 'status' => $status, + 'comments' => $formated_comments + ); } } - - -Wiaas_Delivery_Process_Action::init(); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php index 779fd98..53f5579 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php @@ -27,39 +27,42 @@ class Wiaas_Delivery_Process_Addon extends Gravity_Flow_Extension { public function init() { parent::init(); - - add_action( 'gravityflow_entry_detail', array( $this, 'display_process_steps_details' ), 10, 3 ); - - add_action('gravityflow_title_entry_detail', array( $this, 'process_title' ), 10, 3); - - add_filter( 'gform_upload_path', array( $this, 'post_file_upload' ), 10, 2 ); } public function init_ajax() { parent::init_ajax(); add_action( 'wp_ajax_wiaas_get_action_entry', array( $this, 'ajax_get_action_entry' ) ); + + // this AJAX action is here and not in /admin folder because of Gravity Forms extension logic + add_action( 'wp_ajax_wiaas_delivery_get_form', array( $this, 'ajax_get_form' ) ); } + public function ajax_get_form() { - public function post_file_upload($path_info, $form_id) { + $form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; - $wp_uploads = wp_upload_dir(); + $field_id = sanitize_text_field( rgget( 'field_id' ) ); - if ( empty( $wp_uploads['subdir'] ) ) { - $path_info['path'] = $wp_uploads['path'] . wiaas_documents_base_dir(); - $path_info['url'] = $wp_uploads['url'] . wiaas_documents_base_dir(); - $path_info['subdir'] = wiaas_documents_base_dir(); - } else { - $new_subdir = wiaas_documents_base_dir() . $wp_uploads['subdir']; + $entry_id = absint( rgget( 'entry_id' ) ); - $path_info['path'] = str_replace( $wp_uploads['subdir'], $new_subdir, $wp_uploads['path'] ); - $path_info['url'] = str_replace( $wp_uploads['subdir'], $new_subdir, $wp_uploads['url'] ); - $path_info['subdir'] = str_replace( $wp_uploads['subdir'], $new_subdir, $wp_uploads['subdir'] ); - } + $field_values = array( $field_id => $entry_id ); - error_log($path_info); + gravity_form_enqueue_scripts( $form_id, true ); - return $path_info; + $is_admin = isset( $_GET['is_admin'] ); + if ( $is_admin ) { + wp_enqueue_style( 'common', site_url() . '/wp-admin/css/common.css', array(), $this->_version ); + } else { + wp_enqueue_style( 'common', get_stylesheet_directory_uri() . '/style.css', array(), $this->_version ); + } + + wp_print_styles(); + wp_print_scripts(); + // Render an AJAX-enabled form. + // https://www.gravityhelp.com/documentation/article/embedding-a-form/#function-call + $html = gravity_form( $form_id, true, false, false, $field_values, true, 1, false ); + printf( "
    %s
    ", $html ); + die(); } @@ -125,170 +128,6 @@ class Wiaas_Delivery_Process_Addon extends Gravity_Flow_Extension { return ''; } - public function display_process_steps_details($form, $entry, $current_step) { - - $delivery_settings = rgar($form, 'wiaas_delivery_process'); - - if ($delivery_settings['delivery_form_type'] === 'action') { - return; - } - - $workflow_api = new Gravity_Flow_API($form['id']); - - $steps = $workflow_api->get_steps(); - - foreach ($steps as $index => $step) { - - if (! $step->is_active()) { - continue; - } - - $is_step_running = $step->get_status() === 'pending'; - $is_current_step = $step->get_id() === $current_step->get_id(); - - $disabled_style = $is_step_running ? '' : 'opacity: 0.5'; - - ?> - -
    - -

    - get_name(), 'wiaas') ?> -

    - - target_form_id ); - - if (empty($action_form)) { - - echo '
    '; - - continue; - } - - $action_delivery_settings = rgar($action_form, 'wiaas_delivery_process'); - - ?> - -
    - - - - ' . - ' ' . $action_form['title'] . '', - $form_url ); - - echo $form_link; - } - - echo '


    '; - - $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, $search_criteria, $sorting, $paging ); - - foreach ($entries as $action_entry) { - $this->_display_step_action_entry($action_form, $action_entry); - } - - ?> - -
    - -
    - - - -
    - get_current_step($action_entry); - - - ?> - - - type === 'wiaas_order') { - continue; - } - - if ($field->type === 'workflow_discussion') { - - echo ''; - - continue; - } - - $value = $field->get_value_entry_detail($action_entry[$field->id]); - $label = $field->get_field_label(false, $action_entry[$field->id]); - - echo '' . - '' . - '' . - ''; - } - - if (! empty($current_action_step)) { - - ?> - - - - - - - - -
    ' . $field->get_value_entry_detail($action_entry[$field->id]) . '
    ' . $label . ' : ' . $value . '
    - - View - get_status_label($current_action_step->get_status()) ?> - -
    - -
    - esc_html__( 'Delivery Process', 'wiaas' ), 'fields' => array( array( - 'name' => 'delivery_form_type', + 'name' => 'delivery_process', 'label' => esc_html__( 'Delivery Form Type', 'wiaas' ), - 'type' => 'delivery_form_type', - ), - array( - 'name' => 'delivery_action_code', - 'label' => esc_html__( 'Action code', 'wiaas' ), - 'type' => 'delivery_action_code', - ), - array( - 'name' => 'delivery_action_form_type', - 'label' => esc_html__( 'Automatic?', 'wiaas' ), - 'type' => 'delivery_action_form_automatic', + 'type' => 'delivery_process', ) ) ) ); } - public function settings_delivery_form_type() { + public function settings_delivery_process() { $this->settings_select(array( 'name' => 'delivery_form_type', 'choices' => array( + array( 'value' => 'process', 'label' => 'Process Form' ), array( 'value' => 'action', 'label' => 'Action Form' ), - array( 'value' => 'process', 'label' => 'Process Form' ) ), 'after_select' => '

    Choose if this form will be used as process form or action form.

    ' . '

    Process form defines order delivery process workflow.

    ' . '

    Action form defines custom order data that is collected from delivery process participants.

    ' )); - } - public function settings_delivery_action_code() { - $this->settings_select(array( - 'name' => 'delivery_action_code', - 'choices' => array( - array( 'value' => '', 'label' => 'Select action code ...' ), - array( 'value' => 'customer-acceptance', 'label' => 'Customer acceptance' ), - array( 'value' => 'validate-questionnaire', 'label' => 'Validate Questionnaire' ), - array( 'value' => 'schedule-meeting', 'label' => 'Schedule meeting' ) - ), - 'after_select' => '

    Choose action code for action form.

    ' - )); - } - public function settings_delivery_action_form_automatic() { + ?> +


    + settings_checkbox_and_select(array( - 'checkbox' => array( - 'label' => esc_html__( 'Enable', 'wiaas' ), - 'name' => 'automatic_action_entries_enabled', - 'defeault_value' => '0', - ), - 'select' => array( - 'name' => 'automatic_action_entries_type', + + $settings = $this->get_current_settings(); + + if ($settings['delivery_form_type'] !== 'process') { + + $this->settings_select(array( + 'name' => 'delivery_action_code', 'choices' => array( - array( - 'value' => 'single', - 'label' => esc_html__( 'Single entry', 'wiaas' ), - ), - array( - 'value' => 'bundle', - 'label' => esc_html__( 'Entry per bundle', 'wiaas' ), - ) + array( 'value' => '', 'label' => 'Select action code ...' ), + array( 'value' => 'customer-acceptance', 'label' => 'Customer acceptance' ), + array( 'value' => 'validate-questionnaire', 'label' => 'Validate Questionnaire' ), + array( 'value' => 'schedule-meeting', 'label' => 'Schedule meeting' ) ), - 'after_select' => '

    Automatic entries can be created once per order or per every bundle in order.

    ' . - '

    Automatic entry will not be created if any required field cannot be populated.

    ', - ) + 'after_select' => '

    Choose action code for action form.

    ' + )); + + + $this->settings_checkbox_and_select(array( + 'checkbox' => array( + 'label' => esc_html__( 'Automatic', 'wiaas' ), + 'name' => 'automatic_action_entries_enabled', + 'default_value' => '0', + ), + 'select' => array( + 'name' => 'automatic_action_entries_type', + 'choices' => array( + array( + 'value' => 'single', + 'label' => esc_html__( 'Single entry', 'wiaas' ), + ), + array( + 'value' => 'bundle', + 'label' => esc_html__( 'Entry per bundle', 'wiaas' ), + ) + ), + 'after_select' => '

    Automatic entries can be created once per order or per every bundle in order.

    ' . + '

    Automatic entry will not be created if any required field cannot be populated.

    ', + ) + )); + + return; + } + + + $this->settings_select(array( + 'name' => 'delivery_country', + 'choices' => array( + array( 'value' => 'se', 'label' => 'Sweden' ), + array( 'value' => 'dk', 'label' => 'Denmark' ), + array( 'value' => 'fi', 'label' => 'Finland' ) + ), + 'after_select' => '

    Choose country for which this process is defined.

    ' )); } } \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php index a7f385c..5655d09 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php @@ -79,9 +79,16 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { public function update_step_status($status = false) { - if ($status === 'cancelled') { + if (isset( $_POST['_gravityflow_admin_action'] ) ) { - $status = 'complete'; + $admin_action = rgpost( 'gravityflow_admin_action' ); + + list( $base_admin_action, $action_id ) = rgexplode( '|', $admin_action, 2 ); + + if ($base_admin_action === 'send_to_step' && $this->get_status() === 'pending') { + + $status = 'complete'; + } } parent::update_step_status($status); @@ -262,12 +269,9 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { return $action_entries_ids; } - $new_entry = array_merge($new_entry,array( - 'form_id' => $this->target_form_id, - 'wiaas_delivery_process_id' => $this->get_entry_id(), - 'wiaas_delivery_order_id' => $order_id, - 'wiaas_delivery_step_name' => $this->get_name(), - )); + $new_entry['form_id'] = $target_form['id']; + $new_entry['wiaas_delivery_process_id'] = $this->get_entry_id(); + $new_entry['wiaas_delivery_order_id'] = $order_id; $entry_id = GFAPI::add_entry( $new_entry ); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php index 013c4df..84ddeb5 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php @@ -28,30 +28,33 @@ class Wiaas_Field_Order_Bundle_Select extends GF_Field_Select { return $this->get_selected_bundle_display_name($value); } - public function get_field_input( $form, $value = '', $entry = null ) { - - $this->choices = array(); - - $order_id = null; - - if (! empty($entry)) { - - $order_field = GFCommon::get_fields_by_type($form, array( 'wiaas_order' ) )[0]; - - $order_id = ! empty($order_field) ? $entry[$order_field->id] : null; - - } else if( ! empty($value)) { - - list ($order_id, $item_id) = explode('|', $value); - } - - if (! empty($order_id)) { - - $this->choices = $this->get_selected_bundle_display_name($order_id); - } - - return parent::get_field_input( $form, $value, $entry ); - } +// public function get_field_input( $form, $value = '', $entry = null ) { +// +// $this->choices = array(); +// +// $order_id = null; +// +// if (! empty($entry)) { +// +// $order_field = GFCommon::get_fields_by_type($form, array( 'wiaas_order' ) )[0]; +// +// $order_id = ! empty($order_field) ? $entry[$order_field->id] : null; +// +// } else if( ! empty($value)) { +// +// list ($order_id, $item_id) = explode('|', $value); +// } else { +// +// $order_id = absint(rgget('order_id')); +// } +// +// if (! empty($order_id)) { +// +// $this->choices = $this->get_selected_bundle_display_name($order_id); +// } +// +// return parent::get_field_input( $form, $value, $entry ); +// } /** diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php index 7874e74..170e576 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php @@ -65,13 +65,14 @@ class Wiaas_Order_Fields { public static function map_order_to_entry($order_id, $form, $bundle_item_id = null) { - if (empty($form['fields']) || empty(GFCommon::get_fields_by_type( $form, array('wiaas_order')) ) ) { // form does not have order field so cannot be mapped return false; } + error_log(json_encode('here')); + $order = wc_get_order($order_id); $bundle_item = $order->get_item($bundle_item_id); diff --git a/frontend/src/actions/dashboard/nextActionsActions.js b/frontend/src/actions/dashboard/nextActionsActions.js index cfaff25..9c3ce11 100644 --- a/frontend/src/actions/dashboard/nextActionsActions.js +++ b/frontend/src/actions/dashboard/nextActionsActions.js @@ -19,7 +19,7 @@ export const fetchNextActions = () => { return dispatch => { dispatch(requestNextActions()); return client.fetch({ - url: `${API_SERVER}/wp-json/wiaas/next-delivery-steps` + url: `${API_SERVER}/wp-json/wiaas/delivery/next-actions` }) .then(response => dispatch(recieveNextActions(response.data))) .catch(error => { diff --git a/frontend/src/actions/orders/customerAcceptanceActions.js b/frontend/src/actions/orders/customerAcceptanceActions.js index 642a22d..7fec4e1 100644 --- a/frontend/src/actions/orders/customerAcceptanceActions.js +++ b/frontend/src/actions/orders/customerAcceptanceActions.js @@ -23,11 +23,11 @@ const recieveCustomerAcceptance = (json) => ({ customerAcceptance: json }); -export const fetchCustomerAcceptance = (idEntry) => { +export const fetchCustomerAcceptance = (idOrder) => { return dispatch => { dispatch(requestCustomerAcceptance()); return htmlClient.fetch({ - url: `${API_SERVER}/wp-json/wiaas/customer-acceptance/${idEntry}`, + url: `${API_SERVER}/wp-json/wiaas/delivery/${idOrder}/customer-acceptance`, method: 'get' }) .then(response => { @@ -45,15 +45,15 @@ const uploadAcceptanceAction = () => ({ type: UPLOAD_CUSTOMER_ACCEPTANCE }); -export const uploadAcceptance = (idEntry, file) => { +export const uploadAcceptance = (idOrder, file) => { return dispatch => { dispatch(uploadAcceptanceAction()); return htmlClient.uploadFile(file, { - url: `${API_SERVER}/wp-json/wiaas/customer-acceptance/${idEntry}/upload-file` + url: `${API_SERVER}/wp-json/wiaas/delivery/${idOrder}/customer-acceptance/upload` }).then(response => { if (typeof response.data !== 'undefined') { dispatch(updateMessages(response.data.messages, orderMessages)); - dispatch(fetchCustomerAcceptance(idEntry)); + dispatch(fetchCustomerAcceptance(idOrder)); } }).catch(error => { htmlClient.onError(error, dispatch); @@ -71,21 +71,21 @@ const sendCustomerAcceptance = () => ({ type: SEND_CUSTOMER_ACCEPTANCE }); -export const acceptDeclineInstallation = (idEntry, actionType, declineReason) => { +export const acceptDeclineInstallation = (idOrder, actionType, declineReason) => { return dispatch => { dispatch(sendCustomerAcceptance()); return htmlClient.fetch({ - url: `${API_SERVER}/wp-json/wiaas/customer-acceptance/${idEntry}`, + url: `${API_SERVER}/wp-json/wiaas/delivery/${idOrder}/customer-acceptance`, method: 'post', data: { - actionType, - declineReason + 'action_type': actionType, + 'decline_reason': declineReason } }) .then(response => { if (response.data) { dispatch(updateMessages(response.data.messages, orderMessages)); - dispatch(fetchCustomerAcceptance(idEntry)); + dispatch(fetchCustomerAcceptance(idOrder)); } }) .catch(error => { diff --git a/frontend/src/actions/orders/customerQuestionnairesActions.js b/frontend/src/actions/orders/customerQuestionnairesActions.js index 6fe111f..5a86e86 100644 --- a/frontend/src/actions/orders/customerQuestionnairesActions.js +++ b/frontend/src/actions/orders/customerQuestionnairesActions.js @@ -36,7 +36,7 @@ export const fetchCustomerQuestionnaires = (idOrder) => { return dispatch => { dispatch(requestCustomerQuestionnaires()); return htmlClient.fetch({ - url: `${API_SERVER}/wp-json/wiaas/customer-questionnaires/${idOrder}`, + url: `${API_SERVER}/wp-json/wiaas/delivery/${idOrder}/customer-questionnaires`, method: 'get' }) .then(response => { @@ -55,7 +55,7 @@ export const uploadCustomerQuestionnaire = (orderId, actionId, file) => { return dispatch => { dispatch(uploadCustomerQuestionnaireAction()); return htmlClient.uploadFile(file, { - url: `${API_SERVER}/wp-json/wiaas/customer-questionnaires/${orderId}/upload/${actionId}`, + url: `${API_SERVER}/wp-json/wiaas/delivery/${orderId}/customer-questionnaires/upload/${actionId}`, }).then(response => { if (typeof response.data !== 'undefined') { dispatch(updateMessages(response.data.messages, orderMessages)); diff --git a/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx b/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx index 4d12479..300e20c 100644 --- a/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx +++ b/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx @@ -31,10 +31,10 @@ class CustomerAcceptance extends Component { fileHandler.download(fileUrl, fileName); } - uploadFile(idEntry, acceptedFiles, rejectedFiles) { + uploadFile(idOrder, acceptedFiles, rejectedFiles) { if(acceptedFiles && acceptedFiles.length){ const file = acceptedFiles[0]; - this.props.dispatch(uploadAcceptance(idEntry, file)); + this.props.dispatch(uploadAcceptance(idOrder, file)); } if(rejectedFiles && rejectedFiles.length) { @@ -59,9 +59,9 @@ class CustomerAcceptance extends Component { } acceptDeclineInstallation() { - const {idProcess} = this.props.step; + const {idOrder} = this.props.step; const {actionType, reason} = this.state; - this.props.dispatch(acceptDeclineInstallation(idProcess, actionType, reason)); + this.props.dispatch(acceptDeclineInstallation(idOrder, actionType, reason)); this.setState({reason: ''}); } @@ -107,8 +107,8 @@ class CustomerAcceptance extends Component { } componentDidMount(){ - const {idProcess} = this.props.step; - this.props.dispatch(fetchCustomerAcceptance(idProcess)); + const {idOrder} = this.props.step; + this.props.dispatch(fetchCustomerAcceptance(idOrder)); } render() { @@ -137,7 +137,7 @@ class CustomerAcceptance extends Component { multiple={false} accept=".pdf,.docx,.doc,.xlsx,.xls,.odt,.ods,.jpg,.png,.jpeg" activeClassName="upload-file-accept" - onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(step.idProcess, acceptedFiles, rejectedFiles)}}> + onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(step.idOrder, acceptedFiles, rejectedFiles)}}>
    {orderTexts.labels.UPLOAD_ACCEPTANCE_LABEL}
    @@ -148,7 +148,7 @@ class CustomerAcceptance extends Component { { customerAcceptance.documents.map((document, index) =>
    - {document.name} ({document.extension}) + {document.name} {document.validation}
    diff --git a/frontend/src/containers/orders/components/process/ValidateQuestionnaire.jsx b/frontend/src/containers/orders/components/process/ValidateQuestionnaire.jsx index 29e09a3..63324b2 100644 --- a/frontend/src/containers/orders/components/process/ValidateQuestionnaire.jsx +++ b/frontend/src/containers/orders/components/process/ValidateQuestionnaire.jsx @@ -23,8 +23,8 @@ class ValidateQuestionnaire extends Component { return (
    { - customerQuestionnaires && customerQuestionnaires.actions && - customerQuestionnaires.actions.map((customerQuestionnaryAction) => + customerQuestionnaires && + customerQuestionnaires.map((customerQuestionnaryAction) =>
    - {this.downloadDocument(document)}}> - {document.version} + + {document.name}
    @@ -60,8 +59,7 @@ class ValidateQuestionnaireItem extends Component { (action.comments && action.comments.length > 0) &&
    {action.comments.map((comment, key) =>
    -
    {comment.user} - {comment.addDate}
    -
    {comment.comment}
    +
    {comment}
    )}
    } @@ -80,9 +78,8 @@ class ValidateQuestionnaireItem extends Component { :
    - {this.downloadDocument(document)}}> - {document.version} + + {document.name}
    diff --git a/frontend/src/helpers/OrderHelper.js b/frontend/src/helpers/OrderHelper.js index 1b585c3..409405d 100644 --- a/frontend/src/helpers/OrderHelper.js +++ b/frontend/src/helpers/OrderHelper.js @@ -11,10 +11,15 @@ function formatAddress(addressObject) { } export const fromWCOrder = (WCOrder) => { - let processInfo = Object.assign({},WCOrder['delivery-process']); - if (WCOrder['delivery-process']){ + let processInfo = undefined; + + if (WCOrder['delivery-process']) { + + processInfo = Object.assign({},WCOrder['delivery-process']); processInfo.steps = WCOrder['delivery-process'].steps.map(step=>fromWiaasProcessStep(step)); + } + return { id: WCOrder.id, number: WCOrder.number, From 3d16d5027bf733e087745ba5bf83eed2f20ec041 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Thu, 1 Nov 2018 10:43:15 +0100 Subject: [PATCH 03/14] Handle process visualization and going from one step to another --- .../class-wiaas-admin-delivery-process.php | 55 +- .../wiaas/includes/class-wiaas-db-update.php | 3 +- .../includes/class-wiaas-delivery-process.php | 101 ++-- .../delivery-forms/delivery-action-forms.json | 1 + ...elivery-process-normal-delivery-form.json} | 269 ++++++--- ...ivery_action_customer_acceptance_form.json | 524 ------------------ .../delivery_action_manual_form.json | 252 --------- .../delivery_action_schedule_meeting.json | 406 -------------- ...ry_action_validate_questionnaire_form.json | 264 --------- .../db-updates/wiaas-db-update-general.php | 67 +-- .../class-wiaas-date-list-field.php | 38 -- .../class-wiaas-delivery-process-addon.php | 108 +++- .../class-wiaas-delivery-process-step.php | 105 ++-- ...lass-wiaas-field-order-bundle-document.php | 4 + ...lass-wiaas-field-order-supplier-select.php | 11 +- .../class-wiaas-order-fields.php | 11 +- .../document/class-wiaas-document-upload.php | 2 +- .../includes/order/wiaas-order-functions.php | 6 +- .../user/wiaas-organization-functions.php | 7 + 19 files changed, 448 insertions(+), 1786 deletions(-) create mode 100644 backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json rename backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/{delivery_process_normal_delivery_form.json => delivery-process-normal-delivery-form.json} (56%) delete mode 100644 backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_customer_acceptance_form.json delete mode 100644 backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_manual_form.json delete mode 100644 backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_schedule_meeting.json delete mode 100644 backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_validate_questionnaire_form.json delete mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-date-list-field.php diff --git a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php index 582eab6..db0f925 100644 --- a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php @@ -43,18 +43,23 @@ class Wiaas_Admin_Delivery_Process { continue; } - $is_step_running = $step->get_status() === 'pending'; - $is_step_completed = $step->get_status() === 'complete'; - $is_current_step = $step->get_id() === $current_step->get_id(); + $is_step_completed = $step->get_status() === 'complete' || $step->get_status() === 'approved'; + $is_current_step = $current_step && $step->get_id() === $current_step->get_id(); - //$disabled_style = $is_step_running ? '' : 'opacity: 0.5'; - $completed_style = $is_step_completed ? 'border-left: 4px solid #46b450;' : ''; + 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') ?>

    @@ -163,28 +168,38 @@ class Wiaas_Admin_Delivery_Process { $label = $field->get_field_label(false, $action_entry[$field->id]); echo '' . - '
    ' . $label . ' :
    ' . + '' . $label . ' : ' . '' . $value . '' . ''; } - if (! empty($current_action_step)) { + ?> - ?> + + + + - - - - - get_name() . ' ' . $current_action_step->get_status_label($current_action_step->get_status()) ?> - - - - + get_status_label($current_action_step->get_status()) . ': ' . $current_action_step->get_name(); + echo '' . + ' ' . + ''; + + } else { + echo $workflow_api->get_status($action_entry); + } + ?> + + + + + + + diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php index 4d57c07..5368ef7 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php @@ -6,7 +6,6 @@ class Wiaas_DB_Update { private static $db_updates = array( '20180801222206' => 'wiaas_db_update_setup_gravity', - '20180802222206' => 'wiaas_db_update_add_delivery_process_forms', '20180811134511' => 'wiaas_db_update_enable_orders_access_management', '20180911101010' => 'wiaas_db_setup_exclusive_taxonomies', '20181003164100' => 'wiaas_db_setup_customer_capabilities', @@ -22,7 +21,7 @@ class Wiaas_DB_Update { '20191019014550' => 'wiaas_db_update_add_general_ui_fields', '20191019014650' => 'wiaas_db_update_add_product_properties_ui_fields', '20181019064450' => 'wiaas_db_update_add_bundle_properties_ui_field', - '20191020014650' => 'wiaas_create_organization_roles_capabilities' + '20191020014650' => 'wiaas_create_organization_roles_capabilities', ); public static function execute() { 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 f5d6dce..ddec2e9 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php @@ -11,21 +11,22 @@ defined( 'ABSPATH' ) || exit; class Wiaas_Delivery_Process { public static function init() { - self::_register_delivery_process_step_type(); + self::_register_delivery_process(); self::_init_hooks(); } private static function _init_hooks() { - add_action('woocommerce_new_order', array( __CLASS__, 'create_delivery_process_for_order' )); - // add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_order'), 10, 3 ); + add_action( 'gravityflow_workflow_complete', array(__CLASS__, 'maybe_complete_parent_order'), 10, 2 ); } /** - * Registers our Delivery Process Step Type as available Gravity Flow Step Type + * + * Registers our Delivery Process Addons + * */ - private static function _register_delivery_process_step_type() { + private static function _register_delivery_process() { require_once( 'delivery-process/class-wiaas-delivery-process-step.php' ); require_once( 'delivery-process/class-wiaas-delivery-process-addon.php' ); @@ -39,9 +40,6 @@ class Wiaas_Delivery_Process { require_once( 'delivery-process/class-wiaas-field-order-supplier-select.php' ); require_once( 'delivery-process/class-wiaas-field-order-bundle-document.php' ); - - require_once( 'delivery-process/class-wiaas-date-list-field.php' ); - Gravity_Flow_Steps::register( new Wiaas_Delivery_Process_Step() ); GFAddOn::register( 'Wiaas_Delivery_Process_Addon' ); @@ -55,7 +53,8 @@ class Wiaas_Delivery_Process { public static function maybe_complete_parent_order($entry_id, $form) { $entry = GFAPI::get_entry($entry_id); - $order_id = $entry['wiaas_delivery_order_id']; + $order_field = GFCommon::get_fields_by_type($form, 'wiaas_order')[0]; + $order_id = empty($order_field) ? null : absint($entry[$order_field->id]); if (!isset($order_id)) { return; @@ -277,17 +276,7 @@ class Wiaas_Delivery_Process { continue; } - $action_code = 'manual'; - $action_form = GFAPI::get_form($step->target_form_id); - $has_action_form = $action_form !== false; - - if ($has_action_form) { - - $delivery_settings = rgar($action_form, 'wiaas_delivery_process'); - - $action_code = empty($delivery_settings['delivery_action_code']) ? 'manual' : $delivery_settings['delivery_action_code']; - } - + $action_code = Wiaas_Delivery_Process_Action::get_process_step_action_form_action_code($step); $info = $step->get_feed_meta(); $status = $step->get_status(); @@ -310,44 +299,40 @@ class Wiaas_Delivery_Process { return $delivery_process; } - - - /** - * Automatically create delivery process instance when order is created - * @param $order_id - */ - public static function create_delivery_process_for_order($order_id) { - $process_form = null; - - $forms = GFAPI::get_forms(); - foreach ( $forms as $form ) { - $delivery_settings = rgar($form, 'wiaas_delivery_process'); - if ( ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'process'){ - $process_form = $form; - - break; - } - } - - if (empty($process_form)) { - - return; - } - - $order = wc_get_order( $order_id ); - $order_field = GFCommon::get_fields_by_type($form, 'wiaas_order')[0]; - $order_field_id = $order_field->id; - - $new_process_entry = array( - 'form_id' => $process_form->id, - "$order_field_id" => $order_id, - 'wiaas_delivery_order_id' => $order_id, - ); - $process_entry_id = GFAPI::add_entry( $new_process_entry ); - - add_post_meta($order_id, 'wiaas_delivery_process_id', $process_form->id); - add_post_meta($order_id, 'wiaas_delivery_process_entry_id', $process_entry_id); - } } add_action( 'gravityflow_loaded', array('Wiaas_Delivery_Process', 'init') ); + + +add_filter( 'gform_notification', 'rw_notification_attachments', 10, 3 ); +function rw_notification_attachments( $notification, $form, $entry ) { + + $fileupload_fields = GFAPI::get_fields_by_type( $form, array( 'fileupload' ) , true); + + if ( ! is_array( $fileupload_fields ) ) { + return $notification; + } + + $notification['attachments'] = rgar( $notification, 'attachments', array() ); + $upload_root = RGFormsModel::get_upload_root(); + + foreach( $fileupload_fields as $field ) { + + $url = rgar( $entry, $field->id ); + + if ( empty( $url ) ) { + continue; + } elseif ( $field->multipleFiles ) { + $uploaded_files = json_decode( stripslashes( $url ), true ); + foreach ( $uploaded_files as $uploaded_file ) { + $attachment = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $uploaded_file ); + $notification['attachments'][] = $attachment; + } + } else { + $attachment = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $url ); + $notification['attachments'][] = $attachment; + } + } + + return $notification; +} diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json new file mode 100644 index 0000000..593b25c --- /dev/null +++ b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json @@ -0,0 +1 @@ +{"0":{"title":"ACTION: Supplier Configuration Approval","description":"Bundle configuration for supplier.","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","allowsPrepopulate":true,"id":3,"label":"Order","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"administrative","inputs":null,"formId":"11","description":"","inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_supplier","id":7,"label":"Supplier","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"11","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_bundle","id":8,"label":"Bundle","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"11","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"fileupload","id":10,"label":"File","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"11","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","displayOnly":"","enablePrice":""},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"config","id":9,"label":"Config Document","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"11","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":"11","useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"gravityflowparentchild":{"parent_form_1":"0","parent_form_3":"0","parent_form_4":"0","parent_form_5":"1","parent_form_6":"0","parent_form_7":"0","parent_form_11":"0","parent_form_12":"0"},"wiaas_delivery":{"wiaas_delivery_form_type":"step","wiaas_order_mappings":{"3":"","4":"","5":"","6":""}},"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"","automatic_action_entries_enabled":"0","automatic_action_entries_type":"single"},"is_active":"1","date_created":"2018-10-27 22:13:02","is_trash":"0","notifications":[{"id":"5bd4e2eeaef5b","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"confirmations":[{"id":"5bd4e2eeaf4c1","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"feeds":{"gravityflow":[{"id":"28","form_id":"11","is_active":"1","feed_order":"0","meta":{"step_name":"Approve Supplier Configuration","description":"Supplier must review and approve configuration","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|supplier"],"routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"1","instructionsValue":"Instructions<\/strong>: please review the values in the fields below and click on the Approve<\/span><\/strong> or Reject<\/span><\/strong> button\r\n\r\n ","display_fields_mode":"all_fields","assignee_notification_enabled":"1","assignee_notification_from_name":"Wiaas","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"Approve Configuration","assignee_notification_message":"A new entry is pending your approval. Please check your Workflow Inbox.\r\n\r\n \r\n\r\n{workflow_entry_link}\r\n\r\n{all_fields}\r\n\r\n ","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"1","rejection_notification_type":"select","rejection_notification_users":["role|administrator"],"rejection_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"{Supplier:5}","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"1","approval_notification_type":"select","approval_notification_users":["role|administrator"],"approval_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"{Supplier:5}","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"{Order:3} : Supplier approved configuration for {Bundle:6}","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"40","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"40","destination_approved":"complete"},"addon_slug":"gravityflow","event_type":null},{"id":"40","form_id":"11","is_active":"1","feed_order":"0","meta":{"step_name":"Update Rejected Supplier Configuration","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"editable_fields":["9"],"routing":"","assignee_policy":"any","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"{Supplier:7}","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"{workflow_entry_url}\r\n\r\n{workflow_entry_url}\r\n\r\n \r\n\r\n ","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"28"},"addon_slug":"gravityflow","event_type":null}]}},"1":{"title":"ACTION: Validate Customer Questionnaire","description":"Bundle configuration for supplier.","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":12,"label":"Order Number","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"0","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_bundle","id":13,"label":"Bundle","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"bundle_id","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","failed_validation":"","productField":"","displayOnly":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"enablePrice":""},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"order_questionaire","id":17,"label":"Questionnaire Document","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"workflow_discussion","id":9,"label":"Notes","adminLabel":"","isRequired":false,"size":"small","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","form_id":"","useRichTextEditor":false,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":"12","useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"gravityflowparentchild":{"parent_form_1":"0","parent_form_3":"0","parent_form_4":"0","parent_form_5":"1","parent_form_6":"0","parent_form_7":"0","parent_form_11":"0","parent_form_12":"0"},"wiaas_delivery":{"delivery_form_type":"action","automatic_step_entries_enabled":"1","automatic_action_entries_type":"bundle"},"is_active":"1","date_created":"2018-10-28 15:09:59","is_trash":"0","wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"validate-questionnaire","automatic_action_entries_enabled":"1","automatic_action_entries_type":"bundle"},"confirmations":[{"id":"5bd4e2eeaf4c1","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd4e2eeaef5b","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"27","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Approve configuration info","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":{"conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"12","operator":"isnot","value":"0"}]}},"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"1","instructionsValue":"Review customer configuration {Questionnaire Document:17} for {Bundle:13}","display_fields_mode":"selected_fields","display_fields_selected":["13","17","9"],"assignee_notification_enabled":"1","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry is pending your approval. Please check your Workflow Inbox.\r\n\r\n{all_fields}\r\n\r\n \r\n\r\n{workflow_entry_link}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"1","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"Wiaas","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"{Order:3} : Bundle questionnaire has been rejected {Bundle:6}","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"1","approval_notification_type":"select","approval_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"Wiaas","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"{Order:3} : Bundle questionnaire has been approved","approval_notification_message":" \r\n\r\n{all_fields}\r\n\r\nEntry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"29","note_mode":"hidden","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"44","destination_approved":"complete"},"addon_slug":"gravityflow","event_type":null},{"id":"44","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Add reject reason","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"editable_fields":["9"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry requires your input.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"29","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Update bundle configuration","description":"Since administrator rejected questionnaire provided by customer, he needs to update it and upload it again.","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|customer"],"editable_fields":["17","9"],"routing":"","assignee_policy":"any","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"1","instructionsValue":"Please download and update questionnaire.","display_fields_mode":"selected_fields","display_fields_selected":["12","13","17","9"],"default_status":"submit_buttons","note_mode":"hidden","assignee_notification_enabled":"1","assignee_notification_from_name":"Wiaas","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order:3}: Questionnaire rejected for {Bundle:6}","assignee_notification_message":"A new entry requires your input.\r\n\r\n{workflow_entry_link}\r\n\r\n{all_fields}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"1","complete_notification_type":"select","complete_notification_users":["role|administrator"],"complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"{user:display_name}","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"{Order:3}: Questionnaire updated for {Bundle:6}","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"1","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"27"},"addon_slug":"gravityflow","event_type":null}]}},"2":{"title":"ACTION: Complete Installation And Upload Test Protocol","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order ID","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_supplier","id":4,"label":"Installation Company","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"fileupload","id":6,"label":"Installation protocol","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":14,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery":{"wiaas_delivery_form_type":"step"},"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"","automatic_action_entries_enabled":"1","automatic_action_entries_type":"single"},"notifications":[{"id":"5bd66ca932e4a","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"confirmations":[{"id":"5bd66ca93384b","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"feeds":{"gravityflow":[{"id":"34","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Installation completed confirmation","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|supplier"],"routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"1","assignee_notification_from_name":"Wiaas","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"Confirm if installation is completed.\r\n\r\n{workflow_entry_link}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"35","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"complete","destination_approved":"35"},"addon_slug":"gravityflow","event_type":null},{"id":"35","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Upload installation protocol","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|supplier"],"editable_fields":["6"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"1","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"Wiaas","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"Upload installation test protocol for {Order ID:1}","assignee_notification_message":"A new entry requires your input.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"1","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"complete"},"addon_slug":"gravityflow","event_type":null}]}},"3":{"title":"ACTION: Customer Acceptance","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order Number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"fileupload","id":2,"label":"Acceptance Document","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":true,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"date","id":6,"label":"Expiration Date","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"dateType":"datepicker","calendarIconType":"none","formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","calendarIconUrl":"","dateFormat":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":""},{"type":"radio","id":4,"label":"Acceptance","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"choices":[{"text":"Not Accepted","value":"pending","isSelected":false,"price":""},{"text":"Accepted","value":"accept","isSelected":false,"price":""},{"text":"Declined","value":"decline","isSelected":false,"price":""}],"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","conditionalLogic":"","productField":"","enableOtherChoice":"","enablePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"enableChoiceValue":true,"displayOnly":""},{"type":"textarea","id":3,"label":"Decline Reason","adminLabel":"","isRequired":false,"size":"small","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_decline_reason","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"4","operator":"is","value":"decline"}]},"productField":"","form_id":"","useRichTextEditor":false,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":16,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"customer-acceptance","automatic_action_entries_enabled":"1","automatic_action_entries_type":"single"},"confirmations":[{"id":"5bd8668e50997","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd8668e50471","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"41","form_id":"16","is_active":"1","feed_order":"0","meta":{"step_name":"Upload Acceptance Document","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","schedule_date_field":"6","type":"select","assignees":["role|customer"],"editable_fields":["2"],"routing":"","assignee_policy":"all","conditional_logic_editable_fields_enabled":"1","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry requires your input.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","expiration_date_field":"6","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"43","form_id":"16","is_active":"1","feed_order":"0","meta":{"step_name":"Accept installation","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","schedule_date_field":"6","type":"select","assignees":["role|customer"],"routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"0","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry is pending your approval. Please check your Workflow Inbox.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"41","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","expiration_date_field":"6","status_expiration":"rejected","destination_expired":"next","destination_rejected":"41","destination_approved":"complete"},"addon_slug":"gravityflow","event_type":null}]}},"version":"2.3.2"} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_process_normal_delivery_form.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-normal-delivery-form.json similarity index 56% rename from backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_process_normal_delivery_form.json rename to backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-normal-delivery-form.json index 7258d6f..d1685a1 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_process_normal_delivery_form.json +++ b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-normal-delivery-form.json @@ -11,19 +11,18 @@ }, "fields": [ { - "type": "number", - "id": 1, - "label": "order-id", - "adminLabel": "order-id", + "type": "wiaas_order", + "id": 3, + "label": "Order", + "adminLabel": "", "isRequired": false, "size": "medium", "errorMessage": "", "visibility": "visible", "inputs": null, - "numberFormat": "decimal_dot", "formId": 5, "description": "", - "allowsPrepopulate": true, + "allowsPrepopulate": false, "inputMask": false, "inputMaskValue": "", "inputType": "", @@ -32,12 +31,13 @@ "subLabelPlacement": "", "placeholder": "", "cssClass": "", - "inputName": "order-id", + "inputName": "", "noDuplicates": false, "defaultValue": "", "choices": "", "conditionalLogic": "", "enableCalculation": false, + "numberFormat": "decimal_dot", "rangeMin": "", "rangeMax": "", "productField": "", @@ -50,58 +50,9 @@ "useRichTextEditor": false, "displayOnly": "", "enablePrice": "" - }, - { - "type": "workflow_user", - "id": 2, - "label": "customer-id", - "adminLabel": "customer-id", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "choices": [ - { - "value": 2, - "text": "Customer Wiaas" - }, - { - "value": 1, - "text": "wpUser" - } - ], - "formId": 5, - "description": "", - "allowsPrepopulate": true, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "customer-id", - "noDuplicates": false, - "defaultValue": "", - "conditionalLogic": "", - "failed_validation": "", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "", - "enablePrice": "", - "gravityflowUsersRoleFilter": "" } ], - "version": "2.3.2.6", + "version": "2.3.2", "id": 5, "useCurrentUserAsAuthor": true, "postContentTemplateEnabled": false, @@ -112,20 +63,8 @@ "pagination": null, "firstPageCssClass": null, "is_active": "1", - "date_created": "2018-08-09 15:36:00", + "date_created": "2018-10-24 18:12:10", "is_trash": "0", - "confirmations": [ - { - "id": "5b5f7ae4bb79e", - "name": "Default Confirmation", - "isDefault": true, - "type": "message", - "message": "Thanks for contacting us! We will get in touch with you shortly.", - "url": "", - "pageId": "", - "queryString": "" - } - ], "notifications": [ { "id": "5b5f7ae4baced", @@ -138,6 +77,24 @@ "isActive": false } ], + "confirmations": [ + { + "id": "5b5f7ae4bb79e", + "name": "Default Confirmation", + "isDefault": true, + "type": "message", + "message": "Thanks for contacting us! We will get in touch with you shortly.", + "url": "", + "pageId": "", + "queryString": "" + } + ], + "wiaas_delivery_process": { + "delivery_form_type": "process", + "delivery_action_code": "", + "automatic_action_entries_enabled": "0", + "automatic_action_entries_type": "single" + }, "feeds": { "gravityflow": [ { @@ -147,7 +104,7 @@ "feed_order": "0", "meta": { "step_name": "Validate customer configuration information", - "description": "Validate customer configuration information", + "description": "Review configuration documents uploaded by customer during order creation process.\r\nApprove or reject each document.", "step_type": "wiaas_delivery_step", "step_highlight": "0", "step_highlight_type": "color", @@ -162,11 +119,41 @@ "schedule_date_field_offset": "0", "schedule_date_field_offset_unit": "hours", "schedule_date_field_before_after": "after", + "instructionsEnable": "1", + "instructionsValue": "Review configuration documents uploaded by customer during order creation process.\u00a0 Approve or reject each document.", + "is_visible_to_customer": "1", + "target_form_id": "12", + "destination_complete": "next" + }, + "addon_slug": "gravityflow", + "event_type": null + }, + { + "id": "26", + "form_id": "5", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Procure components", + "description": "", + "step_type": "wiaas_delivery_step", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#c7e8d6", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", "instructionsEnable": "0", "instructionsValue": "", - "target_form_id": 3, - "store_new_entry_idEnable": "1", - "new_entry_id_field": "6", + "is_visible_to_customer": "0", + "target_form_id": "11", "destination_complete": "next" }, "addon_slug": "gravityflow", @@ -196,9 +183,8 @@ "schedule_date_field_before_after": "after", "instructionsEnable": "0", "instructionsValue": "", - "target_form_id": 4, - "store_new_entry_idEnable": "0", - "new_entry_id_field": "", + "is_visible_to_customer": "1", + "target_form_id": "", "destination_complete": "next" }, "addon_slug": "gravityflow", @@ -228,9 +214,8 @@ "schedule_date_field_before_after": "after", "instructionsEnable": "0", "instructionsValue": "", - "target_form_id": 4, - "store_new_entry_idEnable": "0", - "new_entry_id_field": "", + "is_visible_to_customer": "1", + "target_form_id": "14", "destination_complete": "next" }, "addon_slug": "gravityflow", @@ -258,9 +243,10 @@ "schedule_date_field_offset": "0", "schedule_date_field_offset_unit": "hours", "schedule_date_field_before_after": "after", - "target_form_id": 1, - "store_new_entry_idEnable": "1", - "new_entry_id_field": "7", + "instructionsEnable": "0", + "instructionsValue": "", + "is_visible_to_customer": "1", + "target_form_id": "16", "destination_complete": "next" }, "addon_slug": "gravityflow", @@ -290,11 +276,9 @@ "schedule_date_field_before_after": "after", "instructionsEnable": "0", "instructionsValue": "", - "target_form_id": 4, - "store_new_entry_idEnable": "0", - "new_entry_id_field": "", - "destination_complete": "next", - "feedName": " - Copy 1" + "is_visible_to_customer": "1", + "target_form_id": "", + "destination_complete": "next" }, "addon_slug": "gravityflow", "event_type": null @@ -323,13 +307,116 @@ "schedule_date_field_before_after": "after", "instructionsEnable": "0", "instructionsValue": "", - "target_form_id": 4, - "store_new_entry_idEnable": "0", - "new_entry_id_field": "", + "is_visible_to_customer": "1", + "target_form_id": "", "destination_complete": "next" }, "addon_slug": "gravityflow", "event_type": null + }, + { + "id": "36", + "form_id": "5", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Complete delivery", + "description": "", + "step_type": "approval", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "type": "select", + "assignees": [ + "role|administrator" + ], + "routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "assignee_policy": "all", + "instructionsEnable": "0", + "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", + "display_fields_mode": "all_fields", + "assignee_notification_enabled": "0", + "assignee_notification_from_name": "", + "assignee_notification_from_email": "{admin_email}", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "", + "assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "rejection_notification_enabled": "0", + "rejection_notification_type": "select", + "rejection_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "rejection_notification_from_name": "", + "rejection_notification_from_email": "{admin_email}", + "rejection_notification_reply_to": "", + "rejection_notification_bcc": "", + "rejection_notification_subject": "", + "rejection_notification_message": "Entry {entry_id} has been rejected", + "rejection_notification_disable_autoformat": "0", + "approval_notification_enabled": "0", + "approval_notification_type": "select", + "approval_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "approval_notification_from_name": "", + "approval_notification_from_email": "{admin_email}", + "approval_notification_reply_to": "", + "approval_notification_bcc": "", + "approval_notification_subject": "", + "approval_notification_message": "Entry {entry_id} has been approved", + "approval_notification_disable_autoformat": "0", + "note_mode": "not_required", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "status_expiration": "rejected", + "destination_expired": "next", + "destination_rejected": "complete", + "destination_approved": "next" + }, + "addon_slug": "gravityflow", + "event_type": null } ] } diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_customer_acceptance_form.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_customer_acceptance_form.json deleted file mode 100644 index 659e050..0000000 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_customer_acceptance_form.json +++ /dev/null @@ -1,524 +0,0 @@ -{ - "0": { - "title": "DELIVERY ACTION TYPE: Customer acceptance", - "description": "The customer must accept the implementation before further actions can be taken. If the customer isn't satisfied, the problems or discrepancies must be fixed in order to gen an acceptance.", - "labelPlacement": "top_label", - "descriptionPlacement": "below", - "button": { - "type": "text", - "text": "Submit", - "imageUrl": "" - }, - "fields": [ - { - "type": "workflow_user", - "id": 2, - "label": "customer-id", - "adminLabel": "customer-id", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "administrative", - "inputs": null, - "choices": [ - ], - "formId": 1, - "description": "", - "allowsPrepopulate": true, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "customer-id", - "noDuplicates": false, - "defaultValue": "", - "conditionalLogic": "", - "failed_validation": "", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "", - "enablePrice": "", - "gravityflowUsersRoleFilter": "" - }, - { - "type": "date", - "id": 6, - "label": "Actual date", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "dateType": "datepicker", - "calendarIconType": "none", - "formId": 1, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "calendarIconUrl": "", - "dateFormat": "ymd_dash", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "" - }, - { - "type": "radio", - "id": 8, - "label": "acceptance", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "choices": [ - { - "text": "not-accepted", - "value": "not-accepted", - "isSelected": true, - "price": "" - }, - { - "text": "accept", - "value": "accept", - "isSelected": false, - "price": "" - }, - { - "text": "decline", - "value": "decline", - "isSelected": false, - "price": "" - } - ], - "formId": 1, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "conditionalLogic": "", - "productField": "", - "enableOtherChoice": "", - "enablePrice": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "" - }, - { - "type": "date", - "id": 9, - "label": "Expiration date", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "dateType": "datepicker", - "calendarIconType": "none", - "formId": 1, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "calendarIconUrl": "", - "dateFormat": "ymd_dash", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "" - }, - { - "type": "text", - "id": 10, - "label": "Reason", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "formId": 1, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "productField": "", - "enablePasswordInput": "", - "maxLength": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "", - "enablePrice": "" - }, - { - "type": "fileupload", - "id": 12, - "label": "File", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "formId": 1, - "description": "Upload customer acceptance file", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "maxFileSize": "", - "maxFiles": "", - "multipleFiles": true, - "allowedExtensions": "pdf,docx,doc,xlsx,xls,odt,ods,jpg,png,jpeg", - "productField": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false - } - ], - "version": "2.3.2", - "id": 1, - "useCurrentUserAsAuthor": true, - "postContentTemplateEnabled": false, - "postTitleTemplateEnabled": false, - "postTitleTemplate": "", - "postContentTemplate": "", - "lastPageButton": null, - "pagination": null, - "firstPageCssClass": null, - "is_active": "1", - "date_created": "2018-08-15 20:30:18", - "is_trash": "0", - "confirmations": [ - { - "id": "5b5f75f7494b7", - "name": "Default Confirmation", - "isDefault": true, - "type": "message", - "message": "Thanks for contacting us! We will get in touch with you shortly.", - "url": "", - "pageId": "", - "queryString": "" - } - ], - "notifications": [ - { - "id": "5b5f75f748cee", - "to": "{admin_email}", - "name": "Admin Notification", - "event": "form_submission", - "toType": "email", - "subject": "New submission from {form_title}", - "message": "{all_fields}" - } - ], - "feeds": { - "gravityflow": [ - { - "id": "1", - "form_id": "1", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Upload acceptance file", - "description": "", - "step_type": "user_input", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "schedule_date_field": "6", - "type": "select", - "assignees": [ - "role|administrator", - "assignee_user_field|2" - ], - "routing": "", - "assignee_policy": "any", - "highlight_editable_fields_enabled": "0", - "highlight_editable_fields_class": "green-triangle", - "instructionsEnable": "0", - "instructionsValue": "", - "display_fields_mode": "selected_fields", - "default_status": "hidden", - "note_mode": "not_required", - "assignee_notification_enabled": "0", - "assignee_notification_from_name": "", - "assignee_notification_from_email": "{admin_email}", - "assignee_notification_reply_to": "", - "assignee_notification_bcc": "", - "assignee_notification_subject": "Upload order acceptance file", - "assignee_notification_message": "A new entry requires your input.", - "assignee_notification_disable_autoformat": "0", - "resend_assignee_emailEnable": "0", - "resend_assignee_emailValue": "7", - "resend_assignee_email_repeatEnable": "0", - "resend_assignee_email_repeatValue": "3", - "in_progress_notification_enabled": "0", - "in_progress_notification_type": "select", - "in_progress_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "in_progress_notification_from_name": "", - "in_progress_notification_from_email": "{admin_email}", - "in_progress_notification_reply_to": "", - "in_progress_notification_bcc": "", - "in_progress_notification_subject": "", - "in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.", - "in_progress_notification_disable_autoformat": "0", - "complete_notification_enabled": "0", - "complete_notification_type": "select", - "complete_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "complete_notification_from_name": "", - "complete_notification_from_email": "{admin_email}", - "complete_notification_reply_to": "", - "complete_notification_bcc": "", - "complete_notification_subject": "", - "complete_notification_message": "Entry {entry_id} has been updated completing the step.", - "complete_notification_disable_autoformat": "0", - "confirmation_messageEnable": "0", - "confirmation_messageValue": "Thank you.", - "expiration": "0", - "expiration_type": "date_field", - "expiration_date": "", - "expiration_delay_offset": "7", - "expiration_delay_unit": "days", - "expiration_date_field_offset": "0", - "expiration_date_field_offset_unit": "hours", - "expiration_date_field_before_after": "after", - "expiration_date_field": "9", - "status_expiration": "expired", - "destination_expired": "2", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "2", - "form_id": "1", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Approve customer acceptance", - "description": "", - "step_type": "approval", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "type": "select", - "assignees": [ - "role|administrator" - ], - "routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "assignee_policy": "any", - "instructionsEnable": "0", - "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", - "display_fields_mode": "all_fields", - "assignee_notification_enabled": "0", - "assignee_notification_from_name": "", - "assignee_notification_from_email": "{admin_email}", - "assignee_notification_reply_to": "", - "assignee_notification_bcc": "", - "assignee_notification_subject": "", - "assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.", - "assignee_notification_disable_autoformat": "0", - "resend_assignee_emailEnable": "0", - "resend_assignee_emailValue": "7", - "resend_assignee_email_repeatEnable": "0", - "resend_assignee_email_repeatValue": "3", - "rejection_notification_enabled": "0", - "rejection_notification_type": "select", - "rejection_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "rejection_notification_from_name": "", - "rejection_notification_from_email": "{admin_email}", - "rejection_notification_reply_to": "", - "rejection_notification_bcc": "", - "rejection_notification_subject": "", - "rejection_notification_message": "Entry {entry_id} has been rejected", - "rejection_notification_disable_autoformat": "0", - "approval_notification_enabled": "0", - "approval_notification_type": "select", - "approval_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "approval_notification_from_name": "", - "approval_notification_from_email": "{admin_email}", - "approval_notification_reply_to": "", - "approval_notification_bcc": "", - "approval_notification_subject": "", - "approval_notification_message": "Entry {entry_id} has been approved", - "approval_notification_disable_autoformat": "0", - "revertEnable": "0", - "revertValue": 1, - "note_mode": "not_required", - "expiration": "0", - "expiration_type": "delay", - "expiration_date": "", - "expiration_delay_offset": "", - "expiration_delay_unit": "hours", - "expiration_date_field_offset": "0", - "expiration_date_field_offset_unit": "hours", - "expiration_date_field_before_after": "after", - "status_expiration": "rejected", - "destination_expired": "next", - "destination_rejected": 1, - "destination_approved": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - } - ] - } - }, - "version": "2.3.2" -} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_manual_form.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_manual_form.json deleted file mode 100644 index cbca857..0000000 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_manual_form.json +++ /dev/null @@ -1,252 +0,0 @@ -{ - "0": { - "title": "DELIVERY ACTION TYPE: Manual", - "description": "Manual process step action type", - "labelPlacement": "top_label", - "descriptionPlacement": "below", - "button": { - "type": "text", - "text": "Submit", - "imageUrl": "" - }, - "fields": [ - { - "type": "workflow_user", - "id": 2, - "label": "customer-id", - "adminLabel": "customer-id", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "administrative", - "inputs": null, - "choices": [ - { - "value": 2, - "text": "Customer Wiaas" - }, - { - "value": 1, - "text": "wpUser" - } - ], - "formId": 4, - "description": "", - "allowsPrepopulate": true, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "customer-id", - "noDuplicates": false, - "defaultValue": "", - "conditionalLogic": "", - "failed_validation": "", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "", - "enablePrice": "", - "gravityflowUsersRoleFilter": "" - }, - { - "type": "date", - "id": 3, - "label": "Actual Date", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "dateType": "datepicker", - "calendarIconType": "calendar", - "formId": 4, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "calendarIconUrl": "", - "dateFormat": "ymd_dash", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "" - } - ], - "version": "2.3.2", - "id": 4, - "useCurrentUserAsAuthor": true, - "postContentTemplateEnabled": false, - "postTitleTemplateEnabled": false, - "postTitleTemplate": "", - "postContentTemplate": "", - "lastPageButton": null, - "pagination": null, - "firstPageCssClass": null, - "is_active": "1", - "date_created": "2018-08-09 15:36:00", - "is_trash": "0", - "confirmations": [ - { - "id": "5b5f9ebc52a80", - "name": "Default Confirmation", - "isDefault": true, - "type": "message", - "message": "Thanks for contacting us! We will get in touch with you shortly.", - "url": "", - "pageId": "", - "queryString": "" - } - ], - "notifications": [ - { - "id": "5b5f9ebc520f3", - "to": "{admin_email}", - "name": "Admin Notification", - "event": "form_submission", - "toType": "email", - "subject": "New submission from {form_title}", - "message": "{all_fields}" - } - ], - "feeds": { - "gravityflow": [ - { - "id": "6", - "form_id": "4", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Complete step", - "description": "", - "step_type": "approval", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "schedule_date_field": "3", - "type": "select", - "assignees": [ - "role|administrator" - ], - "routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "assignee_policy": "any", - "instructionsEnable": "0", - "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", - "display_fields_mode": "all_fields", - "assignee_notification_enabled": "0", - "assignee_notification_from_name": "", - "assignee_notification_from_email": "{admin_email}", - "assignee_notification_reply_to": "", - "assignee_notification_bcc": "", - "assignee_notification_subject": "", - "assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.", - "assignee_notification_disable_autoformat": "0", - "resend_assignee_emailEnable": "0", - "resend_assignee_emailValue": "7", - "resend_assignee_email_repeatEnable": "0", - "resend_assignee_email_repeatValue": "3", - "rejection_notification_enabled": "0", - "rejection_notification_type": "select", - "rejection_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "rejection_notification_from_name": "", - "rejection_notification_from_email": "{admin_email}", - "rejection_notification_reply_to": "", - "rejection_notification_bcc": "", - "rejection_notification_subject": "", - "rejection_notification_message": "Entry {entry_id} has been rejected", - "rejection_notification_disable_autoformat": "0", - "approval_notification_enabled": "0", - "approval_notification_type": "select", - "approval_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "approval_notification_from_name": "", - "approval_notification_from_email": "{admin_email}", - "approval_notification_reply_to": "", - "approval_notification_bcc": "", - "approval_notification_subject": "", - "approval_notification_message": "Entry {entry_id} has been approved", - "approval_notification_disable_autoformat": "0", - "note_mode": "not_required", - "expiration": "0", - "expiration_type": "delay", - "expiration_date": "", - "expiration_delay_offset": "", - "expiration_delay_unit": "hours", - "expiration_date_field_offset": "0", - "expiration_date_field_offset_unit": "hours", - "expiration_date_field_before_after": "after", - "expiration_date_field": "3", - "status_expiration": "rejected", - "destination_expired": "next", - "destination_rejected": "complete", - "destination_approved": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - } - ] - } - }, - "version": "2.3.2" -} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_schedule_meeting.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_schedule_meeting.json deleted file mode 100644 index be4ebb0..0000000 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_schedule_meeting.json +++ /dev/null @@ -1,406 +0,0 @@ -{ - "0": { - "title": "DELIVERY ACTION TYPE: Schedule meeting", - "description": "Schedule meeting with customer", - "labelPlacement": "top_label", - "descriptionPlacement": "below", - "button": { - "type": "text", - "text": "Submit", - "imageUrl": "" - }, - "fields": [ - { - "type": "workflow_user", - "id": 3, - "label": "customer-id", - "adminLabel": "customer-id", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "administrative", - "inputs": null, - "choices": [ - { - "value": 2, - "text": "Customer Wiaas" - }, - { - "value": 1, - "text": "wpUser" - } - ], - "formId": 2, - "description": "", - "allowsPrepopulate": true, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "customer-id", - "noDuplicates": false, - "defaultValue": "", - "conditionalLogic": "", - "failed_validation": "", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "", - "gravityflowUsersRoleFilter": "" - }, - { - "type": "date", - "id": 4, - "label": "Actual Date", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "dateType": "datepicker", - "calendarIconType": "calendar", - "formId": 2, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "calendarIconUrl": "", - "dateFormat": "ymd_dash", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "" - }, - { - "type": "date", - "id": 5, - "label": "Schedule date", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "dateType": "datepicker", - "calendarIconType": "calendar", - "formId": 2, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "calendarIconUrl": "", - "dateFormat": "ymd_dash", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false - } - ], - "version": "2.3.2", - "id": 2, - "useCurrentUserAsAuthor": true, - "postContentTemplateEnabled": false, - "postTitleTemplateEnabled": false, - "postTitleTemplate": "", - "postContentTemplate": "", - "lastPageButton": null, - "pagination": null, - "firstPageCssClass": null, - "is_active": "1", - "date_created": "2018-08-09 15:35:59", - "is_trash": "0", - "confirmations": [ - { - "id": "5b60b12baa00e", - "name": "Default Confirmation", - "isDefault": true, - "type": "message", - "message": "Thanks for contacting us! We will get in touch with you shortly.", - "url": "", - "pageId": "", - "queryString": "" - } - ], - "notifications": [ - { - "id": "5b60b12ba9850", - "to": "{admin_email}", - "name": "Admin Notification", - "event": "form_submission", - "toType": "email", - "subject": "New submission from {form_title}", - "message": "{all_fields}" - } - ], - "feeds": { - "gravityflow": [ - { - "id": "3", - "form_id": "2", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Broker proposes meeting date", - "description": "", - "step_type": "user_input", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "schedule_date_field": "4", - "type": "select", - "assignees": [ - "role|administrator" - ], - "editable_fields": [ - "4", - "5" - ], - "routing": "", - "assignee_policy": "all", - "highlight_editable_fields_enabled": "0", - "highlight_editable_fields_class": "green-triangle", - "instructionsEnable": "0", - "instructionsValue": "", - "display_fields_mode": "selected_fields", - "display_fields_selected": [ - "4", - "5" - ], - "default_status": "submit_buttons", - "note_mode": "not_required", - "assignee_notification_enabled": "0", - "assignee_notification_from_name": "", - "assignee_notification_from_email": "{admin_email}", - "assignee_notification_reply_to": "", - "assignee_notification_bcc": "", - "assignee_notification_subject": "", - "assignee_notification_message": "A new entry requires your input.", - "assignee_notification_disable_autoformat": "0", - "resend_assignee_emailEnable": "0", - "resend_assignee_emailValue": "7", - "resend_assignee_email_repeatEnable": "0", - "resend_assignee_email_repeatValue": "3", - "in_progress_notification_enabled": "0", - "in_progress_notification_type": "select", - "in_progress_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "in_progress_notification_from_name": "", - "in_progress_notification_from_email": "{admin_email}", - "in_progress_notification_reply_to": "", - "in_progress_notification_bcc": "", - "in_progress_notification_subject": "", - "in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.", - "in_progress_notification_disable_autoformat": "0", - "complete_notification_enabled": "0", - "complete_notification_type": "select", - "complete_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "complete_notification_from_name": "", - "complete_notification_from_email": "{admin_email}", - "complete_notification_reply_to": "", - "complete_notification_bcc": "", - "complete_notification_subject": "", - "complete_notification_message": "Entry {entry_id} has been updated completing the step.", - "complete_notification_disable_autoformat": "0", - "confirmation_messageEnable": "0", - "confirmation_messageValue": "Thank you.", - "expiration": "0", - "expiration_type": "delay", - "expiration_date": "", - "expiration_delay_offset": "", - "expiration_delay_unit": "hours", - "expiration_date_field_offset": "0", - "expiration_date_field_offset_unit": "hours", - "expiration_date_field_before_after": "after", - "expiration_date_field": "4", - "status_expiration": "complete", - "destination_expired": "next", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "4", - "form_id": "2", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Customer approval for scheduled date", - "description": "", - "step_type": "approval", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "schedule_date_field": "4", - "type": "select", - "assignees": [ - "assignee_user_field|3" - ], - "routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "assignee_policy": "all", - "instructionsEnable": "0", - "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", - "display_fields_mode": "selected_fields", - "display_fields_selected": [ - "5" - ], - "assignee_notification_enabled": "0", - "assignee_notification_from_name": "", - "assignee_notification_from_email": "{admin_email}", - "assignee_notification_reply_to": "", - "assignee_notification_bcc": "", - "assignee_notification_subject": "", - "assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.", - "assignee_notification_disable_autoformat": "0", - "resend_assignee_emailEnable": "0", - "resend_assignee_emailValue": "7", - "resend_assignee_email_repeatEnable": "0", - "resend_assignee_email_repeatValue": "3", - "rejection_notification_enabled": "0", - "rejection_notification_type": "select", - "rejection_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "rejection_notification_from_name": "", - "rejection_notification_from_email": "{admin_email}", - "rejection_notification_reply_to": "", - "rejection_notification_bcc": "", - "rejection_notification_subject": "", - "rejection_notification_message": "Entry {entry_id} has been rejected", - "rejection_notification_disable_autoformat": "0", - "approval_notification_enabled": "0", - "approval_notification_type": "select", - "approval_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "approval_notification_from_name": "", - "approval_notification_from_email": "{admin_email}", - "approval_notification_reply_to": "", - "approval_notification_bcc": "", - "approval_notification_subject": "", - "approval_notification_message": "Entry {entry_id} has been approved", - "approval_notification_disable_autoformat": "0", - "revertEnable": "0", - "revertValue": 3, - "note_mode": "not_required", - "expiration": "0", - "expiration_type": "delay", - "expiration_date": "", - "expiration_delay_offset": "", - "expiration_delay_unit": "hours", - "expiration_date_field_offset": "0", - "expiration_date_field_offset_unit": "hours", - "expiration_date_field_before_after": "after", - "expiration_date_field": "4", - "status_expiration": "rejected", - "destination_expired": "next", - "destination_rejected": 3, - "destination_approved": "complete" - }, - "addon_slug": "gravityflow", - "event_type": null - } - ] - } - }, - "version": "2.3.2" -} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_validate_questionnaire_form.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_validate_questionnaire_form.json deleted file mode 100644 index e5e55f1..0000000 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery_action_validate_questionnaire_form.json +++ /dev/null @@ -1,264 +0,0 @@ -{ - "0": { - "title": "DELIVERY ACTION TYPE: Validate Questionnaire", - "description": "The configuration details submitted at ordering must be validated and any missing or incomplete information must be added.", - "labelPlacement": "top_label", - "descriptionPlacement": "below", - "button": { - "type": "text", - "text": "Submit", - "imageUrl": "" - }, - "fields": [ - { - "type": "workflow_user", - "id": 4, - "label": "customer-id", - "adminLabel": "customer-id", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "administrative", - "inputs": null, - "choices": [ - { - "value": 2, - "text": "Customer Wiaas" - }, - { - "value": 1, - "text": "wpUser" - } - ], - "formId": 3, - "description": "", - "allowsPrepopulate": true, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "customer-id", - "noDuplicates": false, - "defaultValue": "", - "conditionalLogic": "", - "failed_validation": "", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "", - "enablePrice": "", - "gravityflowUsersRoleFilter": "" - }, - { - "type": "date", - "id": 5, - "label": "Actual date", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "dateType": "datepicker", - "calendarIconType": "none", - "formId": 3, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "calendarIconUrl": "", - "dateFormat": "", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "enableCalculation": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false - } - ], - "version": "2.3.2", - "id": 3, - "useCurrentUserAsAuthor": true, - "postContentTemplateEnabled": false, - "postTitleTemplateEnabled": false, - "postTitleTemplate": "", - "postContentTemplate": "", - "lastPageButton": null, - "pagination": null, - "firstPageCssClass": null, - "is_active": "1", - "date_created": "2018-08-09 15:36:00", - "is_trash": "0", - "confirmations": [ - { - "id": "5b5f688188e90", - "name": "Default Confirmation", - "isDefault": true, - "type": "message", - "message": "Thanks for contacting us! We will get in touch with you shortly.", - "url": "", - "pageId": "", - "queryString": "" - } - ], - "notifications": [ - { - "id": "5b5f68818822e", - "to": "{admin_email}", - "name": "Admin Notification", - "event": "form_submission", - "toType": "email", - "subject": "New submission from {form_title}", - "message": "{all_fields}" - } - ], - "feeds": { - "gravityflow": [ - { - "id": "5", - "form_id": "3", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Approve customer configuration", - "description": "", - "step_type": "approval", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": { - "conditionalLogic": { - "actionType": "show", - "logicType": "all", - "rules": [ - { - "fieldId": "2", - "operator": "is", - "value": "administrator" - } - ] - } - }, - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "schedule_date_field": "5", - "type": "select", - "assignees": [ - "role|administrator" - ], - "routing": [ - { - "target": false, - "fieldId": "0", - "operator": "is", - "value": "", - "type": false, - "assignee": "user_id|2" - } - ], - "assignee_policy": "any", - "instructionsEnable": "1", - "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", - "display_fields_mode": "selected_fields", - "assignee_notification_enabled": "0", - "assignee_notification_from_name": "", - "assignee_notification_from_email": "{admin_email}", - "assignee_notification_reply_to": "", - "assignee_notification_bcc": "", - "assignee_notification_subject": "", - "assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.", - "assignee_notification_disable_autoformat": "0", - "resend_assignee_emailEnable": "0", - "resend_assignee_emailValue": "7", - "resend_assignee_email_repeatEnable": "0", - "resend_assignee_email_repeatValue": "3", - "rejection_notification_enabled": "0", - "rejection_notification_type": "select", - "rejection_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "rejection_notification_from_name": "", - "rejection_notification_from_email": "{admin_email}", - "rejection_notification_reply_to": "", - "rejection_notification_bcc": "", - "rejection_notification_subject": "", - "rejection_notification_message": "Entry {entry_id} has been rejected", - "rejection_notification_disable_autoformat": "0", - "approval_notification_enabled": "0", - "approval_notification_type": "select", - "approval_notification_routing": [ - { - "assignee": "user_id|2", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "approval_notification_from_name": "", - "approval_notification_from_email": "{admin_email}", - "approval_notification_reply_to": "", - "approval_notification_bcc": "", - "approval_notification_subject": "", - "approval_notification_message": "Entry {entry_id} has been approved", - "approval_notification_disable_autoformat": "0", - "note_mode": "not_required", - "expiration": "0", - "expiration_type": "delay", - "expiration_date": "", - "expiration_delay_offset": "", - "expiration_delay_unit": "hours", - "expiration_date_field_offset": "0", - "expiration_date_field_offset_unit": "hours", - "expiration_date_field_before_after": "after", - "expiration_date_field": "5", - "status_expiration": "rejected", - "destination_expired": "next", - "destination_rejected": "complete", - "destination_approved": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - } - ] - } - }, - "version": "2.3.2" -} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php index a5af42b..97cc1f1 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php +++ b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php @@ -17,59 +17,6 @@ function wiaas_db_update_setup_gravity() { update_option('gravityflow_pending_installation', false); } -function wiaas_db_update_add_delivery_process_forms() { - $action_type_forms_files = array( - 'delivery_action_customer_acceptance_form', - 'delivery_action_schedule_meeting', - 'delivery_action_validate_questionnaire_form', - 'delivery_action_manual_form', - ); - - // Since import action will generate form with new id, we need to remember this mapping - // so we can update process delivery steps to point to correct form ids - $action_type_forms_ids_mappings = array(); - - $process_forms_files = array( - 'delivery_process_normal_delivery_form' - ); - - $created_forms = array(); - - // import forms for delivery action types - foreach ($action_type_forms_files as $action_type_form_file) { - $form_json = file_get_contents( dirname( __FILE__ ) . "/data/delivery-forms/" . $action_type_form_file . '.json' ); - - $form_meta = json_decode( $form_json, true ); - $form_meta = $form_meta[0]; - - $form_id = GFAPI::add_form($form_meta); - - $created_forms[] = GFAPI::get_form($form_id); - - $action_type_forms_ids_mappings[$form_meta['id']] = $form_id; - } - - // import forms for delivery process - foreach ($process_forms_files as $process_form_file) { - $form_json = file_get_contents( dirname( __FILE__ ) . "/data/delivery-forms/" . $process_form_file . '.json' ); - - $form_meta = json_decode( $form_json, true ); - $form_meta = $form_meta[0]; - - // update delivery steps forms ids with correct values - foreach ($form_meta['feeds']['gravityflow'] as $key => $process_step_meta) { - $process_step_target_form_id = $form_meta['feeds']['gravityflow'][$key]['meta']['target_form_id']; - $form_meta['feeds']['gravityflow'][$key]['meta']['target_form_id'] = $action_type_forms_ids_mappings[$process_step_target_form_id]; - } - - $form_id = GFAPI::add_form($form_meta); - - $created_forms[] = GFAPI::get_form($form_id); - } - - do_action('gform_forms_post_import', $created_forms); -} - function wiaas_db_update_enable_orders_access_management() { $post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() ); @@ -129,4 +76,18 @@ function wiaas_create_organization_roles_capabilities() { foreach ($roles as $role) { Groups_Capability::create( array( 'capability' => 'wiaas_' . $role )); } +} + + +function import_delivery_action_forms() { + + $forms = GFAPI::get_forms(); + + foreach ($forms as $form) { + GFAPI::delete_form($form['id']); + } + + GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-action-forms.json"); + + //GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-process-normal-delivery-form.json"); } \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-date-list-field.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-date-list-field.php deleted file mode 100644 index 767c08d..0000000 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-date-list-field.php +++ /dev/null @@ -1,38 +0,0 @@ -inputType = 'date'; - } - - public function get_list_input($has_columns, $column, $value, $form_id) { - - $tabindex = $this->get_tabindex(); - $disabled = $this->is_form_editor() ? 'disabled' : ''; - - return ""; - } - - public function get_value_entry_list( $value, $entry, $field_id, $columns, $form ) { - - return $this->get_value_entry_detail($value, '', false, 'html', 'screen' ); - } -} - -GF_Fields::register( new Wiaas_Dates_List_Field() ); \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php index 53f5579..c412498 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php @@ -27,16 +27,112 @@ class Wiaas_Delivery_Process_Addon extends Gravity_Flow_Extension { public function init() { parent::init(); + + add_filter('gravityflow_get_users_args', array ($this, 'allow_only_administrator_to_be_assigned_to_step')); + + add_filter('gravityflow_assignee_choices', array ($this, 'add_orders_assignee_choices')); + + add_filter('gravityflow_admin_actions_workflow_detail', array ($this, 'filter_process_send_to_step_options'), 10, 5); + + add_filter('gravityflow_step_assignees', array ($this, 'maybe_assign_organization_to_step'), 10, 2); } public function init_ajax() { parent::init_ajax(); - add_action( 'wp_ajax_wiaas_get_action_entry', array( $this, 'ajax_get_action_entry' ) ); // this AJAX action is here and not in /admin folder because of Gravity Forms extension logic add_action( 'wp_ajax_wiaas_delivery_get_form', array( $this, 'ajax_get_form' ) ); } + public function maybe_assign_organization_to_step($assignees, Gravity_Flow_Step $step) { + + $mapped_assignees = array(); + + foreach ($assignees as $assignee) { + + if (strpos($assignee->get_type(), 'wiaas_organization_order_') !== false) { + + $organization_id = $assignee->get_id(); + + $user_ids = wiaas_get_organization_user_ids($organization_id); + + if (empty($user_ids)) { + + continue; + } + + $user_id = $user_ids[0]; + + $mapped_assignees[] = $step->get_assignee( array( + 'id' => $user_id, + 'type' => 'user_id', + 'editable_fields' => $assignee->get_editable_fields() + ) ); + + continue; + } + + $mapped_assignees[] = $assignee; + } + + return $mapped_assignees; + } + + public function filter_process_send_to_step_options($admin_actions, $current_step, $steps, $form, $entry) { + + $delivery_process_actions = array(); + + if ( $current_step ) { + + $previous_step_id = null; + // get previous step id for current step + foreach ($steps as $index => $step) { + + $next_step = gravity_flow()->get_next_step($step, $entry, $form); + + if ($next_step && $next_step->get_id() === $current_step->get_id()) { + + $previous_step_id = $step->get_id(); + } + } + + if (! empty($previous_step_id)) { + + $delivery_process_actions[] = array( + 'label' => esc_html__( 'Previous step', 'wiaas' ), + 'value' => 'send_to_step|' . $previous_step_id + ); + } + + // get next step id for current step + $next_step = gravity_flow()->get_next_step($current_step, $entry, $form); + if ($next_step) { + + $delivery_process_actions[] = array( + 'label' => esc_html__( 'Next step', 'wiaas' ), + 'value' => 'send_to_step|' . $next_step->get_id() + ); + } + } + + return $delivery_process_actions; + } + + + public function allow_only_administrator_to_be_assigned_to_step($args) { + + $args['role'] = 'administrator'; + + //$args['exclude'] = array( 1 ); // exclude super admin user + + return $args; + } + + public static function add_orders_assignee_choices($choices) { + + return $choices; + } + public function ajax_get_form() { $form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; @@ -65,14 +161,6 @@ class Wiaas_Delivery_Process_Addon extends Gravity_Flow_Extension { die(); } - - public function ajax_get_action_entry() { - - $form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; - - $entry_id = absint( rgget( 'entry_id' ) ); - } - /** * Extends Gravity Form entry metadata with 'wiaas_delivery_process_id' * @@ -223,7 +311,7 @@ class Wiaas_Delivery_Process_Addon extends Gravity_Flow_Extension { array( 'value' => '', 'label' => 'Select action code ...' ), array( 'value' => 'customer-acceptance', 'label' => 'Customer acceptance' ), array( 'value' => 'validate-questionnaire', 'label' => 'Validate Questionnaire' ), - array( 'value' => 'schedule-meeting', 'label' => 'Schedule meeting' ) + array( 'value' => 'schedule-meeting', 'label' => 'Schedule meeting' ), ), 'after_select' => '

    Choose action code for action form.

    ' )); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php index 5655d09..a1c3b80 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php @@ -7,24 +7,6 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { * @var string */ public $_step_type = 'wiaas_delivery_step'; - - private static $delivery_action_form_title_prefix = 'DELIVERY ACTION TYPE:'; - - private static $delivery_action_types = array( - 'DELIVERY ACTION TYPE: Customer acceptance' => 'customer-acceptance', - 'DELIVERY ACTION TYPE: Validate Questionnaire' => 'validate-questionnaire', - 'DELIVERY ACTION TYPE: Manual' => 'manual', - 'DELIVERY ACTION TYPE: Schedule meeting' => 'schedule-meeting' - ); - - public static function get_delivery_action_types() { - return array_keys(self::$delivery_action_types); - } - - public static function get_delivery_action_type_prefix() { - return self::$delivery_action_form_title_prefix; - } - /** * Returns label for Wiass Delivery Process Step * @return string @@ -44,7 +26,17 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { $forms = $this->get_action_forms_choices(); $form_choices[] = array( 'label' => esc_html__( 'Select a Form', 'wiaas' ), 'value' => '' ); foreach ( $forms as $form ) { - $form_choices[] = array( 'label' => $form['title'], 'value' => $form['id'] ); + + $delivery_settings = rgar($form, 'wiaas_delivery_process'); + + $code = $form['id']; + + if (! empty($delivery_settings['delivery_action_code'])) { + + $code = $delivery_settings['delivery_action_code']; + } + + $form_choices[] = array( 'label' => $form['title'], 'value' => $code ); } $settings = array( @@ -77,15 +69,47 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { return $settings; } + public function start() { + + $complete = parent::start(); + + if ($complete) { + + $this->update_step_status('complete'); + } else { + + $this->update_step_status('pending'); + } + + return $complete; + } + + public function evaluate_status() { + + return 'pending'; + } + + public function get_status_label($status) { + + $label = parent::get_status_label($status); + + if (empty($label)) { + + $label = __('Not started', 'wiaas'); + } + + return $label; + } + public function update_step_status($status = false) { - if (isset( $_POST['_gravityflow_admin_action'] ) ) { + if ($status === 'cancelled' && $admin_action = rgpost( 'gravityflow_admin_action' )) { - $admin_action = rgpost( 'gravityflow_admin_action' ); + list( $base_admin_action, $step_id ) = rgexplode( '|', $admin_action, 2 ); - list( $base_admin_action, $action_id ) = rgexplode( '|', $admin_action, 2 ); - - if ($base_admin_action === 'send_to_step' && $this->get_status() === 'pending') { + $next_step = gravity_flow()->get_next_step($this, $this->get_entry(), $this->get_form()); + // going to next step + if ($base_admin_action === 'send_to_step' && $next_step && $next_step->get_id() == $step_id) { $status = 'complete'; } @@ -157,18 +181,6 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { return false; } - /** - * Evaluates current step status based on target form entry status - * - * If target form entry has associated workflow current step will complete its status - * only when target form entry workflow is completed - * @return string - */ - public function status_evaluation() { - - // return 'pending'; - } - public function workflow_detail_box($form, $args) { parent::workflow_detail_box($form, $args); @@ -225,27 +237,6 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { return $action_forms; } - /** - * Retrieves delivery action type that is executed with this step - * @return string - */ - public function get_delivery_action_type() { - $target_form = GFAPI::get_form( $this->target_form_id ); - return self::$delivery_action_types[$target_form['title']]; - } - - /** - * Retrieves target form entry created when step was started - * @return array|null - */ - public function get_target_form_entry() { - $entry = GFAPI::get_entry($this->get_target_form_entry_id()); - if(is_wp_error($entry)) { - return null; - } - return $entry; - } - /** * Retrieves target form entry id created when step was started diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php index 08d191e..ffe5f3f 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php @@ -27,6 +27,10 @@ class Wiaas_Field_Order_Bundle_Document extends GF_Field_FileUpload { ); } + public function get_input_type() { + return 'fileupload'; + } + public function get_form_editor_field_title() { return esc_attr__( 'Bundle Document', 'wiaas' ); } diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php index 1df783d..35ed4bd 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php @@ -8,6 +8,11 @@ class Wiaas_Field_Order_Supplier_Select extends GF_Field_Select { public $type = 'wiaas_order_supplier'; + public function get_input_type() { + // set this input type so delivery workflow step can be assigned to supplier in this field + return 'workflow_assignee_select'; + } + public function get_form_editor_field_title() { return esc_attr__( 'Supplier Select', 'wiaas' ); } @@ -41,9 +46,9 @@ class Wiaas_Field_Order_Supplier_Select extends GF_Field_Select { private function _get_selected_supplier_display_name($value) { - list ($order_id, $supplier_id) = explode('|', $value); + list ($order_key, $supplier_id) = explode('|', $value); - if (! empty($order_id) && ! empty($supplier_id) && $order = wc_get_order($order_id)) { + if (! empty($supplier_id)) { return wiaas_get_organization_name($supplier_id); } @@ -65,7 +70,7 @@ class Wiaas_Field_Order_Supplier_Select extends GF_Field_Select { foreach ($suppliers as $supplier_id => $supplier_name) { $choices[] = array( - 'value' => $order_id . '|' . $supplier_id, + 'value' => 'wiaas_organization_order_' . $order_id . '|' . $supplier_id, 'text' => $supplier_name ); } diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php index 170e576..f104f11 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php @@ -71,8 +71,6 @@ class Wiaas_Order_Fields { return false; } - error_log(json_encode('here')); - $order = wc_get_order($order_id); $bundle_item = $order->get_item($bundle_item_id); @@ -129,6 +127,15 @@ class Wiaas_Order_Fields { break; + case 'wiaas_order_supplier': + $suppliers = wiaas_get_order_suppliers($order); + + $supplier_ids = array_keys($suppliers); + + $supplier_id = $supplier_ids[0]; + + $entry[(string) $field->id] = 'wiaas_organization_order_' . $order_id . '|' . $supplier_id; + } } diff --git a/backend/app/plugins/wiaas/includes/document/class-wiaas-document-upload.php b/backend/app/plugins/wiaas/includes/document/class-wiaas-document-upload.php index 87211ab..37c01ee 100644 --- a/backend/app/plugins/wiaas/includes/document/class-wiaas-document-upload.php +++ b/backend/app/plugins/wiaas/includes/document/class-wiaas-document-upload.php @@ -7,7 +7,7 @@ class Wiaas_Document_Upload { ); public static function init() { - add_filter( 'upload_dir', array( __CLASS__, 'upload_dir' ) ); + //add_filter( 'upload_dir', array( __CLASS__, 'upload_dir' ) ); } diff --git a/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php b/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php index 4132ee4..a25c61d 100644 --- a/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php +++ b/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php @@ -16,11 +16,7 @@ function wiaas_get_order_suppliers($order) { $items = $order->get_items(); - $suppliers = get_terms(array( - 'taxonomy' => 'supplier', - 'fields' => 'id=>name', - 'hide_empty' => false - )); + $suppliers = wiaas_get_suppliers(); return $suppliers; } diff --git a/backend/app/plugins/wiaas/includes/user/wiaas-organization-functions.php b/backend/app/plugins/wiaas/includes/user/wiaas-organization-functions.php index b011408..4b9eeda 100644 --- a/backend/app/plugins/wiaas/includes/user/wiaas-organization-functions.php +++ b/backend/app/plugins/wiaas/includes/user/wiaas-organization-functions.php @@ -103,4 +103,11 @@ function wiaas_get_user_organization_id($user_id) { */ function wiaas_get_current_user_organization_id() { return wiaas_get_user_organization_id(get_current_user_id()); +} + +function wiaas_get_organization_user_ids($organization_id) { + + $user_ids = get_objects_in_term($organization_id, Wiaas_User_Organization::TAXONOMY_NAME); + + return is_wp_error($user_ids) ? array() : $user_ids; } \ No newline at end of file From cdbefc7ef05b95cbd31a8f45a78eaf698745114d Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Fri, 2 Nov 2018 10:30:25 +0100 Subject: [PATCH 04/14] Handle assigment for order delivery flow --- .../wiaas/assets/js/wiaas-form-editor.js | 6 +- .../class-wiaas-admin-delivery-process.php | 514 ++++++++++++------ .../class-wiaas-rest-delivery-process-api.php | 18 +- .../wiaas/includes/class-wiaas-countries.php | 13 + .../wiaas/includes/class-wiaas-db-update.php | 3 +- .../includes/class-wiaas-delivery-process.php | 103 ++-- .../delivery-forms/delivery-action-forms.json | 2 +- ...delivery-process-normal-delivery-form.json | 425 --------------- .../delivery-process-sample-form.json | 1 + .../db-updates/wiaas-db-update-general.php | 4 +- .../class-wiaas-delivery-process-action.php | 233 ++++++-- .../class-wiaas-delivery-process-addon.php | 85 +-- ...s-wiaas-delivery-process-step-assignee.php | 189 +++++++ .../class-wiaas-delivery-process-step.php | 29 +- ...lass-wiaas-field-order-bundle-document.php | 1 + .../class-wiaas-field-order-bundle-select.php | 112 ---- .../class-wiaas-field-order-bundle.php | 50 ++ .../class-wiaas-field-order-document.php | 61 +++ ...-wiaas-field-order-installation-select.php | 110 ++++ ...lass-wiaas-field-order-supplier-select.php | 83 --- .../class-wiaas-order-fields.php | 102 +++- .../document/class-wiaas-document-upload.php | 2 +- .../document/wiaas-document-functions.php | 5 - .../includes/order/wiaas-order-functions.php | 21 - .../components/process/OrderProcess.jsx | 6 +- 25 files changed, 1131 insertions(+), 1047 deletions(-) delete mode 100644 backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-normal-delivery-form.json create mode 100644 backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step-assignee.php delete mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-document.php create mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-installation-select.php delete mode 100644 backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php diff --git a/backend/app/plugins/wiaas/assets/js/wiaas-form-editor.js b/backend/app/plugins/wiaas/assets/js/wiaas-form-editor.js index fc6ddc0..7589022 100644 --- a/backend/app/plugins/wiaas/assets/js/wiaas-form-editor.js +++ b/backend/app/plugins/wiaas/assets/js/wiaas-form-editor.js @@ -2,9 +2,13 @@ jQuery(document).bind('gform_load_field_settings', function (event, field, form) var isBundleDoc = field.type === 'wiaas_order_bundle_document'; - if (isBundleDoc) { + var isOrderDoc = field.type === 'wiaas_order_document'; + + if (isBundleDoc || isOrderDoc) { jQuery('#wiaas-doc-type-filter').val(field.wiaasDocTypeFilter); } + jQuery('#wiaas-installation-organization-filter').prop('checked', !!field.wiaasOnlyInstallationOrg); + }); \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php index db0f925..512a03e 100644 --- a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php @@ -7,205 +7,389 @@ class Wiaas_Admin_Delivery_Process { add_action( 'gravityflow_entry_detail', array( __CLASS__, 'display_process_steps_details' ), 10, 3 ); add_action( 'gravityflow_title_entry_detail', array( __CLASS__, 'process_title' ), 10, 3 ); + + + add_action('add_meta_boxes', array(__CLASS__, 'add_delivery_process_metabox'), 100); + + add_action( 'wp_ajax_wiaas_create_order_delivery_process', array(__CLASS__, 'wiaas_ajax_create_order_delivery_process') ); + + add_filter('gravityflow_admin_actions_workflow_detail', array (__CLASS__, 'filter_process_send_to_step_options'), 10, 5); + } + + public static function add_delivery_process_metabox() { + + add_meta_box( + 'order_delivery_process_meta_box', + __('Delivery Process', 'cmb'), + array(__CLASS__, 'order_delivery_process_meta_box'), + 'shop_order', + 'side', + 'high' + ); + } + + + public static function filter_process_send_to_step_options($admin_actions, $current_step, $steps, $form, $entry) { + + $delivery_process_actions = array(); + + if ( $current_step ) { + + $previous_step_id = null; + // get previous step id for current step + foreach ($steps as $index => $step) { + + $next_step = gravity_flow()->get_next_step($step, $entry, $form); + + if ($next_step && $next_step->get_id() === $current_step->get_id()) { + + $previous_step_id = $step->get_id(); + } + } + + if (! empty($previous_step_id)) { + + $delivery_process_actions[] = array( + 'label' => esc_html__( 'Previous step', 'wiaas' ), + 'value' => 'send_to_step|' . $previous_step_id + ); + } + + // get next step id for current step + $next_step = gravity_flow()->get_next_step($current_step, $entry, $form); + if ($next_step) { + + $delivery_process_actions[] = array( + 'label' => esc_html__( 'Next step', 'wiaas' ), + 'value' => 'send_to_step|' . $next_step->get_id() + ); + } + } + + return $delivery_process_actions; } - public static function display_process_steps_details($form, $entry, $current_step) { + public static function wiaas_ajax_create_order_delivery_process() { + check_ajax_referer('wiaas_create_order_delivery_process'); - $delivery_settings = rgar($form, 'wiaas_delivery_process'); + $error = new WP_Error('-1', 'Failed to create order delivery process'); - if ($delivery_settings['delivery_form_type'] === 'action') { - return; - } + if (!isset($_POST['order']) || !isset($_POST['form'])){ + wp_send_json_error($error); + } - // get process order ID - $order_id = absint($entry['wiaas_delivery_order_id']); + $order_id = intval( $_POST['order'] ); + $form_id = intval( $_POST['form'] ); - if (empty($order_id)) { + if ($process_entry_id = Wiaas_Delivery_Process::create_delivery_process_for_order($order_id, $form_id)){ - $order_field = GFCommon::get_fields_by_type($form, array( 'wiaas_order') )[0]; + $workflow = new Gravity_Flow_API($form_id); - if ( ! empty($order_field)) { + $step = $workflow->get_current_step(GFAPI::get_entry($process_entry_id)); - $order_id = $entry[$order_field->id]; - } - } + $entry_url = $step->get_entry_url(); - // display process steps + wp_send_json_success(array( + 'url' => $entry_url + )); + } - $workflow_api = new Gravity_Flow_API($form['id']); - - $steps = $workflow_api->get_steps(); - - foreach ($steps as $index => $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; - } - - $action_delivery_settings = rgar($action_form, 'wiaas_delivery_process'); - - ?> - -
    - - - - ' . - ' ' . $action_form['title'] . '', - $form_url ); - - echo $form_link; - } - - echo '


    '; - - $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, $search_criteria, $sorting, $paging ); - - foreach ($entries as $action_entry) { - self::_display_step_action_entry($action_form, $action_entry); - } - - ?> - -
    - -
    - - - -
    - get_current_step($action_entry); + $order_id = $post->ID; + $process_entry = Wiaas_Delivery_Process::get_order_delivery_process_entry($order_id); + + if ( empty($process_entry) ){ + + $order = wc_get_order($order_id); + + $list_of_delivery_processes = Wiaas_Delivery_Process::get_available_process_list_for_country( + Wiaas_Countries::get_country_code_by_currency($order->get_currency()) + ); ?> - - type === 'wiaas_order') { - continue; +
    + - if ($field->type === 'workflow_discussion') { + Assign +
    - echo ''; + -
    + 'gravityflow-inbox', + 'view' => 'entry', + 'id' => $process_entry['form_id'], + 'lid' => $process_entry['id'] + ), admin_url() ); + + ?> + Delivery Process 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; + } + + $action_delivery_settings = rgar($action_form, 'wiaas_delivery_process'); + + ?> + +
    + +
    ' . $field->format_discussion_value($action_entry[$field->id]) . '
    + + ' . + ' ' . $action_form['title'] . '', + $form_url ); + + echo $form_link; + } + + echo '


    '; + + $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, $search_criteria, $sorting, $paging ); + + foreach ($entries as $action_entry) { + self::_display_step_action_entry($action_form, $action_entry); + } + + ?> + +
    + +
    + + + +
    + get_current_step($action_entry); + + + ?> + + + type === 'wiaas_order') { + continue; + } + + if ($field->type === 'workflow_discussion') { + + echo ''; + + continue; + } + + $value = $field->get_value_entry_detail($action_entry[$field->id]); + $label = $field->get_field_label(false, $action_entry[$field->id]); + + echo '' . + '' . + '' . + ''; + } + + ?> + + + + + + + + +
    ' . $field->format_discussion_value($action_entry[$field->id]) . '
    ' . $label . ' : ' . $value . '
    + + + get_status_label($current_action_step->get_status()) . ': ' . $current_action_step->get_name(); + echo '' . + ' ' . + ''; + + } else { + echo $workflow_api->get_status($action_entry); + } + ?> + + +
    + +
    + 'pending', ); - $user_roles = gravity_flow()->get_user_roles(); - foreach ( $user_roles as $user_role ) { - $field_filters[] = array( - 'key' => 'workflow_role_' . $user_role, - 'value' => 'pending', - ); - } - $field_filters['mode'] = 'any'; $search_criteria = array(); @@ -93,10 +85,11 @@ class Wiass_REST_Delivery_Process_API { $form_ids = gravity_flow()->get_workflow_form_ids(); - $total_count = 7; - - - $entries = GFAPI::get_entries( $form_ids, $search_criteria, null, null, $total_count ); + $entries = GFAPI::get_entries( + $form_ids, + $search_criteria, + null, + null); $data = array(); foreach ($entries as $entry) { @@ -167,6 +160,7 @@ class Wiass_REST_Delivery_Process_API { if ($installation_declined){ return wiaas_api_notice('INSTALLATION_DECLINED', 'success'); } + return wiaas_api_notice('INSTALLATION_ACCEPTED', 'success'); } diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-countries.php b/backend/app/plugins/wiaas/includes/class-wiaas-countries.php index 2e42185..a88c14f 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-countries.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-countries.php @@ -62,6 +62,19 @@ class Wiaas_Countries { return ''; } + public static function get_country_code_by_currency($currency) { + + foreach (self::$available_countries as $country) { + + if ($country['currency'] === $currency) { + + return $country['code']; + } + } + + return null; + } + /** * Registers product taxonomy for avaiable countries */ diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php index 2430b76..3155f2f 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php @@ -22,7 +22,8 @@ class Wiaas_DB_Update { '20191019014650' => 'wiaas_db_update_add_product_properties_ui_fields', '20181019064450' => 'wiaas_db_update_add_bundle_properties_ui_field', '20191020014650' => 'wiaas_create_organization_roles_capabilities', - '20191030162450' => 'wiaas_db_update_update_supplier_order_capabilities' + '20191030162450' => 'wiaas_db_update_update_supplier_order_capabilities', + '20191031162450' => 'update_delivery_forms' ); public static function execute() { 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 ddec2e9..5ba59d4 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php @@ -27,24 +27,58 @@ class Wiaas_Delivery_Process { * */ private static function _register_delivery_process() { - require_once( 'delivery-process/class-wiaas-delivery-process-step.php' ); - require_once( 'delivery-process/class-wiaas-delivery-process-addon.php' ); require_once( 'delivery-process/class-wiaas-delivery-process-action.php' ); + require_once( 'delivery-process/class-wiaas-delivery-process-step-assignee.php' ); + require_once( 'delivery-process/class-wiaas-delivery-process-step.php' ); // order fields require_once( 'delivery-process/class-wiaas-order-fields.php' ); require_once( 'delivery-process/class-wiaas-field-order-number.php' ); - require_once( 'delivery-process/class-wiaas-field-order-bundle-select.php' ); - require_once( 'delivery-process/class-wiaas-field-order-supplier-select.php' ); + require_once( 'delivery-process/class-wiaas-field-order-bundle.php' ); + require_once( 'delivery-process/class-wiaas-field-order-installation-select.php' ); require_once( 'delivery-process/class-wiaas-field-order-bundle-document.php' ); + require_once( 'delivery-process/class-wiaas-field-order-document.php' ); Gravity_Flow_Steps::register( new Wiaas_Delivery_Process_Step() ); GFAddOn::register( 'Wiaas_Delivery_Process_Addon' ); } + + public static function create_delivery_process_for_order($order_id, $process_id) { + + $process_form = null; + $process_form = GFAPI::get_form($process_id); + + if( $process_form ) { + + $new_process_entry = array( + 'wiaas_delivery_order_id' => $order_id, + 'form_id' => $process_id, + ); + + $order_fields = GFCommon::get_fields_by_type($process_form, array('wiaas_order')); + + + if (! empty($order_fields)) { + + $order_field = $order_fields[0]; + + $new_process_entry[$order_field['id']] = $order_id; + } + + $process_entry_id = GFAPI::add_entry( $new_process_entry ); + + update_post_meta($order_id, 'wiaas_delivery_process_id', $process_id); + update_post_meta($order_id, 'wiaas_delivery_process_entry_id', $process_entry_id); + + return $process_entry_id; + } + return false; + } + /** * Maybe complete parent order for completed delivery process * @param $entry_id @@ -147,7 +181,7 @@ class Wiaas_Delivery_Process { return $data; } - public static function update_customer_acceptance_status($order_id,$status, $reason) { + public static function update_customer_acceptance_status($order_id, $status, $reason) { $delivery_process_entry = self::get_order_delivery_process_entry($order_id); @@ -228,10 +262,12 @@ class Wiaas_Delivery_Process { public static function get_order_delivery_process_entry($order_id) { $order = wc_get_order($order_id); + $process_entry_id = $order->get_meta('wiaas_delivery_process_entry_id', true); - if (!isset($process_entry_id)) { - return array(); + if (empty($process_entry_id)) { + + return array(); } return GFAPI::get_entry($process_entry_id); @@ -246,7 +282,7 @@ class Wiaas_Delivery_Process { */ public static function get_order_delivery_process($order_id) { - $process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id'); + $process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id', true); if (empty($process_entry_id)) { return null; @@ -263,7 +299,22 @@ class Wiaas_Delivery_Process { $delivery_process = array( 'id' => $process_form['id'], 'name' => $process_form['title'], - 'steps' => array() + 'steps' => array( + array( + 'short_desc' => 'Order placed', + 'status' => 'complete', + 'order_id' => $order_id, + 'process_id' => $process_entry_id, + 'step_id' => -1, + ), + array( + 'short_desc' => 'Assign process', + 'status' => 'complete', + 'order_id' => $order_id, + 'process_id' => $process_entry_id, + 'step_id' => 0, + ) + ) ); $current_step = $api->get_current_step($process_instance); @@ -302,37 +353,3 @@ class Wiaas_Delivery_Process { } add_action( 'gravityflow_loaded', array('Wiaas_Delivery_Process', 'init') ); - - -add_filter( 'gform_notification', 'rw_notification_attachments', 10, 3 ); -function rw_notification_attachments( $notification, $form, $entry ) { - - $fileupload_fields = GFAPI::get_fields_by_type( $form, array( 'fileupload' ) , true); - - if ( ! is_array( $fileupload_fields ) ) { - return $notification; - } - - $notification['attachments'] = rgar( $notification, 'attachments', array() ); - $upload_root = RGFormsModel::get_upload_root(); - - foreach( $fileupload_fields as $field ) { - - $url = rgar( $entry, $field->id ); - - if ( empty( $url ) ) { - continue; - } elseif ( $field->multipleFiles ) { - $uploaded_files = json_decode( stripslashes( $url ), true ); - foreach ( $uploaded_files as $uploaded_file ) { - $attachment = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $uploaded_file ); - $notification['attachments'][] = $attachment; - } - } else { - $attachment = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $url ); - $notification['attachments'][] = $attachment; - } - } - - return $notification; -} diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json index 593b25c..dc92517 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json +++ b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json @@ -1 +1 @@ -{"0":{"title":"ACTION: Supplier Configuration Approval","description":"Bundle configuration for supplier.","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","allowsPrepopulate":true,"id":3,"label":"Order","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"administrative","inputs":null,"formId":"11","description":"","inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_supplier","id":7,"label":"Supplier","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"11","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_bundle","id":8,"label":"Bundle","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"11","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"fileupload","id":10,"label":"File","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"11","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","displayOnly":"","enablePrice":""},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"config","id":9,"label":"Config Document","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"11","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":"11","useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"gravityflowparentchild":{"parent_form_1":"0","parent_form_3":"0","parent_form_4":"0","parent_form_5":"1","parent_form_6":"0","parent_form_7":"0","parent_form_11":"0","parent_form_12":"0"},"wiaas_delivery":{"wiaas_delivery_form_type":"step","wiaas_order_mappings":{"3":"","4":"","5":"","6":""}},"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"","automatic_action_entries_enabled":"0","automatic_action_entries_type":"single"},"is_active":"1","date_created":"2018-10-27 22:13:02","is_trash":"0","notifications":[{"id":"5bd4e2eeaef5b","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"confirmations":[{"id":"5bd4e2eeaf4c1","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"feeds":{"gravityflow":[{"id":"28","form_id":"11","is_active":"1","feed_order":"0","meta":{"step_name":"Approve Supplier Configuration","description":"Supplier must review and approve configuration","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|supplier"],"routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"1","instructionsValue":"Instructions<\/strong>: please review the values in the fields below and click on the Approve<\/span><\/strong> or Reject<\/span><\/strong> button\r\n\r\n ","display_fields_mode":"all_fields","assignee_notification_enabled":"1","assignee_notification_from_name":"Wiaas","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"Approve Configuration","assignee_notification_message":"A new entry is pending your approval. Please check your Workflow Inbox.\r\n\r\n \r\n\r\n{workflow_entry_link}\r\n\r\n{all_fields}\r\n\r\n ","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"1","rejection_notification_type":"select","rejection_notification_users":["role|administrator"],"rejection_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"{Supplier:5}","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"1","approval_notification_type":"select","approval_notification_users":["role|administrator"],"approval_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"{Supplier:5}","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"{Order:3} : Supplier approved configuration for {Bundle:6}","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"40","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"40","destination_approved":"complete"},"addon_slug":"gravityflow","event_type":null},{"id":"40","form_id":"11","is_active":"1","feed_order":"0","meta":{"step_name":"Update Rejected Supplier Configuration","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"editable_fields":["9"],"routing":"","assignee_policy":"any","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"{Supplier:7}","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"{workflow_entry_url}\r\n\r\n{workflow_entry_url}\r\n\r\n \r\n\r\n ","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"28"},"addon_slug":"gravityflow","event_type":null}]}},"1":{"title":"ACTION: Validate Customer Questionnaire","description":"Bundle configuration for supplier.","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":12,"label":"Order Number","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"0","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_bundle","id":13,"label":"Bundle","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"bundle_id","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","failed_validation":"","productField":"","displayOnly":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"enablePrice":""},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"order_questionaire","id":17,"label":"Questionnaire Document","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"workflow_discussion","id":9,"label":"Notes","adminLabel":"","isRequired":false,"size":"small","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","form_id":"","useRichTextEditor":false,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":"12","useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"gravityflowparentchild":{"parent_form_1":"0","parent_form_3":"0","parent_form_4":"0","parent_form_5":"1","parent_form_6":"0","parent_form_7":"0","parent_form_11":"0","parent_form_12":"0"},"wiaas_delivery":{"delivery_form_type":"action","automatic_step_entries_enabled":"1","automatic_action_entries_type":"bundle"},"is_active":"1","date_created":"2018-10-28 15:09:59","is_trash":"0","wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"validate-questionnaire","automatic_action_entries_enabled":"1","automatic_action_entries_type":"bundle"},"confirmations":[{"id":"5bd4e2eeaf4c1","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd4e2eeaef5b","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"27","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Approve configuration info","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":{"conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"12","operator":"isnot","value":"0"}]}},"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"1","instructionsValue":"Review customer configuration {Questionnaire Document:17} for {Bundle:13}","display_fields_mode":"selected_fields","display_fields_selected":["13","17","9"],"assignee_notification_enabled":"1","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry is pending your approval. Please check your Workflow Inbox.\r\n\r\n{all_fields}\r\n\r\n \r\n\r\n{workflow_entry_link}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"1","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"Wiaas","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"{Order:3} : Bundle questionnaire has been rejected {Bundle:6}","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"1","approval_notification_type":"select","approval_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"Wiaas","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"{Order:3} : Bundle questionnaire has been approved","approval_notification_message":" \r\n\r\n{all_fields}\r\n\r\nEntry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"29","note_mode":"hidden","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"44","destination_approved":"complete"},"addon_slug":"gravityflow","event_type":null},{"id":"44","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Add reject reason","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"editable_fields":["9"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry requires your input.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"29","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Update bundle configuration","description":"Since administrator rejected questionnaire provided by customer, he needs to update it and upload it again.","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|customer"],"editable_fields":["17","9"],"routing":"","assignee_policy":"any","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"1","instructionsValue":"Please download and update questionnaire.","display_fields_mode":"selected_fields","display_fields_selected":["12","13","17","9"],"default_status":"submit_buttons","note_mode":"hidden","assignee_notification_enabled":"1","assignee_notification_from_name":"Wiaas","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order:3}: Questionnaire rejected for {Bundle:6}","assignee_notification_message":"A new entry requires your input.\r\n\r\n{workflow_entry_link}\r\n\r\n{all_fields}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"1","complete_notification_type":"select","complete_notification_users":["role|administrator"],"complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"{user:display_name}","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"{Order:3}: Questionnaire updated for {Bundle:6}","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"1","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"27"},"addon_slug":"gravityflow","event_type":null}]}},"2":{"title":"ACTION: Complete Installation And Upload Test Protocol","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order ID","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_supplier","id":4,"label":"Installation Company","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"fileupload","id":6,"label":"Installation protocol","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":14,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery":{"wiaas_delivery_form_type":"step"},"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"","automatic_action_entries_enabled":"1","automatic_action_entries_type":"single"},"notifications":[{"id":"5bd66ca932e4a","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"confirmations":[{"id":"5bd66ca93384b","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"feeds":{"gravityflow":[{"id":"34","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Installation completed confirmation","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|supplier"],"routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"1","assignee_notification_from_name":"Wiaas","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"Confirm if installation is completed.\r\n\r\n{workflow_entry_link}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"35","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"complete","destination_approved":"35"},"addon_slug":"gravityflow","event_type":null},{"id":"35","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Upload installation protocol","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|supplier"],"editable_fields":["6"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"1","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"Wiaas","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"Upload installation test protocol for {Order ID:1}","assignee_notification_message":"A new entry requires your input.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"1","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"complete"},"addon_slug":"gravityflow","event_type":null}]}},"3":{"title":"ACTION: Customer Acceptance","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order Number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"fileupload","id":2,"label":"Acceptance Document","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":true,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"date","id":6,"label":"Expiration Date","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"dateType":"datepicker","calendarIconType":"none","formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","calendarIconUrl":"","dateFormat":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":""},{"type":"radio","id":4,"label":"Acceptance","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"choices":[{"text":"Not Accepted","value":"pending","isSelected":false,"price":""},{"text":"Accepted","value":"accept","isSelected":false,"price":""},{"text":"Declined","value":"decline","isSelected":false,"price":""}],"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","conditionalLogic":"","productField":"","enableOtherChoice":"","enablePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"enableChoiceValue":true,"displayOnly":""},{"type":"textarea","id":3,"label":"Decline Reason","adminLabel":"","isRequired":false,"size":"small","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_decline_reason","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"4","operator":"is","value":"decline"}]},"productField":"","form_id":"","useRichTextEditor":false,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":16,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"customer-acceptance","automatic_action_entries_enabled":"1","automatic_action_entries_type":"single"},"confirmations":[{"id":"5bd8668e50997","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd8668e50471","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"41","form_id":"16","is_active":"1","feed_order":"0","meta":{"step_name":"Upload Acceptance Document","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","schedule_date_field":"6","type":"select","assignees":["role|customer"],"editable_fields":["2"],"routing":"","assignee_policy":"all","conditional_logic_editable_fields_enabled":"1","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry requires your input.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","expiration_date_field":"6","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"43","form_id":"16","is_active":"1","feed_order":"0","meta":{"step_name":"Accept installation","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","schedule_date_field":"6","type":"select","assignees":["role|customer"],"routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"0","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry is pending your approval. Please check your Workflow Inbox.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"41","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","expiration_date_field":"6","status_expiration":"rejected","destination_expired":"next","destination_rejected":"41","destination_approved":"complete"},"addon_slug":"gravityflow","event_type":null}]}},"version":"2.3.2"} \ No newline at end of file +{"0":{"title":"ACTION: Validate Customer Questionnaire","description":"Bundle configuration for supplier.","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":12,"label":"Order Number","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"0","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"workflow_user","id":18,"label":"Customer User:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"choices":[{"value":4,"text":"AA aa"},{"value":2,"text":"Commercial User"},{"value":3,"text":"Customer User"},{"value":6,"text":"Supplier 2 Jonson"},{"value":5,"text":"Supplier1 Jonson"},{"value":1,"text":"wpUser"}],"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"gravityflowUsersRoleFilter":""},{"type":"wiaas_order_bundle","id":13,"label":"Bundle","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"bundle_id","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","productField":"","displayOnly":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"enablePrice":""},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"order_questionaire","id":17,"label":"Questionnaire Document","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"workflow_discussion","id":9,"label":"Notes","adminLabel":"","isRequired":false,"size":"small","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","form_id":"","useRichTextEditor":false,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":"12","useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"gravityflowparentchild":{"parent_form_1":"0","parent_form_3":"0","parent_form_4":"0","parent_form_5":"1","parent_form_6":"0","parent_form_7":"0","parent_form_11":"0","parent_form_12":"0"},"wiaas_delivery":{"delivery_form_type":"action","automatic_step_entries_enabled":"1","automatic_action_entries_type":"bundle"},"is_active":"1","date_created":"2018-10-28 15:09:59","is_trash":"0","wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"validate-questionnaire","automatic_action_entries_enabled":"1","automatic_action_entries_type":"bundle"},"confirmations":[{"id":"5bd4e2eeaf4c1","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd4e2eeaef5b","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"27","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Approve configuration info","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":{"conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"12","operator":"isnot","value":"0"}]}},"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"1","instructionsValue":"Review customer configuration for {Bundle:13}<\/strong>","display_fields_mode":"selected_fields","display_fields_selected":["13","17","9"],"assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Marketplace","assignee_notification_from_email":"info@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order Number:12} : Validate Customer Configuration","assignee_notification_message":"\u00a0{Order Number:12}<\/strong>\r\n\r\nGo to {workflow_entry_link} to validate customer configuration for\u00a0 {Bundle:13} .\r\n\r\n ","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"1","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"Wiaas","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"{Order:3} : Bundle questionnaire has been rejected {Bundle:6}","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"1","approval_notification_type":"select","approval_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"Wiaas","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"{Order:3} : Bundle questionnaire has been approved","approval_notification_message":" \r\n\r\n{all_fields}\r\n\r\nEntry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"44","note_mode":"hidden","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"44","destination_approved":"complete"},"addon_slug":"gravityflow","event_type":null},{"id":"44","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Add reject reason","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"editable_fields":["9"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"1","highlight_editable_fields_class":"green-background","instructionsEnable":"1","instructionsValue":"Enter reason why customer configuration has been declined.","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"hidden","assignee_notification_enabled":"0","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry requires your input.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"93","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Update configuration info","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["assignee_user_field|18"],"editable_fields":["17"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Marketplace","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order Number:12} : Update configuration info","assignee_notification_message":"{Order Number:12}<\/strong>\r\n\r\nConfiguration info has bee rejected for\u00a0{Bundle:13}.\r\n\r\nPlease login to your interface, review and make necessary changes.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"wiaas_order_role|customer","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"wiaas_order_role|customer","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"27"},"addon_slug":"gravityflow","event_type":null}]}},"1":{"title":"ACTION: Complete Installation And Upload Test Protocol","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order ID","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_bundle","id":8,"label":"Bundle:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[{"value":"0","text":"Select bundle ..."}],"conditionalLogic":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":"","enableChoiceValue":true},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"install_guide","id":13,"label":"Installation Guide Documents:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"fileupload","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":true,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_installation_select","id":11,"label":"Installation Company:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[{"value":"0","text":"Select installation ..."}],"conditionalLogic":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":"","enableChoiceValue":true},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"installation_protocol","id":14,"label":"Installation Protocol Document:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false}],"version":"2.3.2","id":14,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery":{"wiaas_delivery_form_type":"step"},"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"","automatic_action_entries_enabled":"1","automatic_action_entries_type":"bundle"},"confirmations":[{"id":"5bd66ca93384b","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd66ca932e4a","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"80","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Select Installation","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"1","feed_condition_conditional_logic_object":{"conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"11","operator":"is","value":"0"}]}},"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"editable_fields":["11"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"1","highlight_editable_fields_class":"green-background","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"selected_fields","display_fields_selected":["1","8","13"],"default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Marketplace","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order ID:1} : Select installation company for {Bundle::8}","assignee_notification_message":"Select installation company for\u00a0{Bundle::8} in order\u00a0{Order ID:1}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"wiaas_order_role|customer","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"wiaas_order_role|customer","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"34","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Installation completed confirmation","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["assignee_field|11"],"routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Market","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order ID:1} : Confirm installation","assignee_notification_message":"Please go to {workflow_entry_link} to\u00a0confirm that installation is completed for order\u00a0{Order ID:1}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"35","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"complete","destination_approved":"35"},"addon_slug":"gravityflow","event_type":null},{"id":"35","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Upload installation protocol for order","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["assignee_field|11"],"editable_fields":["14"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"1","highlight_editable_fields_class":"green-background","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Market","assignee_notification_from_email":" confirm that installation is completed for order\u00a0{Order ID:1}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"Upload installation test protocol for {Order ID:1}","assignee_notification_message":"{Order ID:1}<\/strong>\r\n\r\nGo to {workflow_entry_link} to upload installation test protocol for order\u00a0{Order ID:1}\r\n\r\n ","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"complete"},"addon_slug":"gravityflow","event_type":null}]}},"2":{"title":"ACTION: Customer Acceptance","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order Number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"workflow_user","id":10,"label":"Customer User:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"choices":[{"value":2,"text":"Commercial User"},{"value":3,"text":"Customer User"}],"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":"","gravityflowUsersRoleFilter":"customer"},{"type":"wiaas_order_document","wiaasDocTypeFilter":"customer_acceptance","id":9,"label":"Acceptance Document:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"fileupload","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":true,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"date","id":6,"label":"Expiration Date","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"dateType":"datepicker","calendarIconType":"none","formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","calendarIconUrl":"","dateFormat":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":""},{"type":"radio","id":4,"label":"Acceptance","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"choices":[{"text":"Not Accepted","value":"pending","isSelected":false,"price":""},{"text":"Accepted","value":"accept","isSelected":false,"price":""},{"text":"Declined","value":"decline","isSelected":false,"price":""}],"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","conditionalLogic":"","productField":"","enableOtherChoice":"","enablePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"enableChoiceValue":true,"displayOnly":""},{"type":"textarea","id":3,"label":"Decline Reason","adminLabel":"","isRequired":false,"size":"small","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_decline_reason","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"4","operator":"is","value":"decline"}]},"productField":"","form_id":"","useRichTextEditor":false,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":16,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"customer-acceptance","automatic_action_entries_enabled":"1","automatic_action_entries_type":"single"},"confirmations":[{"id":"5bd8668e50997","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd8668e50471","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"94","form_id":"16","is_active":"1","feed_order":"0","meta":{"step_name":"Upload Acceptance Document","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","schedule_date_field":"6","type":"select","assignees":["assignee_user_field|10"],"editable_fields":["9","4","3"],"routing":"","assignee_policy":"any","conditional_logic_editable_fields_enabled":"1","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Market","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order Number:1}: Upload acceptance document","assignee_notification_message":"{Order Number:1}<\/strong>\r\n\r\nPlease go to your account and upload acceptance document.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","expiration_date_field":"6","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"95","form_id":"16","is_active":"1","feed_order":"0","meta":{"step_name":"Accept installation","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","schedule_date_field":"6","type":"select","assignees":["assignee_user_field|10"],"routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Market","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order Number:1}: Accept installation","assignee_notification_message":"Login to your account and accept installation.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"41","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","expiration_date_field":"6","status_expiration":"rejected","destination_expired":"next","destination_rejected":"complete","destination_approved":"next"},"addon_slug":"gravityflow","event_type":null}]}},"version":"2.3.2"} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-normal-delivery-form.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-normal-delivery-form.json deleted file mode 100644 index d1685a1..0000000 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-normal-delivery-form.json +++ /dev/null @@ -1,425 +0,0 @@ -{ - "0": { - "title": "DELIVERY PROCESS: Normal Delivery", - "description": "Normal delivery process", - "labelPlacement": "top_label", - "descriptionPlacement": "below", - "button": { - "type": "text", - "text": "Submit", - "imageUrl": "" - }, - "fields": [ - { - "type": "wiaas_order", - "id": 3, - "label": "Order", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "formId": 5, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "enableCalculation": false, - "numberFormat": "decimal_dot", - "rangeMin": "", - "rangeMax": "", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "", - "enablePrice": "" - } - ], - "version": "2.3.2", - "id": 5, - "useCurrentUserAsAuthor": true, - "postContentTemplateEnabled": false, - "postTitleTemplateEnabled": false, - "postTitleTemplate": "", - "postContentTemplate": "", - "lastPageButton": null, - "pagination": null, - "firstPageCssClass": null, - "is_active": "1", - "date_created": "2018-10-24 18:12:10", - "is_trash": "0", - "notifications": [ - { - "id": "5b5f7ae4baced", - "to": "{admin_email}", - "name": "Admin Notification", - "event": "form_submission", - "toType": "email", - "subject": "New submission from {form_title}", - "message": "{all_fields}", - "isActive": false - } - ], - "confirmations": [ - { - "id": "5b5f7ae4bb79e", - "name": "Default Confirmation", - "isDefault": true, - "type": "message", - "message": "Thanks for contacting us! We will get in touch with you shortly.", - "url": "", - "pageId": "", - "queryString": "" - } - ], - "wiaas_delivery_process": { - "delivery_form_type": "process", - "delivery_action_code": "", - "automatic_action_entries_enabled": "0", - "automatic_action_entries_type": "single" - }, - "feeds": { - "gravityflow": [ - { - "id": "7", - "form_id": "5", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Validate customer configuration information", - "description": "Review configuration documents uploaded by customer during order creation process.\r\nApprove or reject each document.", - "step_type": "wiaas_delivery_step", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "instructionsEnable": "1", - "instructionsValue": "Review configuration documents uploaded by customer during order creation process.\u00a0 Approve or reject each document.", - "is_visible_to_customer": "1", - "target_form_id": "12", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "26", - "form_id": "5", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Procure components", - "description": "", - "step_type": "wiaas_delivery_step", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#c7e8d6", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "instructionsEnable": "0", - "instructionsValue": "", - "is_visible_to_customer": "0", - "target_form_id": "11", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "8", - "form_id": "5", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Wait for installation to be scheduled and confirmed", - "description": "Wait for installation to be scheduled and confirmed", - "step_type": "wiaas_delivery_step", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "instructionsEnable": "0", - "instructionsValue": "", - "is_visible_to_customer": "1", - "target_form_id": "", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "9", - "form_id": "5", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Installation", - "description": " Installation", - "step_type": "wiaas_delivery_step", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "instructionsEnable": "0", - "instructionsValue": "", - "is_visible_to_customer": "1", - "target_form_id": "14", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "10", - "form_id": "5", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Customer acceptance", - "description": "Customer acceptance", - "step_type": "wiaas_delivery_step", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "instructionsEnable": "0", - "instructionsValue": "", - "is_visible_to_customer": "1", - "target_form_id": "16", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "11", - "form_id": "5", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Customer training", - "description": "Customer training", - "step_type": "wiaas_delivery_step", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "instructionsEnable": "0", - "instructionsValue": "", - "is_visible_to_customer": "1", - "target_form_id": "", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "12", - "form_id": "5", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Set start\/stop dates for contracts", - "description": "Set start\/stop dates for contracts", - "step_type": "wiaas_delivery_step", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "instructionsEnable": "0", - "instructionsValue": "", - "is_visible_to_customer": "1", - "target_form_id": "", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "36", - "form_id": "5", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Complete delivery", - "description": "", - "step_type": "approval", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "type": "select", - "assignees": [ - "role|administrator" - ], - "routing": [ - { - "assignee": "role|administrator", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "assignee_policy": "all", - "instructionsEnable": "0", - "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", - "display_fields_mode": "all_fields", - "assignee_notification_enabled": "0", - "assignee_notification_from_name": "", - "assignee_notification_from_email": "{admin_email}", - "assignee_notification_reply_to": "", - "assignee_notification_bcc": "", - "assignee_notification_subject": "", - "assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.", - "assignee_notification_disable_autoformat": "0", - "resend_assignee_emailEnable": "0", - "resend_assignee_emailValue": "7", - "resend_assignee_email_repeatEnable": "0", - "resend_assignee_email_repeatValue": "3", - "rejection_notification_enabled": "0", - "rejection_notification_type": "select", - "rejection_notification_routing": [ - { - "assignee": "role|administrator", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "rejection_notification_from_name": "", - "rejection_notification_from_email": "{admin_email}", - "rejection_notification_reply_to": "", - "rejection_notification_bcc": "", - "rejection_notification_subject": "", - "rejection_notification_message": "Entry {entry_id} has been rejected", - "rejection_notification_disable_autoformat": "0", - "approval_notification_enabled": "0", - "approval_notification_type": "select", - "approval_notification_routing": [ - { - "assignee": "role|administrator", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "approval_notification_from_name": "", - "approval_notification_from_email": "{admin_email}", - "approval_notification_reply_to": "", - "approval_notification_bcc": "", - "approval_notification_subject": "", - "approval_notification_message": "Entry {entry_id} has been approved", - "approval_notification_disable_autoformat": "0", - "note_mode": "not_required", - "expiration": "0", - "expiration_type": "delay", - "expiration_date": "", - "expiration_delay_offset": "", - "expiration_delay_unit": "hours", - "expiration_date_field_offset": "0", - "expiration_date_field_offset_unit": "hours", - "expiration_date_field_before_after": "after", - "status_expiration": "rejected", - "destination_expired": "next", - "destination_rejected": "complete", - "destination_approved": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - } - ] - } - }, - "version": "2.3.2" -} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json new file mode 100644 index 0000000..f550ca4 --- /dev/null +++ b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json @@ -0,0 +1 @@ +{"0":{"title":"DELIVERY PROCESS EXAMPLE: Copy and set to active to create new delivery process","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":24,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":24,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery_process":{"delivery_form_type":"process","delivery_country":"se"},"notifications":[{"id":"5bdb1c7c26952","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"confirmations":[{"id":"5bdb1c7c26da9","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"feeds":{"gravityflow":[{"id":"83","form_id":"24","is_active":"1","feed_order":"0","meta":{"step_name":"Delivery Step Placeholder (Change this to start creating workflow)","description":"","step_type":"wiaas_delivery_step","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","instructionsEnable":"0","instructionsValue":"","is_visible_to_customer":"1","target_form_id":"","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"84","form_id":"24","is_active":"1","feed_order":"0","meta":{"step_name":"Complete","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"routing":[{"assignee":"user_id|1","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"0","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry is pending your approval. Please check your Workflow Inbox.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"user_id|1","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"user_id|1","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"complete","destination_approved":"next"},"addon_slug":"gravityflow","event_type":null}]}},"version":"2.3.2"} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php index 97cc1f1..2ba2d56 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php +++ b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php @@ -79,7 +79,7 @@ function wiaas_create_organization_roles_capabilities() { } -function import_delivery_action_forms() { +function update_delivery_forms() { $forms = GFAPI::get_forms(); @@ -89,5 +89,5 @@ function import_delivery_action_forms() { GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-action-forms.json"); - //GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-process-normal-delivery-form.json"); + GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-process-sample-form.json"); } \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php index e1d1683..0e39e60 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php @@ -1,7 +1,17 @@ target_form_id)) { @@ -16,11 +33,18 @@ class Wiaas_Delivery_Process_Action { return null; } - $action_form = GFAPI::get_form($step->target_form_id); - - return $action_form; + return GFAPI::get_form($step->target_form_id); } + /** + * Get action code for delivery process step form + * + * Action code is used for implementing specific logic for step form + * + * @param Wiaas_Delivery_Process_Step $step + * + * @return string + */ public static function get_process_step_action_form_action_code($step) { $action_form = self::get_process_step_action_form($step); @@ -35,16 +59,35 @@ class Wiaas_Delivery_Process_Action { return empty($delivery_settings) ? 'manual' : $delivery_settings['delivery_action_code']; } + /** + * Check if delivery process step has customer acceptance action form + * + * @param Wiaas_Delivery_Process_Step $step + * + * @return bool + */ public static function process_step_has_customer_acceptance_action($step) { return self::get_process_step_action_form_action_code($step) === 'customer-acceptance'; } + /** + * Check if delivery process step has customer validate action form + * + * @param Wiaas_Delivery_Process_Step $step + * + * @return bool + */ public static function process_step_has_customer_validate_questionnaires_action($step) { return self::get_process_step_action_form_action_code($step) === 'validate-questionnaire'; } + /** + * @param Wiaas_Delivery_Process_Step $step + * + * @return array|WP_Error + */ public static function get_process_step_action_entries(Wiaas_Delivery_Process_Step $step) { $action_form = self::get_process_step_action_form($step); @@ -67,6 +110,11 @@ class Wiaas_Delivery_Process_Action { return GFAPI::get_entries( $action_form, $search_criteria, $sorting ); } + /** + * Retrieve forms that will be used as possible action forms + * + * @return array + */ public static function get_action_forms() { $forms = GFAPI::get_forms(); @@ -86,9 +134,14 @@ class Wiaas_Delivery_Process_Action { return $action_forms; } - public static function complete_action_step($action_id) { + /** + * Complete current workflow step for action form + * + * @param int $action_entry_id + */ + public static function complete_action_step($action_entry_id) { - $action_entry = GFAPI::get_entry($action_id); + $action_entry = GFAPI::get_entry($action_entry_id); $action_form = GFAPI::get_form($action_entry['form_id']); @@ -111,6 +164,11 @@ class Wiaas_Delivery_Process_Action { gravity_flow()->process_workflow($action_form, $action_entry['id']); } + /** + * Upload customer questionnaire document + * + * @param int $action_entry_id + */ public static function upload_customer_questionnaire($action_entry_id) { $action_entry = GFAPI::get_entry($action_entry_id); @@ -125,56 +183,34 @@ class Wiaas_Delivery_Process_Action { GFAPI::update_entry($action_entry); } - public static function get_customer_acceptance_action_data($action_id) { - - $action_entry = GFAPI::get_entry($action_id); + /** + * Check if customer uploaded acceptance document + * + * @param int $action_entry_id + * + * @return bool + */ + public static function is_customer_acceptance_uploaded($action_entry_id) { + $action_entry = GFAPI::get_entry($action_entry_id); $action_form = GFAPI::get_form($action_entry['form_id']); - $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'fileupload')[0]; - $acceptance_field = GFCommon::get_fields_by_type($action_form, 'radio')[0]; - $decline_reason_field = GFCommon::get_fields_by_type($action_form, 'textarea')[0]; - $expiration_date_field = GFCommon::get_fields_by_type($action_form, 'date')[0]; - - $file_paths = json_decode($action_entry[$acceptance_documents_field->id]); - - $documents = array(); - - foreach ($file_paths as $file_path) { - - $info = pathinfo( $file_path ); - - $documents[] = array( - 'name' => $info['basename'], - 'url' => $acceptance_documents_field->get_download_url( $file_path, true ) - ); - } - - - return array( - 'action_id' => $action_entry['id'], - 'documents' => $documents, - 'expiration' => $action_entry[$expiration_date_field->id], - 'decline_reason' => $action_entry[$decline_reason_field->id], - 'status' => ($action_entry[$acceptance_field->id] === 'accept') ? 1 : -1 - ); - } - - public static function is_customer_acceptance_uploaded($action_id) { - - $action_entry = GFAPI::get_entry($action_id); - $action_form = GFAPI::get_form($action_entry['form_id']); - - - $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'fileupload')[0]; + $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'wiaas_order_document')[0]; return ! empty( $action_entry[$acceptance_documents_field->id]); } - public static function update_customer_acceptance_status($action_id, $new_status, $reason) { + /** + * Update acceptance status for order + * + * @param int $action_entry_id + * @param $new_status + * @param $reason + */ + public static function update_customer_acceptance_status($action_entry_id, $new_status, $reason) { - $action_entry = GFAPI::get_entry($action_id); + $action_entry = GFAPI::get_entry($action_entry_id); $action_form = GFAPI::get_form($action_entry['form_id']); $acceptance_field = GFCommon::get_fields_by_type($action_form, 'radio')[0]; @@ -184,14 +220,28 @@ class Wiaas_Delivery_Process_Action { $action_entry[$decline_reason_field->id] = $reason; GFAPI::update_entry($action_entry); + + $workflow = new Gravity_Flow_API($action_form['id']); + $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']); } - public static function upload_customer_acceptance_document($action_id) { + /** + * Upload customer acceptance document for order + * + * @param int $action_entry_id + * + * @return bool + */ + public static function upload_customer_acceptance_document($action_entry_id) { - $action_entry = GFAPI::get_entry($action_id); + $action_entry = GFAPI::get_entry($action_entry_id); $action_form = GFAPI::get_form($action_entry['form_id']); - $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'fileupload')[0]; + $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'wiaas_order_document')[0]; $old_value = $action_entry[$acceptance_documents_field->id]; @@ -220,9 +270,69 @@ class Wiaas_Delivery_Process_Action { return ! is_wp_error($result); } - public static function get_customer_validate_questionnaires_action_data($action_id) { + /** + * Collect customer acceptance action data + * + * @param int $action_entry_id + * + * @return array + */ + public static function get_customer_acceptance_action_data($action_entry_id) { - $action_entry = GFAPI::get_entry($action_id); + $action_entry = GFAPI::get_entry($action_entry_id); + + $action_form = GFAPI::get_form($action_entry['form_id']); + + + $acceptance_documents_field = GFCommon::get_fields_by_type($action_form, 'wiaas_order_document')[0]; + $acceptance_field = GFCommon::get_fields_by_type($action_form, 'radio')[0]; + $decline_reason_field = GFCommon::get_fields_by_type($action_form, 'textarea')[0]; + $expiration_date_field = GFCommon::get_fields_by_type($action_form, 'date')[0]; + + $file_paths = json_decode($action_entry[$acceptance_documents_field->id]); + + error_log($action_entry[$acceptance_documents_field->id]); + + $documents = array(); + + foreach ($file_paths as $file_path) { + + $info = pathinfo( $file_path ); + + $documents[] = array( + 'name' => $info['basename'], + 'url' => $acceptance_documents_field->get_download_url( $file_path, true ) + ); + } + + $status = 0; + if ($action_entry[$acceptance_field->id] === 'accept') { + $status = 1; + } + + if ($action_entry[$acceptance_field->id] === 'decline') { + $status = -1; + } + + return array( + 'action_id' => $action_entry['id'], + 'documents' => $documents, + 'expiration' => $action_entry[$expiration_date_field->id], + 'decline_reason' => $action_entry[$decline_reason_field->id], + 'status' => $status + ); + } + + /** + * Get customer validate questionnaires action data + * + * @param int $action_entry_id + * + * @return array|null + */ + public static function get_customer_validate_questionnaires_action_data($action_entry_id) { + + $action_entry = GFAPI::get_entry($action_entry_id); $action_form = GFAPI::get_form($action_entry['form_id']); @@ -240,9 +350,8 @@ class Wiaas_Delivery_Process_Action { return null; } - $bundle_item = $order->get_item($bundle_item_id); - $document_field = GFCommon::get_fields_by_type(GFAPI::get_form($action_entry['form_id']), 'wiaas_order_bundle_document')[0]; + $document_field = GFCommon::get_fields_by_type($action_form, 'wiaas_order_bundle_document')[0]; $file_path = $action_entry[$document_field->id]; $info = pathinfo( $action_entry[$document_field->id] ); @@ -260,25 +369,29 @@ class Wiaas_Delivery_Process_Action { if (is_array($discussion_items)) { foreach ($discussion_items as $item) { - $formated_comments[] = $discussion_field->format_discussion_item( $item, 'text', $action_id ); + $formated_comments[] = $discussion_field->format_discussion_item( $item, 'text', $action_entry_id ); } } $action_workflow_api = new Gravity_Flow_API($action_form['id']); $action_step = $action_workflow_api->get_current_step($action_entry); + + + // if completed it means that document got validated $status = 'validated'; if (! empty($action_step)) { - if ($action_step->get_type() === 'approval') { - - $status = 'not-validated'; - } - - if ($action_step->get_type() === 'user_input') { + $is_assignee = $action_step->is_assignee($action_step->get_current_assignee_key()); + if ($is_assignee) { + // if customer is assignee it means it is his turn to upload changed version of document + // which means it was rejected $status = 'invalid'; + } else { + // if customer is not assignee it means administrator is still reviewing document + $status = 'not-validated'; } } diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php index c412498..34f8e6d 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-addon.php @@ -32,18 +32,17 @@ class Wiaas_Delivery_Process_Addon extends Gravity_Flow_Extension { add_filter('gravityflow_assignee_choices', array ($this, 'add_orders_assignee_choices')); - add_filter('gravityflow_admin_actions_workflow_detail', array ($this, 'filter_process_send_to_step_options'), 10, 5); - add_filter('gravityflow_step_assignees', array ($this, 'maybe_assign_organization_to_step'), 10, 2); } - public function init_ajax() { - parent::init_ajax(); - - // this AJAX action is here and not in /admin folder because of Gravity Forms extension logic - add_action( 'wp_ajax_wiaas_delivery_get_form', array( $this, 'ajax_get_form' ) ); - } - + /** + * Handle organization assignee for step (Map users from organization as assignees to step) + * + * @param $assignees + * @param Gravity_Flow_Step $step + * + * @return array + */ public function maybe_assign_organization_to_step($assignees, Gravity_Flow_Step $step) { $mapped_assignees = array(); @@ -78,46 +77,6 @@ class Wiaas_Delivery_Process_Addon extends Gravity_Flow_Extension { return $mapped_assignees; } - public function filter_process_send_to_step_options($admin_actions, $current_step, $steps, $form, $entry) { - - $delivery_process_actions = array(); - - if ( $current_step ) { - - $previous_step_id = null; - // get previous step id for current step - foreach ($steps as $index => $step) { - - $next_step = gravity_flow()->get_next_step($step, $entry, $form); - - if ($next_step && $next_step->get_id() === $current_step->get_id()) { - - $previous_step_id = $step->get_id(); - } - } - - if (! empty($previous_step_id)) { - - $delivery_process_actions[] = array( - 'label' => esc_html__( 'Previous step', 'wiaas' ), - 'value' => 'send_to_step|' . $previous_step_id - ); - } - - // get next step id for current step - $next_step = gravity_flow()->get_next_step($current_step, $entry, $form); - if ($next_step) { - - $delivery_process_actions[] = array( - 'label' => esc_html__( 'Next step', 'wiaas' ), - 'value' => 'send_to_step|' . $next_step->get_id() - ); - } - } - - return $delivery_process_actions; - } - public function allow_only_administrator_to_be_assigned_to_step($args) { @@ -133,34 +92,6 @@ class Wiaas_Delivery_Process_Addon extends Gravity_Flow_Extension { return $choices; } - public function ajax_get_form() { - - $form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; - - $field_id = sanitize_text_field( rgget( 'field_id' ) ); - - $entry_id = absint( rgget( 'entry_id' ) ); - - $field_values = array( $field_id => $entry_id ); - - gravity_form_enqueue_scripts( $form_id, true ); - - $is_admin = isset( $_GET['is_admin'] ); - if ( $is_admin ) { - wp_enqueue_style( 'common', site_url() . '/wp-admin/css/common.css', array(), $this->_version ); - } else { - wp_enqueue_style( 'common', get_stylesheet_directory_uri() . '/style.css', array(), $this->_version ); - } - - wp_print_styles(); - wp_print_scripts(); - // Render an AJAX-enabled form. - // https://www.gravityhelp.com/documentation/article/embedding-a-form/#function-call - $html = gravity_form( $form_id, true, false, false, $field_values, true, 1, false ); - printf( "
    %s
    ", $html ); - die(); - } - /** * Extends Gravity Form entry metadata with 'wiaas_delivery_process_id' * diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step-assignee.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step-assignee.php new file mode 100644 index 0000000..2debd3b --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step-assignee.php @@ -0,0 +1,189 @@ + __( 'Order', 'wiaas' ), + 'choices' => array( + array( + 'value' => 'role|administrator', // allow global administrator role here since it is only one + 'label' => __('Administrator', 'wiaas') + ) + ), + ) + ); + + // add administrator users + $args = array( + 'number' => 1000, + 'orderby' => 'display_name', + 'role' => 'administrator' + ); + $accounts = get_users( $args ); + $account_choices = array(); + foreach ( $accounts as $account ) { + $account_choices[] = array( 'value' => 'user_id|' . $account->ID, 'label' => $account->display_name ); + } + + $choices[] = array( + 'label' => __( 'Users', 'gravityflow' ), + 'choices' => $account_choices, + ); + + // append field choices + foreach ($old_choices as $old_choice) { + + if ($old_choice['label'] === 'Fields') { + + $choices[] = $old_choice; + break; + } + } + + return $choices; + } + + + /** + * Handle order level assignees for delivery process step + * + * @param $assignees + * + * @param Gravity_Flow_Step $step + * + * @return array + */ + public static function maybe_handle_order_organization_assignees($assignees, Gravity_Flow_Step $step) { + + $mapped_assignees = array(); + + $order_id = self::get_order_id_for_step($step); + + $order = wc_get_order($order_id); + + foreach ($assignees as $assignee) { + + if (strpos($assignee->get_type(), 'wiaas_installation_') !== false) { + + $item_id = $assignee->get_id(); + + $item = $order->get_item($item_id); + + $product_id = $item['product_id']; + + //TODO: Get this value from order since product can get changed or deleted later + $organization_id = Wiaas_Product_Supplier::get_supplier_organisation_id_from_product($product_id); + + $user_ids = wiaas_get_organization_user_ids($organization_id); + + if (empty($user_ids)) { + + continue; + } + + $user_id = $user_ids[0]; + + $mapped_assignees[] = $step->get_assignee( array( + 'id' => $user_id, + 'type' => 'user_id', + 'editable_fields' => $assignee->get_editable_fields() + ) ); + + continue; + } + + if ($assignee->get_type() === 'wiaas_order_role') { + + + $order_role = $assignee->get_id(); + + if ($order_role === 'customer') { + + $customer_user_id = $order->get_customer_id(); + + // for now assign only customer that create order + // check if all customer organization users should be able to see order step + + $mapped_assignees[] = $step->get_assignee( array( + 'id' => $customer_user_id, + 'type' => 'user_id', + 'editable_fields' => $assignee->get_editable_fields() + ) ); + + continue; + } + } + + $mapped_assignees[] = $assignee; + } + + return $mapped_assignees; + } + + + /** + * Retrieve order id for delivery process step + * + * @param Gravity_Flow_Step $step + * + * @return bool|int Order id on success, false if step does not have associated order id + * + */ + public static function get_order_id_for_step(Gravity_Flow_Step $step) { + + $entry = $step->get_entry(); + + // if order is present in entry metadata use that value + if (! empty($entry['wiaas_delivery_order_id'])) { + + return absint($entry['wiaas_delivery_order_id']); + } + + // try getting order id from order field + $form = GFAPI::get_form($entry['form_id']); + + $order_fields = GFCommon::get_fields_by_type($form, array( 'wiaas_order')); + + if (! empty($order_fields)) { + + $order_field = $order_fields[0]; // there should only be one order field per entry + + return absint($entry[$order_field->id]); + } + + return false; + } +} + +Wiaas_Delivery_Process_Step_Assignee::init(); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php index a1c3b80..bc6b668 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php @@ -27,16 +27,7 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { $form_choices[] = array( 'label' => esc_html__( 'Select a Form', 'wiaas' ), 'value' => '' ); foreach ( $forms as $form ) { - $delivery_settings = rgar($form, 'wiaas_delivery_process'); - - $code = $form['id']; - - if (! empty($delivery_settings['delivery_action_code'])) { - - $code = $delivery_settings['delivery_action_code']; - } - - $form_choices[] = array( 'label' => $form['title'], 'value' => $code ); + $form_choices[] = array( 'label' => $form['title'], 'value' => $form['id'] ); } $settings = array( @@ -215,26 +206,12 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { /** * Retrieves forms that are valid options for delivery step action + * * @return array */ public function get_action_forms_choices() { - $forms = GFAPI::get_forms(); - - $action_forms = array(); - - foreach ( $forms as $form ) { - - $delivery_settings = rgar($form, 'wiaas_delivery_process'); - - if ( ! empty($delivery_settings) && $delivery_settings['delivery_form_type'] === 'action'){ - - $action_forms[] = $form; - } - } - - - return $action_forms; + return Wiaas_Delivery_Process_Action::get_action_forms(); } diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php index ffe5f3f..dfefebe 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php @@ -13,6 +13,7 @@ class Wiaas_Field_Order_Bundle_Document extends GF_Field_FileUpload { public function get_form_editor_field_settings() { return array( 'wiaas_doc_type_filter', + 'multiple_files_setting', 'conditional_logic_field_setting', 'error_message_setting', 'label_setting', diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php deleted file mode 100644 index 84ddeb5..0000000 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-select.php +++ /dev/null @@ -1,112 +0,0 @@ -get_selected_bundle_display_name($value); - } - - - public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br ) { - return $this->get_selected_bundle_display_name($value); - } - - - public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { - return $this->get_selected_bundle_display_name($value); - } - -// public function get_field_input( $form, $value = '', $entry = null ) { -// -// $this->choices = array(); -// -// $order_id = null; -// -// if (! empty($entry)) { -// -// $order_field = GFCommon::get_fields_by_type($form, array( 'wiaas_order' ) )[0]; -// -// $order_id = ! empty($order_field) ? $entry[$order_field->id] : null; -// -// } else if( ! empty($value)) { -// -// list ($order_id, $item_id) = explode('|', $value); -// } else { -// -// $order_id = absint(rgget('order_id')); -// } -// -// if (! empty($order_id)) { -// -// $this->choices = $this->get_selected_bundle_display_name($order_id); -// } -// -// return parent::get_field_input( $form, $value, $entry ); -// } - - - /** - * Adds bundles as choices - */ - public function post_convert_field() { - - if ($this->is_form_editor()) { - - $this->choices = array(); - } - - if ( ! $this->is_form_editor() && ! empty( rgget('order_id') )) { - $this->choices = $this->get_bundles_as_choices(absint(rgget('order_id'))); - } - } - - - public function get_selected_bundle_display_name($value) { - - list ($order_id, $item_id) = explode('|', $value); - - if (! empty($order_id) && ! empty($item_id) && $order = wc_get_order($order_id)) { - - $item = $order->get_item($item_id); - - return $item->get_name(); - } - - return ''; - } - - - public function get_bundles_as_choices($order_id) { - - $choices = array(); - - if (! empty ($order_id) && $order = wc_get_order($order_id)) { - - $standard_bundle_items = wiaas_get_order_standard_bundle_items($order); - - foreach ($standard_bundle_items as $item) { - - $choices[] = array( - 'value' => $order_id . '|' . $item->get_id(), - 'text' => $item->get_name() - ); - } - } - - return $choices; - } -} - -GF_Fields::register( new Wiaas_Field_Order_Bundle_Select() ); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle.php new file mode 100644 index 0000000..0d4ab92 --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle.php @@ -0,0 +1,50 @@ +get_bundle_display_name($value); + } + + + public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br ) { + return $this->get_bundle_display_name($value); + } + + + public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { + return $this->get_bundle_display_name($value); + } + + public function get_bundle_item($value) { + + list($order_id, $item_id) = rgexplode('|', $value, 2); + + if (! empty($order_id) && ! empty($item_id) && $order = wc_get_order($order_id)) { + + return $order->get_item($item_id); + } + + return null; + } + + public function get_bundle_display_name($value) { + + $item = $this->get_bundle_item($value); + + if (! empty($item)) { + + return $item->get_name(); + } + + return ''; + } +} + +GF_Fields::register( new Wiaas_Field_Order_Bundle() ); \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-document.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-document.php new file mode 100644 index 0000000..a0cde76 --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-document.php @@ -0,0 +1,61 @@ +formId ); + $upload_root = trailingslashit( $upload_root ); + + // handle download for order documents not uploaded by gravity forms + if ( strpos( $file, $upload_root ) === false ) { + + return admin_url() . '?gf-wiaas-order-doc=' . urlencode($file); + } + + return parent::get_download_url( $file, true ); + } + + public function sanitize_settings() { + parent::sanitize_settings(); + + $this->wiaasDocTypeFilter = sanitize_key($this->wiaasDocTypeFilter); + } +} + + +GF_Fields::register( new Wiaas_Field_Order_Document() ); \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-installation-select.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-installation-select.php new file mode 100644 index 0000000..689ed9f --- /dev/null +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-installation-select.php @@ -0,0 +1,110 @@ +get_bundle_item($entry[$bundle_item_field->id])) { + + $bundled_items = wc_pb_get_bundled_order_items($bundle_item); + + $installation_items = array(); + + foreach ($bundled_items as $id => $bundled_item) { + + $product = $bundled_item->get_product(); + + if ($product && Wiaas_Product_Category::is_installation($product)) { + + $installation_items[] = $bundled_item; + } + } + + $choices = array( + array( 'value' => '0', 'text' => 'Select installation ...') + ); + + $order_id = $bundle_item->get_order_id(); + + foreach ($installation_items as $installation_item) { + + $choices[] = array( + 'value' => 'wiaas_installation_' . $order_id . '|' . $installation_item->get_id(), + 'text' => $installation_item->get_name() + ); + } + + $this->choices = $choices; + } + + return parent::get_field_input($form, $value, $entry); + } + + public function get_form_editor_field_title() { + return esc_attr__( 'Installation Select', 'wiaas' ); + } + + public function get_value_entry_list( $value, $entry, $field_id, $columns, $form ) { + return $this->get_selected_installation_display_name($value); + } + + + public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br ) { + return $this->get_selected_installation_display_name($value); + } + + + public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { + return $this->get_selected_installation_display_name($value); + } + + + public function get_selected_installation_display_name($value) { + + $value = $value ? str_replace('wiaas_installation_', '', $value) : ''; + + list ($order_id, $item_id) = explode('|', $value); + + if (! empty($order_id) && ! empty($item_id) && $order = wc_get_order($order_id)) { + + $item = $order->get_item($item_id); + + return $item->get_name(); + } + + return ''; + } + + public function post_convert_field() { + + if ($this->is_form_editor()) { + + $this->choices = array( + array( 'value' => '0', 'text' => 'Select installation ...') + ); + } + } +} + + +GF_Fields::register( new Wiaas_Order_Installation_Select() ); \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php deleted file mode 100644 index 35ed4bd..0000000 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-supplier-select.php +++ /dev/null @@ -1,83 +0,0 @@ -_get_selected_supplier_display_name($value); - } - - - public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br ) { - return $this->_get_selected_supplier_display_name($value); - } - - - public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { - return $this->_get_selected_supplier_display_name($value); - } - - - /** - * Adds bundles as choices - */ - public function post_convert_field() { - $this->choices = array(); - - if ( ! $this->is_form_editor() ) { - $this->choices = $this->_get_suppliers_as_choices(); - } - } - - - private function _get_selected_supplier_display_name($value) { - - list ($order_key, $supplier_id) = explode('|', $value); - - if (! empty($supplier_id)) { - - return wiaas_get_organization_name($supplier_id); - } - - return ''; - } - - - private function _get_suppliers_as_choices() { - - $choices = array(); - - $order_id = absint(rgget('order_id')); - - if (! empty ($order_id) && $order = wc_get_order($order_id)) { - - $suppliers = wiaas_get_order_suppliers($order); - - foreach ($suppliers as $supplier_id => $supplier_name) { - - $choices[] = array( - 'value' => 'wiaas_organization_order_' . $order_id . '|' . $supplier_id, - 'text' => $supplier_name - ); - } - } - - return $choices; - } -} - -GF_Fields::register( new Wiaas_Field_Order_Supplier_Select() ); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php index f104f11..af92e20 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php @@ -9,6 +9,21 @@ class Wiaas_Order_Fields { public static function init() { add_action( 'gform_field_standard_settings', array( __CLASS__, 'field_settings' ) ); + + add_filter('gform_fileupload_entry_value_file_path', array( __CLASS__, 'display_order_document_fields' ), 999, 2); + } + + + public static function display_order_document_fields($file_path, $field) { + + if ($field->type === 'wiaas_order_bundle_document') { + + $field = new Wiaas_Field_Order_Bundle_Document(); + + return $field->get_download_url($file_path); + } + + return $file_path; } /** @@ -30,11 +45,20 @@ class Wiaas_Order_Fields { + +
  • + + +
  • + get_item($bundle_item_id); - $entry = array(); foreach ($form['fields'] as $field) { @@ -87,8 +109,15 @@ class Wiaas_Order_Fields { break; + case 'workflow_user': + $entry[(string) $field->id] = $order->get_customer_id(); // save customer if needed + + break; + case 'wiaas_order_bundle': + $bundle_item = $order->get_item($bundle_item_id); + if ( empty($bundle_item) && $field->isRequired) { // there is no data for required field so entry cannot be created return false; @@ -103,6 +132,8 @@ class Wiaas_Order_Fields { case 'wiaas_order_bundle_document': + $bundle_item = $order->get_item($bundle_item_id); + if ( empty($bundle_item) && $field->isRequired) { // there is no data for required field so entry cannot be created return false; @@ -110,31 +141,80 @@ class Wiaas_Order_Fields { if (! empty($bundle_item)) { - $documents = wiaas_get_order_item_documents($bundle_item, $field->wiaasDocTypeFilter); + $documents = wiaas_get_standard_package_order_item_documents($order, $bundle_item_id); - if ( empty($documents) && $field->isRequired) { + $filtered_documents = array(); + + foreach ($documents as $document) { + + if ($document['type'] === $field->wiaasDocTypeFilter) { + + $filtered_documents[] = $document; + } + } + + if ( empty($filtered_documents) && $field->isRequired ) { // there is no data for required field so entry cannot be created return false; } - if (! empty($documents)) { + if (! empty ($filtered_documents) && ! $field->multipleFiles) { - $document = $documents[0]; + $document = $filtered_documents[0]; $entry[$field->id] = $document['version']; + + } else if (! empty ($filtered_documents) ) { + + $versions = array(); + foreach ($filtered_documents as $filtered_document) { + $versions[] = $filtered_document['version']; + } + + $entry[$field->id] = json_encode($versions); } } break; - case 'wiaas_order_supplier': - $suppliers = wiaas_get_order_suppliers($order); + case 'wiaas_order_installation_select': - $supplier_ids = array_keys($suppliers); + $bundle_item = $order->get_item($bundle_item_id); - $supplier_id = $supplier_ids[0]; + if ( empty($bundle_item) && $field->isRequired) { + // there is no data for required field so entry cannot be created + return false; + } - $entry[(string) $field->id] = 'wiaas_organization_order_' . $order_id . '|' . $supplier_id; + $bundled_items = wc_pb_get_bundled_order_items($bundle_item, $order); + + $installation_items = array(); + + foreach ($bundled_items as $id => $bundled_item) { + + $product = $bundled_item->get_product(); + + if ($product && Wiaas_Product_Category::is_installation($product)) { + + $installation_items[] = $bundled_item; + } + } + + if (empty($installation_items) && $field->isRequired) { + // there is no data for required field so entry cannot be created + return false; + } + + if (count($installation_items) === 1) { + + $installation_item = $installation_items[0]; + + $entry[(string) $field->id] = 'wiaas_installation_' . $order->get_id() . '|' . $installation_item->get_id(); + } else if (count($installation_items) > 1) { + + // force admin to select installation + $entry[(string) $field->id] = '0'; + } } } diff --git a/backend/app/plugins/wiaas/includes/document/class-wiaas-document-upload.php b/backend/app/plugins/wiaas/includes/document/class-wiaas-document-upload.php index 37c01ee..87211ab 100644 --- a/backend/app/plugins/wiaas/includes/document/class-wiaas-document-upload.php +++ b/backend/app/plugins/wiaas/includes/document/class-wiaas-document-upload.php @@ -7,7 +7,7 @@ class Wiaas_Document_Upload { ); public static function init() { - //add_filter( 'upload_dir', array( __CLASS__, 'upload_dir' ) ); + add_filter( 'upload_dir', array( __CLASS__, 'upload_dir' ) ); } diff --git a/backend/app/plugins/wiaas/includes/document/wiaas-document-functions.php b/backend/app/plugins/wiaas/includes/document/wiaas-document-functions.php index 8a078ab..524b2ef 100644 --- a/backend/app/plugins/wiaas/includes/document/wiaas-document-functions.php +++ b/backend/app/plugins/wiaas/includes/document/wiaas-document-functions.php @@ -222,9 +222,4 @@ function wiaas_get_order_item_documents($order_item, $doc_type = null) { } return $filtered_documents; -} - -function wiaas_get_order_item_document_admin_download_link($order_id, $item_id, $version) { - - } \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php b/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php index a25c61d..0787060 100644 --- a/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php +++ b/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php @@ -1,26 +1,5 @@ get_items(); - - $suppliers = wiaas_get_suppliers(); - - return $suppliers; -} - /** * Retrieve standard bundles from order * diff --git a/frontend/src/containers/orders/components/process/OrderProcess.jsx b/frontend/src/containers/orders/components/process/OrderProcess.jsx index 3424e32..bc4d8e8 100644 --- a/frontend/src/containers/orders/components/process/OrderProcess.jsx +++ b/frontend/src/containers/orders/components/process/OrderProcess.jsx @@ -41,7 +41,11 @@ class OrderProcess extends Component { { - visibleSteps.reverse().map((step, index) => ) + visibleSteps.reverse().map((step, index) => ) } From 26f997abbc70a64231f91eabe2c0de55c7a79aca Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Fri, 2 Nov 2018 11:20:40 +0100 Subject: [PATCH 05/14] Import new forms --- .../wiaas/includes/class-wiaas-db-update.php | 2 +- .../delivery-forms/delivery-action-forms.json | 1778 ++++++++++++++++- .../delivery-process-sample-form.json | 234 ++- .../db-updates/wiaas-db-update-general.php | 30 +- 4 files changed, 2037 insertions(+), 7 deletions(-) diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php index 3155f2f..a0d2c1a 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php @@ -23,7 +23,7 @@ class Wiaas_DB_Update { '20181019064450' => 'wiaas_db_update_add_bundle_properties_ui_field', '20191020014650' => 'wiaas_create_organization_roles_capabilities', '20191030162450' => 'wiaas_db_update_update_supplier_order_capabilities', - '20191031162450' => 'update_delivery_forms' + '20191031162850' => 'update_delivery_forms' ); public static function execute() { diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json index dc92517..9bcd15e 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json +++ b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-action-forms.json @@ -1 +1,1777 @@ -{"0":{"title":"ACTION: Validate Customer Questionnaire","description":"Bundle configuration for supplier.","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":12,"label":"Order Number","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"0","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"workflow_user","id":18,"label":"Customer User:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"choices":[{"value":4,"text":"AA aa"},{"value":2,"text":"Commercial User"},{"value":3,"text":"Customer User"},{"value":6,"text":"Supplier 2 Jonson"},{"value":5,"text":"Supplier1 Jonson"},{"value":1,"text":"wpUser"}],"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"gravityflowUsersRoleFilter":""},{"type":"wiaas_order_bundle","id":13,"label":"Bundle","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"bundle_id","noDuplicates":false,"defaultValue":"","choices":[],"conditionalLogic":"","productField":"","displayOnly":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"enablePrice":""},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"order_questionaire","id":17,"label":"Questionnaire Document","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"workflow_discussion","id":9,"label":"Notes","adminLabel":"","isRequired":false,"size":"small","errorMessage":"","visibility":"visible","inputs":null,"formId":"12","description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","form_id":"","useRichTextEditor":false,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":"12","useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"gravityflowparentchild":{"parent_form_1":"0","parent_form_3":"0","parent_form_4":"0","parent_form_5":"1","parent_form_6":"0","parent_form_7":"0","parent_form_11":"0","parent_form_12":"0"},"wiaas_delivery":{"delivery_form_type":"action","automatic_step_entries_enabled":"1","automatic_action_entries_type":"bundle"},"is_active":"1","date_created":"2018-10-28 15:09:59","is_trash":"0","wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"validate-questionnaire","automatic_action_entries_enabled":"1","automatic_action_entries_type":"bundle"},"confirmations":[{"id":"5bd4e2eeaf4c1","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd4e2eeaef5b","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"27","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Approve configuration info","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":{"conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"12","operator":"isnot","value":"0"}]}},"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"1","instructionsValue":"Review customer configuration for {Bundle:13}<\/strong>","display_fields_mode":"selected_fields","display_fields_selected":["13","17","9"],"assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Marketplace","assignee_notification_from_email":"info@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order Number:12} : Validate Customer Configuration","assignee_notification_message":"\u00a0{Order Number:12}<\/strong>\r\n\r\nGo to {workflow_entry_link} to validate customer configuration for\u00a0 {Bundle:13} .\r\n\r\n ","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"1","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"Wiaas","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"{Order:3} : Bundle questionnaire has been rejected {Bundle:6}","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"1","approval_notification_type":"select","approval_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"Wiaas","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"{Order:3} : Bundle questionnaire has been approved","approval_notification_message":" \r\n\r\n{all_fields}\r\n\r\nEntry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"44","note_mode":"hidden","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"44","destination_approved":"complete"},"addon_slug":"gravityflow","event_type":null},{"id":"44","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Add reject reason","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"editable_fields":["9"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"1","highlight_editable_fields_class":"green-background","instructionsEnable":"1","instructionsValue":"Enter reason why customer configuration has been declined.","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"hidden","assignee_notification_enabled":"0","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry requires your input.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"user_id|2","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"93","form_id":"12","is_active":"1","feed_order":"0","meta":{"step_name":"Update configuration info","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["assignee_user_field|18"],"editable_fields":["17"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Marketplace","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order Number:12} : Update configuration info","assignee_notification_message":"{Order Number:12}<\/strong>\r\n\r\nConfiguration info has bee rejected for\u00a0{Bundle:13}.\r\n\r\nPlease login to your interface, review and make necessary changes.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"wiaas_order_role|customer","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"wiaas_order_role|customer","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"27"},"addon_slug":"gravityflow","event_type":null}]}},"1":{"title":"ACTION: Complete Installation And Upload Test Protocol","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order ID","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_bundle","id":8,"label":"Bundle:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[{"value":"0","text":"Select bundle ..."}],"conditionalLogic":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":"","enableChoiceValue":true},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"install_guide","id":13,"label":"Installation Guide Documents:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"fileupload","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":true,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"wiaas_order_installation_select","id":11,"label":"Installation Company:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":[{"value":"0","text":"Select installation ..."}],"conditionalLogic":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":"","enableChoiceValue":true},{"type":"wiaas_order_bundle_document","wiaasDocTypeFilter":"installation_protocol","id":14,"label":"Installation Protocol Document:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":14,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":false,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false}],"version":"2.3.2","id":14,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery":{"wiaas_delivery_form_type":"step"},"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"","automatic_action_entries_enabled":"1","automatic_action_entries_type":"bundle"},"confirmations":[{"id":"5bd66ca93384b","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd66ca932e4a","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"80","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Select Installation","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"1","feed_condition_conditional_logic_object":{"conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"11","operator":"is","value":"0"}]}},"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"editable_fields":["11"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"1","highlight_editable_fields_class":"green-background","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"selected_fields","display_fields_selected":["1","8","13"],"default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Marketplace","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order ID:1} : Select installation company for {Bundle::8}","assignee_notification_message":"Select installation company for\u00a0{Bundle::8} in order\u00a0{Order ID:1}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"wiaas_order_role|customer","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"wiaas_order_role|customer","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"34","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Installation completed confirmation","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["assignee_field|11"],"routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Market","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order ID:1} : Confirm installation","assignee_notification_message":"Please go to {workflow_entry_link} to\u00a0confirm that installation is completed for order\u00a0{Order ID:1}","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"35","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"complete","destination_approved":"35"},"addon_slug":"gravityflow","event_type":null},{"id":"35","form_id":"14","is_active":"1","feed_order":"0","meta":{"step_name":"Upload installation protocol for order","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["assignee_field|11"],"editable_fields":["14"],"routing":"","assignee_policy":"all","highlight_editable_fields_enabled":"1","highlight_editable_fields_class":"green-background","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Market","assignee_notification_from_email":" confirm that installation is completed for order\u00a0{Order ID:1}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"Upload installation test protocol for {Order ID:1}","assignee_notification_message":"{Order ID:1}<\/strong>\r\n\r\nGo to {workflow_entry_link} to upload installation test protocol for order\u00a0{Order ID:1}\r\n\r\n ","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"complete","destination_expired":"next","destination_complete":"complete"},"addon_slug":"gravityflow","event_type":null}]}},"2":{"title":"ACTION: Customer Acceptance","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order Number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_id","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"workflow_user","id":10,"label":"Customer User:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"choices":[{"value":2,"text":"Commercial User"},{"value":3,"text":"Customer User"}],"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","conditionalLogic":"","failed_validation":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":"","gravityflowUsersRoleFilter":"customer"},{"type":"wiaas_order_document","wiaasDocTypeFilter":"customer_acceptance","id":9,"label":"Acceptance Document:","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"fileupload","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","maxFileSize":"","maxFiles":"","multipleFiles":true,"allowedExtensions":"","productField":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""},{"type":"date","id":6,"label":"Expiration Date","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"dateType":"datepicker","calendarIconType":"none","formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","calendarIconUrl":"","dateFormat":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":""},{"type":"radio","id":4,"label":"Acceptance","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"choices":[{"text":"Not Accepted","value":"pending","isSelected":false,"price":""},{"text":"Accepted","value":"accept","isSelected":false,"price":""},{"text":"Declined","value":"decline","isSelected":false,"price":""}],"formId":16,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","conditionalLogic":"","productField":"","enableOtherChoice":"","enablePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"enableChoiceValue":true,"displayOnly":""},{"type":"textarea","id":3,"label":"Decline Reason","adminLabel":"","isRequired":false,"size":"small","errorMessage":"","visibility":"visible","inputs":null,"formId":16,"description":"","allowsPrepopulate":true,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"order_decline_reason","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"4","operator":"is","value":"decline"}]},"productField":"","form_id":"","useRichTextEditor":false,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":16,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery_process":{"delivery_form_type":"action","delivery_action_code":"customer-acceptance","automatic_action_entries_enabled":"1","automatic_action_entries_type":"single"},"confirmations":[{"id":"5bd8668e50997","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bd8668e50471","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"94","form_id":"16","is_active":"1","feed_order":"0","meta":{"step_name":"Upload Acceptance Document","description":"","step_type":"user_input","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","schedule_date_field":"6","type":"select","assignees":["assignee_user_field|10"],"editable_fields":["9","4","3"],"routing":"","assignee_policy":"any","conditional_logic_editable_fields_enabled":"1","highlight_editable_fields_enabled":"0","highlight_editable_fields_class":"green-triangle","instructionsEnable":"0","instructionsValue":"","display_fields_mode":"all_fields","default_status":"hidden","note_mode":"not_required","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Market","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order Number:1}: Upload acceptance document","assignee_notification_message":"{Order Number:1}<\/strong>\r\n\r\nPlease go to your account and upload acceptance document.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","in_progress_notification_enabled":"0","in_progress_notification_type":"select","in_progress_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"in_progress_notification_from_name":"","in_progress_notification_from_email":"{admin_email}","in_progress_notification_reply_to":"","in_progress_notification_bcc":"","in_progress_notification_subject":"","in_progress_notification_message":"Entry {entry_id} has been updated and remains in progress.","in_progress_notification_disable_autoformat":"0","complete_notification_enabled":"0","complete_notification_type":"select","complete_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"complete_notification_from_name":"","complete_notification_from_email":"{admin_email}","complete_notification_reply_to":"","complete_notification_bcc":"","complete_notification_subject":"","complete_notification_message":"Entry {entry_id} has been updated completing the step.","complete_notification_disable_autoformat":"0","confirmation_messageEnable":"0","confirmation_messageValue":"Thank you.","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","expiration_date_field":"6","status_expiration":"complete","destination_expired":"next","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"95","form_id":"16","is_active":"1","feed_order":"0","meta":{"step_name":"Accept installation","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","schedule_date_field":"6","type":"select","assignees":["assignee_user_field|10"],"routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"1","assignee_notification_from_name":"WIAAS Market","assignee_notification_from_email":"support@co-ideation.com","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"{Order Number:1}: Accept installation","assignee_notification_message":"Login to your account and accept installation.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"role|administrator","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","revertEnable":"0","revertValue":"41","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","expiration_date_field":"6","status_expiration":"rejected","destination_expired":"next","destination_rejected":"complete","destination_approved":"next"},"addon_slug":"gravityflow","event_type":null}]}},"version":"2.3.2"} \ No newline at end of file +{ + "0": { + "title": "ACTION: Validate Customer Questionnaire", + "description": "Bundle configuration for supplier.", + "labelPlacement": "top_label", + "descriptionPlacement": "below", + "button": { + "type": "text", + "text": "Submit", + "imageUrl": "" + }, + "fields": [ + { + "type": "wiaas_order", + "id": 12, + "label": "Order Number", + "adminLabel": "", + "isRequired": true, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": "12", + "description": "", + "allowsPrepopulate": true, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "order_id", + "noDuplicates": false, + "defaultValue": "0", + "choices": "", + "conditionalLogic": "", + "enableCalculation": false, + "numberFormat": "decimal_dot", + "rangeMin": "", + "rangeMax": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "" + }, + { + "type": "workflow_user", + "id": 18, + "label": "Customer User:", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "choices": [ + { + "value": 4, + "text": "AA aa" + }, + { + "value": 2, + "text": "Commercial User" + }, + { + "value": 3, + "text": "Customer User" + }, + { + "value": 6, + "text": "Supplier 2 Jonson" + }, + { + "value": 5, + "text": "Supplier1 Jonson" + }, + { + "value": 1, + "text": "wpUser" + } + ], + "formId": "12", + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "conditionalLogic": "", + "failed_validation": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "gravityflowUsersRoleFilter": "" + }, + { + "type": "wiaas_order_bundle", + "id": 13, + "label": "Bundle", + "adminLabel": "", + "isRequired": true, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": "12", + "description": "", + "allowsPrepopulate": true, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "bundle_id", + "noDuplicates": false, + "defaultValue": "", + "choices": [], + "conditionalLogic": "", + "productField": "", + "displayOnly": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "enablePrice": "" + }, + { + "type": "wiaas_order_bundle_document", + "wiaasDocTypeFilter": "order_questionaire", + "id": 17, + "label": "Questionnaire Document", + "adminLabel": "", + "isRequired": true, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": "12", + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "maxFileSize": "", + "maxFiles": "", + "multipleFiles": false, + "allowedExtensions": "", + "productField": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "" + }, + { + "type": "workflow_discussion", + "id": 9, + "label": "Notes", + "adminLabel": "", + "isRequired": false, + "size": "small", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": "12", + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "productField": "", + "form_id": "", + "useRichTextEditor": false, + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "displayOnly": "", + "enablePrice": "" + } + ], + "version": "2.3.2", + "id": "12", + "useCurrentUserAsAuthor": true, + "postContentTemplateEnabled": false, + "postTitleTemplateEnabled": false, + "postTitleTemplate": "", + "postContentTemplate": "", + "lastPageButton": null, + "pagination": null, + "firstPageCssClass": null, + "gravityflowparentchild": { + "parent_form_1": "0", + "parent_form_3": "0", + "parent_form_4": "0", + "parent_form_5": "1", + "parent_form_6": "0", + "parent_form_7": "0", + "parent_form_11": "0", + "parent_form_12": "0" + }, + "wiaas_delivery": { + "delivery_form_type": "action", + "automatic_step_entries_enabled": "1", + "automatic_action_entries_type": "bundle" + }, + "is_active": "1", + "date_created": "2018-10-28 15:09:59", + "is_trash": "0", + "wiaas_delivery_process": { + "delivery_form_type": "action", + "delivery_action_code": "validate-questionnaire", + "automatic_action_entries_enabled": "1", + "automatic_action_entries_type": "bundle" + }, + "confirmations": [ + { + "id": "5bd4e2eeaf4c1", + "name": "Default Confirmation", + "isDefault": true, + "type": "message", + "message": "Thanks for contacting us! We will get in touch with you shortly.", + "url": "", + "pageId": "", + "queryString": "" + } + ], + "notifications": [ + { + "id": "5bd4e2eeaef5b", + "to": "{admin_email}", + "name": "Admin Notification", + "event": "form_submission", + "toType": "email", + "subject": "New submission from {form_title}", + "message": "{all_fields}" + } + ], + "feeds": { + "gravityflow": [ + { + "id": "27", + "form_id": "12", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Approve configuration info", + "description": "", + "step_type": "approval", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": { + "conditionalLogic": { + "actionType": "show", + "logicType": "all", + "rules": [ + { + "fieldId": "12", + "operator": "isnot", + "value": "0" + } + ] + } + }, + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "type": "select", + "assignees": [ + "role|administrator" + ], + "routing": [ + { + "assignee": "user_id|2", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "assignee_policy": "all", + "instructionsEnable": "1", + "instructionsValue": "Review customer configuration for {Bundle:13}<\/strong>", + "display_fields_mode": "selected_fields", + "display_fields_selected": [ + "13", + "17", + "9" + ], + "assignee_notification_enabled": "1", + "assignee_notification_from_name": "WIAAS Marketplace", + "assignee_notification_from_email": "info@co-ideation.com", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "{Order Number:12} : Validate Customer Configuration", + "assignee_notification_message": "\u00a0{Order Number:12}<\/strong>\r\n\r\nGo to {workflow_entry_link} to validate customer configuration for\u00a0 {Bundle:13} .\r\n\r\n ", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "rejection_notification_enabled": "1", + "rejection_notification_type": "select", + "rejection_notification_routing": [ + { + "assignee": "user_id|2", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "rejection_notification_from_name": "Wiaas", + "rejection_notification_from_email": "{admin_email}", + "rejection_notification_reply_to": "", + "rejection_notification_bcc": "", + "rejection_notification_subject": "{Order:3} : Bundle questionnaire has been rejected {Bundle:6}", + "rejection_notification_message": "Entry {entry_id} has been rejected", + "rejection_notification_disable_autoformat": "0", + "approval_notification_enabled": "1", + "approval_notification_type": "select", + "approval_notification_routing": [ + { + "assignee": "user_id|2", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "approval_notification_from_name": "Wiaas", + "approval_notification_from_email": "{admin_email}", + "approval_notification_reply_to": "", + "approval_notification_bcc": "", + "approval_notification_subject": "{Order:3} : Bundle questionnaire has been approved", + "approval_notification_message": " \r\n\r\n{all_fields}\r\n\r\nEntry {entry_id} has been approved", + "approval_notification_disable_autoformat": "0", + "revertEnable": "0", + "revertValue": "44", + "note_mode": "hidden", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "status_expiration": "rejected", + "destination_expired": "next", + "destination_rejected": "44", + "destination_approved": "complete" + }, + "addon_slug": "gravityflow", + "event_type": null + }, + { + "id": "44", + "form_id": "12", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Add reject reason", + "description": "", + "step_type": "user_input", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "type": "select", + "assignees": [ + "role|administrator" + ], + "editable_fields": [ + "9" + ], + "routing": "", + "assignee_policy": "all", + "highlight_editable_fields_enabled": "1", + "highlight_editable_fields_class": "green-background", + "instructionsEnable": "1", + "instructionsValue": "Enter reason why customer configuration has been declined.", + "display_fields_mode": "all_fields", + "default_status": "hidden", + "note_mode": "hidden", + "assignee_notification_enabled": "0", + "assignee_notification_from_name": "", + "assignee_notification_from_email": "{admin_email}", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "", + "assignee_notification_message": "A new entry requires your input.", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "in_progress_notification_enabled": "0", + "in_progress_notification_type": "select", + "in_progress_notification_routing": [ + { + "assignee": "user_id|2", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "in_progress_notification_from_name": "", + "in_progress_notification_from_email": "{admin_email}", + "in_progress_notification_reply_to": "", + "in_progress_notification_bcc": "", + "in_progress_notification_subject": "", + "in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.", + "in_progress_notification_disable_autoformat": "0", + "complete_notification_enabled": "0", + "complete_notification_type": "select", + "complete_notification_routing": [ + { + "assignee": "user_id|2", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "complete_notification_from_name": "", + "complete_notification_from_email": "{admin_email}", + "complete_notification_reply_to": "", + "complete_notification_bcc": "", + "complete_notification_subject": "", + "complete_notification_message": "Entry {entry_id} has been updated completing the step.", + "complete_notification_disable_autoformat": "0", + "confirmation_messageEnable": "0", + "confirmation_messageValue": "Thank you.", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "status_expiration": "complete", + "destination_expired": "next", + "destination_complete": "next" + }, + "addon_slug": "gravityflow", + "event_type": null + }, + { + "id": "93", + "form_id": "12", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Update configuration info", + "description": "", + "step_type": "user_input", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "type": "select", + "assignees": [ + "assignee_user_field|18" + ], + "editable_fields": [ + "17" + ], + "routing": "", + "assignee_policy": "all", + "highlight_editable_fields_enabled": "0", + "highlight_editable_fields_class": "green-triangle", + "instructionsEnable": "0", + "instructionsValue": "", + "display_fields_mode": "all_fields", + "default_status": "hidden", + "note_mode": "not_required", + "assignee_notification_enabled": "1", + "assignee_notification_from_name": "WIAAS Marketplace", + "assignee_notification_from_email": "support@co-ideation.com", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "{Order Number:12} : Update configuration info", + "assignee_notification_message": "{Order Number:12}<\/strong>\r\n\r\nConfiguration info has bee rejected for\u00a0{Bundle:13}.\r\n\r\nPlease login to your interface, review and make necessary changes.", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "in_progress_notification_enabled": "0", + "in_progress_notification_type": "select", + "in_progress_notification_routing": [ + { + "assignee": "wiaas_order_role|customer", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "in_progress_notification_from_name": "", + "in_progress_notification_from_email": "{admin_email}", + "in_progress_notification_reply_to": "", + "in_progress_notification_bcc": "", + "in_progress_notification_subject": "", + "in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.", + "in_progress_notification_disable_autoformat": "0", + "complete_notification_enabled": "0", + "complete_notification_type": "select", + "complete_notification_routing": [ + { + "assignee": "wiaas_order_role|customer", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "complete_notification_from_name": "", + "complete_notification_from_email": "{admin_email}", + "complete_notification_reply_to": "", + "complete_notification_bcc": "", + "complete_notification_subject": "", + "complete_notification_message": "Entry {entry_id} has been updated completing the step.", + "complete_notification_disable_autoformat": "0", + "confirmation_messageEnable": "0", + "confirmation_messageValue": "Thank you.", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "status_expiration": "complete", + "destination_expired": "next", + "destination_complete": "27" + }, + "addon_slug": "gravityflow", + "event_type": null + } + ] + } + }, + "1": { + "title": "ACTION: Complete Installation And Upload Test Protocol", + "description": "", + "labelPlacement": "top_label", + "descriptionPlacement": "below", + "button": { + "type": "text", + "text": "Submit", + "imageUrl": "" + }, + "fields": [ + { + "type": "wiaas_order", + "id": 1, + "label": "Order ID", + "adminLabel": "", + "isRequired": true, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 14, + "description": "", + "allowsPrepopulate": true, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "order_id", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "enableCalculation": false, + "numberFormat": "decimal_dot", + "rangeMin": "", + "rangeMax": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "" + }, + { + "type": "wiaas_order_bundle", + "id": 8, + "label": "Bundle:", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 14, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": [ + { + "value": "0", + "text": "Select bundle ..." + } + ], + "conditionalLogic": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "", + "enableChoiceValue": true + }, + { + "type": "wiaas_order_bundle_document", + "wiaasDocTypeFilter": "install_guide", + "id": 13, + "label": "Installation Guide Documents:", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 14, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "fileupload", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "maxFileSize": "", + "maxFiles": "", + "multipleFiles": true, + "allowedExtensions": "", + "productField": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "" + }, + { + "type": "wiaas_order_installation_select", + "id": 11, + "label": "Installation Company:", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 14, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": [ + { + "value": "0", + "text": "Select installation ..." + } + ], + "conditionalLogic": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "", + "enableChoiceValue": true + }, + { + "type": "wiaas_order_bundle_document", + "wiaasDocTypeFilter": "installation_protocol", + "id": 14, + "label": "Installation Protocol Document:", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 14, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "maxFileSize": "", + "maxFiles": "", + "multipleFiles": false, + "allowedExtensions": "", + "productField": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false + } + ], + "version": "2.3.2", + "id": 14, + "useCurrentUserAsAuthor": true, + "postContentTemplateEnabled": false, + "postTitleTemplateEnabled": false, + "postTitleTemplate": "", + "postContentTemplate": "", + "lastPageButton": null, + "pagination": null, + "firstPageCssClass": null, + "wiaas_delivery": { + "wiaas_delivery_form_type": "step" + }, + "wiaas_delivery_process": { + "delivery_form_type": "action", + "delivery_action_code": "", + "automatic_action_entries_enabled": "1", + "automatic_action_entries_type": "bundle" + }, + "confirmations": [ + { + "id": "5bd66ca93384b", + "name": "Default Confirmation", + "isDefault": true, + "type": "message", + "message": "Thanks for contacting us! We will get in touch with you shortly.", + "url": "", + "pageId": "", + "queryString": "" + } + ], + "notifications": [ + { + "id": "5bd66ca932e4a", + "to": "{admin_email}", + "name": "Admin Notification", + "event": "form_submission", + "toType": "email", + "subject": "New submission from {form_title}", + "message": "{all_fields}" + } + ], + "feeds": { + "gravityflow": [ + { + "id": "80", + "form_id": "14", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Select Installation", + "description": "", + "step_type": "user_input", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "1", + "feed_condition_conditional_logic_object": { + "conditionalLogic": { + "actionType": "show", + "logicType": "all", + "rules": [ + { + "fieldId": "11", + "operator": "is", + "value": "0" + } + ] + } + }, + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "type": "select", + "assignees": [ + "role|administrator" + ], + "editable_fields": [ + "11" + ], + "routing": "", + "assignee_policy": "all", + "highlight_editable_fields_enabled": "1", + "highlight_editable_fields_class": "green-background", + "instructionsEnable": "0", + "instructionsValue": "", + "display_fields_mode": "selected_fields", + "display_fields_selected": [ + "1", + "8", + "13" + ], + "default_status": "hidden", + "note_mode": "not_required", + "assignee_notification_enabled": "1", + "assignee_notification_from_name": "WIAAS Marketplace", + "assignee_notification_from_email": "support@co-ideation.com", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "{Order ID:1} : Select installation company for {Bundle::8}", + "assignee_notification_message": "Select installation company for\u00a0{Bundle::8} in order\u00a0{Order ID:1}", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "in_progress_notification_enabled": "0", + "in_progress_notification_type": "select", + "in_progress_notification_routing": [ + { + "assignee": "wiaas_order_role|customer", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "in_progress_notification_from_name": "", + "in_progress_notification_from_email": "{admin_email}", + "in_progress_notification_reply_to": "", + "in_progress_notification_bcc": "", + "in_progress_notification_subject": "", + "in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.", + "in_progress_notification_disable_autoformat": "0", + "complete_notification_enabled": "0", + "complete_notification_type": "select", + "complete_notification_routing": [ + { + "assignee": "wiaas_order_role|customer", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "complete_notification_from_name": "", + "complete_notification_from_email": "{admin_email}", + "complete_notification_reply_to": "", + "complete_notification_bcc": "", + "complete_notification_subject": "", + "complete_notification_message": "Entry {entry_id} has been updated completing the step.", + "complete_notification_disable_autoformat": "0", + "confirmation_messageEnable": "0", + "confirmation_messageValue": "Thank you.", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "status_expiration": "complete", + "destination_expired": "next", + "destination_complete": "next" + }, + "addon_slug": "gravityflow", + "event_type": null + }, + { + "id": "34", + "form_id": "14", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Installation completed confirmation", + "description": "", + "step_type": "approval", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "type": "select", + "assignees": [ + "assignee_field|11" + ], + "routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "assignee_policy": "all", + "instructionsEnable": "0", + "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", + "display_fields_mode": "all_fields", + "assignee_notification_enabled": "1", + "assignee_notification_from_name": "WIAAS Market", + "assignee_notification_from_email": "support@co-ideation.com", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "{Order ID:1} : Confirm installation", + "assignee_notification_message": "Please go to {workflow_entry_link} to\u00a0confirm that installation is completed for order\u00a0{Order ID:1}", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "rejection_notification_enabled": "0", + "rejection_notification_type": "select", + "rejection_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "rejection_notification_from_name": "", + "rejection_notification_from_email": "{admin_email}", + "rejection_notification_reply_to": "", + "rejection_notification_bcc": "", + "rejection_notification_subject": "", + "rejection_notification_message": "Entry {entry_id} has been rejected", + "rejection_notification_disable_autoformat": "0", + "approval_notification_enabled": "0", + "approval_notification_type": "select", + "approval_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "approval_notification_from_name": "", + "approval_notification_from_email": "{admin_email}", + "approval_notification_reply_to": "", + "approval_notification_bcc": "", + "approval_notification_subject": "", + "approval_notification_message": "Entry {entry_id} has been approved", + "approval_notification_disable_autoformat": "0", + "revertEnable": "0", + "revertValue": "35", + "note_mode": "not_required", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "status_expiration": "rejected", + "destination_expired": "next", + "destination_rejected": "complete", + "destination_approved": "35" + }, + "addon_slug": "gravityflow", + "event_type": null + }, + { + "id": "35", + "form_id": "14", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Upload installation protocol for order", + "description": "", + "step_type": "user_input", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "type": "select", + "assignees": [ + "assignee_field|11" + ], + "editable_fields": [ + "14" + ], + "routing": "", + "assignee_policy": "all", + "highlight_editable_fields_enabled": "1", + "highlight_editable_fields_class": "green-background", + "instructionsEnable": "0", + "instructionsValue": "", + "display_fields_mode": "all_fields", + "default_status": "hidden", + "note_mode": "not_required", + "assignee_notification_enabled": "1", + "assignee_notification_from_name": "WIAAS Market", + "assignee_notification_from_email": " confirm that installation is completed for order\u00a0{Order ID:1}", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "Upload installation test protocol for {Order ID:1}", + "assignee_notification_message": "{Order ID:1}<\/strong>\r\n\r\nGo to {workflow_entry_link} to upload installation test protocol for order\u00a0{Order ID:1}\r\n\r\n ", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "in_progress_notification_enabled": "0", + "in_progress_notification_type": "select", + "in_progress_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "in_progress_notification_from_name": "", + "in_progress_notification_from_email": "{admin_email}", + "in_progress_notification_reply_to": "", + "in_progress_notification_bcc": "", + "in_progress_notification_subject": "", + "in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.", + "in_progress_notification_disable_autoformat": "0", + "complete_notification_enabled": "0", + "complete_notification_type": "select", + "complete_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "complete_notification_from_name": "", + "complete_notification_from_email": "{admin_email}", + "complete_notification_reply_to": "", + "complete_notification_bcc": "", + "complete_notification_subject": "", + "complete_notification_message": "Entry {entry_id} has been updated completing the step.", + "complete_notification_disable_autoformat": "0", + "confirmation_messageEnable": "0", + "confirmation_messageValue": "Thank you.", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "status_expiration": "complete", + "destination_expired": "next", + "destination_complete": "complete" + }, + "addon_slug": "gravityflow", + "event_type": null + } + ] + } + }, + "2": { + "title": "ACTION: Customer Acceptance", + "description": "", + "labelPlacement": "top_label", + "descriptionPlacement": "below", + "button": { + "type": "text", + "text": "Submit", + "imageUrl": "" + }, + "fields": [ + { + "type": "wiaas_order", + "id": 1, + "label": "Order Number", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 16, + "description": "", + "allowsPrepopulate": true, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "order_id", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "enableCalculation": false, + "numberFormat": "decimal_dot", + "rangeMin": "", + "rangeMax": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "" + }, + { + "type": "workflow_user", + "id": 10, + "label": "Customer User:", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "choices": [ + { + "value": 2, + "text": "Commercial User" + }, + { + "value": 3, + "text": "Customer User" + } + ], + "formId": 16, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "conditionalLogic": "", + "failed_validation": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "", + "gravityflowUsersRoleFilter": "customer" + }, + { + "type": "wiaas_order_document", + "wiaasDocTypeFilter": "customer_acceptance", + "id": 9, + "label": "Acceptance Document:", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 16, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "fileupload", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "maxFileSize": "", + "maxFiles": "", + "multipleFiles": true, + "allowedExtensions": "", + "productField": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "" + }, + { + "type": "date", + "id": 6, + "label": "Expiration Date", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "dateType": "datepicker", + "calendarIconType": "none", + "formId": 16, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "calendarIconUrl": "", + "dateFormat": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "" + }, + { + "type": "radio", + "id": 4, + "label": "Acceptance", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "choices": [ + { + "text": "Not Accepted", + "value": "pending", + "isSelected": false, + "price": "" + }, + { + "text": "Accepted", + "value": "accept", + "isSelected": false, + "price": "" + }, + { + "text": "Declined", + "value": "decline", + "isSelected": false, + "price": "" + } + ], + "formId": 16, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "conditionalLogic": "", + "productField": "", + "enableOtherChoice": "", + "enablePrice": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "enableChoiceValue": true, + "displayOnly": "" + }, + { + "type": "textarea", + "id": 3, + "label": "Decline Reason", + "adminLabel": "", + "isRequired": false, + "size": "small", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 16, + "description": "", + "allowsPrepopulate": true, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "order_decline_reason", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": { + "actionType": "show", + "logicType": "all", + "rules": [ + { + "fieldId": "4", + "operator": "is", + "value": "decline" + } + ] + }, + "productField": "", + "form_id": "", + "useRichTextEditor": false, + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "enableCalculation": "", + "disableQuantity": false, + "displayAllCategories": false, + "displayOnly": "", + "enablePrice": "" + } + ], + "version": "2.3.2", + "id": 16, + "useCurrentUserAsAuthor": true, + "postContentTemplateEnabled": false, + "postTitleTemplateEnabled": false, + "postTitleTemplate": "", + "postContentTemplate": "", + "lastPageButton": null, + "pagination": null, + "firstPageCssClass": null, + "wiaas_delivery_process": { + "delivery_form_type": "action", + "delivery_action_code": "customer-acceptance", + "automatic_action_entries_enabled": "1", + "automatic_action_entries_type": "single" + }, + "confirmations": [ + { + "id": "5bd8668e50997", + "name": "Default Confirmation", + "isDefault": true, + "type": "message", + "message": "Thanks for contacting us! We will get in touch with you shortly.", + "url": "", + "pageId": "", + "queryString": "" + } + ], + "notifications": [ + { + "id": "5bd8668e50471", + "to": "{admin_email}", + "name": "Admin Notification", + "event": "form_submission", + "toType": "email", + "subject": "New submission from {form_title}", + "message": "{all_fields}" + } + ], + "feeds": { + "gravityflow": [ + { + "id": "94", + "form_id": "16", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Upload Acceptance Document", + "description": "", + "step_type": "user_input", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "schedule_date_field": "6", + "type": "select", + "assignees": [ + "assignee_user_field|10" + ], + "editable_fields": [ + "9", + "4", + "3" + ], + "routing": "", + "assignee_policy": "any", + "conditional_logic_editable_fields_enabled": "1", + "highlight_editable_fields_enabled": "0", + "highlight_editable_fields_class": "green-triangle", + "instructionsEnable": "0", + "instructionsValue": "", + "display_fields_mode": "all_fields", + "default_status": "hidden", + "note_mode": "not_required", + "assignee_notification_enabled": "1", + "assignee_notification_from_name": "WIAAS Market", + "assignee_notification_from_email": "support@co-ideation.com", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "{Order Number:1}: Upload acceptance document", + "assignee_notification_message": "{Order Number:1}<\/strong>\r\n\r\nPlease go to your account and upload acceptance document.", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "in_progress_notification_enabled": "0", + "in_progress_notification_type": "select", + "in_progress_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "in_progress_notification_from_name": "", + "in_progress_notification_from_email": "{admin_email}", + "in_progress_notification_reply_to": "", + "in_progress_notification_bcc": "", + "in_progress_notification_subject": "", + "in_progress_notification_message": "Entry {entry_id} has been updated and remains in progress.", + "in_progress_notification_disable_autoformat": "0", + "complete_notification_enabled": "0", + "complete_notification_type": "select", + "complete_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "complete_notification_from_name": "", + "complete_notification_from_email": "{admin_email}", + "complete_notification_reply_to": "", + "complete_notification_bcc": "", + "complete_notification_subject": "", + "complete_notification_message": "Entry {entry_id} has been updated completing the step.", + "complete_notification_disable_autoformat": "0", + "confirmation_messageEnable": "0", + "confirmation_messageValue": "Thank you.", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "expiration_date_field": "6", + "status_expiration": "complete", + "destination_expired": "next", + "destination_complete": "next" + }, + "addon_slug": "gravityflow", + "event_type": null + }, + { + "id": "95", + "form_id": "16", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Accept installation", + "description": "", + "step_type": "approval", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "schedule_date_field": "6", + "type": "select", + "assignees": [ + "assignee_user_field|10" + ], + "routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "assignee_policy": "all", + "instructionsEnable": "0", + "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", + "display_fields_mode": "all_fields", + "assignee_notification_enabled": "1", + "assignee_notification_from_name": "WIAAS Market", + "assignee_notification_from_email": "support@co-ideation.com", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "{Order Number:1}: Accept installation", + "assignee_notification_message": "Login to your account and accept installation.", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "rejection_notification_enabled": "0", + "rejection_notification_type": "select", + "rejection_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "rejection_notification_from_name": "", + "rejection_notification_from_email": "{admin_email}", + "rejection_notification_reply_to": "", + "rejection_notification_bcc": "", + "rejection_notification_subject": "", + "rejection_notification_message": "Entry {entry_id} has been rejected", + "rejection_notification_disable_autoformat": "0", + "approval_notification_enabled": "0", + "approval_notification_type": "select", + "approval_notification_routing": [ + { + "assignee": "role|administrator", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "approval_notification_from_name": "", + "approval_notification_from_email": "{admin_email}", + "approval_notification_reply_to": "", + "approval_notification_bcc": "", + "approval_notification_subject": "", + "approval_notification_message": "Entry {entry_id} has been approved", + "approval_notification_disable_autoformat": "0", + "revertEnable": "0", + "revertValue": "41", + "note_mode": "not_required", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "expiration_date_field": "6", + "status_expiration": "rejected", + "destination_expired": "next", + "destination_rejected": "complete", + "destination_approved": "next" + }, + "addon_slug": "gravityflow", + "event_type": null + } + ] + } + }, + "version": "2.3.2" +} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json index f550ca4..2a74d6e 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json +++ b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json @@ -1 +1,233 @@ -{"0":{"title":"DELIVERY PROCESS EXAMPLE: Copy and set to active to create new delivery process","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":24,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":24,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery_process":{"delivery_form_type":"process","delivery_country":"se"},"notifications":[{"id":"5bdb1c7c26952","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"confirmations":[{"id":"5bdb1c7c26da9","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"feeds":{"gravityflow":[{"id":"83","form_id":"24","is_active":"1","feed_order":"0","meta":{"step_name":"Delivery Step Placeholder (Change this to start creating workflow)","description":"","step_type":"wiaas_delivery_step","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","instructionsEnable":"0","instructionsValue":"","is_visible_to_customer":"1","target_form_id":"","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null},{"id":"84","form_id":"24","is_active":"1","feed_order":"0","meta":{"step_name":"Complete","description":"","step_type":"approval","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","type":"select","assignees":["role|administrator"],"routing":[{"assignee":"user_id|1","fieldId":"0","operator":"is","value":"","type":""}],"assignee_policy":"all","instructionsEnable":"0","instructionsValue":"Instructions: please review the values in the fields below and click on the Approve or Reject button","display_fields_mode":"all_fields","assignee_notification_enabled":"0","assignee_notification_from_name":"","assignee_notification_from_email":"{admin_email}","assignee_notification_reply_to":"","assignee_notification_bcc":"","assignee_notification_subject":"","assignee_notification_message":"A new entry is pending your approval. Please check your Workflow Inbox.","assignee_notification_disable_autoformat":"0","resend_assignee_emailEnable":"0","resend_assignee_emailValue":"7","resend_assignee_email_repeatEnable":"0","resend_assignee_email_repeatValue":"3","rejection_notification_enabled":"0","rejection_notification_type":"select","rejection_notification_routing":[{"assignee":"user_id|1","fieldId":"0","operator":"is","value":"","type":""}],"rejection_notification_from_name":"","rejection_notification_from_email":"{admin_email}","rejection_notification_reply_to":"","rejection_notification_bcc":"","rejection_notification_subject":"","rejection_notification_message":"Entry {entry_id} has been rejected","rejection_notification_disable_autoformat":"0","approval_notification_enabled":"0","approval_notification_type":"select","approval_notification_routing":[{"assignee":"user_id|1","fieldId":"0","operator":"is","value":"","type":""}],"approval_notification_from_name":"","approval_notification_from_email":"{admin_email}","approval_notification_reply_to":"","approval_notification_bcc":"","approval_notification_subject":"","approval_notification_message":"Entry {entry_id} has been approved","approval_notification_disable_autoformat":"0","note_mode":"not_required","expiration":"0","expiration_type":"delay","expiration_date":"","expiration_delay_offset":"","expiration_delay_unit":"hours","expiration_date_field_offset":"0","expiration_date_field_offset_unit":"hours","expiration_date_field_before_after":"after","status_expiration":"rejected","destination_expired":"next","destination_rejected":"complete","destination_approved":"next"},"addon_slug":"gravityflow","event_type":null}]}},"version":"2.3.2"} \ No newline at end of file +{ + "0": { + "title": "DELIVERY PROCESS EXAMPLE: Copy and set to active to create new delivery process", + "description": "", + "labelPlacement": "top_label", + "descriptionPlacement": "below", + "button": { + "type": "text", + "text": "Submit", + "imageUrl": "" + }, + "fields": [ + { + "type": "wiaas_order", + "id": 1, + "label": "Order number", + "adminLabel": "", + "isRequired": false, + "size": "medium", + "errorMessage": "", + "visibility": "visible", + "inputs": null, + "formId": 24, + "description": "", + "allowsPrepopulate": false, + "inputMask": false, + "inputMaskValue": "", + "inputType": "", + "labelPlacement": "", + "descriptionPlacement": "", + "subLabelPlacement": "", + "placeholder": "", + "cssClass": "", + "inputName": "", + "noDuplicates": false, + "defaultValue": "", + "choices": "", + "conditionalLogic": "", + "enableCalculation": false, + "numberFormat": "decimal_dot", + "rangeMin": "", + "rangeMax": "", + "productField": "", + "multipleFiles": false, + "maxFiles": "", + "calculationFormula": "", + "calculationRounding": "", + "disableQuantity": false, + "displayAllCategories": false, + "useRichTextEditor": false, + "displayOnly": "", + "enablePrice": "" + } + ], + "version": "2.3.2", + "id": 24, + "useCurrentUserAsAuthor": true, + "postContentTemplateEnabled": false, + "postTitleTemplateEnabled": false, + "postTitleTemplate": "", + "postContentTemplate": "", + "lastPageButton": null, + "pagination": null, + "firstPageCssClass": null, + "wiaas_delivery_process": { + "delivery_form_type": "process", + "delivery_country": "se" + }, + "notifications": [ + { + "id": "5bdb1c7c26952", + "to": "{admin_email}", + "name": "Admin Notification", + "event": "form_submission", + "toType": "email", + "subject": "New submission from {form_title}", + "message": "{all_fields}" + } + ], + "confirmations": [ + { + "id": "5bdb1c7c26da9", + "name": "Default Confirmation", + "isDefault": true, + "type": "message", + "message": "Thanks for contacting us! We will get in touch with you shortly.", + "url": "", + "pageId": "", + "queryString": "" + } + ], + "feeds": { + "gravityflow": [ + { + "id": "83", + "form_id": "24", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Delivery Step Placeholder (Change this to start creating workflow)", + "description": "", + "step_type": "wiaas_delivery_step", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "instructionsEnable": "0", + "instructionsValue": "", + "is_visible_to_customer": "1", + "target_form_id": "", + "destination_complete": "next" + }, + "addon_slug": "gravityflow", + "event_type": null + }, + { + "id": "84", + "form_id": "24", + "is_active": "1", + "feed_order": "0", + "meta": { + "step_name": "Complete", + "description": "", + "step_type": "approval", + "step_highlight": "0", + "step_highlight_type": "color", + "step_highlight_color": "#dd3333", + "feed_condition_conditional_logic": "0", + "feed_condition_conditional_logic_object": [], + "scheduled": "0", + "schedule_type": "delay", + "schedule_date": "", + "schedule_delay_offset": "", + "schedule_delay_unit": "hours", + "schedule_date_field_offset": "0", + "schedule_date_field_offset_unit": "hours", + "schedule_date_field_before_after": "after", + "type": "select", + "assignees": [ + "role|administrator" + ], + "routing": [ + { + "assignee": "user_id|1", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "assignee_policy": "all", + "instructionsEnable": "0", + "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", + "display_fields_mode": "all_fields", + "assignee_notification_enabled": "0", + "assignee_notification_from_name": "", + "assignee_notification_from_email": "{admin_email}", + "assignee_notification_reply_to": "", + "assignee_notification_bcc": "", + "assignee_notification_subject": "", + "assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.", + "assignee_notification_disable_autoformat": "0", + "resend_assignee_emailEnable": "0", + "resend_assignee_emailValue": "7", + "resend_assignee_email_repeatEnable": "0", + "resend_assignee_email_repeatValue": "3", + "rejection_notification_enabled": "0", + "rejection_notification_type": "select", + "rejection_notification_routing": [ + { + "assignee": "user_id|1", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "rejection_notification_from_name": "", + "rejection_notification_from_email": "{admin_email}", + "rejection_notification_reply_to": "", + "rejection_notification_bcc": "", + "rejection_notification_subject": "", + "rejection_notification_message": "Entry {entry_id} has been rejected", + "rejection_notification_disable_autoformat": "0", + "approval_notification_enabled": "0", + "approval_notification_type": "select", + "approval_notification_routing": [ + { + "assignee": "user_id|1", + "fieldId": "0", + "operator": "is", + "value": "", + "type": "" + } + ], + "approval_notification_from_name": "", + "approval_notification_from_email": "{admin_email}", + "approval_notification_reply_to": "", + "approval_notification_bcc": "", + "approval_notification_subject": "", + "approval_notification_message": "Entry {entry_id} has been approved", + "approval_notification_disable_autoformat": "0", + "note_mode": "not_required", + "expiration": "0", + "expiration_type": "delay", + "expiration_date": "", + "expiration_delay_offset": "", + "expiration_delay_unit": "hours", + "expiration_date_field_offset": "0", + "expiration_date_field_offset_unit": "hours", + "expiration_date_field_before_after": "after", + "status_expiration": "rejected", + "destination_expired": "next", + "destination_rejected": "complete", + "destination_approved": "next" + }, + "addon_slug": "gravityflow", + "event_type": null + } + ] + } + }, + "version": "2.3.2" +} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php index 2ba2d56..ebc699a 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php +++ b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php @@ -82,12 +82,34 @@ function wiaas_create_organization_roles_capabilities() { function update_delivery_forms() { $forms = GFAPI::get_forms(); - foreach ($forms as $form) { - GFAPI::delete_form($form['id']); + RGFormsModel::update_form_active($form['id'], false); } - GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-action-forms.json"); + $created_forms = array(); - GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-process-sample-form.json"); + $actions_forms_json = file_get_contents( dirname( __FILE__ ) . '/data/delivery-forms/delivery-action-forms.json' ); + + $action_forms_meta = json_decode( $actions_forms_json, true ); + + foreach ($action_forms_meta as $action_form_meta) { + + $form_id = GFAPI::add_form($action_form_meta); + $created_forms[] = GFAPI::get_form($form_id); + } + + + $sample_form_json = file_get_contents( dirname( __FILE__ ) . '/data/delivery-forms/delivery-process-sample-form.json' ); + + $sample_form = json_decode( $sample_form_json, true ); + + $sample_form = $sample_form[0]; + + $sample_form_id = GFAPI::add_form($sample_form); + + RGFormsModel::update_form_active($sample_form_id, false); + + $created_forms[] = GFAPI::get_form($sample_form_id); + + do_action('gform_forms_post_import', $created_forms); } \ No newline at end of file From 8d4f75cc41fb83ade3f141338104b07b192d38b7 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sat, 3 Nov 2018 11:15:52 +0100 Subject: [PATCH 06/14] Handle process navigation better --- .../css/wiaas-admin-delivery-process.css | 10 ++ .../assets/js/wiaas-admin-delivery-process.js | 8 ++ .../class-wiaas-admin-delivery-process.php | 111 +++++++++++++----- .../wiaas/includes/class-wiaas-cart.php | 29 ++++- .../class-wiaas-delivery-process-step.php | 2 +- .../product/class-wiaas-product-supplier.php | 17 ++- .../user/wiaas-organization-functions.php | 27 +++++ .../process/ValidateQuestionnaireItem.jsx | 2 +- 8 files changed, 168 insertions(+), 38 deletions(-) create mode 100644 backend/app/plugins/wiaas/assets/css/wiaas-admin-delivery-process.css create mode 100644 backend/app/plugins/wiaas/assets/js/wiaas-admin-delivery-process.js diff --git a/backend/app/plugins/wiaas/assets/css/wiaas-admin-delivery-process.css b/backend/app/plugins/wiaas/assets/css/wiaas-admin-delivery-process.css new file mode 100644 index 0000000..430216a --- /dev/null +++ b/backend/app/plugins/wiaas/assets/css/wiaas-admin-delivery-process.css @@ -0,0 +1,10 @@ +.wiaas_delivery_step_nav { + + + +} + + +.gravityflow_workflow_detail #postbox-container-1 > div:nth-child(2) { + display: none; +} diff --git a/backend/app/plugins/wiaas/assets/js/wiaas-admin-delivery-process.js b/backend/app/plugins/wiaas/assets/js/wiaas-admin-delivery-process.js new file mode 100644 index 0000000..10341bb --- /dev/null +++ b/backend/app/plugins/wiaas/assets/js/wiaas-admin-delivery-process.js @@ -0,0 +1,8 @@ +jQuery(document).ready(function ($) { + $('.wiaas_delivery_step_nav').click(function (e) { + var action = $(this).data('step'); + + $('#wiaas_delivery_process_navigation_action').val(action); + + }); +}); diff --git a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php index 512a03e..caf1120 100644 --- a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php @@ -8,14 +8,26 @@ class Wiaas_Admin_Delivery_Process { add_action( 'gravityflow_title_entry_detail', array( __CLASS__, 'process_title' ), 10, 3 ); - add_action('add_meta_boxes', array(__CLASS__, 'add_delivery_process_metabox'), 100); add_action( 'wp_ajax_wiaas_create_order_delivery_process', array(__CLASS__, 'wiaas_ajax_create_order_delivery_process') ); - add_filter('gravityflow_admin_actions_workflow_detail', array (__CLASS__, 'filter_process_send_to_step_options'), 10, 5); + add_action('gravityflow_entry_detail', array(__CLASS__, 'maybe_display_delivery_process_navigation'), 9, 3); + + add_filter('gravityflow_admin_action_feedback', array(__CLASS__, 'maybe_process_admin_step_change_action'), 10, 4); + + add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 ); } + public static function enqueue_scripts() { + + $plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) ); + + wp_enqueue_script( 'wiaas_admin_delivery_process', $plugin_url . '/assets/js/wiaas-admin-delivery-process.js' ); + wp_enqueue_style( 'wiaas_admin_delivery_process', $plugin_url . '/assets/css/wiaas-admin-delivery-process.css' ); + } + + public static function add_delivery_process_metabox() { add_meta_box( @@ -29,45 +41,84 @@ class Wiaas_Admin_Delivery_Process { } - public static function filter_process_send_to_step_options($admin_actions, $current_step, $steps, $form, $entry) { + public static function maybe_process_admin_step_change_action($feedback, $admin_action, $form, $entry) { - $delivery_process_actions = array(); + $admin_action = rgpost( 'wiaas_delivery_process_navigation_action' ); - if ( $current_step ) { + list( $base_admin_action, $action_id ) = rgexplode( '|', $admin_action, 2 ); - $previous_step_id = null; - // get previous step id for current step - foreach ($steps as $index => $step) { + 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' ); + } - $next_step = gravity_flow()->get_next_step($step, $entry, $form); + return $feedback; + } - if ($next_step && $next_step->get_id() === $current_step->get_id()) { - $previous_step_id = $step->get_id(); - } - } + public static function maybe_display_delivery_process_navigation($form, $entry, $current_step) { - if (! empty($previous_step_id)) { + if(! GFAPI::current_user_can_any( 'gravityflow_workflow_detail_admin_actions' ) || empty( $current_step ) ) { + return; + } - $delivery_process_actions[] = array( - 'label' => esc_html__( 'Previous step', 'wiaas' ), - 'value' => 'send_to_step|' . $previous_step_id - ); - } + $steps = gravity_flow()->get_steps($form['id'], $entry); - // get next step id for current step - $next_step = gravity_flow()->get_next_step($current_step, $entry, $form); - if ($next_step) { + // 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(); - $delivery_process_actions[] = array( - 'label' => esc_html__( 'Next step', 'wiaas' ), - 'value' => 'send_to_step|' . $next_step->get_id() - ); - } - } + // get previous step id + foreach ($steps as $step) { - return $delivery_process_actions; - } + $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 wiaas_delivery_step_nav" + style="float:right; margin-left: 20px;" value="NEXT STEP"> + + + class="button wiaas_delivery_step_nav" + style="float:right;" value="PREV STEP"> +
    + add_meta_data( '_wiaas_documents', $item_documents, true ); } + // save simple product information that needs to be avaialable later on + // even if this data is changed or removed from product at that time + $simple_product_meta = array(); + if(wc_pb_is_bundled_cart_item($cart_item)) { + + $product = $cart_item['data']; + + $simple_product_meta['_wiaas_category'] = Wiaas_Product_Category::get_category($product); + $simple_product_meta['_wiaas_price'] = $product->get_price(); + $simple_product_meta['_wiaas_manufacturer_product_no'] = $product->get_meta('_manufacturer_product_no'); + $simple_product_meta['_wiaas_supplier_product_no'] = $product->get_meta('_supplier_product_no'); + // get supplier + if ($supplier_organization_id = Wiaas_Product_Supplier::get_supplier_organisation_id_from_product($product->get_id())) { + $info = wiaas_get_organization_info($supplier_organization_id); + + $simple_product_meta['_wiaas_supplier_info'] = $info; + } + + + } + return $order_item; } diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php index bc6b668..5c15849 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php @@ -94,7 +94,7 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { public function update_step_status($status = false) { - if ($status === 'cancelled' && $admin_action = rgpost( 'gravityflow_admin_action' )) { + if ($status === 'cancelled' && $admin_action = rgpost( 'wiaas_delivery_process_navigation_action' )) { list( $base_admin_action, $step_id ) = rgexplode( '|', $admin_action, 2 ); diff --git a/backend/app/plugins/wiaas/includes/product/class-wiaas-product-supplier.php b/backend/app/plugins/wiaas/includes/product/class-wiaas-product-supplier.php index 6d25327..5982a13 100644 --- a/backend/app/plugins/wiaas/includes/product/class-wiaas-product-supplier.php +++ b/backend/app/plugins/wiaas/includes/product/class-wiaas-product-supplier.php @@ -68,15 +68,24 @@ class Wiaas_Product_Supplier { * Retrieve organisation id of the supplier of the product * * @param $product_id - * @return int organization_id + * @return int|false organization_id */ public static function get_supplier_organisation_id_from_product($product_id) { $supplier_terms = wp_get_object_terms($product_id, 'supplier'); - $supplier_organisation_slug = $supplier_terms[0]->slug; - $supplier_organisation_id = get_term_by('slug', $supplier_organisation_slug, 'wiaas-user-organization')->term_id; + if (empty( $supplier_terms )) { - return $supplier_organisation_id; + return false; + } + + $supplier_organisation_slug = $supplier_terms[0]->slug; + $supplier_organisation = get_term_by('slug', $supplier_organisation_slug, 'wiaas-user-organization'); + + if ($supplier_organisation) { + return $supplier_organisation->term_id; + } + + return $supplier_organisation ? $supplier_organisation->term_id : false; } } diff --git a/backend/app/plugins/wiaas/includes/user/wiaas-organization-functions.php b/backend/app/plugins/wiaas/includes/user/wiaas-organization-functions.php index 4b9eeda..e68884f 100644 --- a/backend/app/plugins/wiaas/includes/user/wiaas-organization-functions.php +++ b/backend/app/plugins/wiaas/includes/user/wiaas-organization-functions.php @@ -110,4 +110,31 @@ function wiaas_get_organization_user_ids($organization_id) { $user_ids = get_objects_in_term($organization_id, Wiaas_User_Organization::TAXONOMY_NAME); return is_wp_error($user_ids) ? array() : $user_ids; +} + +function wiaas_get_organization_info($organization_id) { + + $organization = get_term($organization_id); + + if ($organization) { + + $user_ids = wiaas_get_organization_user_ids($organization_id); + + $email = null; + + if (! empty($user_ids)) { + + $user = get_userdata($user_ids[0]); + + $email = $user ? $user->user_email : null; + } + + return array( + 'name' => $organization->name, + 'description' => $organization->description, + 'vat_code' => get_term_meta($organization_id, '_wiaas_organization_vat'), + 'phone' => get_term_meta($organization_id, '_wiaas_organization_phone'), + 'email' => $email + ); + } } \ No newline at end of file diff --git a/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx b/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx index 5b1b5e6..cc5a4af 100644 --- a/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx +++ b/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx @@ -37,7 +37,7 @@ class ValidateQuestionnaireItem extends Component { { customerDocuments &&
    - {orderPackage.packageName} + {orderPackage.name} { customerDocuments.map(document =>
    { From a6640548efc6b3bd7fc27d737513c7fd3b211e32 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sun, 4 Nov 2018 13:20:13 +0100 Subject: [PATCH 07/14] Update delivery process fields and sample form --- ...lass-wiaas-admin-delivery-process-flow.php | 28 ++- .../wiaas/includes/class-wiaas-cart.php | 32 ++- .../includes/class-wiaas-delivery-process.php | 6 +- .../wiaas/includes/class-wiaas-order.php | 16 +- .../delivery-process-sample-form.json | 234 +----------------- .../class-wiaas-delivery-process-step.php | 14 +- ...lass-wiaas-field-order-bundle-document.php | 13 + .../class-wiaas-field-order-bundle.php | 13 + .../class-wiaas-field-order-document.php | 13 + ...-wiaas-field-order-installation-select.php | 13 + .../class-wiaas-field-order-number.php | 13 + .../class-wiaas-order-fields.php | 23 ++ .../includes/order/wiaas-order-functions.php | 44 +--- .../cart/components/CartUploadDocument.jsx | 2 +- .../components/process/CustomerAcceptance.jsx | 2 +- .../process/ValidateQuestionnaireItem.jsx | 2 +- 16 files changed, 170 insertions(+), 298 deletions(-) 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 a108d4d..877c5b2 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 @@ -90,7 +90,7 @@ class Wiaas_Admin_Order_Process_Flow { $order_id = $entry['wiaas_delivery_order_id']; - $suppliers = wiaas_get_order_delivery_suppliers($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); @@ -102,6 +102,24 @@ class Wiaas_Admin_Order_Process_Flow { $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' ) { @@ -162,11 +180,12 @@ class Wiaas_Admin_Order_Process_Flow { class="button button-primary wiaas_delivery_step_nav" - style="float:right; margin-left: 20px;" value="NEXT STEP"> + style="float:right; margin-left: 20px;" + value="" + > get_items('line_item'); foreach($items as $item) { - if (! empty($item['wiaas_supplier_organization_id']) && - empty($suppliers_info[$item['wiaas_supplier_organization_id']]) ) { + $supplier_organization_id = $item['wiaas_supplier_organization_id']; + + if (! empty($supplier_organization_id) && $item['wiaas_category'] !== 'installation' && + empty($suppliers_info[$supplier_organization_id]) ) { - $supplier_organization_id = $item['wiaas_supplier_organization_id']; $suppliers_info[$supplier_organization_id] = array( 'id' => $supplier_organization_id, 'estimated_delivery_date' => null, @@ -491,9 +501,23 @@ class Wiaas_Cart { $suppliers_info[$supplier_organization_id][$key] = $info; } } + + if (! empty($supplier_organization_id) && $item['wiaas_category'] === 'installation' && + empty($installation_suppliers_info[$supplier_organization_id]) ) { + + $installation_suppliers_info[$supplier_organization_id] = array( + 'id' => $supplier_organization_id, + ); + + $supplier_organization_info = wiaas_get_organization_info($supplier_organization_id); + foreach ($supplier_organization_info as $key => $info) { + $installation_suppliers_info[$supplier_organization_id][$key] = $info; + } + } } - $order->add_meta_data('_wiaas_suppliers', $suppliers_info, true); + $order->add_meta_data('_wiaas_delivery_suppliers', $suppliers_info, true); + $order->add_meta_data('_wiaas_installation_suppliers', $installation_suppliers_info, true); // add additional date fields to order $order->add_meta_data('_wiaas_estimated_delivery_date', null, true); 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 5ba59d4..b1cd25d 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-delivery-process.php @@ -85,10 +85,10 @@ class Wiaas_Delivery_Process { * @param $form */ public static function maybe_complete_parent_order($entry_id, $form) { + $entry = GFAPI::get_entry($entry_id); - $order_field = GFCommon::get_fields_by_type($form, 'wiaas_order')[0]; - $order_id = empty($order_field) ? null : absint($entry[$order_field->id]); + $order_id = $entry['wiaas_delivery_order_id']; if (!isset($order_id)) { return; @@ -97,7 +97,7 @@ class Wiaas_Delivery_Process { $process_entry_id = get_post_meta($order_id, 'wiaas_delivery_process_entry_id', true); // order process entry completed, so complete order - if (absint($process_entry_id) === $entry_id) { + if (absint($process_entry_id) === absint($entry_id)) { $order = wc_get_order($order_id); $order->update_status('completed', 'Completed order delivery process.', true); } diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-order.php b/backend/app/plugins/wiaas/includes/class-wiaas-order.php index 537ac33..718acb2 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-order.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-order.php @@ -61,7 +61,7 @@ class Wiaas_Order { ); $order = wc_get_order($order_id); - $order->update_meta_data('_wiaas_suppliers', $suppliers); + $order->update_meta_data('_wiaas_delivery_suppliers', $suppliers); $order->save_meta_data(); return true; } @@ -79,7 +79,7 @@ class Wiaas_Order { $order = wc_get_order($order_id); - $order->update_meta_data('_wiaas_suppliers', $suppliers); + $order->update_meta_data('_wiaas_delivery_suppliers', $suppliers); $order->save_meta_data(); return true; } @@ -95,7 +95,7 @@ class Wiaas_Order { unset($suppliers[$key]['tracking_info'][$tracking_index]); $order = wc_get_order($order_id); - $order->update_meta_data('_wiaas_suppliers', $suppliers); + $order->update_meta_data('_wiaas_delivery_suppliers', $suppliers); $order->save_meta_data(); return true; } @@ -105,7 +105,7 @@ class Wiaas_Order { } public static function save_estimated_date($order_id, $supplier_id, $date){ - $suppliers = wiaas_get_order_delivery_suppliers($order_id); + $suppliers = self::get_suppliers($order_id); $updated = false; foreach($suppliers as $key => $supplier){ if ($supplier['id'] === $supplier_id){ @@ -120,7 +120,7 @@ class Wiaas_Order { $order = wc_get_order($order_id); - $order->update_meta_data('_wiaas_suppliers', $suppliers); + $order->update_meta_data('_wiaas_delivery_suppliers', $suppliers); self::_update_max_and_earliest_dates($order, $suppliers); $order->save_meta_data(); @@ -129,7 +129,7 @@ class Wiaas_Order { public static function save_confirmed_date($order_id, $supplier_id, $date){ - $suppliers = wiaas_get_order_delivery_suppliers($order_id); + $suppliers = self::get_suppliers($order_id); $updated = false; foreach($suppliers as $key => $supplier){ @@ -148,7 +148,7 @@ class Wiaas_Order { $order = wc_get_order($order_id); - $order->update_meta_data('_wiaas_suppliers', $suppliers); + $order->update_meta_data('_wiaas_delivery_suppliers', $suppliers); self::_update_max_and_earliest_dates($order, $suppliers); $order->save_meta_data(); @@ -201,7 +201,7 @@ class Wiaas_Order { */ public static function get_suppliers($order_id){ $order = wc_get_order($order_id); - return $order->get_meta('_wiaas_suppliers'); + return $order->get_meta('_wiaas_delivery_suppliers'); } /** diff --git a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json index 2a74d6e..9228c21 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json +++ b/backend/app/plugins/wiaas/includes/db-updates/data/delivery-forms/delivery-process-sample-form.json @@ -1,233 +1 @@ -{ - "0": { - "title": "DELIVERY PROCESS EXAMPLE: Copy and set to active to create new delivery process", - "description": "", - "labelPlacement": "top_label", - "descriptionPlacement": "below", - "button": { - "type": "text", - "text": "Submit", - "imageUrl": "" - }, - "fields": [ - { - "type": "wiaas_order", - "id": 1, - "label": "Order number", - "adminLabel": "", - "isRequired": false, - "size": "medium", - "errorMessage": "", - "visibility": "visible", - "inputs": null, - "formId": 24, - "description": "", - "allowsPrepopulate": false, - "inputMask": false, - "inputMaskValue": "", - "inputType": "", - "labelPlacement": "", - "descriptionPlacement": "", - "subLabelPlacement": "", - "placeholder": "", - "cssClass": "", - "inputName": "", - "noDuplicates": false, - "defaultValue": "", - "choices": "", - "conditionalLogic": "", - "enableCalculation": false, - "numberFormat": "decimal_dot", - "rangeMin": "", - "rangeMax": "", - "productField": "", - "multipleFiles": false, - "maxFiles": "", - "calculationFormula": "", - "calculationRounding": "", - "disableQuantity": false, - "displayAllCategories": false, - "useRichTextEditor": false, - "displayOnly": "", - "enablePrice": "" - } - ], - "version": "2.3.2", - "id": 24, - "useCurrentUserAsAuthor": true, - "postContentTemplateEnabled": false, - "postTitleTemplateEnabled": false, - "postTitleTemplate": "", - "postContentTemplate": "", - "lastPageButton": null, - "pagination": null, - "firstPageCssClass": null, - "wiaas_delivery_process": { - "delivery_form_type": "process", - "delivery_country": "se" - }, - "notifications": [ - { - "id": "5bdb1c7c26952", - "to": "{admin_email}", - "name": "Admin Notification", - "event": "form_submission", - "toType": "email", - "subject": "New submission from {form_title}", - "message": "{all_fields}" - } - ], - "confirmations": [ - { - "id": "5bdb1c7c26da9", - "name": "Default Confirmation", - "isDefault": true, - "type": "message", - "message": "Thanks for contacting us! We will get in touch with you shortly.", - "url": "", - "pageId": "", - "queryString": "" - } - ], - "feeds": { - "gravityflow": [ - { - "id": "83", - "form_id": "24", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Delivery Step Placeholder (Change this to start creating workflow)", - "description": "", - "step_type": "wiaas_delivery_step", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "instructionsEnable": "0", - "instructionsValue": "", - "is_visible_to_customer": "1", - "target_form_id": "", - "destination_complete": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - }, - { - "id": "84", - "form_id": "24", - "is_active": "1", - "feed_order": "0", - "meta": { - "step_name": "Complete", - "description": "", - "step_type": "approval", - "step_highlight": "0", - "step_highlight_type": "color", - "step_highlight_color": "#dd3333", - "feed_condition_conditional_logic": "0", - "feed_condition_conditional_logic_object": [], - "scheduled": "0", - "schedule_type": "delay", - "schedule_date": "", - "schedule_delay_offset": "", - "schedule_delay_unit": "hours", - "schedule_date_field_offset": "0", - "schedule_date_field_offset_unit": "hours", - "schedule_date_field_before_after": "after", - "type": "select", - "assignees": [ - "role|administrator" - ], - "routing": [ - { - "assignee": "user_id|1", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "assignee_policy": "all", - "instructionsEnable": "0", - "instructionsValue": "Instructions: please review the values in the fields below and click on the Approve or Reject button", - "display_fields_mode": "all_fields", - "assignee_notification_enabled": "0", - "assignee_notification_from_name": "", - "assignee_notification_from_email": "{admin_email}", - "assignee_notification_reply_to": "", - "assignee_notification_bcc": "", - "assignee_notification_subject": "", - "assignee_notification_message": "A new entry is pending your approval. Please check your Workflow Inbox.", - "assignee_notification_disable_autoformat": "0", - "resend_assignee_emailEnable": "0", - "resend_assignee_emailValue": "7", - "resend_assignee_email_repeatEnable": "0", - "resend_assignee_email_repeatValue": "3", - "rejection_notification_enabled": "0", - "rejection_notification_type": "select", - "rejection_notification_routing": [ - { - "assignee": "user_id|1", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "rejection_notification_from_name": "", - "rejection_notification_from_email": "{admin_email}", - "rejection_notification_reply_to": "", - "rejection_notification_bcc": "", - "rejection_notification_subject": "", - "rejection_notification_message": "Entry {entry_id} has been rejected", - "rejection_notification_disable_autoformat": "0", - "approval_notification_enabled": "0", - "approval_notification_type": "select", - "approval_notification_routing": [ - { - "assignee": "user_id|1", - "fieldId": "0", - "operator": "is", - "value": "", - "type": "" - } - ], - "approval_notification_from_name": "", - "approval_notification_from_email": "{admin_email}", - "approval_notification_reply_to": "", - "approval_notification_bcc": "", - "approval_notification_subject": "", - "approval_notification_message": "Entry {entry_id} has been approved", - "approval_notification_disable_autoformat": "0", - "note_mode": "not_required", - "expiration": "0", - "expiration_type": "delay", - "expiration_date": "", - "expiration_delay_offset": "", - "expiration_delay_unit": "hours", - "expiration_date_field_offset": "0", - "expiration_date_field_offset_unit": "hours", - "expiration_date_field_before_after": "after", - "status_expiration": "rejected", - "destination_expired": "next", - "destination_rejected": "complete", - "destination_approved": "next" - }, - "addon_slug": "gravityflow", - "event_type": null - } - ] - } - }, - "version": "2.3.2" -} \ No newline at end of file +{"0":{"title":"DELIVERY PROCESS EXAMPLE: Copy and set to active to create new delivery process","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"wiaas_order","id":1,"label":"Order number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":36,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"numberFormat":"decimal_dot","rangeMin":"","rangeMax":"","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":"","enablePrice":""}],"version":"2.3.2","id":36,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"wiaas_delivery_process":{"delivery_form_type":"process","delivery_country":"se"},"is_active":"1","date_created":"2018-11-02 10:15:28","is_trash":"0","confirmations":[{"id":"5bdb1c7c26da9","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}],"notifications":[{"id":"5bdb1c7c26952","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"}],"feeds":{"gravityflow":[{"id":"120","form_id":"36","is_active":"1","feed_order":"0","meta":{"step_name":"Delivery Step Placeholder (Use Delivery Step type to create process workflow steps)","description":"","step_type":"wiaas_delivery_step","step_highlight":"0","step_highlight_type":"color","step_highlight_color":"#dd3333","feed_condition_conditional_logic":"0","feed_condition_conditional_logic_object":[],"scheduled":"0","schedule_type":"delay","schedule_date":"","schedule_delay_offset":"","schedule_delay_unit":"hours","schedule_date_field_offset":"0","schedule_date_field_offset_unit":"hours","schedule_date_field_before_after":"after","instructionsEnable":"0","instructionsValue":"","is_visible_to_customer":"1","target_form_id":"","destination_complete":"next"},"addon_slug":"gravityflow","event_type":null}]}},"version":"2.3.2"} \ No newline at end of file diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php index 5c15849..6edcc9e 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step.php @@ -62,22 +62,16 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step { public function start() { - $complete = parent::start(); + parent::start(); - if ($complete) { + $this->update_step_status('pending'); - $this->update_step_status('complete'); - } else { - - $this->update_step_status('pending'); - } - - return $complete; + return false; } public function evaluate_status() { - return 'pending'; + return $this->get_status(); } public function get_status_label($status) { diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php index dfefebe..5611ed0 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle-document.php @@ -32,6 +32,19 @@ class Wiaas_Field_Order_Bundle_Document extends GF_Field_FileUpload { return 'fileupload'; } + public function add_button( $field_groups ) { + $field_groups = Wiaas_Order_Fields::maybe_add_order_field_group($field_groups); + + return parent::add_button( $field_groups ); + } + + public function get_form_editor_button() { + return array( + 'group' => 'wiaas_order_fields', + 'text' => $this->get_form_editor_field_title(), + ); + } + public function get_form_editor_field_title() { return esc_attr__( 'Bundle Document', 'wiaas' ); } diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle.php index 0d4ab92..418708b 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-bundle.php @@ -8,6 +8,19 @@ class Wiaas_Field_Order_Bundle extends GF_Field_Text { return esc_attr__( 'Bundle', 'wiaas' ); } + public function add_button( $field_groups ) { + $field_groups = Wiaas_Order_Fields::maybe_add_order_field_group($field_groups); + + return parent::add_button( $field_groups ); + } + + public function get_form_editor_button() { + return array( + 'group' => 'wiaas_order_fields', + 'text' => $this->get_form_editor_field_title(), + ); + } + public function get_value_entry_list( $value, $entry, $field_id, $columns, $form ) { return $this->get_bundle_display_name($value); } diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-document.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-document.php index a0cde76..f15ca11 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-document.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-document.php @@ -36,6 +36,19 @@ class Wiaas_Field_Order_Document extends GF_Field_FileUpload { return esc_attr__( 'Order Document', 'wiaas' ); } + public function add_button( $field_groups ) { + $field_groups = Wiaas_Order_Fields::maybe_add_order_field_group($field_groups); + + return parent::add_button( $field_groups ); + } + + public function get_form_editor_button() { + return array( + 'group' => 'wiaas_order_fields', + 'text' => $this->get_form_editor_field_title(), + ); + } + public function get_download_url( $file, $force_download = false ) { $upload_root = GFFormsModel::get_upload_url( $this->formId ); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-installation-select.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-installation-select.php index 689ed9f..f19967a 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-installation-select.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-installation-select.php @@ -13,6 +13,19 @@ class Wiaas_Order_Installation_Select extends GF_Field_Select { return 'workflow_assignee_select'; } + public function add_button( $field_groups ) { + $field_groups = Wiaas_Order_Fields::maybe_add_order_field_group($field_groups); + + return parent::add_button( $field_groups ); + } + + public function get_form_editor_button() { + return array( + 'group' => 'wiaas_order_fields', + 'text' => $this->get_form_editor_field_title(), + ); + } + public function get_field_input( $form, $value = '', $entry = null ) { if ( empty($entry) ) { diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-number.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-number.php index fed0ead..e3d3f4f 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-number.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-field-order-number.php @@ -36,6 +36,19 @@ class Wiaas_Field_Order_Number extends GF_Field_Number { return esc_attr__( 'Order Number', 'wiaas' ); } + public function add_button( $field_groups ) { + $field_groups = Wiaas_Order_Fields::maybe_add_order_field_group($field_groups); + + return parent::add_button( $field_groups ); + } + + public function get_form_editor_button() { + return array( + 'group' => 'wiaas_order_fields', + 'text' => $this->get_form_editor_field_title(), + ); + } + public function get_value_entry_list( $value, $entry, $field_id, $columns, $form ) { return "#100000$value"; diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php index af92e20..52a77b0 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php @@ -13,6 +13,29 @@ class Wiaas_Order_Fields { add_filter('gform_fileupload_entry_value_file_path', array( __CLASS__, 'display_order_document_fields' ), 999, 2); } + /** + * Adds the Order Fields group to the form editor. + * + * @param array $field_groups The properties for the field groups. + * + * @return array + */ + public static function maybe_add_order_field_group( $field_groups ) { + foreach ( $field_groups as $field_group ) { + if ( $field_group['name'] == 'wiaas_order_fields' ) { + return $field_groups; + } + } + + $field_groups[] = array( + 'name' => 'wiaas_order_fields', + 'label' => __( 'Order Fields', 'wiaas' ), + 'fields' => array() + ); + + return $field_groups; + } + public static function display_order_document_fields($file_path, $field) { diff --git a/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php b/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php index 0d71cbc..6522ced 100644 --- a/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php +++ b/backend/app/plugins/wiaas/includes/order/wiaas-order-functions.php @@ -42,13 +42,22 @@ function wiaas_get_order_procurement_info($order_id) { $order_items = $order->get_items(); - $order_suppliers_info = $order->get_meta('_wiaas_suppliers'); + $order_suppliers_info = array(); + $order_delivery_suppliers_info = $order->get_meta('_wiaas_delivery_suppliers'); + $order_installation_suppliers_info = $order->get_meta('_wiaas_installation_suppliers'); + + foreach ($order_delivery_suppliers_info as $id => $order_delivery_supplier_info) { + $order_suppliers_info[$id] = $order_delivery_supplier_info; + } + foreach ($order_installation_suppliers_info as $id => $order_installation_supplier_info) { + $order_suppliers_info[$id] = $order_installation_supplier_info; + } $data = array(); foreach ($order_items as $order_item_id => $order_item) { - $category = $order_item['_wiaas_category']; + $category = $order_item['wiaas_category']; $supplier_organization_id = $order_item['wiaas_supplier_organization_id']; $supplier_info = $order_suppliers_info[$supplier_organization_id]; @@ -80,35 +89,4 @@ function wiaas_get_order_procurement_info($order_id) { } return $data; -} - -/** - * Retrieve delivery supplier organizations for order which does not include installation providers - * - * @param int $order_id - * - * @return array - */ -function wiaas_get_order_delivery_suppliers($order_id) { - - $order = wc_get_order($order_id); - - $supplier_organizations = $order->get_meta('_wiaas_suppliers', true); - - $delivery_supplier_organizations = array(); - - $order_items = $order->get_items(); - - foreach ($order_items as $order_item_id => $order_item) { - - $supplier_organization_id = $order_item['wiaas_supplier_organization_id']; - - if (! empty($supplier_organization_id) && $order_item['wiaas_category'] !== 'installation' && - empty($delivery_supplier_organizations[$supplier_organization_id])) { - - $delivery_supplier_organizations[$supplier_organization_id] = $supplier_organizations[$supplier_organization_id]; - } - } - - return $delivery_supplier_organizations; } \ No newline at end of file diff --git a/frontend/src/containers/cart/components/CartUploadDocument.jsx b/frontend/src/containers/cart/components/CartUploadDocument.jsx index 4ad72e3..7d87618 100644 --- a/frontend/src/containers/cart/components/CartUploadDocument.jsx +++ b/frontend/src/containers/cart/components/CartUploadDocument.jsx @@ -61,7 +61,7 @@ class CartUploadDocument extends Component {
    {this.uploadFile(cartItem.key, idDocumentType, acceptedFiles, rejectedFiles, packages)}}> { uploadedDocument diff --git a/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx b/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx index 300e20c..3c459a3 100644 --- a/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx +++ b/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx @@ -135,7 +135,7 @@ class CustomerAcceptance extends Component { {this.uploadFile(step.idOrder, acceptedFiles, rejectedFiles)}}>
    {orderTexts.labels.UPLOAD_ACCEPTANCE_LABEL}
    diff --git a/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx b/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx index cc5a4af..6ec53ee 100644 --- a/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx +++ b/frontend/src/containers/orders/components/process/ValidateQuestionnaireItem.jsx @@ -67,7 +67,7 @@ class ValidateQuestionnaireItem extends Component { {this.uploadFile(action, acceptedFiles, rejectedFiles)}}>
    {orderTexts.labels.SELECT_OR_DROP}
    From 0b54ce54f827eb953a44c7590b7573f588bdb777 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sun, 4 Nov 2018 13:25:19 +0100 Subject: [PATCH 08/14] remove procurement order --- .../wiaas/includes/class-wiaas-order.php | 1 - .../order/class-wiaas-procurement-order.php | 98 ------------------- 2 files changed, 99 deletions(-) delete mode 100644 backend/app/plugins/wiaas/includes/order/class-wiaas-procurement-order.php diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-order.php b/backend/app/plugins/wiaas/includes/class-wiaas-order.php index 718acb2..b9adf1e 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-order.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-order.php @@ -18,7 +18,6 @@ class Wiaas_Order { public static function init() { require_once dirname( __FILE__ ) . '/order/class-wiaas-order-project.php'; - require_once dirname( __FILE__ ) . '/order/class-wiaas-procurement-order.php'; require_once dirname( __FILE__ ) . '/order/wiaas-order-functions.php'; add_filter('woocommerce_register_post_type_shop_order', array(__CLASS__, 'manage_order_settings')); diff --git a/backend/app/plugins/wiaas/includes/order/class-wiaas-procurement-order.php b/backend/app/plugins/wiaas/includes/order/class-wiaas-procurement-order.php deleted file mode 100644 index d48c639..0000000 --- a/backend/app/plugins/wiaas/includes/order/class-wiaas-procurement-order.php +++ /dev/null @@ -1,98 +0,0 @@ -get_customer_id(); - $organization_id = wiaas_get_user_organization_id($customer_user_id); - $customer_organization_info = wiaas_get_organization_info($organization_id); - - $info = array( - 'number' => $order->get_order_number(), - 'project_number' => 'SE' . $order->get_order_number(), - 'reference' => $order->get_meta('_wiaas_reference'), - - 'vat_code' => ! empty($customer_organization_info) ? $customer_organization_info['vat_code'] : '', - 'customer_name' => ! empty($customer_organization_info) ? $customer_organization_info['name'] : '', - - 'delivery_address' => $order->get_shipping_address_1() . ',' . - $order->get_shipping_city() . ',' . - $order->get_shipping_country() . ',' . - $order->get_shipping_postcode(), - 'delivery_full_name' => $order->get_formatted_shipping_full_name(), - - 'billing_address' => $order->get_billing_address_1() . ',' . - $order->get_billing_city() . ',' . - $order->get_billing_country() . ',' . - $order->get_billing_postcode(), - 'billing_full_name' => $order->get_formatted_billing_full_name(), - 'billing_email' => $order->get_billing_email() - ); - - $objPHPExcel->getProperties()->setCreator("RICOH") - ->setLastModifiedBy("Ricoh Dash") - ->setTitle("Order Procurement Report") - ->setSubject("Order Procurement Report") - ->setDescription("Order Procurement Report") - ->setKeywords("office 2007 openxml php order procurement") - ->setCategory("Procurement report file"); - - - $objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A1', 'Customer details') - - ->setCellValue('A2', 'Name') - ->setCellValue('A3', 'Invoice address') - ->setCellValue('A4', 'Invoice full name') - ->setCellValue('A5', 'Invoice email') - ->setCellValue('A6', 'VAT Number') - - ->setCellValue('B2', $info['customer_name']) - ->setCellValue('B3', $info['billing_address']) - ->setCellValue('B4', $info['billing_full_name']) - ->setCellValue('B5', $info['billing_email']) - ->setCellValue('B6', $info['vat_code']); - $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); - - $objPHPExcel->setActiveSheetIndex(0) - ->setCellValue('A9', 'OrderDetails') - - ->setCellValue('A10', 'Order number') - ->setCellValue('A11', 'Project number') - ->setCellValue('A12', 'Delivery address') - ->setCellValue('A13', 'Delivery full name') - ->setCellValue('A14', 'Reference') - - ->setCellValue('B10', $info['number']) - ->setCellValue('B11', $info['project_number']) - ->setCellValue('B12', $info['delivery_address']) - ->setCellValue('B13', $info['delivery_full_name']) - ->setCellValue('B14', $info['reference']); - $objPHPExcel->getActiveSheet()->getStyle('A10')->getFont()->setBold(true); - - $objPHPExcel->getActiveSheet()->setTitle('Order procurement'); - $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); - header('Content-Disposition: attachment;filename="procurement_report_'.$info['orderNumber'].'.xlsx"'); - $objWriter->save('php://output'); - } -} - -Wiaas_Procurement_Order::init(); From 3011c49474a1cce3b0acc210ea641541442789d1 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sun, 4 Nov 2018 14:14:55 +0100 Subject: [PATCH 09/14] remove error logs --- backend/app/plugins/wiaas/includes/class-wiaas-db-update.php | 5 ++--- backend/app/plugins/wiaas/includes/class-wiaas-order.php | 3 --- .../delivery-process/class-wiaas-delivery-process-action.php | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php index 27cf3b5..a62918b 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php @@ -23,9 +23,8 @@ class Wiaas_DB_Update { '20181019064450' => 'wiaas_db_update_add_bundle_properties_ui_field', '20191020014650' => 'wiaas_create_organization_roles_capabilities', '20191030162450' => 'wiaas_db_update_update_supplier_order_capabilities', - '20191102112451' => 'wiaas_disable_processing_order_email_delivery' - '20191030162450' => 'wiaas_db_update_update_supplier_order_capabilities', - '20191031162850' => 'update_delivery_forms' + '20191102112451' => 'wiaas_disable_processing_order_email_delivery', + '20191031172850' => 'update_delivery_forms' ); public static function execute() { diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-order.php b/backend/app/plugins/wiaas/includes/class-wiaas-order.php index b9adf1e..868eee1 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-order.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-order.php @@ -363,9 +363,6 @@ class Wiaas_Order { foreach($suppliers as $supplier) { - error_log($supplier['confirmed_date']); - error_log($supplier['estimated_date']); - if (! empty($supplier['confirmed_date']) ) { $max_confirmed_date = max($max_confirmed_date, $supplier['confirmed_date']); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php index 0e39e60..5ea5d6b 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php @@ -291,8 +291,6 @@ class Wiaas_Delivery_Process_Action { $file_paths = json_decode($action_entry[$acceptance_documents_field->id]); - error_log($action_entry[$acceptance_documents_field->id]); - $documents = array(); foreach ($file_paths as $file_path) { From 27795387dfc83b36d13a9cdcf3b683dc68766e41 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sun, 4 Nov 2018 14:50:54 +0100 Subject: [PATCH 10/14] add dependencies --- backend.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend.dockerfile b/backend.dockerfile index 8ee4d96..dbcaa22 100644 --- a/backend.dockerfile +++ b/backend.dockerfile @@ -46,7 +46,7 @@ ENV WP_SENDGRID_FROM_NAME ${WP_SENDGRID_FROM_NAME} ENV WIAAS_CUSTOMER_INTERFACE ${WIAAS_CUSTOMER_INTERFACE} -RUN apt-get update && apt-get install -y git unzip gnupg mysql-client sudo +RUN apt-get update && apt-get install -y git unzip gnupg mysql-client sudo libpng-dev COPY docker/php/composer.phar /usr/local/bin/composer RUN chmod 755 /usr/local/bin/composer @@ -57,7 +57,7 @@ RUN chmod +x /usr/local/bin/wp COPY docker/php/setup.sh /init-scripts/ RUN chmod +x /init-scripts/setup.sh -RUN docker-php-ext-install pdo pdo_mysql mysqli opcache +RUN docker-php-ext-install pdo pdo_mysql mysqli opcache gd zip mbstring RUN a2enmod rewrite COPY docker/php/000-default.conf /etc/apache2/sites-available From 5e55d296e543c984227a1973a7d3b991720a7f33 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sun, 4 Nov 2018 17:06:42 +0100 Subject: [PATCH 11/14] fix retrieval of process step action entries --- .../class-wiaas-admin-delivery-process-flow.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 877c5b2..4fcdc90 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 @@ -321,7 +321,7 @@ class Wiaas_Admin_Order_Process_Flow { $sorting = array( 'key' => 'date_created', 'direction' => 'DESC' ); $paging = array( 'offset' => 0, 'page_size' => $page_size ); - $entries = GFAPI::get_entries( $action_form, $search_criteria, $sorting, $paging ); + $entries = GFAPI::get_entries( $action_form['id'], $search_criteria, $sorting, $paging ); foreach ($entries as $action_entry) { self::_display_step_action_entry($action_form, $action_entry); From b7e4f7f49b29490729801d58794968b921be955c Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sun, 4 Nov 2018 17:57:48 +0100 Subject: [PATCH 12/14] Update db migration and remove unused files --- .../wiaas/assets/css/wiaas-admin-delivery-process.css | 3 --- .../includes/admin/class-wiaas-admin-delivery-process.php | 1 - .../app/plugins/wiaas/includes/class-wiaas-db-update.php | 3 ++- .../wiaas/includes/db-updates/wiaas-db-update-general.php | 2 +- .../wiaas/includes/db-updates/wiaas-db-update-roles.php | 8 ++++++++ 5 files changed, 11 insertions(+), 6 deletions(-) delete mode 100644 backend/app/plugins/wiaas/assets/css/wiaas-admin-delivery-process.css diff --git a/backend/app/plugins/wiaas/assets/css/wiaas-admin-delivery-process.css b/backend/app/plugins/wiaas/assets/css/wiaas-admin-delivery-process.css deleted file mode 100644 index b943d1f..0000000 --- a/backend/app/plugins/wiaas/assets/css/wiaas-admin-delivery-process.css +++ /dev/null @@ -1,3 +0,0 @@ -.gravityflow_workflow_detail #postbox-container-1 > div:last-child:not(.detail-view-print) { - display: none; -} diff --git a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php index 65ccdcc..981a56e 100644 --- a/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php +++ b/backend/app/plugins/wiaas/includes/admin/class-wiaas-admin-delivery-process.php @@ -16,7 +16,6 @@ class Wiaas_Admin_Delivery_Process { $plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) ); wp_enqueue_script( 'wiaas_admin_delivery_process', $plugin_url . '/assets/js/wiaas-admin-delivery-process.js' ); - wp_enqueue_style( 'wiaas_admin_delivery_process', $plugin_url . '/assets/css/wiaas-admin-delivery-process.css' ); } } diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php index a62918b..4107f47 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-db-update.php @@ -24,7 +24,8 @@ class Wiaas_DB_Update { '20191020014650' => 'wiaas_create_organization_roles_capabilities', '20191030162450' => 'wiaas_db_update_update_supplier_order_capabilities', '20191102112451' => 'wiaas_disable_processing_order_email_delivery', - '20191031172850' => 'update_delivery_forms' + '20191131172850' => 'wiaas_db_update_update_delivery_forms', + '20191131182856' => 'wiaas_db_update_enable_workflow_inbox_for_roles' ); public static function execute() { diff --git a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php index 9e23a7a..76b4f60 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php +++ b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-general.php @@ -88,7 +88,7 @@ function wiaas_disable_processing_order_email_delivery() { } -function update_delivery_forms() { +function wiaas_db_update_update_delivery_forms() { $forms = GFAPI::get_forms(); foreach ($forms as $form) { diff --git a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-roles.php b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-roles.php index 6a3fcc5..b39cb5e 100644 --- a/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-roles.php +++ b/backend/app/plugins/wiaas/includes/db-updates/wiaas-db-update-roles.php @@ -315,4 +315,12 @@ function wiaas_admin_create_role_access_groups() { function wiaas_db_update_update_supplier_order_capabilities() { // add supplier role to view orders wp_roles()->add_cap( 'supplier', 'edit_shop_orders' ); +} + +function wiaas_db_update_enable_workflow_inbox_for_roles() { + // add workflow inbox for supplier + wp_roles()->add_cap( 'supplier', 'gravityflow_inbox' ); + // add workflow inbox for commercial lead + wp_roles()->add_cap( 'commercial_lead', 'gravityflow_inbox' ); + } \ No newline at end of file From 1d097eda6f1bbd38b77ab7f8ab5b5e2fdc0da260 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sun, 4 Nov 2018 19:54:43 +0100 Subject: [PATCH 13/14] Get supplier organization from order item --- .../class-wiaas-delivery-process-step-assignee.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step-assignee.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step-assignee.php index 2debd3b..876c924 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step-assignee.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-step-assignee.php @@ -100,10 +100,7 @@ class Wiaas_Delivery_Process_Step_Assignee { $item = $order->get_item($item_id); - $product_id = $item['product_id']; - - //TODO: Get this value from order since product can get changed or deleted later - $organization_id = Wiaas_Product_Supplier::get_supplier_organisation_id_from_product($product_id); + $organization_id = $item['wiaas_supplier_organization_id']; $user_ids = wiaas_get_organization_user_ids($organization_id); From 4e8b04fa8dab437be7e39eaa65dc482e3944f599 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Sun, 4 Nov 2018 22:13:52 +0100 Subject: [PATCH 14/14] Handle order files download separately from delivery process files --- .../includes/delivery-process/class-wiaas-order-fields.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php index 52a77b0..35168fe 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-order-fields.php @@ -39,7 +39,8 @@ class Wiaas_Order_Fields { public static function display_order_document_fields($file_path, $field) { - if ($field->type === 'wiaas_order_bundle_document') { + if (strpos($file_path, 'gf-download') === false && + strpos($file_path, 'gf-wiaas-order-doc') === false) { $field = new Wiaas_Field_Order_Bundle_Document();