Bug 2664: Add item should preselect logged in branch
authorColin Campbell <colin.campbell@ptfs-europe.com>
Tue, 5 Oct 2010 11:48:25 +0000 (07:48 -0400)
committerGalen Charlton <gmcharlt@gmail.com>
Wed, 6 Oct 2010 10:18:58 +0000 (06:18 -0400)
An earlier fix to stop branch values being overwritten in
edit items was causing the branch value to be unset when adding items

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
cataloguing/additem.pl

index ea4daf9..e6f19d2 100755 (executable)
@@ -433,7 +433,10 @@ foreach my $tag (sort keys %{$tagslib}) {
           foreach my $thisbranch (@$branches) {
               push @authorised_values, $thisbranch->{value};
               $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname};
-             # $value = $thisbranch->{value} if $thisbranch->{selected};
+              # in edit item this is set to the data value otherwise use default
+              if ($op ne 'edititem' && $thisbranch->{selected} ) {
+                  $value = $thisbranch->{value};
+              }
           }
       }
       elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {