Skip to content

Commit ce673f5

Browse files
authored
Merge branch 'main' into em/5056-import-partners
2 parents 42824d4 + 5d4ca69 commit ce673f5

68 files changed

Lines changed: 2394 additions & 236 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ GEM
341341
actionview (>= 5.0.0)
342342
activesupport (>= 5.0.0)
343343
jmespath (1.6.2)
344-
json (2.12.2)
344+
json (2.15.1)
345345
jwt (3.1.2)
346346
base64
347347
kaminari (1.2.2)
@@ -466,7 +466,7 @@ GEM
466466
activerecord (>= 6.1)
467467
request_store (~> 1.4)
468468
parallel (1.27.0)
469-
parser (3.3.8.0)
469+
parser (3.3.9.0)
470470
ast (~> 2.4.1)
471471
racc
472472
pdf-core (0.9.0)
@@ -493,7 +493,7 @@ GEM
493493
prawn-table (0.2.2)
494494
prawn (>= 1.3.0, < 3.0.0)
495495
prettyprint (0.2.0)
496-
prism (1.4.0)
496+
prism (1.5.2)
497497
pry (0.14.2)
498498
coderay (~> 1.1)
499499
method_source (~> 1.0)
@@ -578,7 +578,7 @@ GEM
578578
erb
579579
psych (>= 4.0.0)
580580
recaptcha (5.20.1)
581-
regexp_parser (2.11.2)
581+
regexp_parser (2.11.3)
582582
reline (0.6.2)
583583
io-console (~> 0.5)
584584
request_store (1.7.0)
@@ -610,18 +610,18 @@ GEM
610610
rspec-mocks (~> 3.13)
611611
rspec-support (~> 3.13)
612612
rspec-support (3.13.4)
613-
rubocop (1.75.8)
613+
rubocop (1.80.2)
614614
json (~> 2.3)
615615
language_server-protocol (~> 3.17.0.2)
616616
lint_roller (~> 1.1.0)
617617
parallel (~> 1.10)
618618
parser (>= 3.3.0.2)
619619
rainbow (>= 2.2.2, < 4.0)
620620
regexp_parser (>= 2.9.3, < 3.0)
621-
rubocop-ast (>= 1.44.0, < 2.0)
621+
rubocop-ast (>= 1.46.0, < 2.0)
622622
ruby-progressbar (~> 1.7)
623623
unicode-display_width (>= 2.4.0, < 4.0)
624-
rubocop-ast (1.45.1)
624+
rubocop-ast (1.47.1)
625625
parser (>= 3.3.7.2)
626626
prism (~> 1.4)
627627
rubocop-performance (1.25.0)
@@ -689,10 +689,10 @@ GEM
689689
activesupport (>= 5.2)
690690
sprockets (>= 3.0.0)
691691
stackprof (0.2.27)
692-
standard (1.50.0)
692+
standard (1.51.1)
693693
language_server-protocol (~> 3.17.0.2)
694694
lint_roller (~> 1.0)
695-
rubocop (~> 1.75.5)
695+
rubocop (~> 1.80.2)
696696
standard-custom (~> 1.0.0)
697697
standard-performance (~> 1.8)
698698
standard-custom (1.0.2)
@@ -720,9 +720,9 @@ GEM
720720
railties (>= 7.1.0)
721721
tzinfo (2.0.6)
722722
concurrent-ruby (~> 1.0)
723-
unicode-display_width (3.1.4)
724-
unicode-emoji (~> 4.0, >= 4.0.4)
725-
unicode-emoji (4.0.4)
723+
unicode-display_width (3.2.0)
724+
unicode-emoji (~> 4.1)
725+
unicode-emoji (4.1.0)
726726
uniform_notifier (1.17.0)
727727
uri (1.0.3)
728728
useragent (0.16.11)

app/controllers/audits_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ def index
77
@selected_location = filter_params[:at_location]
88
@audits = current_organization.audits.includes(:line_items, :storage_location).class_filter(filter_params)
99
@storage_locations = StorageLocation.with_audits_for(current_organization).select(:id, :name)
10+
11+
respond_to do |format|
12+
format.html
13+
format.csv do
14+
send_data Audit.generate_csv(@audits), filename: "Audits-#{Time.zone.today}.csv"
15+
end
16+
end
1017
end
1118

