Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5e9fd0ac

Von Werner Hahn vor mehr als 1 Jahr hinzugefügt

  • ID 5e9fd0acd89a899b2d93e13818fe1bdda8abb650
  • Vorgänger 34d34bef
  • Nachfolger c6bf6a01

Dispositionsmanager: Anpassungen an odyn

Unterschiede anzeigen:

SL/Controller/DispositionManager.pm
5 5
use parent qw(SL::Controller::Base);
6 6

  
7 7
use SL::DB::Part;
8
use SL::DB::PurchaseBasket;
8
use SL::DB::PurchaseBasketItem;
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::PurchaseBasket->new(
28
    my $basket_part = SL::DB::PurchaseBasketItem->new(
29 29
      parts_id    => $part->id,
30
      qty         => $part->min_order_qty, # was ist wenn min_order_qty < (rop-onhand) ist? sollte dann nicht (rop-onhand) genommen werden?
30
      qty         => $part->ordersize, # was ist wenn order_size < (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
32 32
    )->save;
33 33
 }
......
39 39
  my ( $self ) = @_;
40 40

  
41 41
  $::request->{layout}->add_javascripts('kivi.DispositionManager.js');
42
  my $basket_items = SL::DB::Manager::PurchaseBasket->get_all( query => [ cleared => 'F' ],  with_objects => [ 'part', 'part.makemodels' ]);
42
  my $basket_items = SL::DB::Manager::PurchaseBasketItem->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::PurchaseBasket->get_all( query => [ id => \@{ $::form->{ids} } ] );
62
  my $basket_items = SL::DB::Manager::PurchaseBasketItem->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::PurchaseBasket->delete_all( where => [ id => \@{ $::form->{ids} }]);
115
    SL::DB::Manager::PurchaseBasketItem->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 )
129
   AND id NOT IN( SELECT parts_id FROM purchase_basket_items )
130 130
   AND NOT obsolete
131 131
SQL
132 132

  
SL/Controller/Part.pm
506 506
  my $mm = SL::DB::MakeModel->new(# parts_id    => $::form->{part}->{id},
507 507
                                  make          => $vendor->id,
508 508
                                  model         => '',
509
                                  min_order_qty => '1',
510 509
                                  lastcost      => 0,
511 510
                                  sortorder     => $position,
512 511
                                 ) or die "Can't create MakeModel object";
......
1112 1111
                                    id        => $makemodel->{id},
1113 1112
                                    make      => $makemodel->{make},
1114 1113
                                    model     => $makemodel->{model} || '',
1115
                                    min_order_qty => $::form->parse_amount(\%::myconfig, $makemodel->{min_order_qty_as_number} || 0),
1116 1114
                                    lastcost  => $::form->parse_amount(\%::myconfig, $makemodel->{lastcost_as_number} || 0),
1117 1115
                                    sortorder => $position,
1118 1116
                                  ) or die "Can't create mm";
sql/Pg-upgrade2/purchase_basket.sql
10 10
  description text,
11 11
  cleared BOOLEAN NOT NULL DEFAULT FALSE
12 12
);
13

  
14
ALTER TABLE parts     ADD COLUMN min_order_qty NUMERIC(15,5);
15
ALTER TABLE makemodel ADD COLUMN min_order_qty NUMERIC(15,5);
templates/webpages/disposition_manager/list_parts.html
24 24
        <td>[% HTML.escape(part.description) %]</td>
25 25
        <td class="numeric">[% part.onhand_as_number %]</td>
26 26
        <td class="numeric">[% part.rop_as_number %]           </td>
27
        <td class="numeric">[% part.min_order_qty_as_number %] </td>
27
        <td class="numeric">[% part.ordersize_as_number %] </td>
28 28
      </tr>
29 29
      [% END %]
30 30
    [% END %]
templates/webpages/part/_basic_data.html
178 178
           </td>
179 179
          </tr>
180 180
        [%- END %]
181
          <tr>
182
           <th align="right" nowrap="true">[% 'Minimum order Quantity' | $T8 %]</th>
183
           <td>[% L.input_tag("part.min_order_qty_as_number", SELF.part.min_order_qty_as_number, size=10, class="reformat_number numeric") %]</td>
184
          </tr>
185 181
          <tr>
186 182
           <th align="right" nowrap="true">[% 'Verrechnungseinheit' | $T8 %]</th>
187 183
           <td>[% L.input_tag("part.ve", SELF.part.ve, size=10) %]</td>

Auch abrufbar als: Unified diff