From b61401974739a6241d8eaa0a2ca47f6abfb25046 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Tue, 22 Oct 2024 14:14:03 +0530 Subject: [PATCH] stock module changes 3 -vadivel J --- app/Controllers/StockController.php | 13 ++++++++----- app/Models/IncomingSilicaSandDetailsModel.php | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 4168d9cc..55d4e785 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -212,15 +212,18 @@ class StockController extends BaseController ->where('materialCode',$materialCode) ->first(); - if($resultExists){ + + + if(!empty($resultExists)){ - $this->incomingSilicaSandDetails_model + $updated = $this->incomingSilicaSandDetails_model ->where('igrNo_fk', $IGRNO) ->where('materialCode', $materialCode) - ->update($dbData); - + ->set($dbData) + ->update(); + }else{ - $this->incomingSilicaSandDetails_model->insert($dbData); + $inserted = $this->incomingSilicaSandDetails_model->insert($dbData); } } diff --git a/app/Models/IncomingSilicaSandDetailsModel.php b/app/Models/IncomingSilicaSandDetailsModel.php index 2411244d..3c2198de 100644 --- a/app/Models/IncomingSilicaSandDetailsModel.php +++ b/app/Models/IncomingSilicaSandDetailsModel.php @@ -18,8 +18,8 @@ class IncomingSilicaSandDetailsModel extends Model 'moistureLoss', 'moistureLossQty','sieveLossQty','salableQty', 'remark', 'is_active','created_at','updated_at']; - protected bool $allowEmptyInserts = true; - protected bool $updateOnlyChanged = false; + protected bool $allowEmptyInserts = false; + protected bool $updateOnlyChanged = true; protected array $casts = []; protected array $castHandlers = [];