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;
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__
<table>
<tr>
- <td colspan="2" align="center">
- [%- 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 %]
- </td>
+ <td colspan="2" align="center" id="data-status-line">[% SELF.order.presenter.status_line %]</td>
</tr>
<tr>