X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/6ebec7f9d7ddef3e7f8befb797314c89e1414635..b581288faa3ae062cef17a50f7d9ad8b2da9822f:/SL/Controller/BankImport.pm diff --git a/SL/Controller/BankImport.pm b/SL/Controller/BankImport.pm index 867589f10..6204e736a 100644 --- a/SL/Controller/BankImport.pm +++ b/SL/Controller/BankImport.pm @@ -13,8 +13,12 @@ sub action_upload_mt940 { my ($self, %params) = @_; my $profile = SL::DB::Manager::CsvImportProfile->find_by(name => 'MT940', login => $::myconfig{login}); - $self->render('bankimport/form', title => $::locale->text('MT940 import'), profile => $profile ? 1 : 0); + if ( ! $profile ) { + $profile = SL::DB::Manager::CsvImportProfile->find_by(name => 'MT940', login => 'default'); + } + $self->setup_upload_mt940_action_bar; + $self->render('bankimport/form', title => $::locale->text('MT940 import'), profile => $profile ? 1 : 0); } sub action_import_mt940 { @@ -30,15 +34,30 @@ sub action_import_mt940 { $file->fh->close; my $profile = SL::DB::Manager::CsvImportProfile->find_by(name => 'MT940', login => $::myconfig{login}); + if ( ! $profile ) { + $profile = SL::DB::Manager::CsvImportProfile->find_by(name => 'MT940', login => 'default'); + } 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;