From 19132371fe1237caafc1a2ef589a881de2780d99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 16 Nov 2021 12:33:34 +0100 Subject: [PATCH] Anzahlungs-Rg.: Workflow Auftrag -> Anzahlungs-Rg. --- SL/Controller/Order.pm | 30 ++++++++++++++++++++++++++++-- bin/mozilla/oe.pl | 6 ++++-- locale/de/all | 2 ++ locale/en/all | 2 ++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 64ad14d23..7d421ef01 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -57,11 +57,11 @@ use Rose::Object::MakeMethods::Generic __PACKAGE__->run_before('check_auth'); __PACKAGE__->run_before('recalc', - only => [ qw(save save_as_new save_and_delivery_order save_and_invoice save_and_ap_transaction + only => [ qw(save save_as_new save_and_delivery_order save_and_invoice save_and_invoice_for_advance_payment save_and_ap_transaction print send_email) ]); __PACKAGE__->run_before('get_unalterable_data', - only => [ qw(save save_as_new save_and_delivery_order save_and_invoice save_and_ap_transaction + only => [ qw(save save_as_new save_and_delivery_order save_and_invoice save_and_invoice_for_advance_payment save_and_ap_transaction print send_email) ]); # @@ -688,6 +688,16 @@ sub action_save_and_invoice { ); } +sub action_save_and_invoice_for_advance_payment { + my ($self) = @_; + + $self->save_and_redirect_to( + controller => 'oe.pl', + action => 'oe_invoice_from_order', + new_invoice_type => 'invoice_for_advance_payment', + ); +} + # workflow from sales order to sales quotation sub action_sales_quotation { $_[0]->workflow_sales_or_request_for_quotation(); @@ -1974,6 +1984,12 @@ sub setup_edit_action_bar { my @req_trans_cost_art = qw(kivi.Order.check_transport_cost_article_presence) x!!$::instance_conf->get_transport_cost_reminder_article_number_id; my @req_cusordnumber = qw(kivi.Order.check_cusordnumber_presence) x($self->type eq sales_order_type() && $::instance_conf->get_order_warn_no_cusordnumber); + my $has_invoice_for_advance_payment; + if ($self->order->id && $self->type eq sales_order_type()) { + my $lr = $self->order->linked_records(direction => 'to', to => ['Invoice']); + $has_invoice_for_advance_payment = any {'SL::DB::Invoice' eq ref $_ && "invoice_for_advance_payment" eq $_->type} @$lr; + } + for my $bar ($::request->layout->get('actionbar')) { $bar->add( combobox => [ @@ -2040,6 +2056,16 @@ sub setup_edit_action_bar { @req_trans_cost_art, @req_cusordnumber, ], ], + action => [ + t8('Save and Invoice for Advance Payment'), + call => [ 'kivi.Order.save', 'save_and_invoice_for_advance_payment', $::instance_conf->get_order_warn_duplicate_parts ], + checks => [ 'kivi.Order.check_save_active_periodic_invoices', + @req_trans_cost_art, @req_cusordnumber, + ], + disabled => $has_invoice_for_advance_payment ? t8('This order has already an invoice for advanced payment.') + : undef, + only_if => (any { $self->type eq $_ } (sales_order_type())), + ], action => [ t8('Save and AP Transaction'), call => [ 'kivi.Order.save', 'save_and_ap_transaction', $::instance_conf->get_order_warn_duplicate_parts ], diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index a3425ecde..b9edf4c96 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1699,7 +1699,9 @@ sub invoice { if ( $form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') { - $form->{title} = $locale->text('Add Sales Invoice'); + $form->{title} = ($form->{new_invoice_type} eq 'invoice_for_advance_payment') + ? $locale->text('Add Invoice for Advance Payment') + : $locale->text('Add Sales Invoice'); $form->{script} = 'is.pl'; $script = "is"; $buysell = 'buy'; @@ -1708,7 +1710,7 @@ sub invoice { # bo creates the id, reset it map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued); $form->{ $form->{vc} } =~ s/--.*//g; - $form->{type} = "invoice"; + $form->{type} = $form->{new_invoice_type} || "invoice"; # locale messages $main::locale = Locale->new("$myconfig{countrycode}", "$script"); diff --git a/locale/de/all b/locale/de/all index f456c5756..4a62d7c3e 100755 --- a/locale/de/all +++ b/locale/de/all @@ -3000,6 +3000,7 @@ $self->{texts} = { 'Save and Delivery Order' => 'Speichern und Lieferschein', 'Save and E-mail' => 'Speichern und E-Mail', 'Save and Invoice' => 'Speichern und Rechnung erfassen', + 'Save and Invoice for Advance Payment' => 'Speichern und Anzahlungsrechnung', 'Save and Order' => 'Speichern und Auftrag erfassen', 'Save and Purchase Order' => 'Speichern und Lieferantenauftrag', 'Save and Quotation' => 'Speichern und Angebot', @@ -3871,6 +3872,7 @@ $self->{texts} = { 'This option controls the method used for determining the startdate for the balance report.' => 'Diese Option bestimmt, wie das Startdatum für den Bilanzbericht ermittelt wird', 'This option controls the method used for profit determination.' => 'Dieser Parameter legt die Berechnungsmethode für die Gewinnermittlung fest.', 'This option controls the posting and calculation behavior for the accounting method.' => 'Dieser Parameter steuert die Buchungs- und Berechnungsmethoden für die Versteuerungsart.', + 'This order has already an invoice for advanced payment.' => 'Dieser Auftrag hat schon eine Anzahlungsrechnung.', 'This part has already been added.' => 'Dieser Artikel wurde schon hinzugefügt', 'This part was already counted for this bin:' => 'Dieser Artikel wurde für diesen Lagerplatz bereits erfasst:', 'This price has since gone down' => 'Dieser Preis ist mittlerweile niedriger', diff --git a/locale/en/all b/locale/en/all index 900c36592..fa77868c1 100644 --- a/locale/en/all +++ b/locale/en/all @@ -2998,6 +2998,7 @@ $self->{texts} = { 'Save and Delivery Order' => '', 'Save and E-mail' => '', 'Save and Invoice' => '', + 'Save and Invoice for Advance Payment' => '', 'Save and Order' => '', 'Save and Purchase Order' => '', 'Save and Quotation' => '', @@ -3866,6 +3867,7 @@ $self->{texts} = { 'This option controls the method used for determining the startdate for the balance report.' => '', 'This option controls the method used for profit determination.' => '', 'This option controls the posting and calculation behavior for the accounting method.' => '', + 'This order has already an invoice for advanced payment.' => '', 'This part has already been added.' => '', 'This part was already counted for this bin:' => '', 'This price has since gone down' => '', -- 2.20.1