Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3a1b684b

Von Martin Helmling martin.helmling@octosoft.eu vor fast 8 Jahren hinzugefügt

  • ID 3a1b684b14006df369bac9f91a942fd3fd3e40dd
  • Vorgänger ea1c5dfb
  • Nachfolger f3c78a02

partpicker mit classification_id als filter erweitert

Unterschiede anzeigen:

SL/Controller/Part.pm
491 491
      query => [
492 492
        obsolete => 0,
493 493
        SL::DB::Manager::Part->type_filter($::form->{filter}{part_type}),
494
        SL::DB::Manager::PartClassification->classification_filter($::form->{filter}{classification_id}),
494 495
        or => [
495 496
          description => { ilike => $::form->{filter}{'all:substr:multi::ilike'} },
496 497
          partnumber  => { ilike => $::form->{filter}{'all:substr:multi::ilike'} },
......
792 793
      partnumber  => t8('Partnumber'),
793 794
      description  => t8('Description'),
794 795
    },
795
    with_objects => [ qw(unit_obj) ],
796
    with_objects => [ qw(unit_obj classification) ],
796 797
  );
797 798
}
798 799

  
......
915 916
  SL::Controller::Helper::GetModels->new(
916 917
    controller     => $_[0],
917 918
    model          => 'Part',
918
    with_objects   => [ qw(unit_obj partsgroup) ],
919
    with_objects   => [ qw(unit_obj partsgroup classification) ],
919 920
    disable_plugin => 'paginated',
920 921
    source         => $::form->{multi_items},
921 922
    sorted         => {
SL/DB/Manager/PartClassification.pm
9 9

  
10 10
__PACKAGE__->make_manager_methods;
11 11

  
12
sub classification_filter {
13
  my ($class, $classification, $prefix) = @_;
14

  
15
  return () unless $classification;
16

  
17
  $prefix //= '';
18

  
19
  my @classifications = grep { $_ } listify($classification);
20
  return ( $prefix . 'classification_id' => \@classifications );
21
}
22

  
12 23
1;
13 24

  
14 25

  
SL/Presenter/Part.pm
39 39

  
40 40
  my $ret =
41 41
    $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => "@classes", type => 'hidden', id => $id) .
42
    join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(part_type unit convertible_unit)) .
42
    join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(part_type classification_id unit convertible_unit)) .
43 43
    $self->input_tag("", ref $value ? $value->displayable_name : '', id => "${id}_name", %params);
44 44

  
45 45
  $::request->layout->add_javascripts('autocomplete_part.js');
js/autocomplete_part.js
28 28
      UNDEFINED: CLASSES.UNDEFINED
29 29
    }
30 30
    var real_id = $real.attr('id');
31
    var $dummy     = $('#' + real_id + '_name');
32
    var $part_type = $('#' + real_id + '_part_type');
33
    var $unit      = $('#' + real_id + '_unit');
34
    var $convertible_unit = $('#' + real_id + '_convertible_unit');
31
    var $dummy             = $('#' + real_id + '_name');
32
    var $part_type         = $('#' + real_id + '_part_type');
33
    var $classification_id = $('#' + real_id + '_classification_id');
34
    var $unit              = $('#' + real_id + '_unit');
35
    var $convertible_unit  = $('#' + real_id + '_convertible_unit');
35 36
    var state   = STATES.PICKED;
36 37
    var last_real = $real.val();
37 38
    var last_dummy = $dummy.val();
......
66 67
      if ($part_type && $part_type.val())
67 68
        data['filter.part_type'] = $part_type.val().split(',');
68 69

  
70
      if ($classification_id && $classification_id.val())
71
        data['filter.classification_id'] = $classification_id.val().split(',');
72

  
69 73
      if ($unit && $unit.val())
70 74
        data['filter.unit'] = $unit.val().split(',');
71 75

  
......
242 246
    popup_button.click(open_dialog);
243 247

  
244 248
    var pp = {
245
      real:           function() { return $real },
246
      dummy:          function() { return $dummy },
247
      part_type:      function() { return $part_type },
248
      unit:           function() { return $unit },
249
      convertible_unit: function() { return $convertible_unit },
249
      real:              function() { return $real },
250
      dummy:             function() { return $dummy },
251
      part_type:         function() { return $part_type },
252
      classification_id: function() { return $classification_id },
253
      unit:              function() { return $unit },
254
      convertible_unit:  function() { return $convertible_unit },
250 255
      update_results: update_results,
251 256
      result_timer:   result_timer,
252 257
      set_item:       set_item,
......
258 263
            set_item({
259 264
              id:   $(this).children('input.part_picker_id').val(),
260 265
              name: $(this).children('input.part_picker_description').val(),
266
              classification_id: $(this).children('input.part_picker_classification_id').val(),
261 267
              unit: $(this).children('input.part_picker_unit').val(),
262 268
              partnumber:  $(this).children('input.part_picker_partnumber').val(),
263 269
              description: $(this).children('input.part_picker_description').val(),
templates/webpages/part/_part_picker_result.html
1 1
[%- USE T8 %]
2 2
[%- USE HTML %]
3 3
[%- USE L %]
4
[%- USE P %]
4 5
[%- USE LxERP %]
5 6

  
6 7
[%# L.dump(SELF.parts) %]
......
15 16
  <span class='ppp_block_description'>[% part.description | html %]</span>
16 17
  <div style='clear:both;'></div>
17 18
  <span class='ppp_block_sellprice'>[% 'Sellprice' | $T8 %]: [% part.sellprice_as_number | html %]</span>
19
  <span class='ppp_block_description'>[% P.typeclass_abbreviation(part) %]</span>
18 20
</div>
19 21
[%- END %]
20 22

  
templates/webpages/part/test_page.html
13 13
[% L.part_picker('part_id4', undef, part_type='assembly') %]<br>
14 14
Waren und Dienstleistungen: <br>
15 15
[% L.part_picker('part_id5', undef, part_type='part,service') %]<br>
16
Artikel-Klassifizierung: Einkauf <br>
17
[% L.part_picker('part_id10', undef, classification_id='1') %]<br>
18
Artikel-Klassifizierung: Verkauf <br>
19
[% L.part_picker('part_id11', undef, classification_id='2') %]<br>
20
Artikel-Klassifizierung: Handelsware <br>
21
[% L.part_picker('part_id12', undef, classification_id='3') %]<br>
22
Artikel-Klassifizierung: Produktion <br>
23
[% L.part_picker('part_id13', undef, classification_id='4') %]<br>
24
Artikel-Klassifizierung: Eink.,Verk.,Prod. <br>
25
[% L.part_picker('part_id14', undef, classification_id='1,2,4') %]<br>
16 26
Pre-filled:<br>
17 27
[% L.part_picker('part_id6', pre_filled_part) %]<br>
18 28
Convertible unit 'Std': (only select parts with unit Tag/Std/Min)<br>

Auch abrufbar als: Unified diff