Disable cash drawer opening in training mode?

Is there an easy way to disable the cash drawer from opening when in training mode (for security reasons)?

I know in other systems when in training mode the drawer will not fire…Thanks

As I understand it training mode duplicated the database and adds _TRAINING or similar to the end.
Sure there is a way to check the current database name in one way or another and you could use that as a constraint on your print job for open drawer rule.
It would need to be in a seperate print job not on bottom of receipt template if that’s how you have done you kick command.

That’s great I’ll give it a go…thanks!

Wouldnt it be easier to just only give them access to a training user account pin and also enable training. That way you configure the pin to be unable to open the drawer?

Wouldn’t stop them using their own pin as training mode clones current database there pin would work as on normal operation.

You just need to find the Rule that fires the Open Drawer Action, and either disable the Rule (remove mappings), or change the Mapping to be active only for certain Roles, or disable the Action with a Constraint like 1==2.

Tried accessing the database name to see if training mode was turned on but couldnt find the correct syntax. I opted instead for setting up a training account and using this as a constraint on my drawer opening action:

This works fine…thanks again for all your help.

I find Microsoft SQL Server Management Studio really helpful to manage my databases. I recommend you install that if you want to see what database was created. Its very easy to use, dont let it scare you away if your new. There you can see the exact name of the database that was created.

1 Like

The SQL command SELECT DB_NAME() will return the name of the Database that is active (NOT the name of the database you have configured in SambaPOS). As other have said, when in ‘training mode’ SambaPOS actually creates a new DB called “training_#####” where ### is a random number, or perhaps derrived from the date or time.

Using the {REPORT SQL DETAILS} you can execute SQL commands wherever you like. But combining this with a .substr() function in a JScript code block [= ] then you can get SambaPOS to access just the first 6 characters of the DB name. You can then compare these 6 characters to the word “Training” - If it matches then you can do something. Of course, you can configure the the compare operation to be != so you can do something only if the DB is NOT a training DB.

You can see this in an example rule below…

Image above is incorrect, should have (0,8) not (0,6)

'[='{REPORT SQL DETAILS:SELECT DB_NAME() AS dbName:F.dbName}'.substr(0,8)]' == 'training'

The advantage of this approach is that you can use all of your users, so you can check what permissions each user can do and you can check that manager overrides work correctly etc…


Editing in training mode would be pointless as pretty sure it dumps the database when you end training mode and makes a fresh copy when started again so this sort of database name method I think is the best approach.
The user method will work so long as they only use the training user in training mode, - given the removal of opening cash drawer your worried about access to till, in which case if someone was so inclided im sure it wouldnt take them long to realise their normal pin works in training mode where they will be able to open the drawer as normal.

That’s really helpful thanks … took me a while to figure out to use substr(0,8) though as it didn’t work at first(!)

Thanks! This has solved the problem in a much better way.

Whoops! - Yes, sorry. I have corrected thsi in my original post now! :slight_smile:

1 Like