-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jw email part 5 request deletion #687
Changes from all commits
7833dfe
24be078
3ad07fb
d747f9f
48c1080
40871f7
8da5142
cda132a
0243e68
778b77c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,9 +89,15 @@ def notify_admin(service_request, submission_email_address, xls, user_current, s | |
mail(:to => email, :from => NO_REPLY_FROM, :subject => subject) | ||
end | ||
|
||
def notify_service_provider(service_provider, service_request, attachments_to_add, user_current, audit_report=nil, ssr_deleted=false) | ||
def notify_service_provider(service_provider, service_request, attachments_to_add, user_current, audit_report=nil, all_ssrs_deleted=false) | ||
@notes = service_request.notes | ||
@status = service_request.status | ||
|
||
if all_ssrs_deleted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @status = all_ssrs_deleted ? 'all_ssrs_deleted' : service_request.status |
||
@status = 'all_ssrs_deleted' | ||
else | ||
@status = service_request.status | ||
end | ||
|
||
@role = 'none' | ||
@full_name = service_provider.identity.full_name | ||
|
||
|
@@ -100,22 +106,18 @@ def notify_service_provider(service_provider, service_request, attachments_to_ad | |
@service_requester_id = @service_request.sub_service_requests.first.service_requester_id | ||
|
||
@audit_report = audit_report | ||
@ssr_deleted = ssr_deleted | ||
|
||
@portal_link = DASHBOARD_LINK + "/protocols/#{@protocol.id}" | ||
@portal_text = "Administrators/Service Providers, Click Here" | ||
|
||
# if the current user is service provider, only show SSR's that are associated with them | ||
@ssrs_to_be_displayed = [] | ||
@service_request.sub_service_requests.each do |ssr| | ||
if service_provider.identity.is_service_provider?(ssr) | ||
@ssrs_to_be_displayed << ssr | ||
end | ||
end | ||
# only display the ssrs that are associated with service_provider | ||
@ssrs_to_be_displayed = @service_request.ssrs_associated_with_service_provider(service_provider) | ||
|
||
attachments_to_add.each do |file_name, document| | ||
next if document.nil? | ||
attachments["#{file_name}"] = document | ||
if !all_ssrs_deleted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unless |
||
attachments_to_add.each do |file_name, document| | ||
next if document.nil? | ||
attachments["#{file_name}"] = document | ||
end | ||
end | ||
|
||
# only send these to the correct person in the production env | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -598,6 +598,16 @@ def has_non_first_draft_ssrs? | |
sub_service_requests.where.not(status: 'first_draft').any? | ||
end | ||
|
||
def ssrs_associated_with_service_provider (service_provider) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think if you used #map here, you could condense this method a bit. Map will create an array and return it. So you wouldn't need to instantiate an empty array. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be a cleaner solution, but honestly it is just a different way of doing it. Fine if we keep it how it is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll make a note to look at this later! I definitely have some refactoring to do once all the different email scenarios are done. Thanks for the input! |
||
ssrs_to_be_displayed = [] | ||
self.sub_service_requests.each do |ssr| | ||
if service_provider.identity.is_service_provider?(ssr) | ||
ssrs_to_be_displayed << ssr | ||
end | ||
end | ||
ssrs_to_be_displayed | ||
end | ||
|
||
private | ||
|
||
def set_original_submitted_date | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
%p | ||
= I18n.t('notifier.body1', :full_name => @full_name) | ||
%p.inline | ||
= I18n.t('notifier.deleted_all_services_from_cart', protocol_type: @protocol.type) | ||
%br | ||
%br |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
%table.table{cellpadding: 3} | ||
%thead | ||
%tr.skinny-black-border | ||
%td{:colspan => 2} | ||
%strong= t(:notifier)[:srid_info] | ||
%tr | ||
%th.skinny-black-border= t(:notifier)[:sr_id_acronym] | ||
%th.skinny-black-border= t(:notifier)[:organization] | ||
%tbody | ||
- @ssrs_to_be_displayed.each do |ssr| | ||
%tr.skinny-black-border | ||
%td.skinny-black-border.center | ||
%strike= ssr.display_id | ||
%td.skinny-black-border.center | ||
%strike= ssr.org_tree_display | ||
%br | ||
%br |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This a pretty hefty change. Can you explain why we're now only looking at line items count?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! Trigger: When a user goes back to a protocol through "Edit" or "Modify Request" button, and delete all the services in an SSR from his/her shopping cart, this email should be send out to the service provider(s) when the last service on a SSR has been deleted from the SPARCRequest shopping cart. Before it would send out on each removed service, but Wenjun wanted that changed. Here's the link to the story: https://www.pivotaltracker.com/story/show/130746829. If you look at Wenjun's last comment, she doesn't want the logic to rely on the status anymore, only submitted_at. Does that make sense?