From: Moritz Bunkus Date: Thu, 11 Jul 2013 07:28:38 +0000 (+0200) Subject: SL::DB::DeliveryOrder: donumber in before_save-Hook erzeugen X-Git-Tag: release-3.1.0beta1~196 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=08d2e0ca58ed59ec1cef94415221a1eb61557aa1;p=kivitendo-erp.git SL::DB::DeliveryOrder: donumber in before_save-Hook erzeugen --- diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm index 7b530c639..372a5cc3a 100644 --- a/SL/DB/DeliveryOrder.pm +++ b/SL/DB/DeliveryOrder.pm @@ -20,6 +20,18 @@ __PACKAGE__->meta->add_relationship(orderitems => { type => 'one to many __PACKAGE__->meta->initialize; +__PACKAGE__->before_save('_before_save_set_donumber'); + +# hooks + +sub _before_save_set_donumber { + my ($self) = @_; + + $self->create_trans_number if !$self->donumber; + + return 1; +} + # methods sub items { goto &orderitems; }