From 4a42f524c448afeffef8abcc74467183ac42903b Mon Sep 17 00:00:00 2001 From: "Martin Helmling martin.helmling@octosoft.eu" Date: Thu, 15 Sep 2016 19:19:33 +0200 Subject: [PATCH] MT940-Import: Vordefiniertes Default Profil MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - Das Profil muss nicht mehr pro Benutzer angelegt werden - CSV-Import wird in das Systemenu zum Import verschoben, Im Menü "Zahlungsverkehr" wird gleich zum MT940 gesprungen - Updatescript muss auch funktionieren wenn bereits ein MT940 Profil angelegt ist - Für Login "default" ist is_default irrelevant --- SL/Controller/BankImport.pm | 6 ++++++ menus/user/00-erp.yaml | 19 +++++++------------ sql/Pg-upgrade2/csv_mt940_add_profile.sql | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 sql/Pg-upgrade2/csv_mt940_add_profile.sql diff --git a/SL/Controller/BankImport.pm b/SL/Controller/BankImport.pm index 867589f10..7206eb8ea 100644 --- a/SL/Controller/BankImport.pm +++ b/SL/Controller/BankImport.pm @@ -13,6 +13,9 @@ sub action_upload_mt940 { my ($self, %params) = @_; 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'); + } $self->render('bankimport/form', title => $::locale->text('MT940 import'), profile => $profile ? 1 : 0); } @@ -30,6 +33,9 @@ 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); diff --git a/menus/user/00-erp.yaml b/menus/user/00-erp.yaml index 8262d88f9..b981290bf 100644 --- a/menus/user/00-erp.yaml +++ b/menus/user/00-erp.yaml @@ -677,18 +677,6 @@ id: cash_bank_import name: Bank Import order: 500 -- parent: cash_bank_import - id: cash_bank_import_csv - name: CSV - order: 100 - access: bank_transaction - params: - action: CsvImport/new - profile.type: bank_transactions -- parent: cash_bank_import - id: cash_bank_import_mt940 - name: MT940 - order: 200 access: bank_transaction params: action: BankImport/upload_mt940 @@ -1283,6 +1271,13 @@ params: action: CsvImport/new profile.type: ar_transactions +- parent: system_import_csv + id: cash_bank_import_csv + name: Bank transactions + order: 900 + params: + action: CsvImport/new + profile.type: bank_transactions - parent: system id: system_templates name: Templates diff --git a/sql/Pg-upgrade2/csv_mt940_add_profile.sql b/sql/Pg-upgrade2/csv_mt940_add_profile.sql new file mode 100644 index 000000000..b7ef6bcef --- /dev/null +++ b/sql/Pg-upgrade2/csv_mt940_add_profile.sql @@ -0,0 +1,16 @@ +-- @tag: csv_mt940_add_profile +-- @description: Default Profile zum Importieren von mt940 +-- @depends: csv_import_profiles_2 + +INSERT INTO csv_import_profiles (name,type,is_default,login) VALUES ('MT940','bank_transactions','t','default'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'charset','UTF-8'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'full_preview','0'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'update_policy','skip'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'numberformat','1000.00'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'sep_char',';'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'quote_char','"'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'escape_char','"'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'json_mappings','[]'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'duplicates','no_check'); +INSERT INTO csv_import_profile_settings (csv_import_profile_id,key,value) VALUES ((SELECT id FROM csv_import_profiles WHERE name='MT940' AND login='default'),'dont_edit_profile','1'); + -- 2.20.1