Formatting and add item deletion event trigger

Signed-off-by: objec <objecttothis@gmail.com>
This commit is contained in:
objec committed 2026-05-29 16:34:22 +04:00
1 parent 07d1d15ade
commit 84b75825e7
2 files changed
+6 -6

No files matched your search

+1
View File
@@ -940,6 +940,7 @@ class Items extends Secure_Controller
$items_to_delete = $this->request->getPost('ids');
if ($this->item->delete_list($items_to_delete)) {
Events::trigger('item_deleted', $items_to_delete);
$message = lang('Items.successful_deleted') . ' ' . count($items_to_delete) . ' ' . lang('Items.one_or_multiple');
return $this->response->setJSON(['success' => true, 'message' => $message]);
} else {
+5 -6
View File
@@ -16,7 +16,6 @@ use stdClass;
*/
class Item extends Model
{
public const ALLOWED_SUGGESTIONS_COLUMNS = ['name', 'item_number', 'description', 'cost_price', 'unit_price'];
public const ALLOWED_SUGGESTIONS_COLUMNS_WITH_EMPTY = ['', 'name', 'item_number', 'description', 'cost_price', 'unit_price'];
@@ -428,11 +427,11 @@ class Item extends Model
/**
* Gets information about multiple items
*/
public function get_multiple_info(array $item_ids, int $location_id): ResultInterface
public function getMultipleInfo(array $itemIds, int $locationId): ResultInterface
{
$format = $this->db->escape(dateformat_mysql());
$builder = $this->db->table('items');
$builder = $this->db->table($this->table);
$builder->select('items.*');
$builder->select('MAX(company_name) AS company_name');
$builder->select('GROUP_CONCAT(DISTINCT CONCAT_WS(\'_\', definition_id, attribute_value) ORDER BY definition_id SEPARATOR \'|\') AS attribute_values');
@@ -445,8 +444,8 @@ class Item extends Model
$builder->join('attribute_links', 'attribute_links.item_id = items.item_id AND sale_id IS NULL AND receiving_id IS NULL', 'left');
$builder->join('attribute_values', 'attribute_links.attribute_id = attribute_values.attribute_id', 'left');
$builder->where('location_id', $location_id);
$builder->whereIn('items.item_id', $item_ids);
$builder->where('location_id', $locationId);
$builder->whereIn('items.item_id', $itemIds);
$builder->groupBy('items.item_id');
@@ -455,7 +454,7 @@ class Item extends Model
public function getItems(array $itemIds): array
{
return $this->db->table('items')
return $this->db->table($this->table)
->whereIn('item_id', $itemIds)
->get()
->getResultArray();