X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/20e24a4a3afcdcf95348bd01f43f7e43550ffd7c..f217d072d76183bc07723dcc29503b732bd2022d:/SL/Controller/DeliveryTerm.pm diff --git a/SL/Controller/DeliveryTerm.pm b/SL/Controller/DeliveryTerm.pm index 47392d947..86c0ed19f 100644 --- a/SL/Controller/DeliveryTerm.pm +++ b/SL/Controller/DeliveryTerm.pm @@ -4,8 +4,10 @@ use strict; use parent qw(SL::Controller::Base); +use SL::DB::Customer; use SL::DB::DeliveryTerm; use SL::DB::Language; +use SL::DB::Vendor; use SL::Helper::Flash; use SL::Locale::String qw(t8); @@ -110,6 +112,15 @@ sub create_or_update { $self->{delivery_term}->save_attribute_translation('description_long', $language, $::form->{"translation_" . $language->id}); } + if ($::form->{remove_customer_vendor_delivery_terms}) { + foreach my $class (qw(Customer Vendor)) { + "SL::DB::Manager::${class}"->update_all( + set => { delivery_term_id => undef }, + where => [ delivery_term_id => $self->{delivery_term}->id ], + ); + } + } + flash_later('info', $is_new ? $::locale->text('The delivery term has been created.') : $::locale->text('The delivery term has been saved.')); $self->redirect_to(action => 'list'); } @@ -166,6 +177,7 @@ sub setup_form_action_bar { ], ); } + $::request->layout->add_javascripts('kivi.Validator.js'); } 1;