Bug Description
Customer loyalty auto-assignment selects the first enabled POS Settings record with a default loyalty program, instead of resolving from the actual POS Profile / company context that created the customer.
Expected Behavior
The loyalty program assigned to a new customer should match the company/profile context of the current POS session.
Actual Behavior
The selection is global and order-dependent rather than context-aware.
Steps to Reproduce
- Configure multiple POS settings/profile contexts with different default loyalty programs
- Create customers from different POS contexts
- Compare the assigned loyalty program with the context that created each customer
Impact
- wrong loyalty program can be assigned in multi-profile or multi-company setups
- customer creation behavior becomes inconsistent across contexts
- downstream loyalty earning/redemption rules may be wrong from the start
Suggested Fix
- resolve default loyalty program from the active POS Profile/company context
- avoid using the first enabled settings row as a global fallback
Notes
This is primarily a context-resolution bug and becomes much more visible on multi-company or multi-profile deployments.