From d5c192b8f594941474c076c3966fe1efbe852b59 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 8 Mar 2021 15:32:40 +0100 Subject: [PATCH] =?utf8?q?Auftrag-Controller:=20Vergleich=20des=20Beleg-Ty?= =?utf8?q?ps=20einheitlicher=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - Zum Typ-Vergleich die Typ-Funktionen verwenden. War hier kein Problem, kann aber Typos verhindern - dafür sind die Funktionen gedacht gewesen. - Auf type nicht als Hash-Key, sondern als Methode zugreifen. Dann ist das einheitlicher, da das auch überall sonst im Controller so gemacht wird. --- SL/Controller/Order.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 211ff09b1..6a2762537 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -69,11 +69,11 @@ sub action_add { my ($self) = @_; $self->order->transdate(DateTime->now_local()); - my $extra_days = $self->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : - $self->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1; + my $extra_days = $self->type eq sales_quotation_type() ? $::instance_conf->get_reqdate_interval : + $self->type eq sales_order_type() ? $::instance_conf->get_delivery_date_interval : 1; - if ( ($self->{type} eq 'sales_order' && $::instance_conf->get_deliverydate_on) - || ($self->{type} eq 'sales_quotation' && $::instance_conf->get_reqdate_on) + if ( ($self->type eq sales_order_type() && $::instance_conf->get_deliverydate_on) + || ($self->type eq sales_quotation_type() && $::instance_conf->get_reqdate_on) && (!$self->order->reqdate)) { $self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days)); } @@ -227,11 +227,11 @@ sub action_save_as_new { # Set new reqdate unless changed if it is enabled in client config if ($order->reqdate == $saved_order->reqdate) { - my $extra_days = $self->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : - $self->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1; + my $extra_days = $self->type eq sales_quotation_type() ? $::instance_conf->get_reqdate_interval : + $self->type eq sales_order_type() ? $::instance_conf->get_delivery_date_interval : 1; - if ( ($self->{type} eq 'sales_order' && !$::instance_conf->get_deliverydate_on) - || ($self->{type} eq 'sales_quotation' && !$::instance_conf->get_reqdate_on)) { + if ( ($self->type eq sales_order_type() && !$::instance_conf->get_deliverydate_on) + || ($self->type eq sales_quotation_type() && !$::instance_conf->get_reqdate_on)) { $new_attrs{reqdate} = ''; } else { $new_attrs{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days); -- 2.20.1