From: Sven Schöling Date: Fri, 17 Dec 2021 18:16:35 +0000 (+0100) Subject: DeliveryOrder: Presenter für die Statuszeile X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~216^2~22 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5e952260525d0e7a225e87e63e2e8a9d1e31cf08;p=kivitendo-erp.git DeliveryOrder: Presenter für die Statuszeile --- diff --git a/SL/Presenter/DeliveryOrder.pm b/SL/Presenter/DeliveryOrder.pm index 7c1a2dbc2..9f525b3f0 100644 --- a/SL/Presenter/DeliveryOrder.pm +++ b/SL/Presenter/DeliveryOrder.pm @@ -2,10 +2,12 @@ package SL::Presenter::DeliveryOrder; use strict; +use SL::DB::DeliveryOrder::TypeData (); +use SL::Locale::String qw(t8); use SL::Presenter::EscapedText qw(escape is_escaped); use Exporter qw(import); -our @EXPORT_OK = qw(sales_delivery_order purchase_delivery_order); +our @EXPORT_OK = qw(sales_delivery_order purchase_delivery_order delivery_order_status_line); use Carp; @@ -63,6 +65,36 @@ sub _do_record { is_escaped($text); } +sub stock_status { + my ($delivery_order) = @_; + + my $in_out = SL::DB::DeliveryOrder::TypeData::get3($delivery_order->type, "properties", "transfer"); + + if ($in_out eq 'in') { + return escape($delivery_order->delivered ? t8('transferred in') : t8('not transferred in yet')); + } + + if ($in_out eq 'out') { + return escape($delivery_order->delivered ? t8('transferred out') : t8('not transferred out yet')); + } +} + +sub closed_status { + my ($delivery_order) = @_; + + return escape($delivery_order->closed ? t8('Closed') : t8('Open')) +} + +sub status_line { + my ($delivery_order) = @_; + + return "" unless $delivery_order->id; + + stock_status($delivery_order) . " ; " . closed_status($delivery_order) +} + +sub delivery_order_status_line { goto &status_line }; + 1; __END__ diff --git a/templates/webpages/delivery_order/tabs/basic_data.html b/templates/webpages/delivery_order/tabs/basic_data.html index 4e0a8ceb0..f4c052bfc 100644 --- a/templates/webpages/delivery_order/tabs/basic_data.html +++ b/templates/webpages/delivery_order/tabs/basic_data.html @@ -98,29 +98,7 @@ - +
- [%- IF SELF.order.id %] - [%- IF SELF.order.delivered %] - [%- IF SELF.type_data.transfer == 'out' %] - [% 'transferred out' | $T8 %] - [%- ELSE %] - [% 'transferred in' | $T8 %] - [%- END %] - [%- ELSE %] - [%- IF SELF.type_data.transfer == 'out' %] - [% 'not transferred out yet' | $T8 %] - [%- ELSE %] - [% 'not transferred in yet' | $T8 %] - [%- END %] - [%- END %] - ; - [%- IF SEF.order.closed %] - [% 'Closed' | $T8 %] - [%- ELSE %] - [% 'Open' | $T8 %] - [%- END %] - [%- END %] - [% SELF.order.presenter.status_line %]