From 9716e08ebc2431c0aaf3410e016a06d25f7218ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 6 Aug 2015 11:29:20 +0200 Subject: [PATCH] PriceSource: Vor Popup Einheit resetten MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Ansonsten gibt es beim nächsten Update Probleme mit doppelt formatierten Einheiten. --- SL/Controller/PriceSource.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SL/Controller/PriceSource.pm b/SL/Controller/PriceSource.pm index 0c3eb877a..10763ce55 100644 --- a/SL/Controller/PriceSource.pm +++ b/SL/Controller/PriceSource.pm @@ -25,6 +25,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); } -- 2.20.1