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

Fix infinite loop when printing invoices for orders not in completed #8197

Closed
wants to merge 2 commits into from
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
8 changes: 7 additions & 1 deletion app/views/spree/admin/orders/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@
= render partial: 'per_page_controls'

- if Spree::Config[:enable_invoices?]
%button.invoices-modal{'ng-controller' => 'bulkInvoiceCtrl', 'ng-click' => 'createBulkInvoice()', 'ng-disabled' => 'selected_orders.length == 0'}
%button.invoices-modal{'ng-controller' => 'bulkInvoiceCtrl', 'ng-click' => 'createBulkInvoice()', 'ng-disabled' => 'selected_orders.length == 0 || !q.completed_at_not_null'}
Copy link
Member

Choose a reason for hiding this comment

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

This changes live on the page when you toggle the "Only show complete orders" checkbox. So it's possible to just tick that box but not reload the page which means that you can still select an incomplete order and run into the same issue of the infinite spinner.

= t('.print_invoices')
%question-mark-with-tooltip{"question-mark-with-tooltip": "_",
"question-mark-with-tooltip-append-to-body": "true",
"question-mark-with-tooltip-placement": "top",
"question-mark-with-tooltip-animation": true,
style: "margin-left: 5px",
key: "'js.admin.print_invoice_tooltip'"}

%table#listing_orders.index.responsive{width: "100%", 'ng-init' => 'initialise()', 'ng-show' => "!RequestMonitor.loading && orders.length > 0" }
%colgroup
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2708,6 +2708,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
Perhaps it has become unavailable or the shop is closing.
admin:
unit_price_tooltip: "The unit price increases transparency by allowing your customers to easily compare prices between different products and packaging sizes. Note, that the final unit price displayed in the shopfront might differ as it is includes taxes & fees."
print_invoice_tooltip: "Choose 'ONLY SHOW COMPLETE ORDERS' to enable bulk printing of invoices"
Copy link
Member

Choose a reason for hiding this comment

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

This is perfect for translations. ✔️

enterprise_limit_reached: "You have reached the standard limit of enterprises per account. Write to %{contact_email} if you need to increase it."
modals:
got_it: "Got it"
Expand Down