From 68e4c3a2d381e0b1b5b8cf317a6bed22973aace9 Mon Sep 17 00:00:00 2001
From: Moritz Bunkus <m.bunkus@linet-services.de>
Date: Wed, 25 Jun 2014 11:50:22 +0200
Subject: [PATCH] =?utf8?q?FollowUp(Access)-Rose-Models:=20sinnvollere=20Na?=
 =?utf8?q?men=20f=C3=BCr=20Relationships?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 SL/DB/MetaSetup/FollowUp.pm       | 8 ++++----
 SL/DB/MetaSetup/FollowUpAccess.pm | 4 ++--
 scripts/rose_auto_create_model.pl | 3 ++-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/SL/DB/MetaSetup/FollowUp.pm b/SL/DB/MetaSetup/FollowUp.pm
index bda14ec5a..a6702b68a 100644
--- a/SL/DB/MetaSetup/FollowUp.pm
+++ b/SL/DB/MetaSetup/FollowUp.pm
@@ -24,14 +24,14 @@ __PACKAGE__->meta->primary_key_columns([ 'id' ]);
 __PACKAGE__->meta->allow_inline_column_values(1);
 
 __PACKAGE__->meta->foreign_keys(
-  created_for => {
+  created_by => {
     class       => 'SL::DB::Employee',
-    key_columns => { created_for_user => 'id' },
+    key_columns => { created_by => 'id' },
   },
 
-  employee => {
+  created_for => {
     class       => 'SL::DB::Employee',
-    key_columns => { created_by => 'id' },
+    key_columns => { created_for_user => 'id' },
   },
 
   note => {
diff --git a/SL/DB/MetaSetup/FollowUpAccess.pm b/SL/DB/MetaSetup/FollowUpAccess.pm
index 43d538610..c2fccb1e9 100644
--- a/SL/DB/MetaSetup/FollowUpAccess.pm
+++ b/SL/DB/MetaSetup/FollowUpAccess.pm
@@ -17,12 +17,12 @@ __PACKAGE__->meta->columns(
 __PACKAGE__->meta->primary_key_columns([ 'id' ]);
 
 __PACKAGE__->meta->foreign_keys(
-  employee => {
+  to_follow_ups_by => {
     class       => 'SL::DB::Employee',
     key_columns => { what => 'id' },
   },
 
-  employee_obj => {
+  with_access => {
     class       => 'SL::DB::Employee',
     key_columns => { who => 'id' },
   },
diff --git a/scripts/rose_auto_create_model.pl b/scripts/rose_auto_create_model.pl
index 4f3360bd6..8106576a8 100755
--- a/scripts/rose_auto_create_model.pl
+++ b/scripts/rose_auto_create_model.pl
@@ -69,7 +69,8 @@ our %foreign_key_name_map     = (
     orderitems                => { parts_id => 'part', trans_id => 'order', },
     delivery_order_items      => { parts_id => 'part' },
     invoice                   => { parts_id => 'part' },
-    follow_ups                => { created_for_user => 'created_for', created_by => 'employee', },
+    follow_ups                => { created_for_user => 'created_for', created_by => 'created_by', },
+    follow_up_access          => { who => 'with_access', what => 'to_follow_ups_by', },
 
     periodic_invoices_configs => { oe_id => 'order' },
   },
-- 
2.20.1