From e2ef75e554021d66214ad31b7c135243cc50765c Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Wed, 11 Jan 2017 11:14:17 +0100 Subject: [PATCH] =?utf8?q?Part=20Controller=20-=20Artikelnummer=20von=20un?= =?utf8?q?benutzten=20Artikeln=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Part.pm | 4 ++-- templates/webpages/part/_basic_data.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index 350edec13..5dc37b45a 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -669,8 +669,8 @@ sub parse_form { my $params = delete($::form->{part}) || { }; delete $params->{id}; - # never overwrite existing partnumber, should be a read-only field anyway - delete $params->{partnumber} if $self->part->partnumber; + # never overwrite existing partnumber for parts in use, should be a read-only field in that case anyway + delete $params->{partnumber} if $self->part->partnumber and not $self->orphaned; $self->part->assign_attributes(%{ $params}); $self->part->bin_id(undef) unless $self->part->warehouse_id; diff --git a/templates/webpages/part/_basic_data.html b/templates/webpages/part/_basic_data.html index 6b79e51aa..c9a2d69d4 100644 --- a/templates/webpages/part/_basic_data.html +++ b/templates/webpages/part/_basic_data.html @@ -20,7 +20,7 @@ [% 'Part Number' | $T8 %] [% SET readonly = 1 %] - [% UNLESS SELF.part.id %][% readonly = 0 %][% END %] + [%- IF !SELF.part.id or SELF.part.orphaned %][% readonly = 0 %][% END %] [% L.input_tag("part.partnumber", SELF.part.partnumber, size=40, readonly=readonly class="initial_focus") %] -- 2.20.1