From: G. Richardson Date: Fri, 29 Jul 2016 06:35:29 +0000 (+0200) Subject: PartPicker - Parameter "type" heißt jetzt "part_type" X-Git-Tag: release-3.5.4~1911 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=862bc8ce30cd40b67d2856ac7f1d11d5e4322f09;p=kivitendo-erp.git PartPicker - Parameter "type" heißt jetzt "part_type" --- diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index 4050ce72a..7b812e892 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -29,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'} }, @@ -48,7 +48,7 @@ sub action_ajax_autocomplete { 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 } }, } diff --git a/SL/DB/Manager/Part.pm b/SL/DB/Manager/Part.pm index b43b57319..b94d7f443 100644 --- a/SL/DB/Manager/Part.pm +++ b/SL/DB/Manager/Part.pm @@ -16,7 +16,7 @@ sub object_class { 'SL::DB::Part' } __PACKAGE__->make_manager_methods; __PACKAGE__->add_filter_specs( - type => sub { + part_type => sub { my ($key, $value, $prefix) = @_; return __PACKAGE__->type_filter($value, $prefix); }, diff --git a/SL/Presenter/Part.pm b/SL/Presenter/Part.pm index 97b14e886..5ec55503a 100644 --- a/SL/Presenter/Part.pm +++ b/SL/Presenter/Part.pm @@ -37,7 +37,7 @@ sub part_picker { my $ret = $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => "@classes", type => 'hidden', id => $id) . - join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(type unit convertible_unit)) . + join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(part_type unit convertible_unit)) . $self->input_tag("", ref $value ? $value->displayable_name : '', id => "${id}_name", %params); $::request->layout->add_javascripts('autocomplete_part.js'); @@ -105,7 +105,7 @@ C. C<$value> can be a parts id or a C instance. -If C<%params> contains C only parts of this type will be used +If C<%params> contains C only parts of this type will be used for autocompletion. You may comma separate multiple types as in C. diff --git a/js/autocomplete_part.js b/js/autocomplete_part.js index cc9354ac3..57f90c7a7 100644 --- a/js/autocomplete_part.js +++ b/js/autocomplete_part.js @@ -28,9 +28,9 @@ namespace('kivi', function(k){ UNDEFINED: CLASSES.UNDEFINED } var real_id = $real.attr('id'); - var $dummy = $('#' + real_id + '_name'); - var $type = $('#' + real_id + '_type'); - var $unit = $('#' + real_id + '_unit'); + var $dummy = $('#' + real_id + '_name'); + var $part_type = $('#' + real_id + '_part_type'); + var $unit = $('#' + real_id + '_unit'); var $convertible_unit = $('#' + real_id + '_convertible_unit'); var state = STATES.PICKED; var last_real = $real.val(); @@ -63,8 +63,8 @@ namespace('kivi', function(k){ current: $real.val(), }; - if ($type && $type.val()) - data['filter.type'] = $type.val().split(','); + if ($part_type && $part_type.val()) + data['filter.part_type'] = $part_type.val().split(','); if ($unit && $unit.val()) data['filter.unit'] = $unit.val().split(','); @@ -244,7 +244,7 @@ namespace('kivi', function(k){ var pp = { real: function() { return $real }, dummy: function() { return $dummy }, - type: function() { return $type }, + part_type: function() { return $part_type }, unit: function() { return $unit }, convertible_unit: function() { return $convertible_unit }, update_results: update_results, diff --git a/templates/webpages/part/test_page.html b/templates/webpages/part/test_page.html index afd96915d..e3999b0fc 100644 --- a/templates/webpages/part/test_page.html +++ b/templates/webpages/part/test_page.html @@ -6,11 +6,11 @@ Alle:
[% L.part_picker('part_id') %] text
Nur Waren:
-[% L.part_picker('part_id2', undef, type='part') %]
+[% L.part_picker('part_id2', undef, part_type='part') %]
Nur Dienstleistungen:
-[% L.part_picker('part_id3', undef, type='service') %]
+[% L.part_picker('part_id3', undef, part_type='service') %]
Waren und Dienstleistungen:
-[% L.part_picker('part_id4', undef, type='part,service') %]
+[% L.part_picker('part_id4', undef, part_type='part,service') %]
Pre-filled:
[% L.part_picker('part_id5', pre_filled_part) %]
Convertible unit 'Std': (only select parts with unit Tag/Std/Min)
@@ -18,17 +18,17 @@ Convertible unit 'Std': (only select parts with unit Tag/Std/Min)

Styling

-Ina span: -Leading text: [% L.part_picker('p1', undef, type='part,service') %] and text after with spacing
-Leading text:[% L.part_picker('p2', undef, type='part,service') %]and text after without spacing
-
Leading text: [% L.part_picker('p3', undef, type='part,service') %] and text after with spacing with div

-
Leading text:[% L.part_picker('p4', undef, type='part,service') %]and text after with spacing with div

+In a span: +Leading text: [% L.part_picker('p1', undef, part_type='part,service') %] and text after with spacing
+Leading text:[% L.part_picker('p2', undef, part_type='part,service') %]and text after without spacing
+
Leading text: [% L.part_picker('p3', undef, part_type='part,service') %] and text after with spacing with div

+
Leading text:[% L.part_picker('p4', undef, part_type='part,service') %]and text after with spacing with div

-Picker + input next to each other: [% L.part_picker('p5', undef, type='part,service', width="100%") %] +Picker + input next to each other: [% L.part_picker('p5', undef, part_type='part,service', width="100%") %] -
[% L.part_picker('p6', undef, type='part,service', style="width:500px") %] 500px width
-
[% L.part_picker('p7', undef, type='part,service', style="width:200px") %] 200px width
-
[% L.part_picker('p8', undef, type='part,service', style="height:40px") %] 40px height
+
[% L.part_picker('p6', undef, part_type='part,service', style="width:500px") %] 500px width
+
[% L.part_picker('p7', undef, part_type='part,service', style="width:200px") %] 200px width
+
[% L.part_picker('p8', undef, part_type='part,service', style="height:40px") %] 40px height
[%# FOREACH i IN 1..50 %] [%# L.part_picker('part_id_' _ i) %]
@@ -41,11 +41,11 @@ Ina span: - + - +
Part picker in table heading[% L.part_picker('p9', undef, type='part,service') %][% L.part_picker('p9', undef, part_type='part,service') %]
Part picker in table cell[% L.part_picker('p10', undef, type='part,service') %][% L.part_picker('p10', undef, part_type='part,service') %]
@@ -54,10 +54,10 @@ Ina span: - + - +
Part picker in table heading[% L.part_picker('p11', undef, type='part,service') %][% L.part_picker('p11', undef, part_type='part,service') %]
Part picker in table cell[% L.part_picker('p12', undef, type='part,service') %][% L.part_picker('p12', undef, part_type='part,service') %]