GWM:merging
This commit is contained in:
parent
ed7e17a1ae
commit
ad2a9b98e0
@ -88,7 +88,7 @@ class Client extends BaseController
|
|||||||
public function delete_client($client_id)
|
public function delete_client($client_id)
|
||||||
{
|
{
|
||||||
$model = new ClientModel();
|
$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();
|
$existingBusiness = $model->where($where)->first();
|
||||||
|
|
||||||
if ($existingBusiness) {
|
if ($existingBusiness) {
|
||||||
|
|||||||
@ -8,12 +8,19 @@ use App\Models\ProductModel;
|
|||||||
|
|
||||||
class Products extends BaseController
|
class Products extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $session;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->session = session();
|
||||||
|
}
|
||||||
|
|
||||||
public function product_index()
|
public function product_index()
|
||||||
{
|
{
|
||||||
|
|
||||||
$ProductModel = new ProductModel();
|
$ProductModel = new ProductModel();
|
||||||
$products=$ProductModel->findAll();
|
$products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
|
||||||
$data['products']=$products;
|
$data['products']=$products;
|
||||||
|
|
||||||
return view('product_list',$data);
|
return view('product_list',$data);
|
||||||
@ -66,7 +73,8 @@ class Products extends BaseController
|
|||||||
'qty'=> $this->request->getPost('qty_in_stock'),
|
'qty'=> $this->request->getPost('qty_in_stock'),
|
||||||
'qty_in_demand'=> $this->request->getPost('qty_in_demand'),
|
'qty_in_demand'=> $this->request->getPost('qty_in_demand'),
|
||||||
'description' => $this->request->getPost('description'),
|
'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;
|
// print_r($data);die;
|
||||||
|
|
||||||
@ -84,10 +92,11 @@ class Products extends BaseController
|
|||||||
|
|
||||||
return redirect()->to('product_index');
|
return redirect()->to('product_index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete_product($product_id)
|
public function delete_product($product_id)
|
||||||
{
|
{
|
||||||
$model = new ProductModel();
|
$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();
|
$existingProduct = $model->where($where)->first();
|
||||||
|
|
||||||
if ($existingProduct) {
|
if ($existingProduct) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user