Inventur: Manager-Klasse für Inventory (f. sorting/paginating)
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 27 Nov 2017 17:08:52 +0000 (18:08 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 5 Jan 2018 12:00:53 +0000 (13:00 +0100)
SL/DB/Inventory.pm
SL/DB/Manager/Inventory.pm [new file with mode: 0644]

index b8f28a3..a463db5 100644 (file)
@@ -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 (file)
index 0000000..030a386
--- /dev/null
@@ -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;