GWM:merging

This commit is contained in:
bitbucket 2024-04-05 17:40:08 +05:30
parent ed7e17a1ae
commit ad2a9b98e0
2 changed files with 13 additions and 4 deletions

View File

@ -88,7 +88,7 @@ class Client extends BaseController
public function delete_client($client_id)
{
$model = new ClientModel();
$where = ['client_id' => $client_id, 'isactive' => 1]; // Assuming 'isactive' is a column in your database
$where = ['client_id' => $client_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database
$existingBusiness = $model->where($where)->first();
if ($existingBusiness) {

View File

@ -8,12 +8,19 @@ use App\Models\ProductModel;
class Products extends BaseController
{
public $session;
public function __construct()
{
$this->session = session();
}
public function product_index()
{
$ProductModel = new ProductModel();
$products=$ProductModel->findAll();
$products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$data['products']=$products;
return view('product_list',$data);
@ -66,7 +73,8 @@ class Products extends BaseController
'qty'=> $this->request->getPost('qty_in_stock'),
'qty_in_demand'=> $this->request->getPost('qty_in_demand'),
'description' => $this->request->getPost('description'),
'isactive' => 1 // Assuming this is a default value or handled separately
'isactive' => 1 ,
'branch_id' => $this->session->get('logged_user_branch_id')
];
// print_r($data);die;
@ -84,10 +92,11 @@ class Products extends BaseController
return redirect()->to('product_index');
}
public function delete_product($product_id)
{
$model = new ProductModel();
$where = ['product_id' => $product_id, 'isactive' => 1]; // Assuming 'isactive' is a column in your database
$where = ['product_id' => $product_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database
$existingProduct = $model->where($where)->first();
if ($existingProduct) {