]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Partpicker: Filtermöglichkeit nach Einheiten ('unit')
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 12 Jul 2013 10:09:48 +0000 (12:09 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 12 Jul 2013 11:36:51 +0000 (13:36 +0200)
SL/Presenter/Part.pm
js/autocomplete_part.js

index 44d701e67c08a2f193bd37d1d29c9a6cab6b4e4d..1b81ade4d50e63aa25d0fcb9af5c45e2a3608d3c 100644 (file)
@@ -15,9 +15,8 @@ sub part_picker {
 
   my $ret =
     $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'part_autocomplete', type => 'hidden', id => $id) .
 
   my $ret =
     $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'part_autocomplete', type => 'hidden', id => $id) .
-    $self->input_tag("", delete $params{type}, id => "${id}_type", type => 'hidden') .
-    $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params) .
-    $self->input_tag("", delete $params{column}, id => "${id}_column", type => 'hidden');
+    join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(column type unit)) .
+    $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params);
 
   $self->html_tag('span', $ret, class => 'part_picker');
 }
 
   $self->html_tag('span', $ret, class => 'part_picker');
 }
@@ -60,6 +59,10 @@ If C<%params> contains C<type> only parts of this type will be used
 for autocompletion. You may comma separate multiple types as in
 C<part,assembly>.
 
 for autocompletion. You may comma separate multiple types as in
 C<part,assembly>.
 
+If C<%params> contains C<unit> only parts with this unit will be used
+for autocompletion. You may comma separate multiple units as in
+C<h,min>.
+
 Obsolete parts will by default not displayed for selection. However they are
 accepted as default values and can persist during updates. As with other
 selectors though, they are not selectable once overridden.
 Obsolete parts will by default not displayed for selection. However they are
 accepted as default values and can persist during updates. As with other
 selectors though, they are not selectable once overridden.
index b8b6b5ccf2aa3b7895c17ec0dea0fed367620b9d..5c6b65a8a40507fde9647538d1857a4babc3078f 100644 (file)
@@ -12,6 +12,7 @@ namespace('kivi', function(k){
     var real_id = $real.attr('id');
     var $dummy  = $('#' + real_id + '_name');
     var $type   = $('#' + real_id + '_type');
     var real_id = $real.attr('id');
     var $dummy  = $('#' + real_id + '_name');
     var $type   = $('#' + real_id + '_type');
+    var $unit   = $('#' + real_id + '_unit');
     var $column = $('#' + real_id + '_column');
     var state   = STATES.PICKED;
     var last_real = $real.val();
     var $column = $('#' + real_id + '_column');
     var state   = STATES.PICKED;
     var last_real = $real.val();
@@ -35,9 +36,11 @@ namespace('kivi', function(k){
         current:  $real.val(),
       };
 
         current:  $real.val(),
       };
 
-      var type = $type.val();
-      if (type !== '')
-        data['filter.type'] = type.split(',');
+      if ($type && $type.val())
+        data['filter.type'] = $type.val().split(',');
+
+      if ($unit && $unit.val())
+        data['filter.unit'] = $unit.val().split(',');
 
       return data;
     }
 
       return data;
     }
@@ -150,6 +153,7 @@ namespace('kivi', function(k){
       real:           function() { return $real },
       dummy:          function() { return $dummy },
       type:           function() { return $type },
       real:           function() { return $real },
       dummy:          function() { return $dummy },
       type:           function() { return $type },
+      unit:           function() { return $unit },
       column:         function() { return $column },
       update_results: update_results,
       set_item:       set_item,
       column:         function() { return $column },
       update_results: update_results,
       set_item:       set_item,