]> wagnertech.de Git - kivitendo-erp.git/commitdiff
TopQuickSearch: typisierte Suche gefixt
authorSven Schöling <s.schoeling@linet-services.de>
Wed, 20 Jul 2016 13:18:03 +0000 (15:18 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Wed, 20 Jul 2016 13:18:03 +0000 (15:18 +0200)
SL/Controller/TopQuickSearch/Article.pm
SL/Controller/TopQuickSearch/Assembly.pm
SL/Controller/TopQuickSearch/Part.pm
SL/Controller/TopQuickSearch/Service.pm

index 9bedb436a55bb28cc13a628e9b1b0142d0945091..e19e7736e59e4df895b4fbebe3286458d431a88e 100644 (file)
@@ -44,23 +44,28 @@ sub do_search {
   my $objects = $self->models->get;
 
   return !@$objects     ? ()
   my $objects = $self->models->get;
 
   return !@$objects     ? ()
-       : @$objects == 1 ? redirect_to_part($objects->[0]->id)
-       :                  redirect_to_search($::form->{term});
+       : @$objects == 1 ? $self->redirect_to_part($objects->[0]->id)
+       :                  $self->redirect_to_search($::form->{term});
 }
 
 sub redirect_to_search {
 }
 
 sub redirect_to_search {
+  my ($self, $term) = @_;
+
   SL::Controller::Base->new->url_for(
   SL::Controller::Base->new->url_for(
-    controller  => 'ic.pl',
-    action      => 'generate_report',
-    all         => $_[0],
+    controller   => 'ic.pl',
+    action       => 'generate_report',
+    all          => $term,
+    (searchitems => $self->type) x!!$self->type,
   );
 }
 
 sub redirect_to_part {
   );
 }
 
 sub redirect_to_part {
+  my ($self, $term) = @_;
+
   SL::Controller::Base->new->url_for(
     controller => 'ic.pl',
     action     => 'edit',
   SL::Controller::Base->new->url_for(
     controller => 'ic.pl',
     action     => 'edit',
-    id         => $_[0],
+    id         => $term,
   );
 }
 
   );
 }
 
@@ -76,7 +81,7 @@ sub init_models {
     model      => 'Part',
     source     => {
       filter => {
     model      => 'Part',
     source     => {
       filter => {
-        ($self->type),
+        (type => $self->type) x!!$self->type,
         'all:substr:multi::ilike' => $::form->{term},
       },
     },
         'all:substr:multi::ilike' => $::form->{term},
       },
     },
index bb7eccea10f845d916d4cf721e47d0d6a6a7328d..7f7e9e2a233b62932451aa0d545a4fc3505ff810 100644 (file)
@@ -11,6 +11,6 @@ sub description_config { t8('Assemblies') }
 
 sub description_field { t8('Assemblies') }
 
 
 sub description_field { t8('Assemblies') }
 
-sub type { type => 'assembly' }
+sub type { 'assembly' }
 
 1;
 
 1;
index d6b01e021047a600c455ab073c8ae17ec34e0f39..9d4c2f0d7e3440b70be6b16d2603253472151bd5 100644 (file)
@@ -11,6 +11,6 @@ sub description_config { t8('Parts') }
 
 sub description_field { t8('Parts') }
 
 
 sub description_field { t8('Parts') }
 
-sub type { type => 'part' }
+sub type { 'part' }
 
 1;
 
 1;
index f1f1507e66b224fb89705dedc5f367e9a03a78e8..7a98590152bcb38f6ac665c312529f5111c1a787 100644 (file)
@@ -11,6 +11,6 @@ sub description_config { t8('Services') }
 
 sub description_field { t8('Services') }
 
 
 sub description_field { t8('Services') }
 
-sub type { type => 'service' }
+sub type { 'service' }
 
 1;
 
 1;