Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4cb05cc1

Von Kivitendo Admin vor mehr als 1 Jahr hinzugefügt

  • ID 4cb05cc1379b91cd436088cbcb4f9ce2acff16e7
  • Vorgänger 4bd64342
  • Nachfolger c7ad052c

Disposition Manager - ein paar Änderungen

  • erster Testfall
  • _get_parts in action_list_parts ausgelagert (besser testbar)
  • Formatierung und Typos

Unterschiede anzeigen:

SL/Controller/DispositionsManager.pm
1 1
package SL::Controller::DispositionsManager;
2 2

  
3

  
4 3
use strict;
5 4

  
6 5
use parent qw(SL::Controller::Base);
......
12 11
sub action_list_parts {
13 12
  my ( $self ) = @_;
14 13

  
15
  my $query = <<SQL;
16
SELECT * FROM parts WHERE onhand <= rop AND rop != 0 AND id NOT IN( SELECT parts_id FROM purchase_basket) AND NOT obsolete
17
SQL
14
  my $parts = $self->_get_parts;
18 15

  
19
  my $parts = SL::DB::Manager::Part->get_objects_from_sql( sql => $query );
20 16
  $self->_setup_list_action_bar;
21 17
  $self->render('dispositionsmanager/list_parts', title => t8('Parts short onhand'), PARTS => $parts);
22

  
23

  
24 18
}
25 19

  
26 20
sub action_add_to_purchase_basket{
......
30 24
  foreach my $id (@{ $parts_to_add }) {
31 25
    my $part = SL::DB::Manager::Part->get_first( query => [ id => $id ] );
32 26
    my $basket_part = SL::DB::PurchaseBasket->new(
33
                              parts_id    => $part->id,
34
                              qty         => $part->min_order_qty,
35
                              description => $part->description,
36
                            );
27
      parts_id    => $part->id,
28
      qty         => $part->min_order_qty,
29
      description => $part->description,
30
    );
37 31
   $basket_part->save;
38 32
 }
39 33
 $self->action_show_basket;
......
46 40
  $::request->{layout}->add_javascripts('kivi.DispositionsManager.js');
47 41
  my $basket = SL::DB::Manager::PurchaseBasket->get_all( query => [ cleared => 'F' ],  with_objects => [ 'parts', 'parts.makemodels' ]);
48 42
  $self->_setup_show_basket_action_bar;
49
  $self->render('dispositionsmanager/show_purchase_basket', PARTS => $basket, title => "Purchasebasket" );
43
  $self->render('dispositionsmanager/show_purchase_basket', PARTS => $basket, title => "Purchase basket" );
50 44
}
51 45

  
52 46
sub action_transfer_to_purchase_order {
......
118 112

  
119 113
}
120 114

  
115
sub _get_parts {
116
  my ($self) = @_;
117

  
118
  my $query = <<SQL;
119
SELECT *
120
  FROM parts
121
 WHERE onhand <= rop
122
   AND rop != 0
123
   AND id NOT IN( SELECT parts_id FROM purchase_basket ) AND NOT obsolete
124
SQL
125

  
126
  return SL::DB::Manager::Part->get_objects_from_sql( sql => $query );
127
};
128

  
129

  
121 130
sub _setup_list_action_bar {
122 131
  my ($self) = @_;
123 132
  for my $bar ($::request->layout->get('actionbar')) {
......
155 164

  
156 165
=head1 NAME
157 166

  
158
SL::Controller::DispositionsManager Controller to manage purchaseorders for parts
167
SL::Controller::DispositionsManager Controller to manage purchase orders for parts
159 168

  
160 169
=head1 DESCRIPTION
161 170

  
162
This Controller shows a list of parts using the filter minimum stock (rop).
171
This controller shows a list of parts using the filter minimum stock (rop).
163 172
From this list it is possible to put parts in a purchase basket to order.
164 173
It's also possible to put parts from the parts edit form in the purchase basket.
165 174

  
166
From the purchase basket you can create a purchaseorder by using the filter vendor.
175
From the purchase basket you can create a purchase order by using the filter vendor.
167 176
The quantity to order will be prefilled by the value min_qty_to_order from parts or
168
makemodel(vendor_parts) or default qty 1.
177
makemodel(vendor_parts) or default to qty 1.
169 178

  
170 179
Tables:
171 180

  
......
175 184

  
176 185
=back
177 186

  
178
Depencies:
187
Dependencies:
179 188

  
180 189
=over 2
181 190

  
......
200 209

  
201 210
=item C<action_show_basket>
202 211

  
203
Shows a list with parts wich are in the basket.
204
This List can be filtered by vendor. Then you can create a purchaseorder.
212
Shows a list with parts which are in the basket.
213
This list can be filtered by vendor. Then you can create a purchase order.
205 214

  
206 215
=item C<action_transfer_to_purchase_order>
207 216

  
208 217
Transfers the marked and by vendor filtered parts to a purchase order.
209
Deletes the entry in the purchasebasket.
218
Deletes the entry in the purchase basket.
210 219

  
211 220
=back
212 221

  

Auch abrufbar als: Unified diff