From: Moritz Bunkus Date: Thu, 30 Dec 2010 14:45:41 +0000 (+0100) Subject: Manager-Modul für Employee-Model mit Funktion 'current', die die aktuelle Angestellte... X-Git-Tag: release-2.6.2beta1~17^2~6^2~7 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c377a2dac9813ef97651e747ece0def8acbad5d6;p=kivitendo-erp.git Manager-Modul für Employee-Model mit Funktion 'current', die die aktuelle Angestellte zurückliefert --- 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;