Calculated Fields Form - Version 1.1.80

Version Description

  • Modifies the code that formats the equations' results.
  • Implements the UNFORMAT operation.
  • Modifies From and To attributes in the RecordSet DS fields for the Submissions data-source (Developer and Platinum versions).
  • Modifies the User Registration add-on (Developer and Platinum versions).
  • Fixes an issue in the MailChimp add-on (Platinum version).
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Calculated Fields Form
Version 1.1.80
Comparing to
See all releases

Code changes from version 1.1.79 to 1.1.80

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://cff.dwbooster.com
4
  Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
5
  Requires at least: 3.0.5
6
  Tested up to: 5.9
7
- Stable tag: 1.1.79
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -965,6 +965,14 @@ A: Please, follow the steps below:
965
 
966
  == Changelog ==
967
 
 
 
 
 
 
 
 
 
968
  = 1.1.79 =
969
 
970
  * Includes a new attribute in the form's settings to categorize the forms.
@@ -1019,8 +1027,4 @@ A: Please, follow the steps below:
1019
 
1020
  * Fixes an issue with the CDATE operation.
1021
  * Modifies the Gutenberg Block to update the forms list dynamically.
1022
- * Modifies the reCAPTCHA add-on to fix a conflict when the web page loads an additional instance of the reCAPTCHA API.
1023
-
1024
- = 1.1.70 =
1025
-
1026
- * Modifies the loading process to prevent the iframe tags affect the form generation.
4
  Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
5
  Requires at least: 3.0.5
6
  Tested up to: 5.9
7
+ Stable tag: 1.1.80
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
965
 
966
  == Changelog ==
967
 
968
+ = 1.1.80 =
969
+
970
+ * Modifies the code that formats the equations' results.
971
+ * Implements the UNFORMAT operation.
972
+ * Modifies From and To attributes in the RecordSet DS fields for the Submissions data-source (Developer and Platinum versions).
973
+ * Modifies the User Registration add-on (Developer and Platinum versions).
974
+ * Fixes an issue in the MailChimp add-on (Platinum version).
975
+
976
  = 1.1.79 =
977
 
978
  * Includes a new attribute in the form's settings to categorize the forms.
1027
 
1028
  * Fixes an issue with the CDATE operation.
1029
  * Modifies the Gutenberg Block to update the forms list dynamically.
1030
+ * Modifies the reCAPTCHA add-on to fix a conflict when the web page loads an additional instance of the reCAPTCHA API.
 
 
 
 
changelog.txt CHANGED
@@ -1,5 +1,13 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
3
  = 1.1.79 =
4
 
5
  * Includes a new attribute in the form's settings to categorize the forms.
@@ -494,21 +502,4 @@
494
 
495
  = 1.0.457 =
496
 
497
- * The slider fields can be excluded from submission.
498
-
499
- = 1.0.456 =
500
-
501
- * Fixes an issue in the date controls.
502
- * Modifies the CDATE operation.
503
- * Fixes some conflicts with PHP 8.
504
- * Adds the EOMONTH operation in the Date/Time operations module (Developer and Platinum versions).
505
-
506
- = 1.0.455 =
507
-
508
- * Includes a new option in the form's settings to display a loading form animation.
509
- * Modifies the tooltips icons.
510
- * Fixes an issue displaying the tooltips on forms' pages.
511
-
512
- = 1.0.454 =
513
-
514
- * Modifies the IGNOREFIELD and ACTIVATEFIELD operations for accepting the form as the second parameter.
1
  == Changelog ==
2
 
3
+ = 1.1.80 =
4
+
5
+ * Modifies the code that formats the equations' results.
6
+ * Implements the UNFORMAT operation.
7
+ * Modifies From and To attributes in the RecordSet DS fields for the Submissions data-source (Developer and Platinum versions).
8
+ * Modifies the User Registration add-on (Developer and Platinum versions).
9
+ * Fixes an issue in the MailChimp add-on (Platinum version).
10
+
11
  = 1.1.79 =
12
 
13
  * Includes a new attribute in the form's settings to categorize the forms.
502
 
503
  = 1.0.457 =
504
 
