From 08d2e0ca58ed59ec1cef94415221a1eb61557aa1 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 11 Jul 2013 09:28:38 +0200 Subject: [PATCH] SL::DB::DeliveryOrder: donumber in before_save-Hook erzeugen --- SL/DB/DeliveryOrder.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; } -- 2.20.1