From 6cee5cad1aec5b6bcf7f0c8996f28ed22466962b Mon Sep 17 00:00:00 2001 From: viehlieb Date: Thu, 12 Oct 2023 15:40:35 +0200 Subject: [PATCH 1/2] 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() { From 03884e83a397a64b7488f1daaf5f613a48c9e72b Mon Sep 17 00:00:00 2001 From: viehlieb Date: Thu, 12 Oct 2023 15:50:15 +0200 Subject: [PATCH 2/2] tiny change to summary.haml --- app/views/finance/balancing/_summary.haml | 2 +- config/locales/de.yml | 3 ++- .../balancing/_summary/replace_gross_amount.html.haml.deface | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/finance/balancing/_summary.haml b/app/views/finance/balancing/_summary.haml index 476c7091..92805ad2 100644 --- a/app/views/finance/balancing/_summary.haml +++ b/app/views/finance/balancing/_summary.haml @@ -10,7 +10,7 @@ %td= t('.gross_amount') %td.numeric= number_to_currency(order.sum(:gross)) %tr - %td= t('.fc_amount_total') + %td= t('.fc_amount') %td.numeric= number_to_currency(order.sum(:fc)) %tr %td= t('.groups_amount') diff --git a/config/locales/de.yml b/config/locales/de.yml index 1cae757a..65dd7061 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -860,7 +860,8 @@ de: summary: changed: Daten wurden verändert! duration: von %{starts} bis %{ends} - fc_amount: 'FC-Betrag:' + fc_amount: 'FC-Gesamtbetrag:' + fc_amount_without_deposit: 'FC-Betrag (ohne Pfand):' fc_profit: FC Gewinn gross_amount: 'Bruttobetrag:' groups_amount: 'Gruppenbeträge:' diff --git a/plugins/automatic_invoices/app/overrides/finance/balancing/_summary/replace_gross_amount.html.haml.deface b/plugins/automatic_invoices/app/overrides/finance/balancing/_summary/replace_gross_amount.html.haml.deface index e1963e4c..b0b86a4c 100644 --- a/plugins/automatic_invoices/app/overrides/finance/balancing/_summary/replace_gross_amount.html.haml.deface +++ b/plugins/automatic_invoices/app/overrides/finance/balancing/_summary/replace_gross_amount.html.haml.deface @@ -4,7 +4,7 @@ %td= t('.gross_amount') %td.numeric= number_to_currency(order.sum(:gross_without_deposit)) %tr - %td= t('.fc_amount') + %td= t('.fc_amount_without_deposit') %td.numeric= number_to_currency(order.sum(:fc_without_deposit)) %tr %td= t('.deposit')