]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/DB/InvoiceItem.pm
Vor Fremdschlüsselzuweisung trans_id verwaiste Einträge in orderitems löschen
[kivitendo-erp.git] / SL / DB / InvoiceItem.pm
index 04b28a1952fe7eca064aa904f103a46d5478916c..016f94575b194db3890e511bdef6fea15a4796f7 100644 (file)
@@ -3,17 +3,19 @@ package SL::DB::InvoiceItem;
 use strict;
 
 use SL::DB::MetaSetup::InvoiceItem;
+use SL::DB::Helper::CustomVariables (
+  sub_module  => 'invoice',
+  cvars_alias => 1,
+  overloads   => {
+    parts_id => 'SL::DB::Part',
+  },
+);
 
 __PACKAGE__->meta->add_relationship(
-  part => {
+  unit_obj       => {
     type         => 'one to one',
-    class        => 'SL::DB::Part',
-    column_map   => { parts_id => 'id' },
-  },
-  price_factor_obj => {
-    type           => 'one to one',
-    class          => 'SL::DB::PriceFactor',
-    column_map     => { price_factor_id => 'id' },
+    class        => 'SL::DB::Unit',
+    column_map   => { unit => 'name' },
   },
 );
 
@@ -22,4 +24,9 @@ __PACKAGE__->meta->make_manager_class;
 
 __PACKAGE__->meta->initialize;
 
+sub part {
+  # canonial alias for parts.
+  goto &parts;
+}
+
 1;