From: Moritz Bunkus Date: Wed, 8 Feb 2017 09:18:19 +0000 (+0100) Subject: Kontoauszug verbuchen: »Beleg«/»Memo« bei Vorschlägen angeben können X-Git-Tag: release-3.5.4~1520 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c4d3f82d744113e520282409454f4cc763e012cc;p=kivitendo-erp.git Kontoauszug verbuchen: »Beleg«/»Memo« bei Vorschlägen angeben können --- diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index 8b0c9216a..f2f16b551 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -511,6 +511,8 @@ sub save_invoices { push @{ $self->problems }, $self->save_single_bank_transaction( bank_transaction_id => $bank_transaction_id, invoice_ids => $invoice_ids, + sources => ($::form->{sources} // {})->{$_}, + memos => ($::form->{memos} // {})->{$_}, ); $count += scalar( @{$invoice_ids} ); } @@ -537,6 +539,7 @@ sub action_save_invoices { sub action_save_proposals { my ($self) = @_; + if ( $::form->{proposal_ids} ) { my $propcount = scalar(@{ $::form->{proposal_ids} }); if ( $propcount > 0 ) { @@ -620,6 +623,8 @@ sub save_single_bank_transaction { my $n_invoices = 0; foreach my $invoice (@{ $data{invoices} }) { + my $source = ($data{sources} // [])->[$n_invoices]; + my $memo = ($data{memos} // [])->[$n_invoices]; $n_invoices++ ; @@ -665,6 +670,8 @@ sub save_single_bank_transaction { trans_id => $invoice->id, amount => $open_amount, payment_type => $payment_type, + source => $source, + memo => $memo, transdate => $bank_transaction->transdate->to_kivitendo); } elsif ( $invoice->is_sales && $invoice->type eq 'credit_note' ) { # no check for overpayment/multiple payments @@ -672,6 +679,8 @@ sub save_single_bank_transaction { trans_id => $invoice->id, amount => $invoice->open_amount, payment_type => $payment_type, + source => $source, + memo => $memo, transdate => $bank_transaction->transdate->to_kivitendo); } else { # use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary my $overpaid_amount = $amount_of_transaction - $invoice->open_amount; @@ -679,6 +688,8 @@ sub save_single_bank_transaction { trans_id => $invoice->id, amount => $amount_of_transaction, payment_type => $payment_type, + source => $source, + memo => $memo, transdate => $bank_transaction->transdate->to_kivitendo); $bank_transaction->invoice_amount($bank_transaction->amount); $amount_of_transaction = 0; diff --git a/SL/DB/Helper/Payment.pm b/SL/DB/Helper/Payment.pm index d371e11b9..89fc6e453 100644 --- a/SL/DB/Helper/Payment.pm +++ b/SL/DB/Helper/Payment.pm @@ -112,8 +112,8 @@ sub pay_invoice { my $reference_account = $self->reference_account; croak "can't find reference account (link = AR/AP) for invoice" unless ref $reference_account; - my $memo = $params{'memo'} || ''; - my $source = $params{'source'} || ''; + my $memo = $params{memo} // ''; + my $source = $params{source} // ''; my $rounded_params_amount = _round( $params{amount} ); # / $exchangerate); my $fx_gain_loss_amount = 0; # for fx_gain and fx_loss diff --git a/js/kivi.BankTransaction.js b/js/kivi.BankTransaction.js index 7e3fb2e35..a4779465a 100644 --- a/js/kivi.BankTransaction.js +++ b/js/kivi.BankTransaction.js @@ -87,4 +87,36 @@ namespace('kivi.BankTransaction', function(ns) { $.cookie('jquery_ui_tab_bt_tabs', ui_tab); }; + + ns.show_set_all_sources_memos_dialog = function(sources_selector, memos_selector) { + var dlg_id = 'set_all_sources_memos_dialog'; + var $dlg = $('#' + dlg_id); + + $dlg.data('sources-selector', sources_selector); + $dlg.data('memos-selector', memos_selector); + + $('#set_all_sources').val(''); + $('#set_all_memos').val(''); + + kivi.popup_dialog({ + id: dlg_id, + dialog: { + title: kivi.t8('Set all source and memo fields') + } + }); + }; + + ns.set_all_sources_memos = function(sources_selector, memos_selector) { + var $dlg = $('#set_all_sources_memos_dialog'); + + ['sources', 'memos'].forEach(function(type) { + var value = $('#set_all_' + type).val(); + if (value !== '') + $($dlg.data(type + '-selector')).each(function(idx, input) { + $(input).val(value); + }); + }); + + $dlg.dialog('close'); + }; }); diff --git a/js/locale/de.js b/js/locale/de.js index 93a3aff9b..299f58b50 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -89,6 +89,7 @@ namespace("kivi").setupLocale({ "Save and keep open":"Speichern und geöffnet lassen", "Section/Function block actions":"Abschnitts-/Funktionsblockaktionen", "Select template to paste":"Einzufügende Vorlage auswählen", +"Set all source and memo fields":"Alle Beleg-/Memo-Felder setzen", "Show all details":"Alle Details anzeigen", "Show details":"Details anzeigen", "Subject":"Betreff", diff --git a/locale/de/all b/locale/de/all index aa42ab335..4cdc81691 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2598,8 +2598,10 @@ $self->{texts} = { 'Service, assembly or part' => 'Dienstleistung, Erzeugnis oder Ware', 'Services' => 'Dienstleistungen', 'Set (set to)' => 'Setze', + 'Set all source and memo fields' => 'Alle Beleg-/Memo-Felder setzen', 'Set count for one or more of the items to select them' => 'Zum Selektieren bitte Menge für einen oder mehrere Artikel setzen', 'Set eMail text' => 'E-Mail Text eingeben', + 'Set fields' => 'Felder setzen', 'Set lastcost' => 'EK-Preis übernehmen', 'Set sellprice' => 'VK-Preis übernehmen', 'Set to paid missing' => 'Fehlbetrag setzen', diff --git a/templates/webpages/bank_transactions/list.html b/templates/webpages/bank_transactions/list.html index d5abbcd34..2727ba443 100644 --- a/templates/webpages/bank_transactions/list.html +++ b/templates/webpages/bank_transactions/list.html @@ -27,6 +27,24 @@
[% PROCESS "bank_transactions/tabs/automatic.html" %]
+