Revision c8e0c77f
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Controller/RecordLinks.pm | ||
---|---|---|
44 | 44 |
|
45 | 45 |
eval { |
46 | 46 |
my $linked_records = $self->object->linked_records(direction => 'both'); |
47 |
push @{ $linked_records }, $self->object->sepa_export_items if $self->object->can('sepa_export_items'); |
|
47 | 48 |
my $output = SL::Presenter->get->grouped_record_list( |
48 | 49 |
$linked_records, |
49 | 50 |
with_columns => [ qw(record_link_direction) ], |
SL/DB/SepaExportItem.pm | ||
---|---|---|
1 |
# This file has been auto-generated only because it didn't exist. |
|
2 |
# Feel free to modify it at will; it will not be overwritten automatically. |
|
3 |
|
|
4 | 1 |
package SL::DB::SepaExportItem; |
5 | 2 |
|
6 | 3 |
use strict; |
... | ... | |
10 | 7 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
11 | 8 |
__PACKAGE__->meta->make_manager_class; |
12 | 9 |
|
10 |
sub compare_to { |
|
11 |
my ($self, $other) = @_; |
|
12 |
|
|
13 |
return 1 if $self->execution_date && !$other->execution_date; |
|
14 |
return -1 if !$self->execution_date && $other->execution_date; |
|
15 |
|
|
16 |
my $result = 0; |
|
17 |
$result = $self->execution_date <=> $other->execution_date if $self->execution_date; |
|
18 |
return $result || ($self->sepa_export_id <=> $other->sepa_export_id) || ($self->id <=> $other->id); |
|
19 |
} |
|
20 |
|
|
13 | 21 |
1; |
SL/Presenter.pm | ||
---|---|---|
14 | 14 |
use SL::Presenter::Order; |
15 | 15 |
use SL::Presenter::Project; |
16 | 16 |
use SL::Presenter::Record; |
17 |
use SL::Presenter::SepaExport; |
|
17 | 18 |
use SL::Presenter::Text; |
18 | 19 |
use SL::Presenter::Tag; |
19 | 20 |
|
SL/Presenter/Record.pm | ||
---|---|---|
7 | 7 |
use Exporter qw(import); |
8 | 8 |
our @EXPORT = qw(grouped_record_list empty_record_list record_list); |
9 | 9 |
|
10 |
use SL::Util; |
|
11 |
|
|
10 | 12 |
use Carp; |
11 | 13 |
use List::Util qw(first); |
12 | 14 |
|
... | ... | |
37 | 39 |
$output .= _purchase_invoice_list( $self, $groups{purchase_invoices}, %params) if $groups{purchase_invoices}; |
38 | 40 |
$output .= _ar_transaction_list( $self, $groups{ar_transactions}, %params) if $groups{ar_transactions}; |
39 | 41 |
|
42 |
$output .= _sepa_collection_list( $self, $groups{sepa_collections}, %params) if $groups{sepa_collections}; |
|
43 |
$output .= _sepa_transfer_list( $self, $groups{sepa_transfers}, %params) if $groups{sepa_transfers}; |
|
44 |
|
|
40 | 45 |
$output = $self->render('presenter/record/grouped_record_list', %params, output => $output); |
41 | 46 |
|
42 | 47 |
return $output; |
... | ... | |
92 | 97 |
my $meta = $column_meta{ $spec->{data} }; |
93 | 98 |
my $type = ref $meta; |
94 | 99 |
my $relationship = $relationships{ $spec->{data} }; |
95 |
my $rel_type = !$relationship ? '' : lc $relationship->class; |
|
96 |
$rel_type =~ s/^sl::db:://; |
|
100 |
my $rel_type = !$relationship ? '' : $relationship->class; |
|
101 |
$rel_type =~ s/^SL::DB:://; |
|
102 |
$rel_type = SL::Util::snakify($rel_type); |
|
97 | 103 |
|
98 | 104 |
if (ref($spec->{data}) eq 'CODE') { |
99 | 105 |
$cell{value} = $spec->{data}->($obj); |
... | ... | |
146 | 152 |
purchase_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && !$_[0]->is_sales }, |
147 | 153 |
purchase_invoices => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && $_[0]->invoice }, |
148 | 154 |
ap_transactions => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && !$_[0]->invoice }, |
155 |
sepa_collections => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ar_id }, |
|
156 |
sepa_transfers => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ap_id }, |
|
149 | 157 |
); |
150 | 158 |
|
151 | 159 |
my %groups; |
... | ... | |
162 | 170 |
sub _sort_grouped_lists { |
163 | 171 |
my (%groups) = @_; |
164 | 172 |
|
165 |
$groups{$_} = [ sort { $a->date <=> $b->date } @{ $groups{$_} } ] for keys %groups; |
|
173 |
foreach my $group (keys %groups) { |
|
174 |
next unless @{ $groups{$group} }; |
|
175 |
if ($groups{$group}->[0]->can('compare_to')) { |
|
176 |
$groups{$group} = [ sort { $a->compare_to($b) } @{ $groups{$group} } ]; |
|
177 |
} else { |
|
178 |
$groups{$group} = [ sort { $a->date <=> $b->date } @{ $groups{$group} } ]; |
|
179 |
} |
|
180 |
} |
|
166 | 181 |
|
167 | 182 |
return %groups; |
168 | 183 |
} |
... | ... | |
371 | 386 |
); |
372 | 387 |
} |
373 | 388 |
|
389 |
sub _sepa_export_list { |
|
390 |
my ($self, $list, %params) = @_; |
|
391 |
|
|
392 |
my ($source, $destination) = $params{type} eq 'sepa_transfer' ? qw(our vc) : qw(vc our); |
|
393 |
$params{title} = $params{type} eq 'sepa_transfer' ? $::locale->text('Bank transfers via SEPA') : $::locale->text('Bank collections via SEPA'); |
|
394 |
$params{with_columns} = [ grep { $_ ne 'record_link_direction' } @{ $params{with_columns} || [] } ]; |
|
395 |
|
|
396 |
delete $params{edit_record_links}; |
|
397 |
|
|
398 |
return $self->record_list( |
|
399 |
$list, |
|
400 |
columns => [ |
|
401 |
[ $::locale->text('Export Number'), 'sepa_export', ], |
|
402 |
[ $::locale->text('Execution date'), 'execution_date' ], |
|
403 |
[ $::locale->text('Export date'), sub { $_[0]->sepa_export->itime->to_kivitendo } ], |
|
404 |
[ $::locale->text('Source BIC'), "${source}_bic" ], |
|
405 |
[ $::locale->text('Source IBAN'), "${source}_iban" ], |
|
406 |
[ $::locale->text('Destination BIC'), "${destination}_bic" ], |
|
407 |
[ $::locale->text('Destination IBAN'), "${destination}_iban" ], |
|
408 |
[ $::locale->text('Amount'), 'amount' ], |
|
409 |
], |
|
410 |
%params, |
|
411 |
); |
|
412 |
} |
|
413 |
|
|
414 |
sub _sepa_transfer_list { |
|
415 |
my ($self, $list, %params) = @_; |
|
416 |
_sepa_export_list($self, $list, %params, type => 'sepa_transfer'); |
|
417 |
} |
|
418 |
|
|
419 |
sub _sepa_collection_list { |
|
420 |
my ($self, $list, %params) = @_; |
|
421 |
_sepa_export_list($self, $list, %params, type => 'sepa_collection'); |
|
422 |
} |
|
423 |
|
|
374 | 424 |
1; |
375 | 425 |
|
376 | 426 |
__END__ |
... | ... | |
441 | 491 |
|
442 | 492 |
=item * AP transactions |
443 | 493 |
|
494 |
=item * SEPA collections |
|
495 |
|
|
496 |
=item * SEPA transfers |
|
497 |
|
|
444 | 498 |
=back |
445 | 499 |
|
446 | 500 |
Objects of unknown types are skipped. |
SL/Presenter/SepaExport.pm | ||
---|---|---|
1 |
package SL::Presenter::SepaExport; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use parent qw(Exporter); |
|
6 |
|
|
7 |
use Exporter qw(import); |
|
8 |
our @EXPORT = qw(sepa_export); |
|
9 |
|
|
10 |
use Carp; |
|
11 |
|
|
12 |
sub sepa_export { |
|
13 |
my ($self, $sepa_export, %params) = @_; |
|
14 |
|
|
15 |
$params{display} ||= 'inline'; |
|
16 |
|
|
17 |
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/; |
|
18 |
|
|
19 |
my $text = join '', ( |
|
20 |
$params{no_link} ? '' : '<a href="sepa.pl?action=bank_transfer_edit&vc=' . $self->escape($sepa_export->vc) . '&id=' . $self->escape($sepa_export->id) . '">', |
|
21 |
$self->escape($sepa_export->id), |
|
22 |
$params{no_link} ? '' : '</a>', |
|
23 |
); |
|
24 |
return $self->escaped_text($text); |
|
25 |
} |
|
26 |
|
|
27 |
1; |
|
28 |
|
|
29 |
__END__ |
|
30 |
|
|
31 |
=pod |
|
32 |
|
|
33 |
=encoding utf8 |
|
34 |
|
|
35 |
=head1 NAME |
|
36 |
|
|
37 |
SL::Presenter::SepaExport - Presenter module for Rose::DB objects |
|
38 |
for SEPA transfers and collections |
|
39 |
|
|
40 |
=head1 SYNOPSIS |
|
41 |
|
|
42 |
# Collections from an invoice: |
|
43 |
my $invoice = SL::DB::Invoice->new(id => 123)->load; |
|
44 |
my $object = $invoice->sepa_export_items->[0]->sepa_export; |
|
45 |
my $html = SL::Presenter->get->sepa_export($object, display => 'inline'); |
|
46 |
|
|
47 |
# Transfers from a purchase invoice: |
|
48 |
my $invoice = SL::DB::PurchaseInvoice->new(id => 123)->load; |
|
49 |
my $object = $invoice->sepa_export_items->[0]->sepa_export; |
|
50 |
my $html = SL::Presenter->get->sepa_export($object, display => 'inline'); |
|
51 |
|
|
52 |
=head1 FUNCTIONS |
|
53 |
|
|
54 |
=over 4 |
|
55 |
|
|
56 |
=item C<sepa_export $object, %params> |
|
57 |
|
|
58 |
Returns a rendered version (actually an instance of |
|
59 |
L<SL::Presenter::EscapedText>) of the SEPA collection/transfer object |
|
60 |
C<$object>. |
|
61 |
|
|
62 |
C<%params> can include: |
|
63 |
|
|
64 |
=over 2 |
|
65 |
|
|
66 |
=item * display |
|
67 |
|
|
68 |
Either C<inline> (the default) or C<table-cell>. At the moment both |
|
69 |
representations are identical and produce the objects's delivery |
|
70 |
order number linked to the corresponding 'edit' action. |
|
71 |
|
|
72 |
=item * no_link |
|
73 |
|
|
74 |
If falsish (the default) then the delivery order number will be linked |
|
75 |
to the "edit SEPA transfer" dialog from the 'cash' menu. |
|
76 |
|
|
77 |
=back |
|
78 |
|
|
79 |
=back |
|
80 |
|
|
81 |
=head1 BUGS |
|
82 |
|
|
83 |
Nothing here yet. |
|
84 |
|
|
85 |
=head1 AUTHOR |
|
86 |
|
|
87 |
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt> |
|
88 |
|
|
89 |
=cut |
locale/de/all | ||
---|---|---|
871 | 871 |
'Expenses EU with UStId' => 'Aufwand EU m. UStId', |
872 | 872 |
'Expenses EU without UStId' => 'Aufwand EU o. UStId', |
873 | 873 |
'Export Buchungsdaten' => 'Export Buchungsdaten', |
874 |
'Export Number' => 'Exportnummer', |
|
874 | 875 |
'Export Stammdaten' => 'Export Stammdaten', |
875 | 876 |
'Export as CSV' => 'Als CSV exportieren', |
876 | 877 |
'Export as PDF' => 'Als PDF exportieren', |
Auch abrufbar als: Unified diff
Verknüpfte Dokumente: Auch SEPA-Überweisungen/-Einzüge anzeigen
Bisher noch nicht bei Debitoren- und Kreditorenbuchungen.
Conflicts:
SL/Presenter.pm