Handle process visualization and going from one step to another

This commit is contained in:
Almira Krdzic
2018-11-01 10:43:15 +01:00
parent 308c836460
commit 3d16d5027b
19 changed files with 448 additions and 1786 deletions

View File

@@ -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;';
}
?>
<div class="postbox" style="<?php esc_attr_e($completed_style, 'wiaas') ?>">
<div class="postbox">
<h3>
<i class="fa fa-circle" style="font-size: 22px; margin-right: 10px; <?php esc_attr_e($style, 'wiaas') ?>"></i>
<span><?php esc_html_e($step->get_name(), 'wiaas') ?></span>
</h3>
@@ -163,28 +168,38 @@ class Wiaas_Admin_Delivery_Process {
$label = $field->get_field_label(false, $action_entry[$field->id]);
echo '<tr>' .
'<td><h5>' . $label . ' : </h5></td>' .
'<td><strong>' . $label . ' : </strong></td>' .
'<td>' . $value . '</td>' .
'</tr>';
}
if (! empty($current_action_step)) {
?>
?>
<tfoot>
<tr>
<td colspan="2" style="text-transform: uppercase;font-size: 11px; letter-spacing: 0.4px; margin:10px;">
<strong>
<tfoot>
<tr>
<td colspan="2">
<a style="text-transform: uppercase; font-size: 11px; letter-spacing: 0.4px; margin:10px;" href="<?php echo $current_action_step->get_entry_url() ?>">
<?php echo $current_action_step->get_name() . ' ' . $current_action_step->get_status_label($current_action_step->get_status()) ?>
</a>
</td>
</tr>
</tfoot>
<?php
if (! empty($current_action_step)) {
echo $current_action_step->get_status_label($current_action_step->get_status()) . ': ' . $current_action_step->get_name();
echo '<a target="_blank" href="' . $current_action_step->get_entry_url() . '">' .
' <i class="fa fa-external-link" style="font-size: 16px;"></i>' .
'</a>';
} else {
echo $workflow_api->get_status($action_entry);
}
?>
</strong>
</td>
</tr>
</tfoot>
<?php
<?php
}
?>
</table>

View File

@@ -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() {

View File

@@ -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;
}

File diff suppressed because one or more lines are too long

View File

@@ -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
}
]
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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");
}

View File

@@ -1,38 +0,0 @@
<?php
if ( ! class_exists( 'GFForms' ) ) {
die();
}
class Wiaas_Dates_List_Field extends GF_Field_List {
public $type = 'wiaas_date_list';
public function get_form_editor_field_title() {
return esc_attr__( 'Date List', 'wiaas' );
}
public function sanitize_settings() {
parent::sanitize_settings();
//$this->inputType = 'date';
}
public function get_list_input($has_columns, $column, $value, $form_id) {
$tabindex = $this->get_tabindex();
$disabled = $this->is_form_editor() ? 'disabled' : '';
return "<input type='date' name='input_{$this->id}[]' value='" . esc_attr( $value ) . "' {$tabindex} {$disabled}/>";
}
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() );

View File

@@ -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' => '<p class="description"> Choose action code for action form.</p>'
));

View File

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

View File

@@ -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' );
}

View File

@@ -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
);
}

View File

@@ -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;
}
}

View File

@@ -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' ) );
}

View File

@@ -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;
}

View File

@@ -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;
}