summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject/Customer.pm
blob: 36b4ed6239e63ff7dcc21fe7eacdc29d4fad5ab6 (plain)
  1. package LedgerSMB::DBObject::Customer;
  2. use base qw(LedgerSMB::DBObject::Company);
  3. use LedgerSMB::DBObject;
  4. use LedgerSMB::Entity;
  5. sub save {
  6. # this is doing way too much.
  7. my $self = shift @_;
  8. my $entity;
  9. # this is a fairly effective way of telling if we need to create a new
  10. # entity or not.
  11. if (!$self->{entity_id}) {
  12. $entity = LedgerSMB::Entity->new(base=>$request);
  13. }
  14. else {
  15. $entity = LedgerSMB::Entity->get(id=>$self->{entity_id});
  16. }
  17. $entity->set(name=> $reqeust->{first_name}." ".$request->{last_name} );
  18. $entity->set(entity_class=>2);
  19. $self->set(entity_id=>$entity->{id});
  20. $self->set(entity_class=> 2);
  21. $entity->save();
  22. if (!self->{entity_id}) {
  23. $self->{entity_id} = $entity->{id};
  24. }
  25. $self->SUPER::save();
  26. return $self->{id};
  27. }
  28. sub search {
  29. }
  30. 1;