Part Controller - Artikelnummer von unbenutzten Artikeln ändern
authorG. Richardson <information@kivitendo-premium.de>
Wed, 11 Jan 2017 10:14:17 +0000 (11:14 +0100)
committerG. Richardson <information@kivitendo-premium.de>
Wed, 11 Jan 2017 10:14:17 +0000 (11:14 +0100)
SL/Controller/Part.pm
templates/webpages/part/_basic_data.html

index 350edec..5dc37b4 100644 (file)
@@ -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;
 
index 6b79e51..c9a2d69 100644 (file)
@@ -20,7 +20,7 @@
              <tr>
               <th align="right">[% 'Part Number' | $T8 %]</th>
               [% SET readonly = 1 %]
-              [% UNLESS SELF.part.id %][% readonly = 0 %][% END %]
+              [%- IF !SELF.part.id or SELF.part.orphaned %][% readonly = 0 %][% END %]
               <td>[% L.input_tag("part.partnumber", SELF.part.partnumber, size=40, readonly=readonly class="initial_focus") %]</td>
              </tr>
              <tr>