--- /dev/null
+package SL::DB::Manager::Shipto;
+
+use strict;
+
+use SL::DB::Helper::Manager;
+use base qw(SL::DB::Helper::Manager);
+
+use SL::DB::Helper::Sorted;
+
+sub object_class { 'SL::DB::Shipto' }
+
+__PACKAGE__->make_manager_methods;
+
+sub _sort_spec {
+ return (
+ default => [ 'full_address', 1 ],
+ columns => {
+ SIMPLE => 'ALL',
+ full_address => '( lower(shipto.shiptoname) || lower(shipto.shiptostreet) || lower(shipto.shiptocity) )',
+ map { ( $_ => "lower(shipto.shipto$_)" ) } qw(city contact country department_1 department_2 email fax name phone street zipcode)
+ });
+}
+
+1;
use strict;
use SL::DB::MetaSetup::Shipto;
+use SL::DB::Manager::Shipto;
use Rose::DB::Object::Helpers qw(clone_and_reset clone);
our @SHIPTO_VARIABLES = qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
__PACKAGE__->meta->initialize;
-__PACKAGE__->meta->make_manager_class;
-
sub displayable_id {
my $self = shift;
my $text = join('; ', grep { $_ } (map({ $self->$_ } qw(shiptoname shiptostreet)),
$::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]);
$::form->{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]);
- $::form->{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all(query => [
+ $::form->{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [
or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ]
]);
$::form->{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [
$TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]);
$TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]);
- $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all(query => [
+ $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [
or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ]
]);
$TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [
my $employee_list_query_gen = sub { $::form->{$_[0]} ? [ or => [ id => $::form->{$_[0]}, deleted => 0 ] ] : [ deleted => 0 ] };
$TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => $employee_list_query_gen->('employee_id'));
$TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(query => $employee_list_query_gen->('salesman_id'));
- $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all(query => [
+ $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [
or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ]
]);
$TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [