From 2d1ba4f4aa20d6426c8017f5531c04778b1211b6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 18 Jan 2017 15:49:10 +0100 Subject: [PATCH] =?utf8?q?ActionBar:=20Verwendung=20bei=20=C2=BBoffene=20F?= =?utf8?q?orderungen/Verbindlichkeiten=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 1 + bin/mozilla/rp.pl | 104 ++++++++++----------- locale/de/all | 2 - templates/webpages/rp/aging_ar_bottom.html | 18 ++-- templates/webpages/rp/aging_ar_top.html | 2 +- templates/webpages/rp/e_mail.html | 45 --------- templates/webpages/rp/print_options.html | 4 +- templates/webpages/rp/report.html | 10 +- 8 files changed, 68 insertions(+), 118 deletions(-) delete mode 100644 templates/webpages/rp/e_mail.html diff --git a/SL/Form.pm b/SL/Form.pm index 55817db55..362268d3e 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1293,6 +1293,7 @@ sub get_formname_translation { dunning => $main::locale->text('Dunning'), letter => $main::locale->text('Letter'), ic_supply => $main::locale->text('Intra-Community supply'), + statement => $main::locale->text('Statement'), ); $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index a4ba678e6..e6543fecd 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -43,6 +43,7 @@ use SL::DB::Project; use SL::DB::Customer; use SL::RP; use SL::Iconv; +use SL::Locale::String qw(t8); use SL::ReportGenerator; use Data::Dumper; use List::MoreUtils qw(any); @@ -164,6 +165,7 @@ sub report { my $is_trial_balance = $::form->{report} eq "trial_balance"; my $is_aging = $::form->{report} =~ /^a[rp]_aging$/; my $is_payments = $::form->{report} =~ /(receipts|payments)$/; + my $format = 'html'; my ($label, $nextsub, $vc); if ($is_aging) { @@ -174,6 +176,8 @@ sub report { $nextsub = "generate_$::form->{report}"; $vc = qq|{vc} size=35 class="initial_focus">|; + + $format = 'pdf'; } my ($selection, $paymentaccounts); @@ -189,6 +193,8 @@ sub report { } } + setup_rp_report_action_bar(); + $::form->header; print $::form->parse_html_template('rp/report', { paymentaccounts => $paymentaccounts, @@ -206,6 +212,7 @@ sub report { is_income_statement => $is_income_statement, is_erfolgsrechnung => $is_erfolgsrechnung, is_projects => $is_projects, + format => $format, }); $::lxdebug->leave_sub; @@ -1001,7 +1008,7 @@ sub aging { my @columns = qw(statement ct invnumber transdate duedate amount open); my %column_defs = ( - 'statement' => { 'text' => '', 'visible' => $form->{ct} eq 'customer' ? 'HTML' : 0, }, + 'statement' => { raw_header_data => $::request->presenter->checkbox_tag("checkall", checkall => '[name^=statement_]'), 'visible' => $form->{ct} eq 'customer' ? 'HTML' : 0, align => "center" }, 'ct' => { 'text' => $form->{ct} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), }, 'invnumber' => { 'text' => $locale->text('Invoice'), }, 'transdate' => { 'text' => $locale->text('Date'), }, @@ -1112,62 +1119,12 @@ sub aging { 'raw_bottom_info_text' => $raw_bottom_info_text); } + setup_rp_aging_action_bar(arap => $form->{arap}); $report->generate_with_headers(); $main::lxdebug->leave_sub(); } -sub select_all { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - RP->aging(\%myconfig, \%$form); - - map { $_->{checked} = "checked" } @{ $form->{AG} }; - - &aging; - - $main::lxdebug->leave_sub(); -} - -sub e_mail { - $::lxdebug->enter_sub; - $::auth->assert('general_ledger'); - - # get name and email addresses - my $selected = 0; - for my $i (1 .. $::form->{rowcount}) { - next unless $::form->{"statement_$i"}; - $::form->{"$::form->{ct}_id"} = $::form->{"$::form->{ct}_id_$i"}; - RP->get_customer(\%::myconfig, $::form); - $selected = 1; - last; - } - - $::form->error($::locale->text('Nothing selected!')) unless $selected; - - $::form->{media} = "email"; - - # save all other variables - my @hidden_values; - for my $key (keys %$::form) { - next if any { $key eq $_ } qw(login password action email cc bcc subject message type sendmode format header); - next unless '' eq ref $::form->{$key}; - push @hidden_values, $key; - } - - $::form->header; - print $::form->parse_html_template('rp/e_mail', { - print_options => print_options(inline => 1), - hidden_values => \@hidden_values, - }); - - $::lxdebug->leave_sub; -} - sub send_email { $main::lxdebug->enter_sub(); @@ -1184,6 +1141,11 @@ sub send_email { $form->{"statement_1"} = 1; + my $email_form = delete $form->{email_form}; + my %field_names = (to => 'email'); + + $form->{ $field_names{$_} // $_ } = $email_form->{$_} for keys %{ $email_form }; + $form->{media} = 'email'; print_form(); @@ -1910,4 +1872,42 @@ sub hotfix_reformat_date { $main::lxdebug->leave_sub(); } + +sub setup_rp_aging_action_bar { + my %params = @_; + + return unless $params{arap} eq 'ar'; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + combobox => [ + action => [ + t8('Print'), + call => [ 'kivi.SalesPurchase.show_print_dialog' ], + checks => [ [ 'kivi.check_if_entries_selected', '[name^=statement_]' ] ], + ], + action => [ + t8('E Mail'), + call => [ 'kivi.SalesPurchase.show_email_dialog', 'send_email' ], + checks => [ [ 'kivi.check_if_entries_selected', '[name^=statement_]' ] ], + ], + ], + ); + } +} + +sub setup_rp_report_action_bar { + my %params = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Continue'), + submit => [ '#form', { action => 'continue' } ], + accesskey => 'enter', + ], + ); + } +} + 1; diff --git a/locale/de/all b/locale/de/all index d376e641d..fe65edf9e 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1055,7 +1055,6 @@ $self->{texts} = { 'E-Mail' => 'E-Mail', 'E-Mail-Journal' => 'E-Mail-Journal', 'E-mail' => 'E-Mail', - 'E-mail Statement to' => 'Fälligkeitsabrechnung als E-Mail an', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', 'EAN' => 'EAN', 'EAN-Code' => 'EAN-Code', @@ -2561,7 +2560,6 @@ $self->{texts} = { 'Select a customer' => 'Einen Kunden auswählen', 'Select a period' => 'Bitte Zeitraum auswählen', 'Select a vendor' => 'Einen Lieferanten auswählen', - 'Select all' => 'Alle auswählen', 'Select charts for which the CB/OB transactions want to be posted.' => 'Wählen Sie Konten aus, zu welchen SB/EB-Buchungen erstellt werden sollen.', 'Select federal state...' => 'Bundesland auswählen...', 'Select file to upload' => 'Datei zum Hochladen auswählen', diff --git a/templates/webpages/rp/aging_ar_bottom.html b/templates/webpages/rp/aging_ar_bottom.html index d148e2225..398c792c0 100644 --- a/templates/webpages/rp/aging_ar_bottom.html +++ b/templates/webpages/rp/aging_ar_bottom.html @@ -1,7 +1,5 @@ [%- USE T8 %] -[% USE HTML %] - - [% PRINT_OPTIONS %] +[% USE HTML %][%- USE L -%] @@ -10,11 +8,15 @@ + [% L.hidden_tag("formname", "statement") %] - [% 'Statement' | $T8 %] -
- - - + + + + diff --git a/templates/webpages/rp/aging_ar_top.html b/templates/webpages/rp/aging_ar_top.html index 066ac9838..cae322aa9 100644 --- a/templates/webpages/rp/aging_ar_top.html +++ b/templates/webpages/rp/aging_ar_top.html @@ -1 +1 @@ -
+ diff --git a/templates/webpages/rp/e_mail.html b/templates/webpages/rp/e_mail.html deleted file mode 100644 index 3c20bb8e5..000000000 --- a/templates/webpages/rp/e_mail.html +++ /dev/null @@ -1,45 +0,0 @@ -[%- USE HTML %] -[%- USE L %] -[%- USE LxERP %] -[%- USE T8 %] - -

[% 'E-mail Statement to' | $T8 %] [% $ct %]

- - - - - - - - - - - - - -[% IF AUTH.assert('email_bcc', 'may_fail') %] - - -[%- END %] - -
[% 'E-mail' | $T8 %][% 'Cc' | $T8 %]
[% 'Subject' | $T8 %][% 'Bcc' | $T8 %]
- - - - - - - -
[% 'Message' | $T8 %]
-[% print_options %] -
- - -[%- FOREACH var = hidden_values %] -[% L.hidden_tag(var, $var) %] -[%- END %] - -
- -
- diff --git a/templates/webpages/rp/print_options.html b/templates/webpages/rp/print_options.html index 33a34b8ad..d824f2ef7 100644 --- a/templates/webpages/rp/print_options.html +++ b/templates/webpages/rp/print_options.html @@ -5,12 +5,12 @@ - + [% L.hidden_tag("format", format) %] @@ -363,11 +363,6 @@ [%- END %]
- - diff --git a/templates/webpages/rp/report.html b/templates/webpages/rp/report.html index b122652ac..162c59c84 100644 --- a/templates/webpages/rp/report.html +++ b/templates/webpages/rp/report.html @@ -118,7 +118,7 @@

[% title %]

-
+ @@ -264,7 +264,7 @@
- -
-
- - - -- 2.20.1