mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 11:57:16 +08:00
On import, set blank stock values to zero instead of destroying [SCI-10912]
This commit is contained in:
parent
82557d31d6
commit
a135b6fb59
1 changed files with 16 additions and 1 deletions
|
@ -217,7 +217,7 @@ module RepositoryImportParser
|
|||
repository_cell.to_destroy = true
|
||||
@updated = true
|
||||
else
|
||||
repository_cell.value.destroy!
|
||||
erase_cell!(repository_cell)
|
||||
end
|
||||
|
||||
repository_cell
|
||||
|
@ -302,5 +302,20 @@ module RepositoryImportParser
|
|||
# all rows minus header
|
||||
@rows.count - 1
|
||||
end
|
||||
|
||||
def erase_cell!(repository_cell)
|
||||
case repository_cell.value
|
||||
when RepositoryStockValue
|
||||
repository_cell.value.update_data!(
|
||||
{
|
||||
amount: 0,
|
||||
unit_item_id: repository_cell.value.repository_stock_unit_item_id
|
||||
},
|
||||
@user
|
||||
)
|
||||
else
|
||||
repository_cell.value.destroy!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue