Staff meal issue upon entering confirmation "Admin pin"

Hello everyone,
I applied Staff Meal discount using the second method (Method-2) in the tutorial: 4.36. How to Make 100% Discount for Staff Meals? – SambaPOS Knowledgebase
It works fine if Admin user is logged in and applies the “Staff Meal”, but when a cashier user is logged in and clicks on “Staff Meal” button then the admin/manager enters his pin the error “There is a problem. Message: An error occurred while updating the entries. See the inner exception for details” comes.
Below is the exception in the log file.
Any suggestions?

1/1/2024 3:07 PM

[General Info]

Application: SambaPOS
Version: 5.7.6
Region: en
DB: SQ
Machine: -------
User: ---------
Date: 1/1/2024
Time: 12:07 PM

User Explanation:

-------- said “”

[Exception Info 1]

Top-level Exception
Type: System.Data.Entity.Infrastructure.DbUpdateException
Message: An error occurred while updating the entries. See the inner exception for details.
Source: EntityFramework
Stack Trace: at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at System.Data.Entity.DbContext.SaveChanges()
at Samba.Infrastructure.Data.SqlData.EFWorkspace.CommitChanges()
at Samba.Persistance.Implementations.AutomationCommandLoggerDao.LogAutomationCommand(String name, String description, Int32 automationcommandid, Int32 userid, Int32 adminid, Int32 ticketid, String orderuid, String userName, String adminName)
at Samba.Presentation.Services.Implementations.AutomationModule.AutomationCommandLoggerClient.LogAutomationCommand(String name, String description, Int32 automationcommandid, Int32 userid, Int32 adminid, Int32 ticketid, String orderuid, String userName, String adminName)

Inner Exception 1
Type: System.Data.Entity.Core.UpdateException
Message: An error occurred while updating the entries. See the inner exception for details.
Source: EntityFramework
Stack Trace: at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<>c.b__21_0(UpdateTranslator ut)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func2 updateFunction) at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update() at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__153_0() at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass148_0.b__0()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
at System.Data.Entity.Internal.InternalContext.SaveChanges()

Inner Exception 2
Type: System.Data.SqlClient.SqlException
Message: The INSERT statement conflicted with the FOREIGN KEY constraint “FK_dbo.AutomationCommandLogs_dbo.Tickets_TicketId”. The conflict occurred in database “SambaPOS-Demo”, table “dbo.Tickets”, column ‘Id’.
The statement has been terminated.
Source: .Net SqlClient Data Provider
Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c.<Reader>b__6_0(DbCommand t, DbCommandInterceptionContext1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func3 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary2 identifierValues, List1 generatedValues)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()


[Assembly Info]

mscorlib, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
System, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
Samba.Services, Version=5.7.8759.28644
System.ComponentModel.Composition, Version=4.0.0.0
System.Configuration, Version=4.0.0.0
DevExpress.Xpf.Core.v17.2, Version=17.2.13.0
System.Xaml, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
Samba.Presentation.Services, Version=5.7.8759.28647
Samba.Presentation.Common, Version=5.7.8759.28648
System.Drawing, Version=4.0.0.0
Samba.Domain, Version=5.7.8759.28642
Microsoft.Practices.Prism, Version=4.0.0.0
Samba.Infrastructure, Version=5.7.8759.28639
System.Core, Version=4.0.0.0
DevExpress.Data.v17.2, Version=17.2.13.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0
Samba.Localization, Version=5.3.8759.28640
Samba.Persistance, Version=5.7.8759.28642
FastButton, Version=1.0.0.0


[System Info]

Operating System
-Microsoft Windows 11 Home Single Language
–CodeSet = 1252
–CSDVersion =
–CurrentTimeZone = 180
–FreePhysicalMemory = 6342320
–OSArchitecture = 64-bit
–OSLanguage = 1033
–ServicePackMajorVersion = 0
–ServicePackMinorVersion = 0
–Version = 10.0.22631

Machine


–Manufacturer = LENOVO
–Model = 82YN
–TotalPhysicalMemory = 16891371520
–UserName = ----------


######################### E N D #########################