Skip to content

Commit

Permalink
only show amount if invoice_items present, refs #425
Browse files Browse the repository at this point in the history
  • Loading branch information
bihorco36 committed Dec 13, 2017
1 parent 54af871 commit bb1518b
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 23 deletions.
3 changes: 1 addition & 2 deletions app/controllers/invoices_controller.rb
Expand Up @@ -119,8 +119,7 @@ def payment_attrs
def pdf_options
{
articles: params[:articles] != 'false',
payment_slip: params[:payment_slip] != 'false',
amount: params[:amount] != 'false'
payment_slip: params[:payment_slip] != 'false'
}
end

Expand Down
2 changes: 1 addition & 1 deletion app/domain/export/pdf/invoice/payment_slip.rb
Expand Up @@ -12,7 +12,7 @@ def render
return unless options[:payment_slip]
invoice_address
account_number
amount if options[:amount]
amount if invoice.invoice_items.present?
esr_number if invoice.ch_esr? || invoice.ch_besr?
payment_purpose if invoice.ch_es? || invoice.ch_bes?
receiver_address
Expand Down
4 changes: 0 additions & 4 deletions app/helpers/dropdown/invoices.rb
Expand Up @@ -31,12 +31,8 @@ def export

def pdf_links
add_item(translate(:full), export_path(:pdf), item_options)
add_item(translate(:full_without_amount), export_path(:pdf, amount: false), item_options)
add_item(translate(:articles_only), export_path(:pdf, payment_slip: false), item_options)
add_item(translate(:esr_only), export_path(:pdf, articles: false), item_options)
add_item(translate(:esr_only_without_amount),
export_path(:pdf, articles: false, amount: false),
item_options)
end

def label_links
Expand Down
2 changes: 0 additions & 2 deletions config/locales/views.de.yml
Expand Up @@ -147,9 +147,7 @@ de:
print: 'Drucken'
labels: 'Etiketten'
full: 'Rechnung inkl. Einzahlungsschein'
full_without_amount: 'Rechnung inkl. Einzahlungsschein (ohne Rechnungsbetrag)'
esr_only: 'Einzahlungsschein separat'
esr_only_without_amount: 'Einzahlungsschein separat (ohne Rechnungsbetrag)'
articles_only: 'Rechnung separat'
csv: 'CSV'
pdf: 'PDF'
Expand Down
14 changes: 0 additions & 14 deletions spec/features/group/invoices_controller_spec.rb
Expand Up @@ -92,12 +92,6 @@
expect(page).to have_current_path("/groups/#{group.id}/invoices/#{invoice.id}.pdf")
end

it 'exports full invoice without amount' do
click_link('Export')
click_link('Rechnung inkl. Einzahlungsschein (ohne Rechnungsbetrag)')
expect(page).to have_current_path("/groups/#{group.id}/invoices/#{invoice.id}.pdf?amount=false")
end

it 'exports only articles' do
click_link('Export')
click_link('Rechnung separat')
Expand All @@ -109,14 +103,6 @@
click_link('Einzahlungsschein separat')
expect(page).to have_current_path("/groups/#{group.id}/invoices/#{invoice.id}.pdf?articles=false")
end

it 'exports only esr without amount' do
click_link('Export')
click_link('Einzahlungsschein separat (ohne Rechnungsbetrag)')
expect(page).
to have_current_path("/groups/#{group.id}/invoices/#{invoice.id}.pdf?amount=false&articles=false")
end
end

end

1 comment on commit bb1518b

@kronn
Copy link
Member

@kronn kronn commented on bb1518b Dec 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.