]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/Invoice.pm
Rose: 'with_args' nach Foreign-Key-Einführung gefixt
[mfinanz.git] / SL / DB / Invoice.pm
index 0138efc024a3f423e907967747a27554ec2c9223..b3adee7349244f260e85f5d340289ff77fe65c5a 100644 (file)
@@ -25,46 +25,17 @@ __PACKAGE__->meta->add_relationship(
     class        => 'SL::DB::InvoiceItem',
     column_map   => { id => 'trans_id' },
     manager_args => {
-      with_objects => [ 'part' ]
+      with_objects => [ 'parts' ]
     }
   },
-  payment_term => {
-    type       => 'one to one',
-    class      => 'SL::DB::PaymentTerm',
-    column_map => { payment_id => 'id' },
-  },
-  contact      => {
-    type       => 'one to one',
-    class      => 'SL::DB::Contact',
-    column_map => { cp_id => 'cp_id' },
-  },
-  shipto       => {
-    type       => 'one to one',
-    class      => 'SL::DB::Shipto',
-    column_map => { shipto_id => 'shipto_id' },
-  },
-  department   => {
-    type       => 'one to one',
-    class      => 'SL::DB::Department',
-    column_map => { department_id => 'id' },
-  },
-  language     => {
-    type       => 'one to one',
-    class      => 'SL::DB::Language',
-    column_map => { language_id => 'id' },
-  },
-  employee     => {
-    type       => 'one to one',
-    class      => 'SL::DB::Employee',
-    column_map => { employee_id => 'id' },
-  },
 );
 
 __PACKAGE__->meta->initialize;
 
 # methods
 
-sub items { goto &invoiceitems; }
+sub items        { goto &invoiceitems; }
+sub payment_term { goto &payment;      }
 
 # it is assumed, that ordnumbers are unique here.
 sub first_order_by_ordnumber {
@@ -188,14 +159,11 @@ sub post {
 sub _post_add_acctrans {
   my ($self, $entries) = @_;
 
-  my $default_tax_id = SL::DB::Manager::Tax->find_by(taxkey => 0)->id;
-
   while (my ($chart_id, $spec) = each %{ $entries }) {
-    $spec = { taxkey => 0, tax_id => $default_tax_id, amount => $spec } unless ref $spec;
+    $spec = { taxkey => 0, amount => $spec } unless ref $spec;
     SL::DB::AccTransaction->new(trans_id   => $self->id,
                                 chart_id   => $chart_id,
                                 amount     => $spec->{amount},
-                                tax_id     => $spec->{tax_id},
                                 taxkey     => $spec->{taxkey},
                                 project_id => $self->globalproject_id,
                                 transdate  => $self->transdate)->save;