From c377a2dac9813ef97651e747ece0def8acbad5d6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 30 Dec 2010 15:45:41 +0100 Subject: [PATCH] =?utf8?q?Manager-Modul=20f=C3=BCr=20Employee-Model=20mit?= =?utf8?q?=20Funktion=20'current',=20die=20die=20aktuelle=20Angestellte=20?= =?utf8?q?zur=C3=BCckliefert?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Employee.pm | 6 +----- SL/DB/Manager/Employee.pm | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 SL/DB/Manager/Employee.pm diff --git a/SL/DB/Employee.pm b/SL/DB/Employee.pm index 841696b6e..1ef565ee6 100644 --- a/SL/DB/Employee.pm +++ b/SL/DB/Employee.pm @@ -1,13 +1,9 @@ -# This file has been auto-generated only because it didn't exist. -# Feel free to modify it at will; it will not be overwritten automatically. - package SL::DB::Employee; use strict; use SL::DB::MetaSetup::Employee; +use SL::DB::Manager::Employee; -# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. -__PACKAGE__->meta->make_manager_class; 1; diff --git a/SL/DB/Manager/Employee.pm b/SL/DB/Manager/Employee.pm new file mode 100644 index 000000000..e52eebb1f --- /dev/null +++ b/SL/DB/Manager/Employee.pm @@ -0,0 +1,17 @@ +package SL::DB::Manager::Employee; + +use strict; + +use SL::DB::Helpers::Manager; +use base qw(SL::DB::Helpers::Manager); + +sub object_class { 'SL::DB::Employee' } + +__PACKAGE__->make_manager_methods; + +sub current { + return undef unless $::form && $::form->{login}; + return shift->find_by(login => $::form->{login}); +} + +1; -- 2.20.1