diff --git a/app/helpers/spree/admin/orders_helper_decorator.rb b/app/helpers/spree/admin/orders_helper_decorator.rb index b75d0df45b..94a850bb7f 100644 --- a/app/helpers/spree/admin/orders_helper_decorator.rb +++ b/app/helpers/spree/admin/orders_helper_decorator.rb @@ -13,8 +13,10 @@ module Spree links << { name: t(:send_invoice), url: "#", icon: 'icon-email', confirm: t(:must_have_valid_business_number, enterprise_name: order.distributor.name) } end links << { name: t(:print_invoice), url: print_admin_order_path(order), icon: 'icon-print', target: "_blank" } - links << { name: t(:print_ticket), url: print_ticket_admin_order_path(order), icon: 'icon-print', target: "_blank" } - links << { name: t(:select_ticket_printer), url: "#{print_ticket_admin_order_path(order)}#select-printer", icon: 'icon-print', target: "_blank" } + if Spree::Config.enable_receipt_printing? + links << { name: t(:print_ticket), url: print_ticket_admin_order_path(order), icon: 'icon-print', target: "_blank" } + links << { name: t(:select_ticket_printer), url: "#{print_ticket_admin_order_path(order)}#select-printer", icon: 'icon-print', target: "_blank" } + end end if @order.ready_to_ship? links << { name: t(:ship_order), url: fire_admin_order_path(@order, :e => 'ship'), method: 'put', icon: 'icon-truck', confirm: t(:are_you_sure) } diff --git a/app/models/spree/app_configuration_decorator.rb b/app/models/spree/app_configuration_decorator.rb index cbddf2e5ed..2dfda8949c 100644 --- a/app/models/spree/app_configuration_decorator.rb +++ b/app/models/spree/app_configuration_decorator.rb @@ -33,6 +33,7 @@ Spree::AppConfiguration.class_eval do # External services preference :bugherd_api_key, :string, default: nil - # Invoice layout + # Invoices & Receipts preference :invoice_style2?, :boolean, default: false + preference :enable_receipt_printing?, :boolean, default: false end diff --git a/app/views/admin/invoice_settings/edit.html.haml b/app/views/admin/invoice_settings/edit.html.haml index d3e4faf328..e134356927 100644 --- a/app/views/admin/invoice_settings/edit.html.haml +++ b/app/views/admin/invoice_settings/edit.html.haml @@ -10,5 +10,10 @@ = check_box_tag 'preferences[invoice_style2?]', '1', Spree::Config[:invoice_style2?] = label_tag nil, t('.invoice_style2?') + .field.align-center + = hidden_field_tag 'preferences[enable_receipt_printing?]', '0' + = check_box_tag 'preferences[enable_receipt_printing?]', '1', Spree::Config[:enable_receipt_printing?] + = label_tag nil, t('.enable_receipt_printing?') + .form-buttons{"data-hook" => "buttons"} = button t(:update), 'icon-refresh' diff --git a/config/locales/en.yml b/config/locales/en.yml index cd6e1c0497..475942a692 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -515,7 +515,7 @@ en: edit: title: Invoice Settings invoice_style2?: Use the alternative invoice model that includes total tax breakdown per rate and tax rate info per item (not yet suitable for countries displaying prices excluding tax) - + enable_receipt_printing?: Show options for printing receipts using thermal printers in order dropdown? home: hubs: