Skip to content

Commit

Permalink
Merge branch 'release/2.2.6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Jun 26, 2018
2 parents 9c9163c + 4d9183e commit e2196f0
Show file tree
Hide file tree
Showing 61 changed files with 1,392 additions and 820 deletions.
66 changes: 59 additions & 7 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,64 @@
------------------------------------------------------------------------------------------------------------------
Version 2.3.0.2
- Fixed a potential fatal error that can occur during or before the database upgrade.
Version 2.3.2
- Added the "gform_field_filters" filter enabling the filter settings for the form fields, entry properties, and entry meta to be overridden.
- Added 'gform_use_post_value_for_conditional_logic_save_entry' to support fetching values from the $_POST when evaluating a field's conditional logic while re-saving an existing entry.
- Updated the routing rule value select on the edit notification page to include the field placeholder, if configured.
- Updated the {save_email_input} merge tag to support using the placeholder attribute to override the inputs placeholder e.g. {save_email_input:placeholder="Enter your email address"}
- Updated form stylesheets to be registered and enqueued instead of directly enqueued.
- Updated list of available languages for reCAPTCHA.
- Updated GFFeedAddon::get_single_submission_feed() method to only return cached feed if the same form object is provided.
- Fixed an issue on the field editor that caused the field UI to be duplicated in certain conditions.
- Fixed an issue with checkbox field where preview wasn't taking into account selected value.
- Fixed an issue with list field merge tag processing when a comma separated list of modifiers was used. Credit: The team at GravityView.
- Fixed a PHP notice which could occur when sending a notification which uses routing if a routing rule property is not defined.
- Fixed issue allowing site admins to uninstall network activated add-ons.
- Fixed the save email input placeholder not being translatable.
- Fixed a performance issue which forces the autoload options to reload on every request.
- Fixed a performance issue when checking the database version.
- Fixed an issue where elements could not escape content container in tabbed content sections.
- Fixed an issue with the entry search when searching for values in nullable columns in the entry table. For example, this fixes an issue when filtering entries for payment status is not 'Processing' where null values are ignored.
- Fixed JS errors which can occur when using the reCAPTCHA field if there is a slow network connection or jQuery is included in the page footer.
- Fixed an issue with the upgrade process where the table check for the incomplete submissions table may fail.
- Fixed a JavaScript error when sites use jQuery v3 on the front-end.
- Fixed bad text strings in messages regarding Add-Ons incompatible with the version of Gravity Formsx
- Fixed GFCommon::get_product_fields() interacting with option and shipping fields as arrays instead of using object notation.
- Fixed an issue with how the result from the gform_product_info_name_include_field_label filter was being used.
- Fixed the admin label not being used for the option and shipping fields when using the {all_fields:admin} merge tag.
- Fixed an issue where products with no options, no name, and no price could be included in the products info used to populate the summary table.
- Fixed some options remaining in the database on uninstall resulting in submissions being blocked or a failed database upgrade occurring on reinstall.
- Fixed issue where fields disabled by default were re-enabled via conditional logic.
- Fixed text format notifications being formatted to include HTML br tags.
- Fixed an issue with the Date field layout.
- Fixed an issue with the entry search where incorrect results are returned when searching for a meta value that is not empty.
- AF: Fixed an issue with the Ajax request for the "show more" link on the Results page which prevented additional results being displayed.
- API: Fixed an issue with the entry search where searching for an empty string meta value will return zero results.
- API: Fixed issue with GFAPI::count_entries( 0 ) where the result is always zero.

------------------------------------------------------------------------------------------------------------------
Version 2.3.0.1
- Fixed an issue retrieving the entry before the entry migration has completed successfully.
- Fixed an issue preventing the entry limit feature from limiting entries.
- Fixed an issue preventing the upgrade process from completing when the incomplete submissions table does not exist.
Version 2.3.1
- Added percentage complete to the System Status page when upgrading from 2.2.x.
- Added a message to the status report when background tasks are not enabled warning that the upgrade will take longer than usual.

- Updated the 'force the upgrade' link on the System Status page trigger the upgrade synchronously and then poll the cron task until complete when upgrading from 2.2.x. This provides a way to upgrade if neither background tasks nor the cron are working.
- Updated the way background tasks are handled on multisite. Tasks are processed for the current blog ID before processing tasks for other blog IDs.

