Revision 34d34bef
Von Werner Hahn vor mehr als 1 Jahr hinzugefügt
SL/Controller/DispositionManager.pm | ||
---|---|---|
5 | 5 |
use parent qw(SL::Controller::Base); |
6 | 6 |
|
7 | 7 |
use SL::DB::Part; |
8 |
use SL::DB::PurchaseBasketItem;
|
|
8 |
use SL::DB::PurchaseBasket; |
|
9 | 9 |
use SL::PriceSource; |
10 | 10 |
use SL::Locale::String qw(t8); |
11 | 11 |
use Data::Dumper; |
... | ... | |
25 | 25 |
my $parts_to_add = delete($::form->{ids}) || []; |
26 | 26 |
foreach my $id (@{ $parts_to_add }) { |
27 | 27 |
my $part = SL::DB::Manager::Part->find_by(id => $id) or die "Can't find part with id: $id\n"; |
28 |
my $basket_part = SL::DB::PurchaseBasketItem->new(
|
|
28 |
my $basket_part = SL::DB::PurchaseBasket->new( |
|
29 | 29 |
parts_id => $part->id, |
30 | 30 |
qty => $part->min_order_qty, # was ist wenn min_order_qty < (rop-onhand) ist? sollte dann nicht (rop-onhand) genommen werden? |
31 | 31 |
description => $part->description, # Warum wird description zusätzlich gespeichert, parts_id sollte doch reichen? Falls die sich in den Stammdaten in der Zwischenzeit verändert? zumal du in action_transfer_to_purchase_order explizit $part->description verwendest |
... | ... | |
39 | 39 |
my ( $self ) = @_; |
40 | 40 |
|
41 | 41 |
$::request->{layout}->add_javascripts('kivi.DispositionManager.js'); |
42 |
my $basket_items = SL::DB::Manager::PurchaseBasketItem->get_all( query => [ cleared => 'F' ], with_objects => [ 'part', 'part.makemodels' ]);
|
|
42 |
my $basket_items = SL::DB::Manager::PurchaseBasket->get_all( query => [ cleared => 'F' ], with_objects => [ 'part', 'part.makemodels' ]); |
|
43 | 43 |
$self->_setup_show_basket_action_bar; |
44 | 44 |
$self->render('disposition_manager/show_purchase_basket', BASKET_ITEMS => $basket_items, title => "Purchase basket" ); |
45 | 45 |
} |
... | ... | |
59 | 59 |
$vendor = SL::DB::Manager::Vendor->find_by(id => $v_id) or die "Can't find vendor"; |
60 | 60 |
$employee = SL::DB::Manager::Employee->current or die "Can't find employee"; |
61 | 61 |
|
62 |
my $basket_items = SL::DB::Manager::PurchaseBasketItem->get_all( query => [ id => \@{ $::form->{ids} } ] );
|
|
62 |
my $basket_items = SL::DB::Manager::PurchaseBasket->get_all( query => [ id => \@{ $::form->{ids} } ] ); |
|
63 | 63 |
|
64 | 64 |
# create order first so we have a record for PriceSource |
65 | 65 |
my $order = SL::DB::Order->new( |
... | ... | |
112 | 112 |
$item->{custom_variables} = \@{ $item->cvars_by_config }; |
113 | 113 |
$item->save; |
114 | 114 |
} |
115 |
SL::DB::Manager::PurchaseBasketItem->delete_all( where => [ id => \@{ $::form->{ids} }]);
|
|
115 |
SL::DB::Manager::PurchaseBasket->delete_all( where => [ id => \@{ $::form->{ids} }]); |
|
116 | 116 |
return 1; |
117 | 117 |
}) || die "error: " . $order->db->error; |
118 | 118 |
$self->redirect_to(controller => "oe.pl", action => 'edit', type => 'purchase_order', vc => 'vendor', id => $order->id); |
... | ... | |
126 | 126 |
FROM parts |
127 | 127 |
WHERE onhand <= rop |
128 | 128 |
AND rop != 0 |
129 |
AND id NOT IN( SELECT parts_id FROM purchase_basket_items )
|
|
129 |
AND id NOT IN( SELECT parts_id FROM purchase_basket ) |
|
130 | 130 |
AND NOT obsolete |
131 | 131 |
SQL |
132 | 132 |
|
Auch abrufbar als: Unified diff
DispositionManager Anpassungen nach Geoffreys patches"