From bb74dcef1ff3d6eb73bdde38eb11320590b2c011 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Tue, 20 Nov 2007 07:36:30 +0000 Subject: Customer screen now renders reasonably well. TODO: Needs a lot of CSS work to beautify. Also CSS/Javascript could be used to create a tabbed interface for this screen. Also, a lot of issues with stored procedures have been fixed. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1880 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/DBObject/Customer.pm | 47 ++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) (limited to 'LedgerSMB/DBObject') diff --git a/LedgerSMB/DBObject/Customer.pm b/LedgerSMB/DBObject/Customer.pm index 09f8e3dd..9a120f91 100644 --- a/LedgerSMB/DBObject/Customer.pm +++ b/LedgerSMB/DBObject/Customer.pm @@ -5,39 +5,24 @@ use LedgerSMB::DBObject; use LedgerSMB::Entity; sub save { - - # this is doing way too much. - my $self = shift @_; - - my $entity; - - # this is a fairly effective way of telling if we need to create a new - # entity or not. - - if (!$self->{entity_id}) { - - $entity = LedgerSMB::Entity->new(base=>$request); - } - else { - - $entity = LedgerSMB::Entity->get(id=>$self->{entity_id}); - } - - $entity->set(name=> $reqeust->{first_name}." ".$request->{last_name} ); - $entity->set(entity_class=>2); - $self->set(entity_id=>$entity->{id}); - $self->set(entity_class=> 2); - - $entity->save(); - if (!self->{entity_id}) { - - $self->{entity_id} = $entity->{id}; - } - $self->SUPER::save(); - - return $self->{id}; + # This saves both the entity and the credit account. -- CT + $self->{entity_class} = 2; + $self->{id} = $self->exec_method(funcname => 'entity_credit_save'); +} + +sub get_metadata { + my $self = shift @_; + + @{$self->{location_class}} = + $self->exec_method(funcname => 'location_list_class'); + + @{$self->{country}} = + $self->exec_method(funcname => 'location_list_country'); + + @{$self->{contact_class}} = + $self->exec_method(funcname => 'entity_list_contact_class'); } sub search { -- cgit v1.2.3