Close ticket rule

Sorry I was going by a different post gerlandog made asking a similar question and putting it in with this question from this post. IT felt like to me he was trying to figure out a work around to his other post about a similar situation and ran into a problem with the CLose Ticket action not working.

That being said, I believe its possible to get the prices to change but it wont affect anything that was already added to the ticket.

Maybe you can use the Update Order action within the rule and it would change current orders price. And to make the trigger work within an open ticket maybe in the Trigger Executed rule make the action execute an Automation Command… Then make a rule that is when that command is executed it changes the price list… closes ticket etc.

So to recap… your in middle of a ticket… the trigger executes… it changes the price of the order already added to ticket closes ticket… reopens ticket… you continue with adding rest of orders with new price list.

Ill try to build it and test it see if it works.

I just got it to work with the Rule I previously posted. But I am not allowed to change Department, only price list.

The Action to change Price List must not change Department.

So it will work we just gotta get it to work with a trigger execute… So he can still use the trigger and not have to hit a button. I think setting the trigger up like i mentioned above might work.

It should theoretically work with a trigger, just not sure why you would want it to. You could be mid-order and suddenly your ticket closes on you!

What I’ve learned from this though, is that you can’t change Department, and almost certainly Ticket Type as well. Further, once the ticket is closed for the final time, you may want to revert back to the original price list.

I wouldnt want it to work that way myself. I was trying to figure out a solution for gerlandog from a previous post he made:

@gerlandog It definately will close the ticket for you with trigger using the setup i posted above:

… now to get it to automatically reopen it… thats the issue im having trouble with.

Gerlandog can you let me know your use case? Why do you want to change prices while creating a ticket? How are you using triggers? Does your prices changes by time?

Side note: Price list changes (anything relates with menus) intentionally not activates during ticket creation.

The only use I might see this being relative would be a Happy Hour… If you spill over into Happy Hour time while in middle of a ticket and you would want it to reflect the Happy Hour prices without having to cancel and restart a ticket.

Happy hour can occur in the middle of a ticket. Thats why prices can change by time. In version 47 close ticket action us not working…
Do not knoq why.
I am setting a trigwr that exec every weekday at 8pm enabling happy hour and one triggwr that exec 9pm to disable happy hour.
When ypu are in the middle of creating a ticket and the trigger exec it asks if ypu wamt to enable happy hour. If yes it should close ticket (not dping) and change price list (doung it corrwct).

Thanks

G

Ah! I see now… that’s being really nit-picky about happy hour imo.

I have happy hour triggers as well (price tag HH), but if I have a ticket open before the trigger executes, that’s too bad. Closing and re-opening the ticket will allow the Price change to come into effect, so the next drink they order will have HH pricing. Of course previous orders on the ticket will have regular pricing.

Close Ticket not working on v47? My screens indicate my test was done on v46. I’ll upgrade to see if it stops working…

edit: updated to v47, and it still works… Switch Price List button closes and repoens ticket, with new definition active.

So my button works, even in the middle of Ticket creation, but the Trigger fails to close the ticket.

I see the trigger executing, since it displays messages, but the ticket never closes and reopens…

1 Like

I’m thinking triggers operate outside of a ticket. Load ticket should work. But how would you know its loading the ticket your on.

So… it was not me dping things wrong… LOL!! This should be the first time jajjajajajajajajajsjs

Thanks

G

It will let you close ticket if it comes from an automation command. But it seems that if you set a trigger to execute an automated command it will not fire when trigger executes.

I tried using the Trigger Executed rule to trigger an action that executes a command then set a rule that on the executed command change price list, close ticket. the trigger worked but the actions did not. I double checked and the logic was right it should have fired.

So it seems triggers are only working with specific actions and not all of them?

OK first of all let me give you some background information. We store prices in cache. That means as you add items to tickets SambaPOS does not read prices from database. When change price list action executes it raises a flag to clear cache and read prices from database. However if there is an open ticket we intentionally do not clear cache as soon as trigger executes. Since we can not determine when a trigger executes it may cause unpreventable errors. For example think of price change executes in the middle of the millisecond we’re calculating discounts and taxes. We can never know the issue relates to a trigger so I completely queue such methods to work after ticket close and it generally completes until it displays the entity screen or what comes next. Caller-id users will experience same behavior. SambaPOS never displays phone number popup (even multiple people calls) in the middle of the ticket creation. It displays queued popups as you close ticket.

So that might seem an error to you but there are rules :slight_smile: We created them to protect stability.

In fact we don’t need triggers at all to implement happy hour. Like @Jesse pointed few posts before we can implement an “apply happy hour price” action with Update Order action and execute it after Order added to Ticket if {DATE:HH} > 20 & {DATE:HH} < 23. That will also work fine in the middle of ticket creation.

2 Likes

I had a hunch it was like this but I thought I would try and help gerlandog work through it to see possibilities

That method of Happy Hour looks like it would be a better solution vs using triggers.