Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8d87ea57

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID 8d87ea5750980847720a4dd48f7f62e378416895
  • Vorgänger 81379539
  • Nachfolger 05d72378

Artikelnummernvergabe im TransNumberGenerator

Unterschiede anzeigen:

SL/DB/Helper/TransNumberGenerator.pm
10 10

  
11 11
use SL::DB::Default;
12 12

  
13
my $oe_scoping = sub {
13
sub oe_scoping {
14 14
  SL::DB::Manager::Order->type_filter($_[0]);
15
};
15
}
16 16

  
17
my $do_scoping = sub {
17
sub do_scoping {
18 18
  SL::DB::Manager::DeliveryOrder->type_filter($_[0]);
19
};
20

  
21
my %specs = ( ar                      => { number_column => 'invnumber',                                                                       fill_holes_in_range => 1 },
22
              sales_quotation         => { number_column => 'quonumber',      number_range_column => 'sqnumber',       scoping => $oe_scoping,                          },
23
              sales_order             => { number_column => 'ordnumber',      number_range_column => 'sonumber',       scoping => $oe_scoping,                          },
24
              request_quotation       => { number_column => 'quonumber',      number_range_column => 'rfqnumber',      scoping => $oe_scoping,                          },
25
              purchase_order          => { number_column => 'ordnumber',      number_range_column => 'ponumber',       scoping => $oe_scoping,                          },
26
              sales_delivery_order    => { number_column => 'donumber',       number_range_column => 'sdonumber',      scoping => $do_scoping, fill_holes_in_range => 1 },
27
              purchase_delivery_order => { number_column => 'donumber',       number_range_column => 'pdonumber',      scoping => $do_scoping, fill_holes_in_range => 1 },
28
              customer                => { number_column => 'customernumber', number_range_column => 'customernumber',                                                  },
29
              vendor                  => { number_column => 'vendornumber',   number_range_column => 'vendornumber',                                                    },
19
}
20

  
21
sub parts_scoping {
22
  SL::DB::Manager::Part->type_filter($_[0]);
23
}
24

  
25
my %specs = ( ar                      => { number_column => 'invnumber',                                                                        fill_holes_in_range => 1 },
26
              sales_quotation         => { number_column => 'quonumber',      number_range_column => 'sqnumber',       scoping => \&oe_scoping,                          },
27
              sales_order             => { number_column => 'ordnumber',      number_range_column => 'sonumber',       scoping => \&oe_scoping,                          },
28
              request_quotation       => { number_column => 'quonumber',      number_range_column => 'rfqnumber',      scoping => \&oe_scoping,                          },
29
              purchase_order          => { number_column => 'ordnumber',      number_range_column => 'ponumber',       scoping => \&oe_scoping,                          },
30
              sales_delivery_order    => { number_column => 'donumber',       number_range_column => 'sdonumber',      scoping => \&do_scoping, fill_holes_in_range => 1 },
31
              purchase_delivery_order => { number_column => 'donumber',       number_range_column => 'pdonumber',      scoping => \&do_scoping, fill_holes_in_range => 1 },
32
              customer                => { number_column => 'customernumber', number_range_column => 'customernumber',                                                   },
33
              vendor                  => { number_column => 'vendornumber',   number_range_column => 'vendornumber',                                                     },
34
              part                    => { number_column => 'partnumber',     number_range_column => 'articlenumber',  scoping => \&parts_scoping                        },
35
              service                 => { number_column => 'partnumber',     number_range_column => 'servicenumber',  scoping => \&parts_scoping                        },
36
              assembly                => { number_column => 'partnumber',     number_range_column => 'articlenumber',  scoping => \&parts_scoping                        },
30 37
            );
31 38

  
32 39
sub get_next_trans_number {
SL/DB/Part.pm
9 9
use SL::DB::MetaSetup::Part;
10 10
use SL::DB::Manager::Part;
11 11
use SL::DB::Chart;
12
use SL::DB::Helper::TransNumberGenerator;
12 13

  
13 14
__PACKAGE__->meta->add_relationships(
14 15
  unit_obj                     => {
......
40 41

  
41 42
__PACKAGE__->meta->initialize;
42 43

  
44
__PACKAGE__->before_save('_before_save_set_partnumber');
45

  
46
sub _before_save_set_partnumber {
47
  my ($self) = @_;
48

  
49
  $self->create_trans_number if $self->partnumber eq '';
50
  return 1;
51
}
52

  
43 53
sub is_type {
44 54
  my $self = shift;
45 55
  my $type  = lc(shift || '');

Auch abrufbar als: Unified diff