Add comment to repository stock activities [SCI-6746]

This commit is contained in:
Anton 2022-04-20 11:29:16 +02:00
parent 918a11a0b0
commit fd736f99c1
2 changed files with 8 additions and 6 deletions

View file

@ -40,7 +40,8 @@ class RepositoryStockValuesController < ApplicationController
params[:operator],
params[:change_amount],
@repository_stock_value.repository_stock_unit_item.data,
@repository_stock_value.amount
@repository_stock_value.amount,
params[:repository_stock_value][:comment]
)
end
@ -80,7 +81,7 @@ class RepositoryStockValuesController < ApplicationController
params.require(:repository_stock_value).permit(:unit_item_id, :amount, :comment, :low_stock_threshold)
end
def log_activity(operator, change_amount, unit, new_amount)
def log_activity(operator, change_amount, unit, new_amount, comment)
Activities::CreateActivityService
.call(activity_type: "inventory_item_stock_#{operator}",
owner: current_user,
@ -91,7 +92,8 @@ class RepositoryStockValuesController < ApplicationController
repository_row: @repository_row.id,
change_amount: change_amount,
unit: unit,
new_amount: new_amount
new_amount: new_amount,
comment: comment
})
end
end

View file

@ -205,9 +205,9 @@ en:
register_molecule_on_step_html: "%{user} registered molecule %{asset_name} on protocol's step %{step_position} %{step} on task %{my_module}."
register_molecule_on_result_html: "%{user} registered molecule %{asset_name} on result %{result}."
register_molecule_on_step_in_repository_html: "%{user} registered molecule %{asset_name} on protocol %{protocol}'s step %{step_position} %{step}."
inventory_item_stock_set_html: "%{user} set total stock for %{repository_row} to %{new_amount} %{unit} in %{repository}"
inventory_item_stock_add_html: "%{user} added %{change_amount} %{unit} of stock to a total of %{new_amount} %{unit} for %{repository_row} in %{repository}"
inventory_item_stock_remove_html: "%{user} removed %{change_amount} %{unit} of stock to a total of %{new_amount} %{unit} for %{repository_row} in %{repository}"
inventory_item_stock_set_html: "%{user} set total stock for %{repository_row} to %{new_amount} %{unit} in %{repository} \n%{comment}"
inventory_item_stock_add_html: "%{user} added %{change_amount} %{unit} of stock to a total of %{new_amount} %{unit} for %{repository_row} in %{repository} \n%{comment}"
inventory_item_stock_remove_html: "%{user} removed %{change_amount} %{unit} of stock to a total of %{new_amount} %{unit} for %{repository_row} in %{repository} \n%{comment}"
task_inventory_item_stock_consumed_html: "%{user} changed consumption of %{repository_row} from %{stock_consumption_was} %{unit} to %{stock_consumption} %{unit} in %{my_module} \n%{comment}"
activity_name: