Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8423bf27

Von Werner Hahn vor mehr als 1 Jahr hinzugefügt

  • ID 8423bf27a0b9dcfdc47896b742f7a61eed32e838
  • Vorgänger c7ad052c
  • Nachfolger 91d6a864

DispositionManager Anpassungen nach Geoffreys patches"

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::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

  
SL/DB/Helper/ALL.pm
108 108
use SL::DB::ProjectRole;
109 109
use SL::DB::ProjectStatus;
110 110
use SL::DB::ProjectType;
111
use SL::DB::PurchaseBasketItem;
111
use SL::DB::PurchaseBasket;
112 112
use SL::DB::PurchaseInvoice;
113 113
use SL::DB::Reclamation;
114 114
use SL::DB::ReclamationItem;
SL/DB/Manager/PurchaseBasket.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::Manager::PurchaseBasket;
5

  
6
use strict;
7

  
8
use parent qw(SL::DB::Helper::Manager);
9

  
10
sub object_class { 'SL::DB::PurchaseBasket' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
1;
SL/DB/Manager/PurchaseBasketItem.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::Manager::PurchaseBasketItem;
5

  
6
use strict;
7

  
8
use parent qw(SL::DB::Helper::Manager);
9

  
10
sub object_class { 'SL::DB::PurchaseBasketItem' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
1;
SL/DB/MetaSetup/PurchaseBasket.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::PurchaseBasket;
4

  
5
use strict;
6

  
7
use parent qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('purchase_basket');
10

  
11
__PACKAGE__->meta->columns(
12
  cleared     => { type => 'boolean', default => 'false', not_null => 1 },
13
  description => { type => 'text' },
14
  id          => { type => 'serial', not_null => 1 },
15
  parts_id    => { type => 'integer' },
16
  qty         => { type => 'numeric', precision => 15, scale => 5 },
17
);
18

  
19
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
20

  
21
__PACKAGE__->meta->foreign_keys(
22
  part => {
23
    class       => 'SL::DB::Part',
24
    key_columns => { parts_id => 'id' },
25
  },
26
);
27

  
28
1;
29
;
SL/DB/MetaSetup/PurchaseBasketItem.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::PurchaseBasketItem;
4

  
5
use strict;
6

  
7
use parent qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('purchase_basket_items');
10

  
11
__PACKAGE__->meta->columns(
12
  cleared     => { type => 'boolean', default => 'false', not_null => 1 },
13
  description => { type => 'text' },
14
  id          => { type => 'serial', not_null => 1 },
15
  parts_id    => { type => 'integer' },
16
  qty         => { type => 'numeric', precision => 15, scale => 5 },
17
);
18

  
19
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
20

  
21
__PACKAGE__->meta->foreign_keys(
22
  part => {
23
    class       => 'SL::DB::Part',
24
    key_columns => { parts_id => 'id' },
25
  },
26
);
27

  
28
1;
29
;
SL/DB/Part.pm
587 587

  
588 588
  foreach my $mm ( @{$_[0]->makemodels} ){
589 589
    my $vendor = SL::DB::Manager::Vendor->get_first( where => [ id => $mm->make ] );
590
    my @tmp = ({ title => $vendor->name, value => $vendor->{id} });
590
    my @tmp = ({ title => $vendor->name . " (" . $::form->format_amount(\%::myconfig, $mm->lastcost, 2) . ")", value => $vendor->{id} });
591 591
    push @vendor_dd, @tmp;
592 592
  }
593 593
  return \@vendor_dd;
SL/DB/PurchaseBasket.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::PurchaseBasket;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::PurchaseBasket;
9
use SL::DB::Manager::PurchaseBasket;
10

  
11
__PACKAGE__->meta->initialize;
12

  
13
1;
SL/DB/PurchaseBasketItem.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::PurchaseBasketItem;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::PurchaseBasketItem;
9
use SL::DB::Manager::PurchaseBasketItem;
10

  
11
__PACKAGE__->meta->initialize;
12

  
13
1;
js/kivi.DispositionManager.js
3 3
    $("table tr").each(function(index) {
4 4
      if ( index !== 0 ) {
5 5
        $row = $(this);
6
        //alert( $row.find("select[name='vendor_id[]']").val() + '!=' + $('#cv_id').val());
7
        if( $row.find("select[name='vendor_id[]']").val() != $('#cv_id').val()) {
6
        //alert( $row.find("select[name='vendor_ids[]']").val() + '!=' + $('#cv_id').val());
7
        if( $row.find("select[name='vendor_ids[]']").val() != $('#cv_id').val()) {
8 8
          $row.remove();
9 9
        }
10 10
      }

Auch abrufbar als: Unified diff