We have a complex verification code that is been generated by a script (JavaScript) and consumed by a Printer Template.
The problem is when we pass any string that includes the “[” or “]” characters. SambaPOS is doing something with those characters. We tried to debug this problem with Visual Studio but whenever the string includes brackets SambaPOS throws this error:
We understand that the “” must have a special treatment in strings. Is this also the case for brackets? Or, is this a bug?
I have simplified the problem to be able to clearly explain myself. Please take a look at the following function (stored in a “tests” script):
function getVerificationCode(number, key) {
var r = '';
r = "number:" + number + " of type " + typeof number + " key:" + key + " of type " + typeof key;
return r;
}
I make three calls to the function from a template:
The first call returns:
Test 1: number:5 of type number key:abc of type string
The second call throws this error (dialog box with OK button):
"Template content has invalid bracket syntax.
The third line returns an empty result (possibly “undefined” data). What I expect is to have the Ticket total as a number and pass it as a parameter.
Test 3:
It works without it but what I receive in the function is a string like this “1,156.08”. The thousand and decimal separators van vary, that is why I am hoping to be able to use TN(). I need a floating point number in that parameter