From c872d063a638a56f1160efd2552f5cf46972e7cc Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 2 Dec 2010 10:29:46 +0100 Subject: [PATCH] =?utf8?q?Unterscheidung=20Bankeinzug/=C3=9Cberweisung=20b?= =?utf8?q?ei=20Liste=20&=20Editmaske?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/SEPA.pm | 17 ++++++----- bin/mozilla/sepa.pl | 7 +++-- .../webpages/sepa/bank_transfer_edit.html | 30 ++++++++++++++----- .../sepa/bank_transfer_list_bottom.html | 1 + 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/SL/SEPA.pm b/SL/SEPA.pm index 904c78ed5..bc8de4fd2 100644 --- a/SL/SEPA.pm +++ b/SL/SEPA.pm @@ -149,18 +149,20 @@ sub retrieve_export { my $self = shift; my %params = @_; - Common::check_params(\%params, qw(id)); + Common::check_params(\%params, qw(id vc)); my $myconfig = \%main::myconfig; my $form = $main::form; + my $vc = $params{vc} eq 'customer' ? 'customer' : 'vendor'; + my $arap = $params{vc} eq 'customer' ? 'ar' : 'ap'; my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); my ($joins, $columns); if ($params{details}) { - $columns = ', ap.invoice'; - $joins = 'LEFT JOIN ap ON (se.ap_id = ap.id)'; + $columns = ', arap.invoice'; + $joins = "LEFT JOIN ${arap} arap ON (se.${arap}_id = arap.id)"; } my $query = @@ -176,10 +178,10 @@ sub retrieve_export { my ($columns, $joins); if ($params{details}) { - $columns = qq|, ap.invnumber, ap.invoice, v.name AS vendor_name, c.accno AS chart_accno, c.description AS chart_description|; - $joins = qq|LEFT JOIN ap ON (sei.ap_id = ap.id) - LEFT JOIN vendor v ON (ap.vendor_id = v.id) - LEFT JOIN chart c ON (sei.chart_id = c.id)|; + $columns = qq|, arap.invnumber, arap.invoice, vc.name AS vc_name, c.accno AS chart_accno, c.description AS chart_description|; + $joins = qq|LEFT JOIN ${arap} arap ON (sei.${arap}_id = arap.id) + LEFT JOIN ${vc} vc ON (arap.${vc}_id = vc.id) + LEFT JOIN chart c ON (sei.chart_id = c.id)|; } $query = qq|SELECT sei.* @@ -187,6 +189,7 @@ sub retrieve_export { FROM sepa_export_items sei $joins WHERE sei.sepa_export_id = ?|; + $export->{items} = selectall_hashref_query($form, $dbh, $query, conv_i($params{id})); } else { diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl index 1164b3bad..1567c6203 100755 --- a/bin/mozilla/sepa.pl +++ b/bin/mozilla/sepa.pl @@ -155,7 +155,7 @@ sub bank_transfer_search { $form->{jsscript} = 1; $form->header(); - print $form->parse_html_template('sepa/bank_transfer_search'); + print $form->parse_html_template('sepa/bank_transfer_search', { vc => $vc }); $main::lxdebug->leave_sub(); } @@ -231,7 +231,7 @@ sub bank_transfer_list { $report->set_options('top_info_text' => join("\n", @options), 'raw_top_info_text' => $form->parse_html_template('sepa/bank_transfer_list_top'), - 'raw_bottom_info_text' => $form->parse_html_template('sepa/bank_transfer_list_bottom', { 'show_buttons' => $open_available }), + 'raw_bottom_info_text' => $form->parse_html_template('sepa/bank_transfer_list_bottom', { 'show_buttons' => $open_available, vc => $vc }), 'std_column_visibility' => 1, 'output_format' => 'HTML', 'title' => $form->{title}, @@ -272,6 +272,7 @@ sub bank_transfer_edit { my $form = $main::form; my $locale = $main::locale; + my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor'; my @ids = (); if (!$form->{mode} || ($form->{mode} eq 'single')) { @@ -287,7 +288,7 @@ sub bank_transfer_edit { my $export; foreach my $id (@ids) { - my $curr_export = SL::SEPA->retrieve_export('id' => $id, 'details' => 1); + my $curr_export = SL::SEPA->retrieve_export('id' => $id, 'details' => 1, 'vc' => $vc); foreach my $item (@{ $curr_export->{items} }) { map { $item->{"export_${_}"} = $curr_export->{$_} } grep { !ref $curr_export->{$_} } keys %{ $curr_export }; diff --git a/templates/webpages/sepa/bank_transfer_edit.html b/templates/webpages/sepa/bank_transfer_edit.html index 28b17edf5..a534d1ada 100644 --- a/templates/webpages/sepa/bank_transfer_edit.html +++ b/templates/webpages/sepa/bank_transfer_edit.html @@ -1,6 +1,15 @@ [%- USE T8 %] [% USE HTML %] [% USE LxERP %] +[% IF vc == 'vendor' %] + [% SET is_vendor = 1 %] + [% SET arap = 'ap' %] + [% SET iris = 'ir' %] +[% ELSE %] + [% SET is_vendor = 0 %] + [% SET arap = 'ar' %] + [% SET iris = 'is' %] +[%- END %]

[% title %]: [% HTML.escape(export.ids.join(', ')) %]

@@ -15,9 +24,14 @@ [%- END %] [% 'Invoice' | $T8 %] - [% 'Vendor' | $T8 %] - [% 'Source bank account' | $T8 %] - [% 'Target bank account' | $T8 %] + [%- IF is_vendor %][% 'Vendor' | $T8 %][%- ELSE %][%- LxERP.t8('Customer') %][%- END %] + [%- IF is_vendor %] + [% 'Source bank account' | $T8 %] + [% 'Target bank account' | $T8 %] + [%- ELSE %] + [% 'Target bank account' | $T8 %] + [% 'Source bank account' | $T8 %] + [%- END %] [% 'Amount' | $T8 %] [% 'Reference' | $T8 %] [% 'Requested execution date' | $T8 %] @@ -52,13 +66,13 @@ [%- END %] - [% HTML.escape(item.invnumber) %] + [% HTML.escape(item.invnumber) %] - [% HTML.escape(item.vendor_name) %] + [% HTML.escape(item.vc_name) %] [% HTML.escape(item.our_iban) %] [% HTML.escape(item.our_bic) %] - [% HTML.escape(item.vendor_iban) %] - [% HTML.escape(item.vendor_bic) %] + [% HTML.escape(item.vc_iban) %] + [% HTML.escape(item.vc_bic) %] [% HTML.escape(LxERP.format_amount(item.amount, 2)) %] [% HTML.escape(item.reference) %] [% HTML.escape(item.requested_execution_date) %] @@ -135,6 +149,8 @@ [%- END %] [%- END %] [%- END %] + + diff --git a/templates/webpages/sepa/bank_transfer_list_bottom.html b/templates/webpages/sepa/bank_transfer_list_bottom.html index 79f373f2c..1eab32bfb 100644 --- a/templates/webpages/sepa/bank_transfer_list_bottom.html +++ b/templates/webpages/sepa/bank_transfer_list_bottom.html @@ -4,6 +4,7 @@ [%- IF show_buttons %] +

-- 2.20.1