From: Moritz Bunkus Date: Fri, 12 Jul 2013 10:09:48 +0000 (+0200) Subject: Partpicker: Filtermöglichkeit nach Einheiten ('unit') X-Git-Tag: release-3.1.0beta1~175^2~2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=880a2e9f233d585d9e1a3d8dc17b2795b8513fcf;p=kivitendo-erp.git Partpicker: Filtermöglichkeit nach Einheiten ('unit') --- diff --git a/SL/Presenter/Part.pm b/SL/Presenter/Part.pm index 44d701e67..1b81ade4d 100644 --- a/SL/Presenter/Part.pm +++ b/SL/Presenter/Part.pm @@ -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) . - $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'); } @@ -60,6 +59,10 @@ If C<%params> contains C only parts of this type will be used for autocompletion. You may comma separate multiple types as in C. +If C<%params> contains C only parts with this unit will be used +for autocompletion. You may comma separate multiple units as in +C. + 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. diff --git a/js/autocomplete_part.js b/js/autocomplete_part.js index b8b6b5ccf..5c6b65a8a 100644 --- a/js/autocomplete_part.js +++ b/js/autocomplete_part.js @@ -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 $unit = $('#' + real_id + '_unit'); 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(), }; - 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; } @@ -150,6 +153,7 @@ namespace('kivi', function(k){ 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,