Commit 138fd5bc authored by KR Moorhouse's avatar KR Moorhouse Committed by Kenny Hall

Modified set check to define default decimal places if the option is left...

Modified set check to define default decimal places if the option is left empty. The original check was not properly catching blank values. (#3139)
parent 621300fb
......@@ -230,7 +230,7 @@ class NF_AJAX_Controllers_Submission extends NF_Abstracts_Controller
// Scrub unmerged tags (ie deleted/non-existent fields/calcs, etc).
$eq = preg_replace( '/{([a-zA-Z0-9]|:|_|-)*}/', 0, $eq);
$dec = ( isset( $calc[ 'dec' ] ) && 0 <= $calc[ 'dec' ] ) ? $calc[ 'dec' ] : 2;
$dec = ( isset( $calc[ 'dec' ] ) && ! empty( $calc[ 'dec' ] ) && 0 <= $calc[ 'dec' ] ) ? $calc[ 'dec' ] : 2;
$calcs_merge_tags->set_merge_tags( $calc[ 'name' ], $eq, $dec, $this->_form_data['settings']['decimal_point'], $this->_form_data['settings']['thousands_sep'] );
$this->_data[ 'extra' ][ 'calculations' ][ $calc[ 'name' ] ] = array(
'raw' => $calc[ 'eq' ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment