[okular] [Bug 468036] Form: NaN in form total (UK IHT 411)

2023-04-09 Thread Albert Astals Cid
https://bugs.kde.org/show_bug.cgi?id=468036

Albert Astals Cid  changed:

   What|Removed |Added

  Latest Commit|https://invent.kde.org/grap |https://invent.kde.org/grap
   |hics/okular/commit/24a9d097 |hics/okular/commit/a747625c
   |d7be00128d4d65903f5c013730b |79dbebb3e0fbf6cc44143f4f26b
   |e1c2c   |82371

--- Comment #6 from Albert Astals Cid  ---
Git commit a747625c79dbebb3e0fbf6cc44143f4f26b82371 by Albert Astals Cid, on
behalf of Dr. David Alan Gilbert.
Committed on 09/04/2023 at 09:38.
Pushed by aacid into branch 'release/23.04'.

JS: Implement field.valueAsString

Adobe's docs say:
  For example, for a field with a value of “020”, value returns the integer 20,
   while valueAsString returns the string “020”.

Share most of the fieldGetValue code by splitting it out into a 'Core'
variant and then using it in both GetValue and GetValueAsString.
(cherry picked from commit 24a9d097d7be00128d4d65903f5c013730be1c2c)

M  +16   -4core/script/kjs_field.cpp

https://invent.kde.org/graphics/okular/commit/a747625c79dbebb3e0fbf6cc44143f4f26b82371

-- 
You are receiving this mail because:
You are the assignee for the bug.

[okular] [Bug 468036] Form: NaN in form total (UK IHT 411)

2023-04-09 Thread Albert Astals Cid
https://bugs.kde.org/show_bug.cgi?id=468036

Albert Astals Cid  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
  Latest Commit||https://invent.kde.org/grap
   ||hics/okular/commit/24a9d097
   ||d7be00128d4d65903f5c013730b
   ||e1c2c

--- Comment #5 from Albert Astals Cid  ---
Git commit 24a9d097d7be00128d4d65903f5c013730be1c2c by Albert Astals Cid, on
behalf of Dr. David Alan Gilbert.
Committed on 09/04/2023 at 09:21.
Pushed by aacid into branch 'master'.

JS: Implement field.valueAsString

Adobe's docs say:
  For example, for a field with a value of “020”, value returns the integer 20,
   while valueAsString returns the string “020”.

Share most of the fieldGetValue code by splitting it out into a 'Core'
variant and then using it in both GetValue and GetValueAsString.

M  +16   -4core/script/kjs_field.cpp

https://invent.kde.org/graphics/okular/commit/24a9d097d7be00128d4d65903f5c013730be1c2c

-- 
You are receiving this mail because:
You are the assignee for the bug.

[okular] [Bug 468036] Form: NaN in form total (UK IHT 411)

2023-04-07 Thread Dave Gilbert
https://bugs.kde.org/show_bug.cgi?id=468036

Dave Gilbert  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|REPORTED|ASSIGNED

--- Comment #4 from Dave Gilbert  ---
OK, fix incoming; it's just that we're missing a definition of valueAsString

-- 
You are receiving this mail because:
You are the assignee for the bug.

[okular] [Bug 468036] Form: NaN in form total (UK IHT 411)

2023-04-07 Thread Dave Gilbert
https://bugs.kde.org/show_bug.cgi?id=468036

--- Comment #3 from Dave Gilbert  ---
I'm seeing a few scripts that run, the two that produce NaN are:

