From ff858aaf5055fc6508352600db8a6a2475743184 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:23:05 +0700 Subject: [PATCH] fix: check if body contains customer branch --- src/controllers/05-quotation-controller.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/05-quotation-controller.ts b/src/controllers/05-quotation-controller.ts index 01b66fa..6235b5c 100644 --- a/src/controllers/05-quotation-controller.ts +++ b/src/controllers/05-quotation-controller.ts @@ -631,7 +631,11 @@ export class QuotationController extends Controller { } await permissionCheckCompany(req.user, record.customerBranch.customer.registeredBranch); - if (customerBranch && record.customerBranchId !== body.customerBranchId) { + if ( + customerBranch && + body.customerBranchId && + record.customerBranchId !== body.customerBranchId + ) { await permissionCheckCompany(req.user, customerBranch.customer.registeredBranch); }