505
+ * The slider fields can be excluded from submission.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cp_calculatedfieldsf_free.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Calculated Fields Form
4
  Plugin URI: https://cff.dwbooster.com
5
  Description: Create forms with field values calculated based in other form field values.
6
- Version: 1.1.79
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
@@ -16,7 +16,7 @@ if(!defined('WP_DEBUG') || true != WP_DEBUG)
16
  }
17
 
18
  // Defining main constants
19
- define('CP_CALCULATEDFIELDSF_VERSION', '1.1.79' );
20
  define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
21
  define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
22
  define('CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
3
  Plugin Name: Calculated Fields Form
4
  Plugin URI: https://cff.dwbooster.com
5
  Description: Create forms with field values calculated based in other form field values.
6
+ Version: 1.1.80
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
16
  }
17
 
18
  // Defining main constants
19
+ define('CP_CALCULATEDFIELDSF_VERSION', '1.1.80' );
20
  define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
21
  define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
22
  define('CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
js/fbuilder-pro-public.jquery.js CHANGED
@@ -1,4 +1,4 @@
1
- $.fbuilder['version'] = '1.1.79';
2
  $.fbuilder['controls'] = $.fbuilder['controls'] || {};
3
  $.fbuilder['forms'] = $.fbuilder['forms'] || {};
4
 
1
+ $.fbuilder['version'] = '1.1.80';
2
  $.fbuilder['controls'] = $.fbuilder['controls'] || {};
3
  $.fbuilder['forms'] = $.fbuilder['forms'] || {};
4
 
js/fields-public/fbuilder.fcalculated.js CHANGED
@@ -21,6 +21,11 @@
21
  noEvalIfManual:true,
22
  formatDynamically:false,
23
  hidefield:false,
 
 
 
 
 
24
  show:function()
25
  {
26
  this.predefined = this._getAttr('predefined');
@@ -30,7 +35,6 @@
30
  {
31
  // Add equations
32
  var me = this,
33
- configuration = { "suffix" : me.suffix, "prefix" : me.prefix, "groupingsymbol" : me.groupingsymbol, "decimalsymbol" : me.decimalsymbol, "currency": me.currency },
34
  dependencies = [];
35
 
36
  $.each( me.dependencies, function( i, d )
@@ -58,7 +62,7 @@
58
 
59
  if( !/^\s*$/.test(eq) )
60
  {
61
- $.fbuilder.calculator.addEquation( me.name, eq, configuration, dependencies, me.form_identifier );
62
  }
63
 
64
  // Events
@@ -92,7 +96,7 @@
92
  )
93
  {
94
  var v = me.val();
95
- this.value = $.fbuilder.calculator.format(v, configuration);
96
  }
97
  try
98
  {
@@ -341,9 +345,9 @@
341
  if(form_identifier in this.pendings) return this.pendings[form_identifier];
342
  return 0;
343
  },
344
- addEquation : function( calculated_field, equation, configuration, dependencies, form_identifier )
345
  {
346
- var equation_result = $('[id="'+calculated_field+'"]');
347
  if(equation_result.length)
348
  {
349
  var form = equation_result[0].form,
@@ -357,14 +361,15 @@
357
  // Avoid insert the equation multiple times to the form
358
  for( i = 0 ; i < h; i++ )
359
  {
360
- if( form.equations[ i ].result == calculated_field ) break;
361
- if( form.equations[ i ].equation.match( calculated_field ) ){ j = i; break; }
362
  }
363
 
364
  // The equation hasn't been inserted previously
365
  if( i == h || j != -1)
366
  {
367
- equationObj = {'result':calculated_field, 'equation':equation, 'conf':configuration, 'dep':dependencies, 'identifier':form_identifier};
 
368
  form.equations.splice(i, 0, equationObj);
369
  while ( match = regexp.exec( equation ) )
370
  {
@@ -505,7 +510,7 @@
505
  result = _calculate( eq_obj.equation, eq_obj.identifier, eq_obj.result),
506
  bk = field.data('bk');
507
 
508
- field.val( ( result !== false ) ? this.format( result, eq_obj.conf) : '' );
509
  if(bk != field.val())
510
  {
511
  field.trigger( 'calcualtedfield_changed' );
@@ -571,7 +576,6 @@
571
 
572
  unformat : function( field )
573
  {
574
-
575
  var escapeSymbol = $.fbuilder.escapeSymbol;
576
 
577
  var eq = field[0].form.equations,
@@ -581,7 +585,7 @@
581
  {
582
  if(eq[i].result == field[0].id)
583
  {
584
- var c = eq[i].conf; // Configuration object
585
 
586
  if( c.prefix && !/^\s*$/.test( c.prefix ) )
587
  {
21
  noEvalIfManual:true,
22
  formatDynamically:false,
23
  hidefield:false,
24
+ configuration : function()
25
+ {
26
+ var me = this;
27
+ return { "suffix" : me.suffix, "prefix" : me.prefix, "groupingsymbol" : me.groupingsymbol, "decimalsymbol" : me.decimalsymbol, "currency": me.currency };
28
+ },
29
  show:function()
30
  {
31
  this.predefined = this._getAttr('predefined');
35
  {
36
  // Add equations
37
  var me = this,
 
38
  dependencies = [];
39
 
40
  $.each( me.dependencies, function( i, d )
62
 
63
  if( !/^\s*$/.test(eq) )
64
  {
65
+ $.fbuilder.calculator.addEquation( me, eq, dependencies, me.form_identifier );
66
  }
67
 
68
  // Events
96
  )
97
  {
98
  var v = me.val();
99
+ this.value = $.fbuilder.calculator.format(v, me.configuration());
100
  }
101
  try
102
  {
345
  if(form_identifier in this.pendings) return this.pendings[form_identifier];
346
  return 0;
347
  },
348
+ addEquation : function( fieldObj, equation, dependencies, form_identifier )
349
  {
350
+ var equation_result = $('[id="'+fieldObj.name+'"]');
351
  if(equation_result.length)
352
  {
353
  var form = equation_result[0].form,
361
  // Avoid insert the equation multiple times to the form
362
  for( i = 0 ; i < h; i++ )
363
  {
364
+ if( form.equations[ i ].result == fieldObj.name ) break;
365
+ if( form.equations[ i ].equation.match( fieldObj.name ) ){ j = i; break; }
366
  }
367
 
368
  // The equation hasn't been inserted previously
369
  if( i == h || j != -1)
370
  {
371
+ /* conf attribute only for compatibility */
372
+ equationObj = {'result':fieldObj.name, 'resultField':fieldObj, 'equation':equation, 'conf':fieldObj.configuration(), 'dep':dependencies, 'identifier':form_identifier};
373
  form.equations.splice(i, 0, equationObj);
374
  while ( match = regexp.exec( equation ) )
375
  {
510
  result = _calculate( eq_obj.equation, eq_obj.identifier, eq_obj.result),
511
  bk = field.data('bk');
512
 
513
+ field.val( ( result !== false ) ? this.format( result, eq_obj.resultField.configuration()) : '' );
514
  if(bk != field.val())
515
  {
516
  field.trigger( 'calcualtedfield_changed' );
576
 
577
  unformat : function( field )
578
  {
 
579
  var escapeSymbol = $.fbuilder.escapeSymbol;
580
 
581
  var eq = field[0].form.equations,
585
  {
586
  if(eq[i].result == field[0].id)
587
  {
588
+ var c = eq[i].resultField.configuration(); // Configuration object
589
 
590
  if( c.prefix && !/^\s*$/.test( c.prefix ) )
591
  {
js/modules/01_mathematical_logical/admin/module_admin.js CHANGED
@@ -32,7 +32,8 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
32
  { "value" : "NTHROOT", "code" : "NTHROOT(", "tip" : "NTHROOT(X,Y) returns the Y root X. <strong>NTHROOT(27, 3) = 3</strong>" },
33
  { "value" : "MAX", "code" : "MAX(", "tip" : "Returns the greater value of the two parameters. <strong>MAX(number1, number2)</strong>" },
34
  { "value" : "MIN", "code" : "MIN(", "tip" : "Returns the lesser value of the two parameters. <strong>MIN(number1, number2)</strong>" },
35
- { "value" : "FORMAT", "code" : "FORMAT(", "tip" : "Formats the number passed as the first parameters, based on the settigns passed as second parameter. <strong>FORMAT(-1234.56, {prefix:&quot;$&quot;, suffix:&quot; usd&quot;, groupingsymbol:&quot;,&quot;, decimalsymbol:&quot;.&quot;, currency:true}) = &quot;-$1,234.56 usd&quot;</strong>" },
 
36
  { "value" : "GCD", "code" : "GCD(", "tip" : "Returns greatest common divisor between the two parameters. <strong>GCD(number1, number2)</strong>" },
37
  { "value" : "LCM", "code" : "LCM(", "tip" : "Returns the least common multiple between two parameters. <strong>LCM(number1, number2)</strong>" },
38
  { "value" : "SIN", "code" : "SIN(", "tip" : "SIN(x) returns the sine of x (x in radians).<br> <strong>SIN(3) = 0.1411200080598672</strong>" },
32
  { "value" : "NTHROOT", "code" : "NTHROOT(", "tip" : "NTHROOT(X,Y) returns the Y root X. <strong>NTHROOT(27, 3) = 3</strong>" },
33
  { "value" : "MAX", "code" : "MAX(", "tip" : "Returns the greater value of the two parameters. <strong>MAX(number1, number2)</strong>" },
34
  { "value" : "MIN", "code" : "MIN(", "tip" : "Returns the lesser value of the two parameters. <strong>MIN(number1, number2)</strong>" },
35
+ { "value" : "FORMAT", "code" : "FORMAT(", "tip" : "Formats the number passed as the first parameter based on the configuration Object passed as the second parameter. <strong>FORMAT(-1234.56, {prefix:&quot;$&quot;, suffix:&quot; usd&quot;, groupingsymbol:&quot;,&quot;, decimalsymbol:&quot;.&quot;, currency:true}) = &quot;-$1,234.56 usd&quot;</strong>" },
36
+ { "value" : "UNFORMAT", "code" : "UNFORMAT(", "tip" : "Converts a text in currency format passed as the first parameter into a valid number based on the configuration object passed as the second parameter (it is optional).<br><strong>FORMAT(&quot;-$1,234.56&quot;) = -1234.56</strong><br><strong>FORMAT(&quot;-$1.234,56&quot;, {decimalsymbol:&quot;,&quot;}) = -1234.56</strong>" },
37
  { "value" : "GCD", "code" : "GCD(", "tip" : "Returns greatest common divisor between the two parameters. <strong>GCD(number1, number2)</strong>" },
38
  { "value" : "LCM", "code" : "LCM(", "tip" : "Returns the least common multiple between two parameters. <strong>LCM(number1, number2)</strong>" },
39
  { "value" : "SIN", "code" : "SIN(", "tip" : "SIN(x) returns the sine of x (x in radians).<br> <strong>SIN(3) = 0.1411200080598672</strong>" },
js/modules/01_mathematical_logical/public/module_public.js CHANGED
@@ -450,6 +450,24 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
450
  };
451
  }
452
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  fbuilderjQuery[ 'fbuilder' ][ 'extend_window' ]( fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ][ 'prefix' ], CF_LOGICAL );
454
  },
455
 
450
  };
451
  }
452
 
453
+ if(window.UNFORMAT == undefined)
454
+ {
455
+ window.UNFORMAT = window.unformat = function(x,o){
456
+ try
457
+ {
458
+ var s;
459
+ try
460
+ {
461
+ s = (typeof o != 'undefined' && 'decimalsymbol' in o) ? o['decimalsymbol'] : '.';
462
+ }catch(err){ s = '.'; }
463
+
464
+ return (x+'').replace(new RegExp('[^\\-\\d\\'+s+']', 'gi'), '')
465
+ .replace(new RegExp('\\'+s, 'gi'), '.')*1;
466
+ }
467
+ catch(err){ return x; }
468
+ };
469
+ }
470
+
471
  fbuilderjQuery[ 'fbuilder' ][ 'extend_window' ]( fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ][ 'prefix' ], CF_LOGICAL );
472
  },
473