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; $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( "
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.
' )); ?>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.
' )); } }