Fix inventory item date notification for deleted date columns [SCI-9921]

This commit is contained in:
Martin Artnik 2024-01-03 11:28:47 +01:00
parent d8cb0b6cf2
commit 5fe001867b

View file

@ -6,11 +6,11 @@ class RepositoryItemDateNotification < BaseNotification
end end
def title def title
unit = human_readable_unit(column.metadata['reminder_unit'], column.metadata['reminder_value']) unit = human_readable_unit(params[:reminder_unit], params[:reminder_value])
I18n.t( I18n.t(
'notifications.content.item_date_reminder.message_html', 'notifications.content.item_date_reminder.message_html',
repository_row_name: subject.name, repository_row_name: subject.name,
value: column.metadata['reminder_value'], value: params[:reminder_value],
units: unit units: unit
) )
end end
@ -21,12 +21,6 @@ class RepositoryItemDateNotification < BaseNotification
NonExistantRecord.new(params[:repository_row_name]) NonExistantRecord.new(params[:repository_row_name])
end end
def column
RepositoryColumn.find(params[:repository_column_id])
rescue ActiveRecord::RecordNotFound
NonExistantRecord.new(params[:repository_column_name])
end
after_deliver do after_deliver do
if params[:repository_date_time_value_id] if params[:repository_date_time_value_id]
RepositoryDateTimeValue.find(params[:repository_date_time_value_id]).update(notification_sent: true) RepositoryDateTimeValue.find(params[:repository_date_time_value_id]).update(notification_sent: true)