- fixed excel import: if there was missing a location-id in the import-csv, then there would not have been created an entry into item_quantities for the item and location.

- fixed also the inventory info-part: before in the inventory-table there was no quantity inserted and data[10] as the location_id
This commit is contained in:
Malte Srocke
2015-01-22 22:19:23 +01:00
parent 3d6d473145
commit 606eb01a67
2 changed files with 71 additions and 19 deletions

View File

@@ -26,6 +26,25 @@ class Stock_locations extends CI_Model
return $this->db->get();
}
/*
* returns all location-ids in a simple array like array (location_id, location_id, ...)
* used in items-controller::do_excel_import
* @since 22.1.15
*/
function get_location_ids_as_array()
{
$this->db->select('location_id');
$this->db->from('stock_locations');
$this->db->where('deleted', 0);
$query = $this->db->get();
$ids_array = array();
foreach($query->result() as $row)
{
$ids_array[] = $row->location_id;
}
return $ids_array;
}
function concat_location_names()
{
$this->db->select('GROUP_CONCAT(location_name SEPARATOR\',\') AS location_names', FALSE);