Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0c73b206

Von Bernd Bleßmann vor mehr als 5 Jahren hinzugefügt

  • ID 0c73b206cea0c8f057852e75bd4ee22c19bfdbc3
  • Vorgänger 88d774c6
  • Nachfolger 549bce5b

PartPicker nach Kunden- und Lieferanten-Artikel-Nr. suchen und filtern können

Unterschiede anzeigen:

SL/Controller/Part.pm
399 399
}
400 400

  
401 401
sub action_show_multi_items_dialog {
402
  my ($self) = @_;
403

  
404
  my $search_term = $self->models->filtered->laundered->{all_substr_multi__ilike};
405
  $search_term  ||= $self->models->filtered->laundered->{all_with_makemodel_substr_multi__ilike};
406
  $search_term  ||= $self->models->filtered->laundered->{all_with_customer_partnumber_substr_multi__ilike};
407

  
402 408
  $_[0]->render('part/_multi_items_dialog', { layout => 0 },
403
    all_partsgroups => SL::DB::Manager::PartsGroup->get_all
409
                all_partsgroups => SL::DB::Manager::PartsGroup->get_all,
410
                search_term     => $search_term
404 411
  );
405 412
}
406 413

  
......
562 569
  # since we need a second get models instance with different filters for that,
563 570
  # we only modify the original filter temporarily in place
564 571
  if ($::form->{prefer_exact}) {
565
    local $::form->{filter}{'all::ilike'} = delete local $::form->{filter}{'all:substr:multi::ilike'};
572
    local $::form->{filter}{'all::ilike'}                          = delete local $::form->{filter}{'all:substr:multi::ilike'};
573
    local $::form->{filter}{'all_with_makemodel::ilike'}           = delete local $::form->{filter}{'all_with_makemodel:substr:multi::ilike'};
574
    local $::form->{filter}{'all_with_customer_partnumber::ilike'} = delete local $::form->{filter}{'all_with_customer_partnumber:substr:multi::ilike'};
566 575

  
567 576
    my $exact_models = SL::Controller::Helper::GetModels->new(
568 577
      controller   => $self,
......
598 607
}
599 608

  
600 609
sub action_part_picker_search {
601
  $_[0]->render('part/part_picker_search', { layout => 0 });
610
  my ($self) = @_;
611

  
612
  my $search_term = $self->models->filtered->laundered->{all_substr_multi__ilike};
613
  $search_term  ||= $self->models->filtered->laundered->{all_with_makemodel_substr_multi__ilike};
614
  $search_term  ||= $self->models->filtered->laundered->{all_with_customer_partnumber_substr_multi__ilike};
615

  
616
  $_[0]->render('part/part_picker_search', { layout => 0 }, search_term => $search_term);
602 617
}
603 618

  
604 619
sub action_part_picker_result {
SL/Presenter/Part.pm
241 241
If C<%params> contains C<convertible_unit> only parts with a unit
242 242
that's convertible to unit will be used for autocompletion.
243 243

  
244
If C<%params> contains C<with_makemodel> or C<with_customer_partnumber> even
245
parts will be used for autocompletion which partnumber is a vendor partnumber
246
(makemodel) or a customer partnumber.
247

  
244 248
Obsolete parts will by default not be displayed for selection. However they are
245 249
accepted as default values and can persist during updates. As with other
246 250
selectors though, they are not selectable once overridden.
js/kivi.Part.js
334 334
    },
335 335
    ajax_data: function(term) {
336 336
      var data = {
337
        'filter.all:substr:multi::ilike': term,
338 337
        current:  this.$real.val(),
339 338
      };
340 339

  
......
356 355
      if (this.o.convertible_unit)
357 356
        data['filter.unit_obj.convertible_to'] = this.o.convertible_unit;
358 357

  
358
      var filter_name = 'all';
359
      if (this.o.with_makemodel) {
360
        filter_name = 'all_with_makemodel';
361
      }
362
      if (this.o.with_customer_partnumber) {
363
        filter_name = 'all_with_customer_partnumber';
364
      }
365
      data['filter.' + filter_name + ':substr:multi::ilike'] = term;
366

  
359 367
      return data;
360 368
    },
361 369
    set_item: function(item) {
templates/webpages/part/_multi_items_dialog.html
5 5
<table id='multi_items_filter_table'>
6 6
  <tr>
7 7
    <th>[%- LxERP.t8("Description") %]/[%- LxERP.t8("Partnumber") %]:</th>
8
    <td>[%- L.input_tag('multi_items_filter', SELF.multi_items_models.filtered.laundered.all_substr_multi__ilike) %]</td>
8
    <td>[%- L.input_tag('multi_items_filter', search_term) %]</td>
9 9
    <th>[%- LxERP.t8("Partsgroup") %]</th>
10 10
    <td>[%- L.select_tag('multi_items.filter.partsgroup_id', all_partsgroups, title_key='partsgroup', value_key='id', with_empty=1) %]</td>
11 11
  <tr>
templates/webpages/part/part_picker_search.html
5 5

  
6 6
<div style='overflow:hidden'>
7 7

  
8
[% LxERP.t8("Filter") %]: [% L.input_tag('part_picker_filter', SELF.models.filtered.laundered.all_substr_multi__ilike, class='part_picker_filter') %]
8
[% LxERP.t8("Filter") %]: [% L.input_tag('part_picker_filter', search_term, class='part_picker_filter') %]
9 9

  
10 10
<div class='float-right'>
11 11
  [% L.checkbox_tag('no_paginate', checked=FORM.no_paginate, id='no_paginate', for_submit=1, label=LxERP.t8('All as list')) %]
templates/webpages/part/test_page.html
32 32
[% P.part.picker('part_id17', undef, status="obsolete") %]<br>
33 33
Artikel-Status: Alle<br>
34 34
[% P.part.picker('part_id18', undef, status="all") %]<br>
35

  
35
<br>
36 36
Pre-filled:<br>
37 37
[% P.part.picker('part_id6', pre_filled_part) %]<br>
38 38
Convertible unit 'Std': (only select parts with unit Tag/Std/Min)<br>
39 39
[% P.part.picker('part_id7', undef, convertible_unit='Std') %]<br>
40

  
40
<br>
41 41
With multi select popup<br>
42 42
[% P.part.picker('part_id8', undef, multiple=1) %]<br>
43
With multi select popup (only obsolete)<br>
44
[% P.part.picker('part_id8', undef, multiple=1, status='obsolete') %]<br>
45
<br>
46
All parts including make models of all vendors: <br>
47
[% P.part.picker('part_id', undef, with_makemodel=1) %]<br>
48
All parts including make models of all vendors with multi select popup: <br>
49
[% P.part.picker('part_id', undef, with_makemodel=1, multiple=1) %]<br>
50
All parts including customer partnumbers of all customers: <br>
51
[% P.part.picker('part_id', undef, with_customer_partnumber=1) %]<br>
43 52

  
44 53
<h2>Styling</h2>
45 54

  

Auch abrufbar als: Unified diff