From 7cad87f84d2284d6836f17d672ce44c9c3418f2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 25 Aug 2020 15:27:49 +0200 Subject: [PATCH] =?utf8?q?S/D/Order:=20before=5Fsave-hooks=20f.=20indiv.?= =?utf8?q?=20Lieferadressen,=20um=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - keine leeren zu speichern - das Modul immer auf 'OE' zu setzen --- SL/DB/Order.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index 657252f8a..af5d80353 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -58,6 +58,8 @@ __PACKAGE__->attr_sorted('items'); __PACKAGE__->before_save('_before_save_set_ord_quo_number'); __PACKAGE__->before_save('_before_save_create_new_project'); +__PACKAGE__->before_save('_before_save_remove_empty_custom_shipto'); +__PACKAGE__->before_save('_before_save_set_custom_shipto_module'); # hooks @@ -98,6 +100,23 @@ sub _before_save_create_new_project { return 1; } + +sub _before_save_remove_empty_custom_shipto { + my ($self) = @_; + + $self->custom_shipto(undef) if $self->custom_shipto && $self->custom_shipto->is_empty; + + return 1; +} + +sub _before_save_set_custom_shipto_module { + my ($self) = @_; + + $self->custom_shipto->module('OE') if $self->custom_shipto; + + return 1; +} + # methods sub items { goto &orderitems; } -- 2.20.1