From ca944f1bf705b8b788ca4bef6f3aba84420c6ed8 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Wed, 9 Oct 2024 11:44:49 +0200 Subject: [PATCH] Fix storage location item move activity [SCI-11164] --- .../storage_location_repository_rows_controller.rb | 11 ++++++++++- config/locales/global_activities/en.yml | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/storage_location_repository_rows_controller.rb b/app/controllers/storage_location_repository_rows_controller.rb index 4ffa5365b..579516a75 100644 --- a/app/controllers/storage_location_repository_rows_controller.rb +++ b/app/controllers/storage_location_repository_rows_controller.rb @@ -54,6 +54,9 @@ class StorageLocationRepositoryRowsController < ApplicationController def move ActiveRecord::Base.transaction do + @original_storage_location = @storage_location_repository_row.storage_location + @original_position = @storage_location_repository_row.human_readable_position + @storage_location_repository_row.discard @storage_location_repository_row = StorageLocationRepositoryRow.create!( repository_row: @repository_row, @@ -61,7 +64,13 @@ class StorageLocationRepositoryRowsController < ApplicationController metadata: storage_location_repository_row_params[:metadata] || {}, created_by: current_user ) - log_activity(:storage_location_repository_row_moved) + log_activity( + :storage_location_repository_row_moved, + { + storage_location_original: @original_storage_location.id, + position_original: @original_position + } + ) render json: @storage_location_repository_row, serializer: Lists::StorageLocationRepositoryRowSerializer rescue ActiveRecord::RecordInvalid => e diff --git a/config/locales/global_activities/en.yml b/config/locales/global_activities/en.yml index 6d1a470a1..9e4f337d4 100644 --- a/config/locales/global_activities/en.yml +++ b/config/locales/global_activities/en.yml @@ -338,7 +338,7 @@ en: container_storage_location_sharing_updated_html: "%{user} changed permission of shared box %{storage_location} with team %{team} to %{permission_level}." storage_location_repository_row_created_html: "%{user} assigned %{repository_row} to box %{storage_location} %{position}." storage_location_repository_row_deleted_html: "%{user} unassigned %{repository_row} from box %{storage_location} %{position}." - storage_location_repository_row_moved_html: "%{user} moved item %{repository_row} from box %{storage_location_original} %{positions} to box %{storage_location_destination} %{positions}." + storage_location_repository_row_moved_html: "%{user} moved item %{repository_row} from box %{storage_location_original} %{position_original} to box %{storage_location} %{position}." container_storage_location_imported_html: "%{user} assigned %{assigned_count} item(s) and unassigned %{unassigned_count} item(s) by import to %{storage_location}." activity_name: create_project: "Project created"