Skip to content

Commit

Permalink
fix(admin-form): do not add formatted value for field value
Browse files Browse the repository at this point in the history
ref #3373
  • Loading branch information
ravinderk committed Jun 18, 2018
1 parent ecde06a commit a76a736
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion includes/admin/give-metabox-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function give_text_input( $field ) {

switch ( $data_type ) {
case 'price' :
$field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( give_maybe_sanitize_amount( $field['value'] ), array( 'sanitize' => false ) ) : $field['value'] );
$field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] );

$field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' );
$field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' );
Expand Down
2 changes: 0 additions & 2 deletions includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ function give_maybe_sanitize_amount( $number, $args = array() ) {
&& 2 === count( $number_parts )
&& ( $number_decimals >= strlen( $number_parts[1] ) )
){
// Remove thousand separator from number.
$number = str_replace( $thousand_separator, '', $number );
return number_format( $number, $number_decimals, '.', '' );
}

Expand Down

0 comments on commit a76a736

Please sign in to comment.