From 6c59b08afa062f17a487910125809095fa3fb684 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 27 Nov 2017 18:08:52 +0100 Subject: [PATCH] =?utf8?q?Inventur:=20Manager-Klasse=20f=C3=BCr=20Inventor?= =?utf8?q?y=20(f.=20sorting/paginating)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Inventory.pm | 4 +--- SL/DB/Manager/Inventory.pm | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 SL/DB/Manager/Inventory.pm diff --git a/SL/DB/Inventory.pm b/SL/DB/Inventory.pm index b8f28a37b..a463db5c6 100644 --- a/SL/DB/Inventory.pm +++ b/SL/DB/Inventory.pm @@ -6,12 +6,10 @@ package SL::DB::Inventory; use strict; use SL::DB::MetaSetup::Inventory; +use SL::DB::Manager::Inventory; __PACKAGE__->meta->initialize; -# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. -__PACKAGE__->meta->make_manager_class; - # part accessor is badly named sub part { goto &parts; diff --git a/SL/DB/Manager/Inventory.pm b/SL/DB/Manager/Inventory.pm new file mode 100644 index 000000000..030a386d0 --- /dev/null +++ b/SL/DB/Manager/Inventory.pm @@ -0,0 +1,28 @@ +package SL::DB::Manager::Inventory; + +use strict; + +use SL::DB::Helper::Manager; +use base qw(SL::DB::Helper::Manager); + +use SL::DB::Helper::Filtered; +use SL::DB::Helper::Paginated; +use SL::DB::Helper::Sorted; + +sub object_class { 'SL::DB::Inventory' } + +__PACKAGE__->make_manager_methods; + +sub _sort_spec { + return ( + default => [ 'itime', 1 ], + columns => { + SIMPLE => 'ALL', + }); +} + +sub default_objects_per_page { + 20; +} + +1; -- 2.20.1