fix for bug 2282: Biblio framework subfields...
[koha.git] / cataloguing / additem.pl
index e575fa6..79b2264 100755 (executable)
@@ -127,13 +127,13 @@ if ($op eq "additem") {
 } elsif ($op eq "edititem") {
 #-------------------------------------------------------------------------------
 # retrieve item if exist => then, it's a modif
-    $itemrecord = GetMarcItem($biblionumber,$itemnumber);
+    $itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber);
     $nextop="saveitem";
 #-------------------------------------------------------------------------------
 } elsif ($op eq "delitem") {
 #-------------------------------------------------------------------------------
     # check that there is no issue on this item before deletion.
-    my $sth=$dbh->prepare("select * from issues i where i.returndate is null and i.itemnumber=?");
+    my $sth=$dbh->prepare("select * from issues i where i.itemnumber=?");
     $sth->execute($itemnumber);
     my $onloan=$sth->fetchrow;
        $sth->finish();
@@ -142,7 +142,7 @@ if ($op eq "additem") {
                $nextop="additem";
     } else {
                # check it doesnt have a waiting reserve
-               $sth=$dbh->prepare("SELECT * FROM reserves WHERE found = 'w' AND cancellationdate IS NULL AND itemnumber = ?");
+               $sth=$dbh->prepare("SELECT * FROM reserves WHERE found = 'W' AND itemnumber = ?");
                $sth->execute($itemnumber);
                my $reserve=$sth->fetchrow;
                if ($reserve){
@@ -208,7 +208,8 @@ foreach my $field (@fields) {
 
         $witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib} if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab}  eq 10);
 
-        $this_row{$subf[$i][0]} =$subf[$i][1] if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab}  eq 10);
+        $this_row{$subf[$i][0]}=GetAuthorisedValueDesc( $field->tag(),
+                        $subf[$i][0], $subf[$i][1], '', $tagslib) if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab}  eq 10);
         
         if (($field->tag eq $branchtagfield) && ($subf[$i][$0] eq $branchtagsubfield) && C4::Context->preference("IndependantBranches")) {
             #verifying rights