I have a rule that gets fired when I click a “Print Invoice” button. This rule generates an invoice number that that sets a ticket tag. The invoice number is a program setting counter like in this tutorial http://forum2.sambapos.org/index.php/topic,97.msg671.html#msg671. In the invoice printing template I use {TICKET TAG:MYINVOICENUMBER} to retrieve the invoice number and it appears fine on the printed invoice. Later on I would like to display this invoice number in a ticket lister but it is always blank. It seems this tag only exists during the execution of the rule but is not saved in database or so.
In the rule the ticket gets reopened, ticket tag updated, saved and closed.
I tried to use ticket states instead of ticket tags but same problem, the invoice number is blank.
What’s the right way to save ticket tags or states ?
My goal is to print an invoice number (different then the ticket number). I also want to be able to show this invoice number later on when I display the ticket.
First thing I see is in your action for State your Parameter syntax is wrong… it should be [:FACTURANUMBER]
If that is all you want then just use {TICKET ID} and you can insert it on the Ticket with {TICKET ID} tag. Every Ticket is assigned a TICKET ID that is seaprate from Ticket NO. Its always increasing and is the unique ticket identifier for database. You can even load and display tickets simply by Ticket Id.
I think he has another rule/action to set program setting called FACTURANUMBER.
@devloic But I don’t see any Ticket Tag MYINVOICENUMBER in your ticket. That is why it is empty.
I think you use {:FACTURANUMBER} to print not {TICKET TAG:MYINVOICENUMBER}.
hmm, I changed it to [:FACTURANUMBER] and now the printed invoice number is blank while it wasn’t with {:FACTURANUMBER}. The tutorial How to create the PERFECT BILL uses {:SOMEPROGRAMSETTING} syntax for program settings.
I can’t use {TICKET ID} because the invoice numbers need to start from some specific value, ex: 1000. (I set the initial value directly in database)
I use both for testing ( hoping that at least one of the two (TAG or STATE) would be persistent). Here is the printing template line I use: <L00>Factura No : STATE{TICKET STATE:MYINVOICENUMBER}TAG{TICKET TAG:MYINVOICENUMBER}
Actually the invoice number is correctly shown in the printed invoice.
It’s later on when I want to show it in a ticket lister that it doesn’t appear.
Nice guess! The “more ticket actions” module was not installed anymore (although the action were still available). After reinstalling I got the tag/state in my ticket lister.