Revision 1bcb4ec6
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/DB/Order.pm | ||
---|---|---|
34 | 34 |
|
35 | 35 |
__PACKAGE__->meta->initialize; |
36 | 36 |
|
37 |
__PACKAGE__->before_save('_before_save_set_ord_quo_number'); |
|
38 |
|
|
39 |
# hooks |
|
40 |
|
|
41 |
sub _before_save_set_ord_quo_number { |
|
42 |
my ($self) = @_; |
|
43 |
|
|
44 |
# ordnumber is 'NOT NULL'. Therefore make sure it's always set to at |
|
45 |
# least an empty string, even if we're saving a quotation. |
|
46 |
$self->ordnumber('') if !$self->ordnumber; |
|
47 |
|
|
48 |
my $field = $self->quotation ? 'quonumber' : 'ordnumber'; |
|
49 |
$self->create_trans_number if !$self->$field; |
|
50 |
|
|
51 |
return 1; |
|
52 |
} |
|
53 |
|
|
37 | 54 |
# methods |
38 | 55 |
|
39 | 56 |
sub items { goto &orderitems; } |
Auch abrufbar als: Unified diff
SL::DB::Order: quo/ordnumber in before_save-Hook erzeugen