Manager-Klasse für Customer
authorMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 3 May 2011 15:59:51 +0000 (17:59 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 16 Jun 2011 07:34:07 +0000 (09:34 +0200)
SL/DB/Customer.pm
SL/DB/Manager/Customer.pm [new file with mode: 0644]

index c2c436d..186ad97 100644 (file)
@@ -35,7 +35,6 @@ __PACKAGE__->meta->add_relationship(
   },
 );
 
-__PACKAGE__->meta->make_manager_class;
 __PACKAGE__->meta->initialize;
 
 __PACKAGE__->before_save('_before_save_set_customernumber');
diff --git a/SL/DB/Manager/Customer.pm b/SL/DB/Manager/Customer.pm
new file mode 100644 (file)
index 0000000..0d62fe8
--- /dev/null
@@ -0,0 +1,21 @@
+package SL::DB::Manager::Customer;
+
+use strict;
+
+use SL::DB::Helper::Manager;
+use base qw(SL::DB::Helper::Manager);
+
+use SL::DB::Helper::Sorted;
+
+sub object_class { 'SL::DB::Customer' }
+
+__PACKAGE__->make_manager_methods;
+
+sub _sort_spec {
+  return ( default => [ 'name', 1 ],
+           columns => { SIMPLE => 'ALL',
+                        map { ( $_ => "lower(customer.$_)" ) } qw(customernumber vendornumber name contact phone fax email street taxnumber business invnumber ordnumber quonumber)
+                      });
+}
+
+1;