From 728f5827cddfd7e7ca7bd7c36a3d40a9ba311d16 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 16 Dec 2016 09:31:22 +0100 Subject: [PATCH] BankTransaction: Spaltennamen von CamelCase in snake_case umbenannt kivitendo nutzt rein lower-case-Spaltennamen mit Unterstrichen als Worttrenner, kein CamelCase. Betrifft Spalten transactioncode und transactiontext in bank_transfers. --- SL/Controller/BankTransaction.pm | 4 ++-- SL/DB/Helper/Payment.pm | 2 +- SL/DB/MetaSetup/BankTransaction.pm | 4 ++-- sql/Pg-upgrade2/bank_transactions_type.sql | 4 ++-- sql/Pg-upgrade2/bank_transactions_type2.sql | 6 ++++++ templates/webpages/bank_transactions/tabs/all.html | 2 +- templates/webpages/bank_transactions/tabs/automatic.html | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 sql/Pg-upgrade2/bank_transactions_type2.sql diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index 041e4ef79..fec37560e 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -160,7 +160,7 @@ sub action_list { if ( $self->is_collective_transaction($bt) ) { foreach ( keys %sepa_exports) { #$main::lxdebug->message(LXDebug->DEBUG2(),"Exp ID=".$_." compare sum amount ".($sepa_exports{$_}->{amount} *1) ." == ".($bt->amount * 1)); - if ( $bt->transactioncode eq '191' && abs(($sepa_exports{$_}->{amount} * 1) - ($bt->amount * 1)) < 0.01 ) { + if ( $bt->transaction_code eq '191' && abs(($sepa_exports{$_}->{amount} * 1) - ($bt->amount * 1)) < 0.01 ) { ## jupp $bt->{proposals} = $sepa_exports{$_}->{invoices} ; $bt->{agreement} = 20; @@ -540,7 +540,7 @@ sub action_save_proposals { sub is_collective_transaction { my ($self, $bt) = @_; - return $bt->transactioncode eq "191"; + return $bt->transaction_code eq "191"; } sub save_single_bank_transaction { diff --git a/SL/DB/Helper/Payment.pm b/SL/DB/Helper/Payment.pm index 9ff921617..4403b0238 100644 --- a/SL/DB/Helper/Payment.pm +++ b/SL/DB/Helper/Payment.pm @@ -640,7 +640,7 @@ sub get_payment_select_options_for_bank_transaction { if ( $open_amount && # invoice amount not 0 $self->skonto_date && # check whether skonto applies ( abs(abs($self->amount_less_skonto) - abs($bt->amount)) < 0.01 || - ( $bt->transactioncode eq "191" && abs($self->amount_less_skonto) < abs($bt->amount) )) && + ( $bt->transaction_code eq "191" && abs($self->amount_less_skonto) < abs($bt->amount) )) && $self->check_skonto_configuration) { if ( $self->within_skonto_period($bt->transdate) ) { push(@options, { payment_type => 'without_skonto', display => t8('without skonto') }); diff --git a/SL/DB/MetaSetup/BankTransaction.pm b/SL/DB/MetaSetup/BankTransaction.pm index 77a24c94e..70c4132df 100644 --- a/SL/DB/MetaSetup/BankTransaction.pm +++ b/SL/DB/MetaSetup/BankTransaction.pm @@ -20,9 +20,9 @@ __PACKAGE__->meta->columns( remote_account_number => { type => 'text' }, remote_bank_code => { type => 'text' }, remote_name => { type => 'text' }, + transaction_code => { type => 'text' }, transaction_id => { type => 'integer' }, - transactioncode => { type => 'text' }, - transactiontext => { type => 'text' }, + transaction_text => { type => 'text' }, transdate => { type => 'date', not_null => 1 }, valutadate => { type => 'date', not_null => 1 }, ); diff --git a/sql/Pg-upgrade2/bank_transactions_type.sql b/sql/Pg-upgrade2/bank_transactions_type.sql index 9a3da5389..246765626 100644 --- a/sql/Pg-upgrade2/bank_transactions_type.sql +++ b/sql/Pg-upgrade2/bank_transactions_type.sql @@ -2,5 +2,5 @@ -- @description: Erweitern der Tabelle bank_transactions mit Typ der Transaktion. -- @depends: bank_transactions -ALTER TABLE bank_transactions ADD COLUMN transactionCode TEXT; -ALTER TABLE bank_transactions ADD COLUMN transactionText TEXT; +ALTER TABLE bank_transactions ADD COLUMN transactioncode TEXT; +ALTER TABLE bank_transactions ADD COLUMN transactiontext TEXT; diff --git a/sql/Pg-upgrade2/bank_transactions_type2.sql b/sql/Pg-upgrade2/bank_transactions_type2.sql new file mode 100644 index 000000000..05aa106b2 --- /dev/null +++ b/sql/Pg-upgrade2/bank_transactions_type2.sql @@ -0,0 +1,6 @@ +-- @tag: bank_transactions_type2 +-- @description: Spalten für Transaktions-Code und -Typen etwas besser benennen +-- @depends: bank_transactions_type + +ALTER TABLE bank_transactions RENAME transactioncode TO transaction_code; +ALTER TABLE bank_transactions RENAME transactiontext TO transaction_text; diff --git a/templates/webpages/bank_transactions/tabs/all.html b/templates/webpages/bank_transactions/tabs/all.html index 1a36040b8..8b7efdfd6 100644 --- a/templates/webpages/bank_transactions/tabs/all.html +++ b/templates/webpages/bank_transactions/tabs/all.html @@ -102,7 +102,7 @@ [% LxERP.format_amount(bt.invoice_amount, 2) %] [% HTML.escape(bt.remote_name) %] [% HTML.escape(bt.purpose) %] - [% HTML.escape(bt.transactiontext) %] + [% HTML.escape(bt.transaction_text) %] [% HTML.escape(bt.remote_account_number) %] [% HTML.escape(bt.remote_bank_code) %] [% bt.valutadate_as_date %] diff --git a/templates/webpages/bank_transactions/tabs/automatic.html b/templates/webpages/bank_transactions/tabs/automatic.html index 38b3b3ff7..63f6d16e1 100644 --- a/templates/webpages/bank_transactions/tabs/automatic.html +++ b/templates/webpages/bank_transactions/tabs/automatic.html @@ -33,7 +33,7 @@ [% L.checkbox_tag('proposal_ids[]', checked=0, value=proposal.id) %] - [% HTML.escape(proposal.transactiontext) %] + [% HTML.escape(proposal.transaction_text) %] [% proposal.id %] [% proposal.transdate_as_date %] [% LxERP.format_amount(proposal.amount,2) %] -- 2.20.1