X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/bc3a01aef9a58d5e22137dbcc38fec7abebfdb22..c8e0c77f4da1fe14f1294a3be2e437c24f40eaea:/SL/Presenter/SepaExport.pm?ds=inline diff --git a/SL/Presenter/SepaExport.pm b/SL/Presenter/SepaExport.pm new file mode 100644 index 000000000..ceb483f2f --- /dev/null +++ b/SL/Presenter/SepaExport.pm @@ -0,0 +1,89 @@ +package SL::Presenter::SepaExport; + +use strict; + +use parent qw(Exporter); + +use Exporter qw(import); +our @EXPORT = qw(sepa_export); + +use Carp; + +sub sepa_export { + my ($self, $sepa_export, %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($sepa_export->id), + $params{no_link} ? '' : '', + ); + return $self->escaped_text($text); +} + +1; + +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::Presenter::SepaExport - Presenter module for Rose::DB objects +for SEPA transfers and collections + +=head1 SYNOPSIS + + # Collections from an invoice: + my $invoice = SL::DB::Invoice->new(id => 123)->load; + my $object = $invoice->sepa_export_items->[0]->sepa_export; + my $html = SL::Presenter->get->sepa_export($object, display => 'inline'); + + # Transfers from a purchase invoice: + my $invoice = SL::DB::PurchaseInvoice->new(id => 123)->load; + my $object = $invoice->sepa_export_items->[0]->sepa_export; + my $html = SL::Presenter->get->sepa_export($object, display => 'inline'); + +=head1 FUNCTIONS + +=over 4 + +=item C + +Returns a rendered version (actually an instance of +L) of the SEPA collection/transfer object +C<$object>. + +C<%params> can include: + +=over 2 + +=item * display + +Either C (the default) or C. At the moment both +representations are identical and produce the objects's delivery +order number linked to the corresponding 'edit' action. + +=item * no_link + +If falsish (the default) then the delivery order number will be linked +to the "edit SEPA transfer" dialog from the 'cash' menu. + +=back + +=back + +=head1 BUGS + +Nothing here yet. + +=head1 AUTHOR + +Moritz Bunkus Em.bunkus@linet-services.deE + +=cut