- Fixed an issue where form imports could fail if the file contain any extra characters before the JSON.
- Fixed an issue where the previous button can not be clicked on multipage forms when the submit button is hidden by conditional logic.
- Fixed an issue where URL is not be removed from entry value when deleting file.
- Fixed an issue with the submissions block which may affect some systems under rare circumstances.
- Fixed an issue on the entry list page when searching for the value of any field.
- Fixed a database error during the daily cron task which can occur before the database has been upgraded.
- Fixed the cron healthcheck when spawning a background task for a different blog ID on multisite.
- Fixed an issue which can cause merge tags to be blank while the database upgrade is queued.
- Fixed a potential fatal error that can occur during or before the database upgrade.
- Fixed an issue retrieving the entry before the entry migration has completed successfully.
- Fixed an issue preventing the entry limit feature from limiting entries.
- Fixed an issue preventing the upgrade process from completing when the incomplete submissions table does not exist.

- AF: Fixed an issue preventing field mapping from rendering when field labels contain HTML tags.

- API: Fixed an issue searching entries with the != operator when combining clauses with multi-input fields.
- API: Fixed an issue searching entries where the is operator is ignored.

------------------------------------------------------------------------------------------------------------------
Version 2.3
Expand Down Expand Up @@ -125,7 +177,7 @@ Version 2.2.6
- AF: Fixed "callback" property being output as a settings field attribute.
- AF: Fixed the payment_gateway entry meta item not being set for some add-ons when using the gform_post_payment_completed hook.
- AF: Add GFAddOn::get_capabilities() to get registered capabilities.

