From 23178763b00b0ede0c72062ccec709183dd45b06 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 5 Jun 2020 17:04:59 +0200 Subject: [PATCH 1/2] Do not print the bill addr. name when there's none The error ``` ActionView::Template::Error: undefined method `full_name' for nil:NilClass ``` happens a few times a day and raises exceptions we don't pay attention to. They add unnecessary noise that hides other more relevant issues. This, however, is a symptom of a deeper data integrity problem that needs solving at some point. This is just a countermeasure. --- app/views/spree/admin/orders/invoice.html.haml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/spree/admin/orders/invoice.html.haml b/app/views/spree/admin/orders/invoice.html.haml index bc2b4dc556..ff4a930e5a 100644 --- a/app/views/spree/admin/orders/invoice.html.haml +++ b/app/views/spree/admin/orders/invoice.html.haml @@ -33,16 +33,19 @@ %td{ align: "left" } %strong= "#{t('.to')}:" %br - = @order.bill_address.full_name + - if @order.bill_address + = @order.bill_address.full_name - if @order.andand.customer.andand.code.present? %br = "#{t('.code')}: #{@order.customer.code}" %br - = @order.bill_address.full_address + - if @order.bill_address + = @order.bill_address.full_address %br - if @order.andand.customer.andand.email.present? = "#{@order.customer.email}," - = "#{@order.bill_address.phone}" + - if @order.bill_address + = "#{@order.bill_address.phone}" %td   %td{ align: "left", style: "border-left: .1em solid black; padding-left: 1em" } From 8c371fd0d1a0c45e35c45a17b332e52f93ee9a7a Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Wed, 1 Jul 2020 11:27:57 +0200 Subject: [PATCH 2/2] Do not print bill addr. in invoice2 either --- app/views/spree/admin/orders/invoice2.html.haml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/spree/admin/orders/invoice2.html.haml b/app/views/spree/admin/orders/invoice2.html.haml index 7964f80e56..b9715c2770 100644 --- a/app/views/spree/admin/orders/invoice2.html.haml +++ b/app/views/spree/admin/orders/invoice2.html.haml @@ -44,14 +44,17 @@ %td{ :align => "right" } = t :invoice_billing_address %br - %strong= @order.bill_address.full_name + - if @order.bill_address + %strong= @order.bill_address.full_name - if @order.andand.customer.andand.code.present? %br = "Code: #{@order.customer.code}" %br - = @order.bill_address.address_part1 + - if @order.bill_address + = @order.bill_address.address_part1 %br - = @order.bill_address.address_part2 + - if @order.bill_address + = @order.bill_address.address_part2 = render 'spree/admin/orders/invoice_table2'