From be60b289f589a8d4cad16c75734d078cd34b8264 Mon Sep 17 00:00:00 2001 From: Werner Hahn Date: Fri, 22 Sep 2017 02:29:31 +0200 Subject: [PATCH] WebshopApi: ShopOrder Presenter --- SL/Presenter.pm | 1 + SL/Presenter/ShopOrder.pm | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 SL/Presenter/ShopOrder.pm diff --git a/SL/Presenter.pm b/SL/Presenter.pm index 590800294..cd4f4e17e 100644 --- a/SL/Presenter.pm +++ b/SL/Presenter.pm @@ -22,6 +22,7 @@ use SL::Presenter::RequirementSpec; use SL::Presenter::RequirementSpecItem; use SL::Presenter::RequirementSpecTextBlock; use SL::Presenter::SepaExport; +use SL::Presenter::ShopOrder; use SL::Presenter::Text; use SL::Presenter::Tag; use SL::Presenter::BankAccount; diff --git a/SL/Presenter/ShopOrder.pm b/SL/Presenter/ShopOrder.pm new file mode 100644 index 000000000..77cc86faf --- /dev/null +++ b/SL/Presenter/ShopOrder.pm @@ -0,0 +1,26 @@ +package SL::Presenter::ShopOrder; + +use strict; + +use parent qw(Exporter); + +use Exporter qw(import); +our @EXPORT = qw(shop_order); + +use Carp; + +sub shop_order { + my ($self, $shop_order, $type, %params) = @_; + + $params{display} ||= 'inline'; + + croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/; + + my $text = join '', ( + $params{no_link} ? '' : '', + $self->escape($shop_order->shop_ordernumber), + $params{no_link} ? '' : '', + ); + return $self->escaped_text($text); +} +1; -- 2.20.1