X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/96308c59e72ec3f4fd911c48bcd7c137f523a706..7a1475567922cd777644a36483a89bcaa756eba5:/SL/Dev/Payment.pm diff --git a/SL/Dev/Payment.pm b/SL/Dev/Payment.pm index bce5c0fae..e1acac681 100644 --- a/SL/Dev/Payment.pm +++ b/SL/Dev/Payment.pm @@ -49,8 +49,8 @@ sub create_bank_transaction { my $amount = (delete $params{amount} || $record->amount) * $multiplier; my $bank_chart; - if ( $params{chart_id} ) { - $bank_chart = SL::DB::Manager::Chart->find_by(chart_id => $params{chart_id}) or die "Can't find bank chart"; + if ( $params{bank_chart_id} ) { + $bank_chart = SL::DB::Manager::Chart->find_by(id => delete $params{bank_chart_id}) or die "Can't find bank chart"; } elsif ( $::instance_conf->get_ar_paid_accno_id ) { $bank_chart = SL::DB::Manager::Chart->find_by(id => $::instance_conf->get_ar_paid_accno_id); } else { @@ -88,30 +88,36 @@ SL::Dev::Payment - create objects for payment-related testing, with minimal defa Create payment terms. Minimal example with default values (30days, 5% skonto within 5 days): - my $payment_terms = SL::Dev::Record::create_payment_terms; + my $payment_terms = SL::Dev::Payment::create_payment_terms; =head2 C Required params: chart_id Example: - my $bank_account = SL::Dev::Record::create_bank_account(chart_id => SL::DB::Manager::Chart->find_by(description => 'Bank')->id); + my $bank_account = SL::Dev::Payment::create_bank_account(chart_id => SL::DB::Manager::Chart->find_by(description => 'Bank')->id); =head2 C +Create a bank transaction that matches an existing invoice record, e.g. to be able to +test the point system. + Required params: record (an SL::DB::Invoice or SL::DB::PurchaseInvoice object) +Optional params: bank_chart_id : the chart id of a configured bank account + amount : the amount of the bank transaction -$params{amount} should always be relative to the absolute amount of the invoice, i.e. use positive -values for sales and purchases. +If no bank_chart_id is given, it tries to find a chart via defaults +(ar_paid_accno_id) or by searching for the chart named "Bank". The chart must +be connected to an existing BankAccount. -Create a bank transaction that matches an existing invoice record, e.g. to be able to -test the point system. +Param amount should always be relative to the absolute amount of the invoice, i.e. use positive +values for sales and purchases. Example: - my $payment_terms = SL::Dev::Record::create_payment_terms; + my $payment_terms = SL::Dev::Payment::create_payment_terms; my $bank_chart = SL::DB::Manager::Chart->find_by(description => 'Bank'); - my $bank_account = SL::Dev::Record::create_bank_account(chart_id => $bank_chart->id); + my $bank_account = SL::Dev::Payment::create_bank_account(chart_id => $bank_chart->id); my $customer = SL::Dev::CustomerVendor::create_customer(iban => 'DE12500105170648489890', bank_code => 'abc', account_number => '44444', @@ -137,8 +143,11 @@ To create a payment for 3 invoices that were all paid together, all with skonto: amount => ($ar1->amount_less_skonto + $ar2->amount_less_skonto + $ar2->amount_less_skonto), purpose => 'Rechnungen 20, 21, 22', ); + =head1 TODO +Nothing here yet. + =head1 BUGS Nothing here yet.