feat: filter out coupons associated with archived loyalty programs in fetchCoupons

This commit is contained in:
Suherdy Yacob 2026-06-14 11:39:10 +07:00
parent 047f8a0987
commit 52f7760d61

View File

@ -155,6 +155,15 @@ patch(OrderPaymentValidation.prototype, {
// ─── PosStore patches ─────────────────────────────────────────────────────────
patch(PosStore.prototype, {
/**
* fetchCoupons filter out coupons/cards of archived programs.
*/
async fetchCoupons(domain, limit = 1) {
const activeDomain = [["program_id.active", "=", true]];
const newDomain = domain ? activeDomain.concat(domain) : activeDomain;
return await super.fetchCoupons(newDomain, limit);
},
/**
* afterProcessServerData purge orphaned lines from ALL orders after load.
*/