Skip to content
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

3988 Omit inactive items from distributions#new dropdown #3998

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/distributions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def new
@distribution.line_items.build
@distribution.copy_from_donation(params[:donation_id], params[:storage_location_id])
end
@items = current_organization.items.alphabetized
@items = current_organization.items.active.alphabetized
@storage_locations = current_organization.storage_locations.active_locations.has_inventory_items.alphabetized
end

Expand Down
9 changes: 9 additions & 0 deletions spec/system/distribution_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@
visit @url_prefix + "/distributions/new"
expect(page).to have_no_content "Inactive R Us"
end

it 'should not display inactive items in dropdown' do
create(:item, :inactive, name: "Inactive Item", organization: @organization)

visit @url_prefix + "/distributions/new"
select @storage_location.name, from: "From storage location"

expect(page).to have_no_content "Inactive Item"
end
end

it "errors if user does not fill storage_location" do
Expand Down
Loading