Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fbf7abba

Von Bernd Bleßmann vor 25 Tagen hinzugefügt

  • ID fbf7abba5ee17530a33e720088ef1a6da60e9df8
  • Vorgänger c20fe7f4
  • Nachfolger ee3de254

S:C:Part: Lagerplatz-Presenter verwenden

Unterschiede anzeigen:

SL/Controller/Part.pm
40 40
                                  orphaned
41 41
                                  assortment assortment_items assembly assembly_items
42 42
                                  all_pricegroups all_translations all_partsgroups all_units
43
                                  all_buchungsgruppen all_payment_terms all_warehouses
43
                                  all_buchungsgruppen all_payment_terms
44 44
                                  parts_classification_filter
45 45
                                  all_languages all_units all_price_factors
46 46
                                  all_businesses) ],
47
  'scalar'                => [ qw(warehouse bin stock_amounts journal) ],
47
  'scalar'                => [ qw(stock_amounts journal) ],
48 48
);
49 49

  
50 50
# safety
......
666 666
  $self->js->run('kivi.Part.redisplay_items', \@to_sort)->render;
667 667
}
668 668

  
669
sub action_warehouse_changed {
670
  my ($self) = @_;
671

  
672
  if ($::form->{warehouse_id} ) {
673
    $self->warehouse(SL::DB::Manager::Warehouse->find_by_or_create(id => $::form->{warehouse_id}));
674
    die unless ref($self->warehouse) eq 'SL::DB::Warehouse';
675

  
676
    if ( $self->warehouse->id and @{$self->warehouse->bins} ) {
677
      $self->bin($self->warehouse->bins_sorted_naturally->[0]);
678
      $self->js
679
        ->html('#bin', $self->build_bin_select)
680
        ->focus('#part_bin_id');
681
      return $self->js->render;
682
    }
683
  }
684

  
685
  # no warehouse was selected, empty the bin field and reset the id
686
  $self->js
687
       ->val('#part_bin_id', undef)
688
       ->html('#bin', '');
689

  
690
  return $self->js->render;
691
}
692

  
693 669
sub action_ajax_autocomplete {
694 670
  my ($self, %params) = @_;
695 671

  
......
1201 1177
  };
1202 1178
}
1203 1179

  
1204
sub build_bin_select {
1205
  select_tag('part.bin_id', [ @{ $_[0]->warehouse->bins_sorted_naturally } ],
1206
    title_key => 'description',
1207
    default   => $_[0]->bin->id,
1208
  );
1209
}
1210

  
1211

  
1212 1180
# get_set_inits for partpicker
1213 1181

  
1214 1182
sub init_parts {
......
1375 1343
  return \@array;
1376 1344
}
1377 1345

  
1378
sub init_all_warehouses {
1379
  my ($self) = @_;
1380
  SL::DB::Manager::Warehouse->get_all(query => [ or => [ invalid => 0, invalid => undef, id => $self->part->warehouse_id ] ]);
1381
}
1382

  
1383 1346
sub init_all_languages {
1384 1347
  SL::DB::Manager::Language->get_all_sorted;
1385 1348
}

Auch abrufbar als: Unified diff