------------------------------------------------------------------------------------------------------------------
Version 2.2.5
- Updated form view recording so that IP isn't included.
Expand Down
125 changes: 97 additions & 28 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ public static function replace_variables( $text, $form, $lead, $url_encode = fal

$lead = $data['entry'];

$text = $nl2br ? nl2br( $text ) : $text;
$text = $format == 'html' && $nl2br ? nl2br( $text ) : $text;
$text = apply_filters( 'gform_pre_replace_merge_tags', $text, $form, $lead, $url_encode, $esc_html, $nl2br, $format );

if ( strpos( $text, '{' ) === false ) {
Expand Down Expand Up @@ -1738,11 +1738,15 @@ public static function send_notification( $notification, $form, $lead, $data = a
if ( empty( $email_to ) && rgar( $notification, 'toType' ) == 'routing' ) {
$email_to = array();
foreach ( $notification['routing'] as $routing ) {
if ( rgempty( 'email', $routing ) ) {
continue;
}

GFCommon::log_debug( __METHOD__ . '(): Evaluating Routing - rule => ' . print_r( $routing, 1 ) );

$source_field = RGFormsModel::get_field( $form, $routing['fieldId'] );
$source_field = RGFormsModel::get_field( $form, rgar( $routing, 'fieldId' ) );
$field_value = RGFormsModel::get_lead_field_value( $lead, $source_field );
$is_value_match = RGFormsModel::is_value_match( $field_value, $routing['value'], $routing['operator'], $source_field, $routing, $form ) && ! RGFormsModel::is_field_hidden( $form, $source_field, array(), $lead );
$is_value_match = RGFormsModel::is_value_match( $field_value, rgar( $routing, 'value', '' ), rgar( $routing, 'operator', 'is' ), $source_field, $routing, $form ) && ! RGFormsModel::is_field_hidden( $form, $source_field, array(), $lead );

if ( $is_value_match ) {
$email_to[] = $routing['email'];
Expand Down Expand Up @@ -2311,6 +2315,33 @@ private static function has_field_by_type( $form, $type ) {
return false;
}

/***
* Determines if the current user has the proper cabalities to uninstall the plugin specified in $plugin_path.
* Plugins that have been network activated can only be uninstalled by a network admin.
*
* @since 2.3.1.12
* @access public
*
* @param string $caps Capabilities that current user must have to be able to uninstall the plugin.
* @param string $plugin_path Path of the plugin to be checked, relative to the plugins folder. i.e. "gravityforms/gravityforms.php"
*
* @return bool True if current user can uninstall the plugin. False otherwise
*/
public static function current_user_can_uninstall( $caps = 'gravityforms_uninstall', $plugin_path = 'gravityforms/gravityforms.php' ) {

$is_multisite = function_exists( 'is_multisite' ) && is_multisite();
$is_network_activated = is_plugin_active_for_network( $plugin_path );


//If an addon is network activated, it can only be uninstalled by a super admin.
if ( $is_multisite && $is_network_activated ) {
return is_super_admin();
} else {
return self::current_user_can_any( $caps );
}

}

public static function current_user_can_any( $caps ) {

if ( ! is_array( $caps ) ) {
Expand Down Expand Up @@ -3512,11 +3543,11 @@ public static function get_product_fields( $form, $lead, $use_choice_text = fals
continue;
}

if ( ! rgget( $id, $products ) ) {
if ( ! rgar( $products, $id ) ) {
$products[ $id ] = array();
}

$products[ $id ]['name'] = $use_admin_label && ! rgempty( 'adminLabel', $field ) ? $field->adminLabel : $lead_value[ $id . '.1' ];
$products[ $id ]['name'] = $use_admin_label && ! empty( $field->adminLabel ) ? $field->adminLabel : $lead_value[ $id . '.1' ];
$products[ $id ]['price'] = rgar( $lead_value, $id . '.2' );
$products[ $id ]['quantity'] = $product_quantity;
} elseif ( ! empty( $lead_value ) ) {
Expand All @@ -3529,68 +3560,87 @@ public static function get_product_fields( $form, $lead, $use_choice_text = fals
$products[ $id ] = array();
}

$field_label = $use_admin_label && ! empty( $field->adminLabel ) ? $field->adminLabel : $field->label;

if ( $field->inputType == 'price' ) {
$name = $field->label;
$name = $field_label;
$price = $lead_value;
} else {
list( $name, $price ) = explode( '|', $lead_value );
}

$products[ $id ]['name'] = ! $use_choice_text ? $name : RGFormsModel::get_choice_text( $field, $name );
$include_field_label = apply_filters( 'gform_product_info_name_include_field_label', false );
if ( $field->inputType == ( 'radio' || 'select' ) && $include_field_label ) {
$products[ $id ]['name'] = $field->label . " ({$products[$id]['name']})";
if ( ! $use_choice_text ) {
$name = RGFormsModel::get_choice_text( $field, $name );
}

/**
* Enables inclusion of the field label or admin label in the product name for choice based Product fields.
*
* @since 1.9.1
*
* @param bool $include_field_label Indicates if the label should be included in the product name. Default is false.
*/
$include_field_label = apply_filters( 'gform_product_info_name_include_field_label', true );
if ( $include_field_label ) {
$name = $field_label . " ({$name})";
}
}

$products[ $id ]['name'] = $name;
$products[ $id ]['price'] = $price;
$products[ $id ]['quantity'] = $quantity;
$products[ $id ]['options'] = array();
}

if ( isset( $products[ $id ] ) ) {
$options = self::get_product_fields_by_type( $form, array( 'option' ), $id );
foreach ( $options as $option ) {
$option_value = RGFormsModel::get_lead_field_value( $lead, $option );
$option_label = empty( $option['adminLabel'] ) ? $option['label'] : $option['adminLabel'];
$option_fields = self::get_product_fields_by_type( $form, array( 'option' ), $id );
foreach ( $option_fields as $option_field ) {
$option_value = RGFormsModel::get_lead_field_value( $lead, $option_field );
$option_label = $use_admin_label && ! empty( $option_field->adminLabel ) ? $option_field->adminLabel : $option_field->label;
if ( is_array( $option_value ) ) {
foreach ( $option_value as $value ) {
$option_info = self::get_option_info( $value, $option, $use_choice_text );
$option_info = self::get_option_info( $value, $option_field, $use_choice_text );
if ( ! empty( $option_info ) ) {
$products[ $id ]['options'][] = array(
'field_label' => rgar( $option, 'label' ),
'field_label' => rgobj( $option_field, 'label' ),
'option_name' => rgar( $option_info, 'name' ),
'option_label' => $option_label . ': ' . rgar( $option_info, 'name' ),
'price' => rgar( $option_info, 'price' )
);
}
}
} elseif ( ! empty( $option_value ) ) {
$option_info = self::get_option_info( $option_value, $option, $use_choice_text );
$option_info = self::get_option_info( $option_value, $option_field, $use_choice_text );
$products[ $id ]['options'][] = array(
'field_label' => rgar( $option, 'label' ),
'field_label' => rgobj( $option_field, 'label' ),
'option_name' => rgar( $option_info, 'name' ),
'option_label' => $option_label . ': ' . rgar( $option_info, 'name' ),
'price' => rgar( $option_info, 'price' )
);
}
}

if ( empty( $products[ $id ]['options'] ) && empty( $products[ $id ]['name'] ) && rgblank( $products[ $id ]['price'] ) ) {
self::log_debug( __METHOD__ . "(): Product field #{$id} has no options, name, or price; removing." );
unset( $products[ $id ] );
}
}
break;
}
}

$shipping_field = GFAPI::get_fields_by_type( $form, array( 'shipping' ) );
$shipping_price = $shipping_name = '';
$shipping_field_id = '';
if ( ! empty( $shipping_field ) && ! RGFormsModel::is_field_hidden( $form, $shipping_field[0], array(), $lead ) ) {
$shipping_price = RGFormsModel::get_lead_field_value( $lead, $shipping_field[0] );
$shipping_name = $shipping_field[0]['label'];
$shipping_field_id = $shipping_field[0]['id'];
if ( $shipping_field[0]['inputType'] != 'singleshipping' && ! empty( $shipping_price ) ) {
$shipping_fields = GFAPI::get_fields_by_type( $form, array( 'shipping' ) );
$shipping_price = $shipping_name = $shipping_field_id = '';

if ( ! empty( $shipping_fields ) && ! RGFormsModel::is_field_hidden( $form, $shipping_fields[0], array(), $lead ) ) {
$shipping_price = RGFormsModel::get_lead_field_value( $lead, $shipping_fields[0] );
$shipping_name = $use_admin_label && ! empty( $shipping_fields[0]->adminLabel ) ? $shipping_fields[0]->adminLabel : $shipping_fields[0]->label;
$shipping_field_id = $shipping_fields[0]->id;
if ( $shipping_fields[0]->inputType != 'singleshipping' && ! empty( $shipping_price ) ) {
list( $shipping_method, $shipping_price ) = explode( '|', $shipping_price );
$shipping_name = $shipping_field[0]['label'] . " ($shipping_method)";
$shipping_name .= " ($shipping_method)";
}
}

$shipping_price = self::to_number( $shipping_price, $lead['currency'] );

$product_info = array(
Expand All @@ -3602,6 +3652,15 @@ public static function get_product_fields( $form, $lead, $use_choice_text = fals
)
);

/**
* Allows the product info used by add-ons and when generating the entry order summary table to be overridden.
*
* @since 1.5.2.8
*
* @param array $product_info The selected products, options, and shipping details for the current entry.
* @param array $form The form object used to generate the current entry.
* @param array $lead The current entry object.
*/
$product_info = gf_apply_filters( array( 'gform_product_info', $form['id'] ), $product_info, $form, $lead );

// save static copy of product info (only for 'real' entries)
Expand Down Expand Up @@ -4877,6 +4936,16 @@ public static function get_field_filter_settings( $form ) {
$field_filters = array_merge( $field_filters, $info_filters );
$field_filters = array_values( $field_filters );

/**
* Enables the filter settings for the form fields, entry properties, and entry meta to be overridden.
*
* @since 2.3.1.16
*
* @param array $field_filters The form field, entry properties, and entry meta filter settings.
* @param array $form The form object the filter settings have been prepared for.
*/
$field_filters = apply_filters( 'gform_field_filters', $field_filters, $form );

return $field_filters;
}

Expand Down
11 changes: 4 additions & 7 deletions css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -3617,17 +3617,18 @@ ul#gf_merge_tag_list a:hover {
-webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1);
-moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1);
box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1);
display: block;
display: flex;
}

.gform_tabs {
width: 150px;
float: left;
flex-grow: 0;
flex-shrink: 0;
margin-top: 10px;
}

.gform_tab_container {
margin-left: 150px;
flex-grow: 1;
padding: 20px;
min-height: 370px;
background-color: #F6FBFD;
Expand Down Expand Up @@ -3659,10 +3660,6 @@ ul#gf_merge_tag_list a:hover {
margin-bottom: 16px;
}

.gform_tab_content {
overflow: hidden;
}

.gform_tab_content h3 {
font-size: 1.6rem;
margin-top: 2px;
Expand Down
Loading

0 comments on commit e2196f0

Please sign in to comment.