diff --git a/app/controllers/repository_stock_values_controller.rb b/app/controllers/repository_stock_values_controller.rb index ba0956b01..ddc8ebc07 100644 --- a/app/controllers/repository_stock_values_controller.rb +++ b/app/controllers/repository_stock_values_controller.rb @@ -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 diff --git a/config/locales/global_activities/en.yml b/config/locales/global_activities/en.yml index 36221e4dc..c0c239d7f 100644 --- a/config/locales/global_activities/en.yml +++ b/config/locales/global_activities/en.yml @@ -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: