summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-08-12 16:39:00 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-08-12 16:39:00 +0000
commit0a21178170ff1917204172a7cc1c3f7e73b8f379 (patch)
tree116966af6c93112c16cac3b8924c381da8e78647 /LedgerSMB/DBObject
parentbca5826c5485e2c1f3d8cfdf36f247826ea4afed (diff)
Undoing svn commit rev 2250
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2251 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/DBObject')
-rw-r--r--LedgerSMB/DBObject/Company.pm82
1 files changed, 11 insertions, 71 deletions
diff --git a/LedgerSMB/DBObject/Company.pm b/LedgerSMB/DBObject/Company.pm
index b2eed72c..23a56cec 100644
--- a/LedgerSMB/DBObject/Company.pm
+++ b/LedgerSMB/DBObject/Company.pm
@@ -88,16 +88,8 @@ This method saves an address for a company.
sub save_location {
my $self = shift @_;
-
$self->{country_id} = $self->{country_code};
-
- if($self->{credit_id}){
- $self->exec_method(funcname => 'eca__location_save');
- } else {
- my ($ref) = $self->exec_method(funcname => 'company__location_save');
- my @vals = values %$ref;
- $self->{location_id} = $vals[0];
- }
+ $self->exec_method(funcname => 'company__location_save');
$self->{dbh}->commit;
}
@@ -162,15 +154,13 @@ 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 {
my ($self) = @_;
- if ($self->{credit_id}){
- $self->exec_method(funcname => 'eca__save_contact');
- } else {
- $self->exec_method(funcname => 'company__save_contact');
- }
+ $self->exec_method(funcname => 'company__save_contact');
$self->{dbh}->commit;
}
@@ -182,11 +172,7 @@ sub save_bank_account {
sub save_notes {
my $self = shift @_;
- if ($self->{credit_id} && $self->{note_class} eq '3'){
- $self->exec_method(funcname => 'eca__save_notes');
- } else {
- $self->exec_method(funcname => 'entity__save_notes');
- }
+ $self->exec_method(funcname => 'entity__save_notes');
$self->{dbh}->commit;
}
@@ -212,65 +198,19 @@ sub get {
$self->merge($ref);
$self->{threshold} = $self->format_amount(amount => $self->{threshold});
- @{$self->{credit_list}} =
- $self->exec_method(funcname => 'entity__list_credit');
-
- for (@{$self->{credit_list}}){
- print STDERR "credit_id: $_->{credit_id}\n";
- if (($_->{credit_id} eq $self->{credit_id})
- or ($_->{meta_number} eq $self->{meta_number})){
- $self->merge($_);
- last;
- }
- }
$self->{name} = $self->{legal_name};
- if ($self->{credit_id} and $self->{meta_number}){
- $self->get_credit_id;
- }
- if ($self->{credit_id}){
- @{$self->{locations}} = $self->exec_method(
- funcname => 'eca__list_locations');
- @{$self->{contacts}} = $self->exec_method(
- funcname => 'eca__list_contacts');
- @{$self->{notes}} = $self->exec_method(
- funcname => 'eca__list_notes');
-
- }
- else {
- @{$self->{locations}} = $self->exec_method(
+ @{$self->{locations}} = $self->exec_method(
funcname => 'company__list_locations');
- @{$self->{contacts}} = $self->exec_method(
- funcname => 'company__list_contacts');
- @{$self->{notes}} = $self->exec_method(
- funcname => 'company__list_notes');
- }
-
- if ($self->{location_id}){
- for (@{$self->{locations}}){
- if ($_->{id} = $self->{location_id}){
- my $old_id = $self->{id};
- $self->merge($_);
- $self->{id} = $old_id;
- last;
- }
- }
- }
-
- if ($self->{contact_id}){
- for (@{$self->{contacts}}){
- if ($_->{id} = $self->{contact_id}){
- my $old_id = $self->{id};
- $self->merge($_);
- $self->{id} = $old_id;
- last;
- }
- }
- }
+ @{$self->{contacts}} = $self->exec_method(
+ funcname => 'company__list_contacts');
@{$self->{bank_account}} = $self->exec_method(
funcname => 'company__list_bank_account');
+
+ @{$self->{notes}} = $self->exec_method(
+ funcname => 'company__list_notes');
};
1;