- Removed unnecessary ReflectionException in PHPdoc
- Corrected return details of insert function
- Replaced deprecated class
- Removed Inventory model's insert function because it wasn't providing functionality that the Model class wasn't.
- Corrected the calling method signature for Inventory->insert()
This commit is contained in:
objecttothis
2023-12-07 16:11:12 +04:00
committed by jekkos
parent cc58cecff0
commit d18d2cf814
6 changed files with 9 additions and 27 deletions

View File

@@ -765,7 +765,7 @@ class Items extends Secure_Controller
'trans_inventory' => $updated_quantity - $item_quantity->quantity
];
$success &= $this->inventory->insert($inv_data);
$success &= $this->inventory->insert($inv_data, false);
}
}
@@ -908,7 +908,7 @@ class Items extends Secure_Controller
'trans_inventory' => parse_quantity($this->request->getPost('newquantity'))
];
$this->inventory->insert($inv_data);
$this->inventory->insert($inv_data, false);
//Update stock quantity
$item_quantity = $this->item_quantity->get_item_quantity($item_id, $location_id);
@@ -1362,7 +1362,7 @@ class Items extends Secure_Controller
$this->item_quantity->save_value($item_quantity_data, $item_data['item_id'], $location_id);
$csv_data['trans_inventory'] = $row["location_$location_name"];
$this->inventory->insert($csv_data); //TODO: Reflection Exception
$this->inventory->insert($csv_data, false);
}
elseif($is_update)
{
@@ -1374,7 +1374,7 @@ class Items extends Secure_Controller
$this->item_quantity->save_value($item_quantity_data, $item_data['item_id'], $location_id);
$csv_data['trans_inventory'] = 0;
$this->inventory->insert($csv_data); //TODO: Reflection Exception
$this->inventory->insert($csv_data, false);
}
}
}

View File

@@ -6,7 +6,7 @@ use App\Models\Appconfig;
use CodeIgniter\Database\Forge;
use CodeIgniter\Database\Migration;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\Router\Exceptions\RedirectException;
use CodeIgniter\HTTP\Exceptions\RedirectException;
use Config\Encryption;
use Config\Services;

View File

@@ -2,10 +2,8 @@
namespace App\Models;
use CodeIgniter\Database\BaseResult;
use CodeIgniter\Database\ResultInterface;
use CodeIgniter\Model;
use ReflectionException;
/**
* Inventory class
@@ -28,20 +26,6 @@ class Inventory extends Model
'trans_location'
];
/**
* Insert new data into the Inventory table.
*
* @param array|null|object $inventory_data Data to be inserted into the inventory table.
* @param bool $returnID Returns the value of the ID column for the inserted row.
* @return int|string|bool The ID of the inserted row on success or false on failure
*/
public function insert($inventory_data = null, bool $returnID = true)
{
$builder = $this->db->table('inventory');
return $builder->insert($inventory_data, $returnID);
}
/**
* @param $comment
* @param $inventory_data

View File

@@ -510,7 +510,6 @@ class Item extends Model
/**
* Deletes one item
* @throws ReflectionException
*/
public function delete($item_id = null, bool $purge = false)
{
@@ -547,7 +546,6 @@ class Item extends Model
/**
* Deletes a list of items
* @throws ReflectionException
*/
public function delete_list(array $item_ids): bool
{

View File

@@ -185,7 +185,7 @@ class Receiving extends Model
'trans_inventory' => $items_received
];
$inventory->insert($inv_data);
$inventory->insert($inv_data, false);
$attribute->copy_attribute_links($item_data['item_id'], 'receiving_id', $receiving_id);
$supplier = $supplier->get_info($supplier_id); //TODO: supplier is never used after this.
}
@@ -247,7 +247,7 @@ class Receiving extends Model
'trans_inventory' => $item['quantity_purchased'] * (-$item['receiving_quantity'])
];
// update inventory
$inventory->insert($inv_data);
$inventory->insert($inv_data, false);
// update quantities
$item_quantity->change_quantity($item['item_id'], $item['item_location'], $item['quantity_purchased'] * (-$item['receiving_quantity']));

View File

@@ -783,7 +783,7 @@ class Sale extends Model
'trans_inventory' => -$item_data['quantity']
];
$inventory->insert($inv_data);
$inventory->insert($inv_data, false);
}
$attribute->copy_attribute_links($item_data['item_id'], 'sale_id', $sale_id);
@@ -955,7 +955,7 @@ class Sale extends Model
'trans_inventory' => $item_data['quantity_purchased']
];
// update inventory
$inventory->insert($inv_data);
$inventory->insert($inv_data, false);
// update quantities
$item_quantity->change_quantity($item_data['item_id'], $item_data['item_location'], $item_data['quantity_purchased']);