--
//set values in boxes to variable\r\nvar tot =
this.getField(\"Grand_Total_stock_1\");\r\nvar tot1 =
Number(this.getField(\"Total_1\").valueAsString);\r\nvar tot2 =
Number(this.getField(\"Total_2\").valueAsString);\r\nvar tot3 =
Number(this.getField(\"Total_3\").valueAsString);\r\nvar tot4 =
Number(this.getField(\"Total_4\").valueAsString);\r\nvar tot5 =
Number(this.getField(\"Total_5\").valueAsString);\r\nvar tot6 =
Number(this.getField(\"Total_6\").valueAsString);\r\nvar tot7 =
Number(this.getField(\"Total_7\").valueAsString);\r\n\r\n//set an array of
above variables\r\nvar arrTotal =[tot1, tot2, tot3, tot4, tot5, tot6,
tot7];\r\n\r\n//loop through variables to add\r\nvar result = 0;\r\nfor (i=0; i
< arrTotal.length; i++)\r\n{\r\nresult += arrTotal[i]\r\n   
};\r\n\r\n//place total of array loop in total box\r\ntot.value =
result;\r\n\r\n//if(tot.value == 0){\r\n//tot.value = \"\";\r\n//};\r\n

//set values in boxes to variable
var tot = this.getField(\"Grand_Total_stock_1\");
var tot1 = Number(this.getField(\"Total_1\").valueAsString);
var tot2 = Number(this.getField(\"Total_2\").valueAsString);
var tot3 = Number(this.getField(\"Total_3\").valueAsString);
var tot4 = Number(this.getField(\"Total_4\").valueAsString);
var tot5 = Number(this.getField(\"Total_5\").valueAsString);
var tot6 = Number(this.getField(\"Total_6\").valueAsString);
var tot7 = Number(this.getField(\"Total_7\").valueAsString);

//set an array of above variables
var arrTotal =[tot1, tot2, tot3, tot4, tot5, tot6, tot7];
//loop through variables to add
var result = 0;
for (i=0; i < arrTotal.length; i++)
{
result += arrTotal[i]
};
//place total of array loop in total box
tot.value = result;
//if(tot.value == 0){
//tot.value = \"\";
//};

--
//set values in boxes to variable\r\nvar totStk =
this.getField(\"Grand_total_stock_2\");\r\nvar totStk1 =
Number(this.getField(\"Total_stock_1\").valueAsString);\r\nvar totStk2 =
Number(this.getField(\"Total_stock_2\").valueAsString);\r\nvar totStk3 =
Number(this.getField(\"Total_stock_3\").valueAsString);\r\nvar totStk4 =
Number(this.getField(\"Total_stock_4\").valueAsString);\r\nvar totStk5 =
Number(this.getField(\"Total_stock_5\").valueAsString);\r\nvar totStk6 =
Number(this.getField(\"Total_stock_6\").valueAsString);\r\nvar totStk7 =
Number(this.getField(\"Total_stock_7\").valueAsString);\r\nvar totStk8 =
Number(this.getField(\"Total_stock_8\").valueAsString);\r\nvar totStk9 =
Number(this.getField(\"Total_stock_9\").valueAsString);\r\nvar totStk10 =
Number(this.getField(\"Total_stock_10\").valueAsString);\r\nvar totStk11 =
Number(this.getField(\"Total_stock_11\").valueAsString);\r\nvar totStk12 =
Number(this.getField(\"Total_stock_12\").valueAsString);\r\nvar totStk13 =
Number(this.getField(\"Total_stock_13\").valueAsString);\r\nvar totStk14 =
Number(this.getField(\"Total_stock_14\").valueAsString);\r\n\r\n//set an array
of above variables\r\nvar arrTotalStk =[totStk1, totStk2, totStk3, totStk4,
totStk5, totStk6, totStk7, totStk8, totStk9, totStk10, totStk11, totStk12,
totStk13, totStk14];\r\n\r\n//loop through variables to add\r\nvar resultStk =
0;\r\nfor (i=0; i < arrTotalStk.length; i++)\r\n{\r\nresultStk +=
arrTotalStk[i]\r\n}\r\n\r\n//place total of array loop in total
box\r\ntotStk.value = resultStk;\r\n\r\n//if(totStk.value ==
0){\r\n//totStk.value = \"\";\r\n//};

//set values in boxes to variable
var totStk = this.getField(\"Grand_total_stock_2\");
var totStk1 = Number(this.getField(\"Total_stock_1\").valueAsString);
var totStk2 = Number(this.getField(\"Total_stock_2\").valueAsString);
var totStk3 = Number(this.getField(\"Total_stock_3\").valueAsString);
var totStk4 = Number(this.getField(\"Total_stock_4\").valueAsString);
var totStk5 = Number(this.getField(\"Total_stock_5\").valueAsString);
var totStk6 = Number(this.getField(\"Total_stock_6\").valueAsString);
var totStk7 = Number(this.getField(\"Total_stock_7\").valueAsString);
var totStk8 = Number(this.getField(\"Total_stock_8\").valueAsString);
var totStk9 = Number(this.getField(\"Total_stock_9\").valueAsString);
var totStk10 = Number(this.getField(\"Total_stock_10\").valueAsString);
var totStk11 = Number(this.getField(\"Total_stock_11\").valueAsString);
var totStk12 = Number(this.getField(\"Total_stock_12\").valueAsString);
var totStk13 = Number(this.getField(\"Total_stock_13\").valueAsString);
var totStk14 = Number(this.getField(\"Total_stock_14\").valueAsString);

//set an array of above variables
var arrTotalStk =[totStk1, totStk2, totStk3, totStk4, totStk5, totStk6,
totStk7, totStk8, totStk9, totStk10, totStk11, totStk12, totStk13, totStk14];

//loop through variables to add
var resultStk = 0;
for (i=0; i < arrTotalStk.length; i++)

[okular] [Bug 468036] Form: NaN in form total (UK IHT 411)

2023-04-01 Thread Dave Gilbert
https://bugs.kde.org/show_bug.cgi?id=468036

--- Comment #2 from Dave Gilbert  ---
For anyone desperately looking to work around this, Chromium doesn't NaN

-- 
You are receiving this mail because:
You are the assignee for the bug.

[okular] [Bug 468036] Form: NaN in form total (UK IHT 411)

2023-04-01 Thread Dave Gilbert
https://bugs.kde.org/show_bug.cgi?id=468036

--- Comment #1 from Dave Gilbert  ---
Created attachment 157769
  --> https://bugs.kde.org/attachment.cgi?id=157769=edit
Verison of IHT411 with dummy £1 value filled in

-- 
You are receiving this mail because:
You are the assignee for the bug.