Problem after updating from 5.1.58 to 5.1.62 with increase tag number

Hi, I just decided to update from 5.1.58 to 5.1.62 to be able to have the user interface in Spanish. Before the update I used this tutorial: https://forum2.sambapos.org/index.php?topic=97.msg671#msg671. because i needed to assign an invoice number that will increase by 1 each time the ticket was paid and printed, this was added as a tag called FACTURA to the ticket. I also created an action to set the initial tag value in case i needed. On the other hand with the same tutorial I created a number called CIERRE that will be assign to each daily report and it will increase when the report was printed. Both of them used to work as described but after the update I’m getting the next validation issue and both numbers are not increasing and they are getting stuck at 1, I can’t even set the initial number anymore:

This is how the actions and rules are set up for the invoice number:

This is how the actions and rules are set up for the report number:

Can anyone help me figure out how to make it work again?

Look at what the error message is telling you …


You have 2 options.

  • remove the Action from the Rule, Save the Rule, Open the Rule, add the Action back, and Save the Rule.

  • OR, change the parameter variable in the action Set Initial Invoice Number from [:ULTIMA FACTURA IMPRESSA] to [:FACTURA]


The same goes for the other Error, but you have not shown the Rule or Action for that, however …


##Advice

###NEVER use {SOMETHING in Curly Braces} directly in Actions

You should not put things like {:INVOICENUMBER} directly in Actions. You should use a [:variable] instead. As in the case above, using something like {:SETTINGNAME} directly in an Action is unreliable, and can (will) produce unwanted results. You should always use a [:variable] for the Action parameters, like [:Tag Value].

###AVOID using Update Type “Increase” in “Update Program Setting” Actions

Instead, always use Update Type Update, and use a variable for the Setting Value, such as [:settingValue]. Then in the Rule, use this to increase the value:

[=TN('{SETTING:<settingName>}') + 1]

Example...
[=TN('{SETTING:INVOICENUMBER}') + 1]

3 Likes

Thanks a lot for your help, it is a lot of clear now for me how to set up this actions and rules.

On the other hand, I notice that when I changed the language from Spanish back to English it worked again as it was before the update. That makes me thing that the language is affecting in some ways the actions and rules commands. I inicially set everything up when it was in english but now when I change it to spanish some action and rules are not working as expected, I believe this might not be intended so it has to be look after, correct me if I’m wrong.

I had downgrade to version 5.1.58 until I have more time to check and fix everything back to normal on the last version. Let me know if it is normal that the language will have some repercussions on actions and rules that were set up on another language in the beginning because that is what happened to me.

It doesn’t surprise me. Especially things like States have different words in different languages, ie. Paid, Unpaid, Gift, Void, etc. A lot of the Rules are constrained to only execute with certain State Values, so when you install with a different language, the words will be incorrect.

If instead you install in say English, then switch the language (not reinstall with different language), that might be prevented and still work Ok, not sure.