From 08fc34ad30c05447750d59e9c66b7e501d011266 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Mon, 3 Dec 2007 09:05:01 +0000 Subject: Adding more Payment features git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1936 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/DBObject/Payment.pm | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'LedgerSMB/DBObject') diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm index 62bef3bd..d8af8a9f 100644 --- a/LedgerSMB/DBObject/Payment.pm +++ b/LedgerSMB/DBObject/Payment.pm @@ -66,9 +66,15 @@ sub get_metadata { $self->list_open_projects(); @{$self->{departments}} = $self->exec_method(funcname => 'department_list'); $self->get_open_currencies(); + $self->{currencies} = []; + for my $c (@{$self->{openCurrencies}}){ + push @{$self->{currencies}}, $c->{payments_get_open_currencies}; + } @{$self->{businesses}} = $self->exec_method( funcname => 'business_type__list' ); + @{$self->{debt_accounts}} = $self->exec_method( + funcname => 'chart_get_ar_ap'); } sub get_open_accounts { @@ -337,5 +343,42 @@ sub get_vc_info { #return @{$self->{vendor_customer_info}}; } +=item get_payment_detail_data + +This method sets appropriate project, department, etc. fields. + +=cut + +sub get_payment_detail_data { + my ($self) = @_; + @{$self->{cash_accounts}} = $self->exec_method( + funcname => 'chart_list_cash'); + $self->get_metadata(); + + my $source_inc; + my $source_src; + if (defined ($self->{source_start})){ + $self->{source_start} =~ /(\d*)\D*$/; + $source_src = $1; + if ($source_src) { + $source_inc = $source_src; + } else { + $source_inc = $0; + } + } + @{$self->{contact_invoices}} = $self->exec_method( + funcname => 'payment_get_all_contact_invoices'); + for my $inv (@{$self->{contact_invoices}}){ + if (defined $self->{source_start}){ + my $source = $self->{source_start}; + $source =~ s/$source_src(\D*)$/$source_inc$1/; + ++ $source_inc; + $inv->{source} = $source; + } + my $tmp_invoices = $inv->{invoices}; + $inv->{invoices} = []; + @{$inv->{invoices}} = $self->_parse_array($tmp_invoices); + } +} 1; -- cgit v1.2.3