From 37c0310344ac135657e19d2090a196bca288e97c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 26 Jan 2017 11:37:07 +0100 Subject: [PATCH] =?utf8?q?ActionBar:=20Verwendung=20bei=20=C2=BBKontoauszu?= =?utf8?q?g=20importieren=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/BankImport.pm | 21 +++++++++++++++++---- templates/webpages/bankimport/form.html | 6 +----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/SL/Controller/BankImport.pm b/SL/Controller/BankImport.pm index 7206eb8ea..6204e736a 100644 --- a/SL/Controller/BankImport.pm +++ b/SL/Controller/BankImport.pm @@ -16,8 +16,9 @@ sub action_upload_mt940 { if ( ! $profile ) { $profile = SL::DB::Manager::CsvImportProfile->find_by(name => 'MT940', login => 'default'); } - $self->render('bankimport/form', title => $::locale->text('MT940 import'), profile => $profile ? 1 : 0); + $self->setup_upload_mt940_action_bar; + $self->render('bankimport/form', title => $::locale->text('MT940 import'), profile => $profile ? 1 : 0); } sub action_import_mt940 { @@ -39,12 +40,24 @@ sub action_import_mt940 { die t8("The MT940 import needs an import profile called MT940") unless $profile; $self->redirect_to(controller => 'controller.pl', action => 'CsvImport/test', 'profile.type' => 'bank_transactions', 'profile.id' => $profile->id, force_profile => 1); - -}; +} sub check_auth { $::auth->assert('bank_transaction'); } -1; +sub setup_upload_mt940_action_bar { + my ($self) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + $::locale->text('Preview'), + submit => [ '#form', { action => 'BankImport/import_mt940' } ], + accesskey => 'enter', + ], + ); + } +} +1; diff --git a/templates/webpages/bankimport/form.html b/templates/webpages/bankimport/form.html index 1c3d6728f..f9c34738f 100644 --- a/templates/webpages/bankimport/form.html +++ b/templates/webpages/bankimport/form.html @@ -10,12 +10,8 @@ [% "Import a MT940 file:" | $T8 %]

-
- [% L.hidden_tag('action', 'BankImport/import_mt940') %] - + [% L.input_tag('file', '', type => 'file', accept => '*') %] - [% L.submit_tag('action_import_mt940', LxERP.t8('Import')) %] -
[% ELSE %]

-- 2.20.1