Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 91d6a864

Von Werner Hahn vor mehr als 1 Jahr hinzugefügt

  • ID 91d6a8641687772b883ab5ea8ce85497829e80e2
  • Vorgänger 8423bf27
  • Nachfolger e05233a3

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
513 513
                                  part_longdescription => '',
514 514
                                  lastcost             => 0,
515 515
                                  sortorder            => $position,
516
                                  min_order_qty        => '1',
517 516
                                 ) or die "Can't create MakeModel object";
518 517

  
519 518
  my $row_as_html = $self->p->render('part/_makemodel_row',
......
1193 1192
                                    part_longdescription => $makemodel->{part_longdescription} || '',
1194 1193
                                    lastcost             => $::form->parse_amount(\%::myconfig, $makemodel->{lastcost_as_number} || 0),
1195 1194
                                    sortorder            => $position,
1196
                                    min_order_qty => $::form->parse_amount(\%::myconfig, $makemodel->{min_order_qty_as_number} || 0),
1197 1195
                                  ) or die "Can't create mm";
1198 1196
    # $mm->id($makemodel->{id}) if $makemodel->{id};
1199 1197
    push(@makemodel_array, $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