From 7f553958add1eeb8a18114917d5a4b752a8dd82f Mon Sep 17 00:00:00 2001 From: einhverfr Date: Tue, 10 Jun 2008 17:33:58 +0000 Subject: Adding UI support for multiple vendor/customer accounts per company. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2163 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/DBObject/Company.pm | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'LedgerSMB/DBObject') diff --git a/LedgerSMB/DBObject/Company.pm b/LedgerSMB/DBObject/Company.pm index b2584aa0..2d538582 100644 --- a/LedgerSMB/DBObject/Company.pm +++ b/LedgerSMB/DBObject/Company.pm @@ -48,11 +48,28 @@ TODO: Separate company from credit account storage. =cut sub save { + my $self = shift @_; + $self->set_entity_class(); + my ($ref) = $self->exec_method(funcname => 'company_save'); + $self->{id} = $ref->{company_save}; + $self->{dbh}->commit; +} + +=over + +=item save_credit + +This method saves the credit account for the company. + +=back + +=cut + +sub save_credit { my $self = shift @_; $self->set_entity_class(); $self->{threshold} = $self->parse_amount(amount => $self->{threshold}); - my ($ref) = $self->exec_method(funcname => 'entity_credit_save'); - $self->{entity_id} = $ref->{entity_credit_save}; + $self->exec_method(funcname => 'entity_credit_save'); $self->{threshold} = $self->format_amount(amount => $self->{threshold}); $self->{dbh}->commit; } @@ -77,6 +94,24 @@ sub save_location { =over +=item get_credit_id + +This method returns the current credit id from the screen. + +=back + +=cut + +sub get_credit_id { + my $self = shift @_; + my ($ref) = $self->exec_method( + funcname => 'entity_credit_get_id' + ); + $self->{credit_id} = $ref->{'entity_credit_get_id'}; +} + +=over + =item get_metadata() This retrieves various information vor building the user interface. Among other @@ -116,6 +151,9 @@ sub get_metadata { @{$self->{contact_class_list}} = $self->exec_method(funcname => 'entity_list_contact_class'); + + @{$self->{credit_list}} = + $self->exec_method(funcname => 'entity__list_credit'); } sub save_contact { -- cgit v1.2.3