Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5f543a5e

Von Sven Schöling vor mehr als 11 Jahren hinzugefügt

  • ID 5f543a5e090f24b33854c4f0f64dae1674276cd6
  • Vorgänger b167020e
  • Nachfolger 5491c513

mini_stock auch direkt nach dem einlagern anzeigen.

Unterschiede anzeigen:

SL/Controller/Inventory.pm
28 28
__PACKAGE__->run_before('load_wh_from_form',     only => [ qw(stock_in warehouse_changed stock) ]);
29 29
__PACKAGE__->run_before('load_bin_from_form',    only => [ qw(stock_in stock) ]);
30 30
__PACKAGE__->run_before('set_target_from_part',  only => [ qw(part_changed) ]);
31
__PACKAGE__->run_before('mini_stock',            only => [ qw(stock_in mini_stock) ]);
31 32
__PACKAGE__->run_before('sanitize_target',       only => [ qw(stock_in warehouse_changed part_changed) ]);
32 33
__PACKAGE__->run_before('set_layout');
33 34

  
......
104 105
sub action_mini_stock {
105 106
  my ($self) = @_;
106 107

  
107
  my $stock        = $self->part->get_simple_stock;
108
  my $stock_by_bin = { map { $_->{bin_id} => $_ } @$stock };
109
  my $stock_empty  = ! grep { $_->{sum} * 1 } @$stock;
110

  
111 108
  $self->js
112
    ->html('#stock', $self->render('inventory/_stock', { output => 0 }, stock => $stock_by_bin, stock_empty => $stock_empty ))
109
    ->html('#stock', $self->render('inventory/_stock', { output => 0 }))
113 110
    ->render($self);
114 111
}
115 112

  
......
224 221
  return \@sorted;
225 222
}
226 223

  
224
sub mini_stock {
225
  my ($self) = @_;
226

  
227
  my $stock             = $self->part->get_simple_stock;
228
  $self->{stock_by_bin} = { map { $_->{bin_id} => $_ } @$stock };
229
  $self->{stock_empty}  = ! grep { $_->{sum} * 1 } @$stock;
230
}
231

  
227 232
sub show_no_warehouse_error {
228 233
  my ($self) = @_;
229 234

  
templates/webpages/inventory/_stock.html
5 5
[%- IF SELF.part.id %]
6 6
<h3>[% LxERP.t8('Stock for part #1', SELF.part.long_description) %]</h3>
7 7

  
8
[%- IF stock_empty && !SELF.part.bin_id  %]
8
[%- IF SELF.stock_empty && !SELF.part.bin_id  %]
9 9
<p>[% 'Nothing stocked yet.' | $T8 %]</p>
10 10
[%- ELSE %]
11 11
<table>
......
17 17
[%- FOREACH wh = SELF.warehouses -%]
18 18
[%- FOREACH bin = wh.bins -%]
19 19
  [%#- display any bins with stock and default bin -%]
20
  [%- SET stock__set = stock.${bin.id} -%]
20
  [%- SET stock__set = SELF.stock_by_bin.${bin.id} -%]
21 21
  [%- IF stock__set.sum > 0 || SELF.part.bin_id == bin.id -%]
22 22
  <tr class='listrow'>
23 23
    <td>[% bin.warehouse.description %]</td>

Auch abrufbar als: Unified diff