]> wagnertech.de Git - mfinanz.git/blob - SL/Presenter/SepaExportItem.pm
date error in mapping
[mfinanz.git] / SL / Presenter / SepaExportItem.pm
1 package SL::Presenter::SepaExportItem;
2
3 use strict;
4 use utf8;
5
6 use SL::Locale::String qw(t8);
7 use SL::Presenter::EscapedText qw(escape);
8
9 use Exporter qw(import);
10 our @EXPORT_OK = qw(show sepa_export_item);
11
12 use Carp;
13
14 sub show {goto &sepa_export_item};
15
16 sub sepa_export_item {
17   my ($sepa_export_item) = @_;
18
19   my ($title, $source, $destination) = $sepa_export_item->ap_id ?
20       (t8('Bank transfer via SEPA'), 'our', 'vc')
21     : (t8('Bank collections via SEPA'), 'vc', 'our')
22   ;
23
24   my $source_bic       = "${source}_bic";
25   my $source_iban      = "${source}_iban";
26   my $destination_bic  = "${destination}_bic";
27   my $destination_iban = "${destination}_iban";
28
29   escape(join ' ', (
30      $title,
31      $sepa_export_item->sepa_export_id . ":",
32      t8('Execution date'), $sepa_export_item->execution_date,
33      "-",
34      t8('Export date'), $sepa_export_item->sepa_export->itime->to_kivitendo,
35      "-",
36      $sepa_export_item->$source_bic,
37      $sepa_export_item->$source_iban,
38      "→",
39      $sepa_export_item->$destination_bic,
40      $sepa_export_item->$destination_iban,
41      "-",
42      t8('Amount'), $sepa_export_item->amount,
43   ));
44 }
45
46 1;
47
48 __END__
49
50 =pod
51
52 =encoding utf8
53
54 =head1 NAME
55
56 SL::Presenter::SepaExportItem - Presenter module for SL::DB::SepaExportItem objects
57
58 =head1 SYNOPSIS
59
60   my $object = SL::DB::Manager::SepaExportItem->get_first();
61   my $html   = SL::Presenter::SepaExportItem::sepa_export_item($object);
62   # or
63   my $html   = $object->presenter->show();
64
65 =head1 FUNCTIONS
66
67 =over 4
68
69 =item C<show $object>
70
71 Alias for C<sepa_export_item $object>.
72
73 =item C<sepa_export_item $object>
74
75 Returns a rendered version (actually an instance of
76 L<SL::Presenter::EscapedText>) of the sepa export item object
77 C<$object>.
78
79 =back
80
81 =head1 BUGS
82
83 Nothing here yet.
84
85 =head1 AUTHOR
86
87 Tamino Steinert E<lt>tamino.steinert@tamino.stE<gt>
88
89 =cut