Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 76bfa214

Von Werner Hahn vor mehr als 1 Jahr hinzugefügt

  • ID 76bfa2147e1cb444e29e41fdc477680eafc8d88a
  • Vorgänger 11200ac6
  • Nachfolger 104ebdfd

HMO: Tests Dispositionsmanager aufgearbeitet

Unterschiede anzeigen:

SL/Controller/DispositionManager.pm
137 137

  
138 138
  my ( $self ) = @_;
139 139
  require SL::DB::Order;
140
  require SL::DB::OrderItem;
140
  # require SL::DB::OrderItem;
141 141
  require SL::DB::Vendor;
142 142
  my @error_report;
143 143

  
SL/DB/Part.pm
335 335

  
336 336
  my ($self, %params) = @_;
337 337

  
338
  require SL::DB::OrderItem;
338
  #require SL::DB::OrderItem;
339 339
  my $orders_count = SL::DB::Manager::OrderItem->get_all_count( where => [ %params ], with_objects => 'order' );
340 340

  
341 341
  return $orders_count == 1 ? 1 : 0;
t/controllers/disposition_manager/disposition_manager.t
18 18
use utf8;
19 19

  
20 20
Support::TestSetup::login();
21

  
22 21
clear_up();
23 22

  
24 23
my ($wh, $bin) = create_warehouse_and_bins();
......
30 29
  sellprice    => 5,
31 30
  lastcost     => 3,
32 31
  rop          => 20,
33
  ordersize    => 2,
32
  ordersize    => 1,
34 33
  warehouse_id => $wh->id,
35 34
  bin_id       => $bin->id,
36 35
  makemodels   => [ _create_makemodel_for_vendor(vendor => $vendor) ],
......
49 48
    partnumber   => "TPO $i",
50 49
    description  => "Testpart onhand $i",
51 50
    rop          => 50,
52
    ordersize    => 2,
51
    ordersize    => $i+2,
53 52
    sellprice    => 5,
54 53
    lastcost     => 3,
55 54
    warehouse_id => $wh->id,
......
87 86
$::form->{ids}        = [ map { $_->id       } @{ $purchase_basket_items } ];
88 87
$::form->{vendor_ids} = [ map { $vendor->id  } @{ $purchase_basket_items } ];
89 88

  
90
$output;
91
open(my $outputFH, '>', \$output) or die;
89
open($outputFH, '>', \$output) or die;
92 90
$oldFH = select $outputFH;
93 91
$controller->action_transfer_to_purchase_order;
94 92
select $oldFH;
......
100 98
my $purchase_order = SL::DB::Manager::Order->get_first();
101 99

  
102 100
is( scalar @{$purchase_order->items}, 6, "Purchase order has 6 item ok");
101
print "PART\n";
102
print Dumper($part1);
103 103
my $first_item = $purchase_order->items_sorted->[0];
104
print "FIRST\n";
105
print Dumper($first_item);
104 106
is( $first_item->parts_id, $part1->id, "Purchase order: first item is part1");
105
is( $first_item->qty, '2.0000000', "Purchase order: first item has qty 2");
106
cmp_ok( $purchase_order->netamount, '==', 24, "Purchase order: netamount ok");
107
is( $first_item->active_price_source, 'makemodel/' . $part1->makemodels->[0]->id . "/" . $part1->makemodels->[0]->parts_id . "/" . $part1->makemodels->[0]->make, "Purchase order: first item has correct active_price_source");
107
is( $first_item->qty, '1.0000000', "Purchase order: first item has qty 1");
108
cmp_ok( $purchase_order->netamount, '==', 52, "Purchase order: netamount ok");
109
is( $first_item->active_price_source, 'makemodel/' . $part1->makemodels->[0]->id . "/" . $part1->makemodels->[0]->parts_id . "/" . $part1->makemodels->[0]->make, "Purchase order: first item has correct active_price_source" . $first_item->part->partnumber);
108 110

  
109 111
clear_up();
110 112
done_testing();

Auch abrufbar als: Unified diff