X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FPriceSource.pm;h=aea9f46454c7412939f287e963df35d25d5561b6;hb=e83604f2c7d6d499d9db8d066cc7f637e6f609de;hp=0c3eb877ac1a64d4c8e5dc15c38862a315567744;hpb=b81ceec0ae27fd58adbb724ad99a6ee48a74af35;p=kivitendo-erp.git diff --git a/SL/Controller/PriceSource.pm b/SL/Controller/PriceSource.pm index 0c3eb877a..aea9f4645 100644 --- a/SL/Controller/PriceSource.pm +++ b/SL/Controller/PriceSource.pm @@ -5,14 +5,13 @@ use strict; use parent qw(SL::Controller::Base); use List::MoreUtils qw(any uniq apply); -use SL::ClientJS; use SL::Locale::String qw(t8); use SL::PriceSource; use Rose::Object::MakeMethods::Generic ( scalar => [ qw(record_item) ], - 'scalar --get_set_init' => [ qw(js record) ], + 'scalar --get_set_init' => [ qw(record) ], ); __PACKAGE__->run_before('check_auth'); @@ -25,6 +24,12 @@ sub action_price_popup { my ($self) = @_; my $record_item = _make_record_item($::form->{row}); + my $old_unit; + if (($old_unit = $record_item->{__additional_form_attributes}{unit_old}) && $old_unit ne $record_item->unit) { + # reset unit changes. the way these interact on update breaks stuff + $record_item->unit_obj(SL::DB::Manager::Unit->find_by(name => $old_unit)); + $self->js->val("select[name='unit_$::form->{row}']", $old_unit); + } $self->render_price_dialog($record_item); } @@ -47,7 +52,7 @@ sub render_price_dialog { # $self->js->show('#dialog_flash_error'); # } - $self->js->render($self); + $self->js->render; } @@ -59,10 +64,6 @@ sub check_auth { $::auth->assert('edit_prices'); } -sub init_js { - SL::ClientJS->new -} - sub init_record { _make_record(); }