Menu

#45 Failure of Import Items from Excel

v2.3.2
closed
nobody
None
2
2015-05-08
2015-05-08
FredJo
No

I was unable to import an Excel files with more than 1 item in the file.
After several investigations, I figured out that the method do_excel_import() in item.php was crashing when inserting the Inventory info at the first item and then exists.
The most appropriate fix I found is to merge the "quantities" and "Inventory info" blocs. The result is

// quantities
$cols = count($data);
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
$emp_info=$this->Employee->get_info($employee_id);
$comment ='Qty CSV Imported';
for ($col = 24; $col < $cols; $col = $col + 2)
{
$item_quantity_data = array(
'item_id' => $item_data['item_id'],
'location_id' => $data[$col],
'quantity' => $data[$col + 1],
);
$this->Item_quantities->save($item_quantity_data, $data[$col], $data[$col + 1]);
// Inventory Info
$excel_data = array
('trans_items'=>$item_data['item_id'],
'trans_user'=>$employee_id,
'trans_comment'=>$comment,
'trans_location'=>$data[$col],
'trans_inventory'=>$data[$col + 1]
);
$this->db->insert('inventory',$excel_data);
}#

I attached the updated PHP file.
If this fix sounds correct, would be great to add it in a next release.

Many thanks for the hard work on this project.

Frederic.

1 Attachments

Discussion

  • FredJo

    FredJo - 2015-05-08

    Right after opening this ticket, I've checked the source in the Git section of the same, and it seems that the fix I was proposing was already there. The problem is that the distrib package 2.3.1 (the latest version available for download), does not contain the latest master version of the items.php file... Maybe an issue in the packaging scripting. Now, might be other source files in this case...
    Frederic.

     

    Last edit: FredJo 2015-05-08
  • Anonymous

    Anonymous - 2015-05-08

    Yes some rework was done on this part in the latest github version, which currently is 2.3.2.

     
  • jekkos

    jekkos - 2015-05-08
    • status: open --> closed
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.