]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/Part.pm
PartPicker - Parameter "type" heißt jetzt "part_type"
[mfinanz.git] / SL / Controller / Part.pm
index e1bbcd9a74a6e4b2c96d0d47283374176d66102e..7b812e892b4870a7f6a1ea651d6432149b040456 100644 (file)
@@ -20,8 +20,6 @@ __PACKAGE__->run_before(sub { $::auth->assert('part_service_assembly_edit') },
 sub action_ajax_autocomplete {
   my ($self, %params) = @_;
 
-  my $value = $::form->{column} || 'description';
-
   # if someone types something, and hits enter, assume he entered the full name.
   # if something matches, treat that as sole match
   # unfortunately get_models can't do more than one per package atm, so we d it
@@ -31,7 +29,7 @@ sub action_ajax_autocomplete {
     if (1 == scalar @{ $exact_matches = SL::DB::Manager::Part->get_all(
       query => [
         obsolete => 0,
-        SL::DB::Manager::Part->type_filter($::form->{filter}{type}),
+        SL::DB::Manager::Part->type_filter($::form->{filter}{part_type}),
         or => [
           description => { ilike => $::form->{filter}{'all:substr:multi::ilike'} },
           partnumber  => { ilike => $::form->{filter}{'all:substr:multi::ilike'} },
@@ -45,12 +43,12 @@ sub action_ajax_autocomplete {
 
   my @hashes = map {
    +{
-     value       => $_->$value,
-     label       => $_->long_description,
+     value       => $_->displayable_name,
+     label       => $_->displayable_name,
      id          => $_->id,
      partnumber  => $_->partnumber,
      description => $_->description,
-     type        => $_->type,
+     part_type   => $_->part_type,
      unit        => $_->unit,
      cvars       => { map { ($_->config->name => { value => $_->value_as_text, is_valid => $_->is_valid }) } @{ $_->cvars_by_config } },
     }
@@ -60,7 +58,7 @@ sub action_ajax_autocomplete {
 }
 
 sub action_test_page {
-  $_[0]->render('part/test_page');
+  $_[0]->render('part/test_page', pre_filled_part => SL::DB::Manager::Part->get_first);
 }
 
 sub action_part_picker_search {
@@ -106,7 +104,7 @@ sub init_models {
     controller => $self,
     sorted => {
       _default  => {
-        by => 'description',
+        by => 'partnumber',
         dir  => 1,
       },
       partnumber  => t8('Partnumber'),