1 package SL::Presenter::SepaExport;
5 use SL::Presenter::EscapedText qw(escape is_escaped);
6 use SL::Presenter::Tag qw(link_tag);
8 use Exporter qw(import);
9 our @EXPORT_OK = qw(sepa_export);
14 my ($sepa_export, %params) = @_;
16 $params{display} ||= 'inline';
18 croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
20 my $text = escape($sepa_export->id);
21 if (! delete $params{no_link}) {
22 my $href = 'sepa.pl?action=bank_transfer_edit'
23 . '&vc=' . escape($sepa_export->vc)
24 . '&id=' . escape($sepa_export->id);
25 $text = link_tag($href, $text, %params);
41 SL::Presenter::SepaExport - Presenter module for Rose::DB objects
42 for SEPA transfers and collections
46 # Collections from an invoice:
47 my $invoice = SL::DB::Invoice->new(id => 123)->load;
48 my $object = $invoice->sepa_export_items->[0]->sepa_export;
49 my $html = SL::Presenter->get->sepa_export($object, display => 'inline');
51 # Transfers from a purchase invoice:
52 my $invoice = SL::DB::PurchaseInvoice->new(id => 123)->load;
53 my $object = $invoice->sepa_export_items->[0]->sepa_export;
54 my $html = SL::Presenter->get->sepa_export($object, display => 'inline');
60 =item C<sepa_export $object, %params>
62 Returns a rendered version (actually an instance of
63 L<SL::Presenter::EscapedText>) of the SEPA collection/transfer object
66 C<%params> can include:
72 Either C<inline> (the default) or C<table-cell>. At the moment both
73 representations are identical and produce the objects's delivery
74 order number linked to the corresponding 'edit' action.
78 If falsish (the default) then the delivery order number will be linked
79 to the "edit SEPA transfer" dialog from the 'cash' menu.
91 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>