1219
def show

app/controllers/distributions_controller.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ def print
2727
end
2828

2929
def destroy
30-
result = DistributionDestroyService.new(params[:id]).call
30+
service = DistributionDestroyService.new(params[:id])
31+
result = service.call
3132

3233
if result.success?
3334
flash[:notice] = "Distribution #{params[:id]} has been reclaimed!"
3435
else
35-
flash[:error] = "Could not destroy distribution #{params[:id]}. Please contact technical support."
36+
flash[:error] = result.error.message
3637
end
3738

3839
redirect_to distributions_path
@@ -185,9 +186,10 @@ def edit
185186
@request = @distribution.request
186187
@items = current_organization.items.active.alphabetized
187188
@partner_list = current_organization.partners.alphabetized
189+
@changes_disallowed = SnapshotEvent.intervening(@distribution).present?
188190
@audit_warning = current_organization.audits
189191
.where(storage_location_id: @distribution.storage_location_id)
190-
.where("updated_at > ?", @distribution.created_at).any?
192+
.where("updated_at > ?", @distribution.created_at).any? && !@changes_disallowed
191193
inventory = View::Inventory.new(@distribution.organization_id)
192194
@storage_locations = current_organization.storage_locations.active.alphabetized.select do |storage_loc|
193195
!inventory.quantity_for(storage_location: storage_loc.id).negative?

app/controllers/donations_controller.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ def new
5555
def edit
5656
@donation = Donation.find(params[:id])
5757
@donation.line_items.build
58-
@audit_performed_and_finalized = Audit.finalized_since?(@donation, @donation.storage_location_id)
58+
@changes_disallowed = SnapshotEvent.intervening(@donation).present?
59+
@audit_performed_and_finalized = Audit.finalized_since?(@donation, @donation.storage_location_id) &&
60+
!@changes_disallowed
5961

6062
load_form_collections
6163
end
@@ -91,7 +93,7 @@ def destroy
9193
if service.success?
9294
flash[:notice] = "Donation #{params[:id]} has been removed!"
9395
else
94-
flash[:error] = "Donation #{params[:id]} failed to be removed because #{service.error}"
96+
flash[:error] = service.error.message
9597
end
9698

9799
redirect_to donations_path

app/controllers/partners/family_requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Partners
22
class FamilyRequestsController < BaseController
33
include Validatable
4+
45
before_action :verify_partner_is_active
56
before_action :authorize_verified_partners
67

app/controllers/partners/individuals_requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Partners
22
class IndividualsRequestsController < BaseController
33
include Validatable
4+
45
before_action :verify_partner_is_active
56
before_action :authorize_verified_partners
67

app/controllers/partners/requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Partners
22
class RequestsController < BaseController
33
include Validatable
4+
45
skip_before_action :require_partner, only: [:new, :create, :validate]
56
before_action :require_partner_or_org_admin, only: [:new, :create, :validate]
67
layout :layout

app/controllers/partners_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# of which Partners are associated with which Diaperbanks.
44
class PartnersController < ApplicationController
55
include Importable
6+
67
before_action :validate_user_role, only: :show
78
skip_before_action :require_organization, only: :show
89

app/controllers/product_drives_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class ProductDrivesController < ApplicationController
22
include Importable
3+
34
before_action :set_product_drive, only: [:show, :edit, :update, :destroy]
45
before_action :set_tags, only: [:index, :new, :edit]
56

app/controllers/purchases_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def new
6363
def edit
6464
@purchase = current_organization.purchases.find(params[:id])
6565
@purchase.line_items.build
66-
@audit_performed_and_finalized = Audit.finalized_since?(@purchase, @purchase.storage_location_id)
66+
@changes_disallowed = SnapshotEvent.intervening(@purchase).present?
67+
@audit_performed_and_finalized = Audit.finalized_since?(@purchase, @purchase.storage_location_id) &&
68+
!@changes_disallowed
6769

6870
load_form_collections(@purchase)
6971
end

0 commit comments

Comments
 (0)