From: Bernd Bleßmann Date: Tue, 25 Aug 2020 13:27:49 +0000 (+0200) Subject: S/D/Order: before_save-hooks f. indiv. Lieferadressen, um … X-Git-Tag: release-3.5.6.1~58 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7cad87f84d2284d6836f17d672ce44c9c3418f2b;p=kivitendo-erp.git S/D/Order: before_save-hooks f. indiv. Lieferadressen, um … - keine leeren zu speichern - das Modul immer auf 'OE' zu setzen --- 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; }