From 6cee5cad1aec5b6bcf7f0c8996f28ed22466962b Mon Sep 17 00:00:00 2001 From: viehlieb Date: Thu, 12 Oct 2023 15:40:35 +0200 Subject: [PATCH] override balancing helper- fix double match stockit --- .../finance/balancing/_order_article.html.haml | 1 + app/views/finance/balancing/_results.html.haml | 3 ++- .../helpers/finance/balancing_helper_override.rb | 15 +++++++++++++++ .../insert_deposit_changes.html.haml.deface | 2 +- .../_edit_results_by_articles_override.html.haml | 1 + 5 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 plugins/automatic_invoices/app/overrides/helpers/finance/balancing_helper_override.rb diff --git a/app/views/finance/balancing/_order_article.html.haml b/app/views/finance/balancing/_order_article.html.haml index 89425ffa..0f388799 100644 --- a/app/views/finance/balancing/_order_article.html.haml +++ b/app/views/finance/balancing/_order_article.html.haml @@ -1,6 +1,7 @@ %td.closed.name = link_to order_article.article.name, '#', 'data-toggle-this' => "#group_order_articles_#{order_article.id}" %td= order_article.article.order_number +-# :plain => true destroys deface functionality %td{title: units_history_line(order_article, :plain => true)} = order_article.units = pkg_helper order_article.article_price diff --git a/app/views/finance/balancing/_results.html.haml b/app/views/finance/balancing/_results.html.haml index 0ab63e84..dacab7b3 100644 --- a/app/views/finance/balancing/_results.html.haml +++ b/app/views/finance/balancing/_results.html.haml @@ -1,2 +1,3 @@ %section#results - = render 'edit_results_by_articles' \ No newline at end of file + = render 'edit_results_by_articles' + \ No newline at end of file diff --git a/plugins/automatic_invoices/app/overrides/helpers/finance/balancing_helper_override.rb b/plugins/automatic_invoices/app/overrides/helpers/finance/balancing_helper_override.rb new file mode 100644 index 00000000..2a151ae2 --- /dev/null +++ b/plugins/automatic_invoices/app/overrides/helpers/finance/balancing_helper_override.rb @@ -0,0 +1,15 @@ +if FoodsoftAutomaticInvoices.enabled? + Finance::BalancingHelper.class_eval do + def balancing_view_partial + view = params[:view] || 'edit_results' + case view + when 'edit_results' + 'edit_results_by_articles_override' + when 'groups_overview' + 'shared/articles_by/groups' + when 'articles_overview' + 'shared/articles_by/articles' + end + end + end +end diff --git a/plugins/automatic_invoices/app/overrides/orders/_articles/insert_deposit_changes.html.haml.deface b/plugins/automatic_invoices/app/overrides/orders/_articles/insert_deposit_changes.html.haml.deface index 1a1c66a9..13b62bd1 100644 --- a/plugins/automatic_invoices/app/overrides/orders/_articles/insert_deposit_changes.html.haml.deface +++ b/plugins/automatic_invoices/app/overrides/orders/_articles/insert_deposit_changes.html.haml.deface @@ -1,4 +1,4 @@ -/ insert_before 'erb:contains("order.stockit?")' +/ insert_before 'erb:contains("t \'.prices\'")' - if FoodsoftAutomaticInvoices.enabled? - if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits) %th= t '.deposit' diff --git a/plugins/automatic_invoices/app/views/finance/balancing/_edit_results_by_articles_override.html.haml b/plugins/automatic_invoices/app/views/finance/balancing/_edit_results_by_articles_override.html.haml index df60a00c..87c56111 100644 --- a/plugins/automatic_invoices/app/views/finance/balancing/_edit_results_by_articles_override.html.haml +++ b/plugins/automatic_invoices/app/views/finance/balancing/_edit_results_by_articles_override.html.haml @@ -1,3 +1,4 @@ +-# :javascript destroy deface functionality - content_for :javascript do :javascript $(function() {