Changes to allow modifications to the website biblioitems
authortruth_nz <truth_nz>
Sun, 12 May 2002 18:08:17 +0000 (18:08 +0000)
committertruth_nz <truth_nz>
Sun, 12 May 2002 18:08:17 +0000 (18:08 +0000)
Changes to way that website biblioitems are shown on the details page

C4/Acquisitions.pm
C4/Search.pm
acqui/finishreceive.pl
detail.pl
modbibitem.pl
moredetail.pl
updatebibitem.pl

index a4d5d65..fd137de 100644 (file)
@@ -563,21 +563,47 @@ values ('$subject[$i]', $bibnum)");
   return($error);
 } # sub modsubject
 
+
 sub modbibitem {
-  my ($bibitemnum,$itemtype,$isbn,$publishercode,$publicationdate,$classification,$dewey,$subclass,$illus,$pages,$volumeddesc,$notes,$size,$place)=@_;
-  my $dbh=C4Connect;
-  my $query="update biblioitems set itemtype='$itemtype',
-  isbn='$isbn',publishercode='$publishercode',publicationyear='$publicationdate',
-  classification='$classification',dewey='$dewey',subclass='$subclass',illus='$illus',
-  pages='$pages',volumeddesc='$volumeddesc',notes='$notes',size='$size',place='$place'
-  where
-  biblioitemnumber=$bibitemnum";
-  my $sth=$dbh->prepare($query);
-#    print $query;
-  $sth->execute;
-  $sth->finish;
-  $dbh->disconnect;
-}
+    my ($biblioitem) = @_;
+    my $dbh   = C4Connect;
+    my $query;
+
+    $biblioitem->{'itemtype'}        = $dbh->quote($biblioitem->{'itemtype'});
+    $biblioitem->{'isbn'}            = $dbh->quote($biblioitem->{'isbn'});
+    $biblioitem->{'publishercode'}   = $dbh->quote($biblioitem->{'publishercode'});
+    $biblioitem->{'publicationyear'} = $dbh->quote($biblioitem->{'publicationyear'});
+    $biblioitem->{'classification'}  = $dbh->quote($biblioitem->{'classification'});
+    $biblioitem->{'dewey'}          = $dbh->quote($biblioitem->{'dewey'});
+    $biblioitem->{'subclass'}       = $dbh->quote($biblioitem->{'subclass'});
+    $biblioitem->{'illus'}           = $dbh->quote($biblioitem->{'illus'});
+    $biblioitem->{'pages'}           = $dbh->quote($biblioitem->{'pages'});
+    $biblioitem->{'volumeddesc'}     = $dbh->quote($biblioitem->{'volumeddesc'});
+    $biblioitem->{'notes'}           = $dbh->quote($biblioitem->{'notes'});
+    $biblioitem->{'size'}            = $dbh->quote($biblioitem->{'size'});
+    $biblioitem->{'place'}           = $dbh->quote($biblioitem->{'place'});
+
+    $query = "Update biblioitems set
+itemtype        = $biblioitem->{'itemtype'},
+isbn            = $biblioitem->{'isbn'},
+publishercode   = $biblioitem->{'publishercode'},
+publicationyear = $biblioitem->{'publicationyear'},
+classification  = $biblioitem->{'classification'},
+dewey           = $biblioitem->{'dewey'},
+subclass        = $biblioitem->{'subclass'},
+illus           = $biblioitem->{'illus'},
+pages           = $biblioitem->{'pages'},
+volumeddesc     = $biblioitem->{'volumeddesc'},
+notes          = $biblioitem->{'notes'},
+size           = $biblioitem->{'size'},
+place          = $biblioitem->{'place'}
+where biblioitemnumber = $biblioitem->{'biblioitemnumber'}";
+
+    $dbh->do($query);
+
+    $dbh->disconnect;
+} # sub modbibitem
+
 
 sub modnote {
   my ($bibitemnum,$note)=@_;
@@ -611,6 +637,7 @@ sub newbiblioitem {
   $biblioitem->{'publishercode'}   = $dbh->quote($biblioitem->{'publishercode'});
   $biblioitem->{'volumedate'}      = $dbh->quote($biblioitem->{'volumedate'});
   $biblioitem->{'volumeddesc'}     = $dbh->quote($biblioitem->{'volumeddesc'});  $biblioitem->{'illus'}            = $dbh->quote($biblioitem->{'illus'});
+  $biblioitem->{'illus'}          = $dbh->quote($biblioitem->{'illus'});
   $biblioitem->{'pages'}           = $dbh->quote($biblioitem->{'pages'});
   $biblioitem->{'notes'}           = $dbh->quote($biblioitem->{'notes'});
   $biblioitem->{'size'}            = $dbh->quote($biblioitem->{'size'});
index d594e14..ef354e4 100755 (executable)
@@ -21,7 +21,7 @@ $VERSION = 0.02;
 &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
 &getboracctrecord &ItemType &itemissues &subject &subtitle
 &addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
-&findguarantor &getwebsites);
+&findguarantor &getwebsites &getwebbiblioitems);
 %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
                  
 # your exported package globals go here,
@@ -587,20 +587,20 @@ sub subsearch {
 
 
 sub ItemInfo {
-  my ($env,$biblionumber,$type)=@_;
-  my $dbh = &C4Connect;
-  my $query="Select * from items,biblio,biblioitems,branches 
-  where (items.biblioitemnumber = biblioitems.biblioitemnumber)
-  and biblioitems.biblionumber=biblio.biblionumber
-  and biblio.biblionumber='$biblionumber' and branches.branchcode=
-  items.holdingbranch ";
-#  print $type;
+    my ($env,$biblionumber,$type) = @_;
+    my $dbh   = &C4Connect;
+    my $query = "Select * from items, biblio, biblioitems, branches
+where (items.biblioitemnumber = biblioitems.biblioitemnumber)
+and biblioitems.biblionumber = biblio.biblionumber
+and biblio.biblionumber = '$biblionumber'
+and branches.branchcode = items.holdingbranch";
+
   if ($type ne 'intra'){
-    $query.=" and ((items.itemlost<>1 and items.itemlost <> 2)
+    $query .= " and ((items.itemlost<>1 and items.itemlost <> 2)
     or items.itemlost is NULL)
     and (wthdrawn <> 1 or wthdrawn is NULL)";
   }
-  $query=$query."order by items.dateaccessioned desc";
+  $query .= " order by items.dateaccessioned desc";
   my $sth=$dbh->prepare($query);
   $sth->execute;
   my $i=0;
@@ -724,48 +724,55 @@ sub itemdata {
   return($data);
 }
 
+
 sub bibdata {
-  my ($bibnum, $type)=@_;
-  my $dbh   = C4Connect;
-  my $query = "Select *, biblio.notes  
+    my ($bibnum, $type) = @_;
+    my $dbh   = C4Connect;
+    my $query = "Select *, biblio.notes  
 from biblio, biblioitems 
 left join bibliosubtitle on
 biblio.biblionumber = bibliosubtitle.biblionumber
 where biblio.biblionumber = $bibnum
 and biblioitems.biblionumber = $bibnum";
+    my $sth   = $dbh->prepare($query);
+    my $data;
 
-  my $sth   = $dbh->prepare($query);
-  $sth->execute;
-  my $data  = $sth->fetchrow_hashref;
-  $sth->finish;
+    $sth->execute;
+    $data  = $sth->fetchrow_hashref;
+    $sth->finish;
 
-  $query = "Select * from bibliosubject where biblionumber = '$bibnum'";
-  $sth=$dbh->prepare($query);
-  $sth->execute;
-  while (my $dat = $sth->fetchrow_hashref){
-    $data->{'subject'} .= " | $dat->{'subject'}";
+    $query = "Select * from bibliosubject where biblionumber = '$bibnum'";
+    $sth   = $dbh->prepare($query);
+    $sth->execute;
+    while (my $dat = $sth->fetchrow_hashref){
+        $data->{'subject'} .= " | $dat->{'subject'}";
+    } # while
 
-  }
+    $sth->finish;
+    $dbh->disconnect;
+    return($data);
+} # sub bibdata
 
-  $sth->finish;
-  $dbh->disconnect;
-  return($data);
-}
 
 sub bibitemdata {
-  my ($bibitem)=@_;
-  my $dbh=C4Connect;
-  my $query="Select *,biblioitems.notes as bnotes from biblio,biblioitems,itemtypes where biblio.biblionumber=
-  biblioitems.biblionumber and biblioitemnumber=$bibitem and
-  biblioitems.itemtype=itemtypes.itemtype";
-#  print $query;
-  my $sth=$dbh->prepare($query);
-  $sth->execute;
-  my $data=$sth->fetchrow_hashref;
-  $sth->finish;
-  $dbh->disconnect;
-  return($data);
-}
+    my ($bibitem) = @_;
+    my $dbh   = C4Connect;
+    my $query = "Select *,biblioitems.notes as bnotes from biblio, biblioitems,itemtypes
+where biblio.biblionumber = biblioitems.biblionumber
+and biblioitemnumber = $bibitem
+and biblioitems.itemtype = itemtypes.itemtype";
+    my $sth   = $dbh->prepare($query);
+    my $data;
+
+    $sth->execute;
+
+    $data = $sth->fetchrow_hashref;
+
+    $sth->finish;
+    $dbh->disconnect;
+    return($data);
+} # sub bibitemdata
+
 
 sub subject {
   my ($bibnum)=@_;
@@ -821,51 +828,66 @@ sub subtitle {
 
 
 sub itemissues {
-  my ($bibitem, $biblio)=@_;
-  my $dbh=C4Connect;
-  my $query="Select * from items where 
-  items.biblioitemnumber='$bibitem'";
-  my $sth=$dbh->prepare($query) || die $dbh->errstr;
-  $sth->execute || die $sth->errstr;
-  my $i=0;
-  my @results;
-  while (my $data=$sth->fetchrow_hashref) {
-    my $query2="select * from issues,borrowers where itemnumber=$data->{'itemnumber'}
-    and returndate is NULL and issues.borrowernumber=borrowers.borrowernumber";
-    my $sth2=$dbh->prepare($query2);
-    $sth2->execute;
-    if (my $data2=$sth2->fetchrow_hashref) {
-      $data->{'date_due'}=$data2->{'date_due'};
-      $data->{'card'}=$data2->{'cardnumber'};
-    } else {
-      if ($data->{'wthdrawn'} eq '1') {
-        $data->{'date_due'}='Cancelled';
-      } else {
-          $data->{'date_due'}='Available';
-      }
-    }
-    $sth2->finish;
-    $query2="select * from issues,borrowers where itemnumber='$data->{'itemnumber'}'
-    and issues.borrowernumber=borrowers.borrowernumber 
-    order by date_due desc";
-    my $sth2=$dbh->prepare($query2) || die $dbh->errstr;
-    $sth2->execute || die $sth2->errstr;
-    for (my $i2=0;$i2<2;$i2++){
-      if (my $data2=$sth2->fetchrow_hashref){
-        $data->{"timestamp$i2"}=$data2->{'timestamp'};
-        $data->{"card$i2"}=$data2->{'cardnumber'};
-       $data->{"borrower$i2"}=$data2->{'borrowernumber'};
-      }
+    my ($bibitem, $biblio)=@_;
+    my $dbh   = C4Connect;
+    my $query = "Select * from items where 
+items.biblioitemnumber = '$bibitem'";
+    my $sth   = $dbh->prepare($query)
+      || die $dbh->errstr;
+    my $i     = 0;
+    my @results;
+  
+    $sth->execute
+      || die $sth->errstr;
+
+    while (my $data = $sth->fetchrow_hashref) {
+        my $query2 = "select * from issues,borrowers
+where itemnumber = $data->{'itemnumber'}
+and returndate is NULL
+and issues.borrowernumber = borrowers.borrowernumber";
+        my $sth2   = $dbh->prepare($query2);
+
+        $sth2->execute;        
+        if (my $data2 = $sth2->fetchrow_hashref) {
+            $data->{'date_due'} = $data2->{'date_due'};
+            $data->{'card'}     = $data2->{'cardnumber'};
+        } else {
+            if ($data->{'wthdrawn'} eq '1') {
+                $data->{'date_due'} = 'Cancelled';
+            } else {
+                $data->{'date_due'} = 'Available';
+            } # else
+        } # else
+
+        $sth2->finish;
+        $query2 = "select * from issues, borrowers
+where itemnumber = '$data->{'itemnumber'}'
+and issues.borrowernumber = borrowers.borrowernumber 
+order by date_due desc";
+        $sth2 = $dbh->prepare($query2)
+          || die $dbh->errstr;
+        $sth2->execute
+          || die $sth2->errstr;
+
+        for (my $i2 = 0; $i2 < 2; $i2++) {
+            if (my $data2 = $sth2->fetchrow_hashref) {
+                $data->{"timestamp$i2"} = $data2->{'timestamp'};
+                $data->{"card$i2"}      = $data2->{'cardnumber'};
+                $data->{"borrower$i2"}  = $data2->{'borrowernumber'};
+            } # if
+        } # for
+
+        $sth2->finish;
+        $results[$i] = $data;
+        $i++;
     }
-    $sth2->finish;
-    $results[$i]=$data;
-    $i++;
-  }
-  $sth->finish;
-  $dbh->disconnect;
-  return(@results);
+
+    $sth->finish;
+    $dbh->disconnect;
+    return(@results);
 }
 
+
 sub itemnodata {
   my ($env,$dbh,$itemnumber) = @_;
   $dbh=C4Connect;
@@ -1125,25 +1147,31 @@ sub ItemType {
   return ($dat->{'description'});
 }
 
+
 sub bibitems {
-  my ($bibnum)=@_;
-  my $dbh=C4Connect;
-  my $query="Select * from biblioitems,itemtypes,items where
-  biblioitems.biblionumber='$bibnum' and biblioitems.itemtype=itemtypes.itemtype and
-  biblioitems.biblioitemnumber=items.biblioitemnumber group by
-  items.biblioitemnumber";
-  my $sth=$dbh->prepare($query);
-  $sth->execute;
-  my $i=0;
-  my @results;
-  while (my $data=$sth->fetchrow_hashref){
-    $results[$i]=$data;
-    $i++;
-  }
-  $sth->finish;
-  $dbh->disconnect;
-  return($i,@results);
-}
+    my ($bibnum) = @_;
+    my $dbh   = C4Connect;
+    my $query = "Select * from biblioitems, itemtypes, items
+where biblioitems.biblionumber = '$bibnum'
+and biblioitems.itemtype = itemtypes.itemtype
+and biblioitems.biblioitemnumber = items.biblioitemnumber
+group by items.biblioitemnumber";
+    my $sth   = $dbh->prepare($query);
+    my $count = 0;
+    my @results;
+
+    $sth->execute;
+
+    while (my $data = $sth->fetchrow_hashref) {
+        $results[$count] = $data;
+        $count++;
+    } # while
+    
+    $sth->finish;
+    $dbh->disconnect;
+    return($count, @results);
+} # sub bibitems
+
 
 sub barcodes{
   #called from request.pl
@@ -1153,7 +1181,7 @@ sub barcodes{
    biblioitemnumber='$biblioitemnumber'
    and ((itemlost <> 1 and itemlost <> 2) or itemlost is NULL) and
    (wthdrawn <> 1 or wthdrawn is NULL)";
-#   print $query;
+
   my $sth=$dbh->prepare($query);
   $sth->execute;
   my @barcodes;
@@ -1189,6 +1217,27 @@ sub getwebsites {
 } # sub getwebsites
 
 
+sub getwebbiblioitems {
+    my ($biblionumber) = @_;
+    my $dbh   = C4Connect;
+    my $query = "Select * from biblioitems where biblionumber = $biblionumber
+and itemtype = 'WEB'";
+    my $sth   = $dbh->prepare($query);
+    my $count = 0;
+    my @results;
+    
+    $sth->execute;
+    while (my $data = $sth->fetchrow_hashref) {
+        $results[$count] = $data;
+        $count++;
+    } # while
+    
+    $sth->finish;
+    $dbh->disconnect;
+    return($count, @results);
+} # sub getwebbiblioitems
+
+
 END { }       # module clean-up code here (global destructor)
 
 =head1 NAME
index df99bc4..1e0209d 100755 (executable)
@@ -67,8 +67,21 @@ if ($itemtype =~ /PER/){
 if ($quantity != 0){
   receiveorder($biblionumber,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno,$freight,$bookfund);
   modbiblio($biblio);
-  modbibitem($bibitemno,$itemtype,$isbn,$publisher,$pubdate,$class,$dewey,$subclass,$illus,$pages,$volinf,$notes,$size);
-  #print $notes;
+  &modbibitem({
+      biblioitemnumber => $bibitemno,
+      itemtype         => $itemtype?$itemtype:"",
+      isbn             => $isbn?$isbn:"",
+      publisher        => $publisher?$publisher:"",
+      publicationyear  => $pubdate?$pubdate:"",
+      class            => $class?$class:"",
+      dewey            => $dewey?$dewey:"",
+      subclass         => $subclass?$subclass:"",
+      illus            => $illus?$illus:"",
+      pages            => $pages?$pages:"",
+      volumeddesc      => $volinf?$volinf:"",
+      notes            => $notes?$notes:"",
+      size             => $size?$size:"" });
+
   my $barcode=$input->param('barcode');
   my @barcodes;
   if ($barcode =~ /\,/){
index 5d2145f..bd19fc4 100755 (executable)
--- a/detail.pl
+++ b/detail.pl
@@ -15,8 +15,9 @@ my @items = &ItemInfo(undef, $bib, $type);
 my @temp  = split('\t', $items[0]);
 my $count = @items;
 my $dat   = &bibdata($bib);
-my ($websitecount, @websites) = &getwebsites($bib);
-my ($authorcount, $addauthor) = &addauthor($bib);
+my ($websitecount, @websites)             = &getwebsites($bib);
+my ($authorcount, $addauthor)             = &addauthor($bib);
+my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($bib);
 my $additional = $addauthor->[0]->{'author'};
 my $main;
 my $secondary;
@@ -176,21 +177,13 @@ print mktablehdr;
 
 if ($type eq 'opac') {
     print mktablerow(6,$main,'Item Type','Class','Branch','Date Due','Last Seen');
-    if ($dat->{'url'} ne '') {
-       $dat->{'url'} =~ s/^http:\/\///;
-       print mktablerow(6, $colour, 'Website', 'WEB', 'Online', 'Available', "<a href=\"http://$dat->{'url'}\">$dat->{'url'}</a>");
-    } # if
 } else {
     print mktablerow(7,$main,'Itemtype','Class','Location','Date Due','Last Seen','Barcode',"","/images/background-mem.gif");
-    if ($dat->{'url'} ne '') {
-       $dat->{'url'} =~ s/^http:\/\///;
-       print mktablerow(7, $colour, 'WEB', '', 'Online', 'Available', "<a href=\"http://$dat->{'url'}\">$dat->{'url'}</a>");
-    } # if
 } # else
 
 $colour = 'white';
 for (my $i = 0; $i < $count; $i ++) {
-    
+
     my @results = split('\t', $items[$i]);
 
     if ($type ne 'opac') {
@@ -224,6 +217,18 @@ for (my $i = 0; $i < $count; $i ++) {
 
 } # for
 
+
+for (my $i = 0; $i < $webbiblioitemcount; $i++) {
+    if ($type eq 'opac') {
+       $webbiblioitems[$i]->{'url'} =~ s/^http:\/\///;
+       print mktablerow(6, $colour, 'Website', 'WEB', 'Online', 'Available', "http://$webbiblioitems[$i]->{'url'}");
+    } else {
+       $webbiblioitems[$i]->{'url'} =~ s/^http:\/\///;
+       print mktablerow(7, $colour, 'WEB', '', 'Online', 'Available', "", "<a href='moredetail.pl?bib=$bib&bi=$webbiblioitems[$i]->{'biblioitemnumber'}&type=$type'>http://$webbiblioitems[$i]->{'url'}</a>");
+    } # else
+} # for
+
+
 print mktableft();
 print "<p>";
 print mktablehdr();
index c67bb33..9640994 100755 (executable)
@@ -14,7 +14,6 @@ use CGI;
 
 
 my $input = new CGI;
-#
 my $bibitemnum=$input->param('bibitem');
 my $data=bibitemdata($bibitemnum);
 my $biblio=$input->param('biblio');
@@ -48,7 +47,7 @@ if ($dewey <= 0){
 $dewey=~ s/\.$//;
 $inputs{'Class'}="text\t$data->{'classification'}$dewey$data->{'subclass'}\t2";
 $inputs{'Item Type'}="text\t$data->{'itemtype'}\t3";
-#$inputs{'Subject'}="textarea\t$sub\t4";
+$inputs{'URL'}="text\t$data->{'url'}\t4";
 $inputs{'Publisher'}="text\t$data->{'publishercode'}\t5";
 #$inputs{'Copyright date'}="text\t$data->{'copyrightdate'}\t6";
 $inputs{'ISBN'}="text\t$data->{'isbn'}\t7";
@@ -73,7 +72,7 @@ print <<printend
 <BLOCKQUOTE><FONT SIZE=6>
 <em><a href=/cgi-bin/koha/detail.pl?bib=$data->{'biblionumber'}&type=intra>$data->{'title'} ($data->{'author'})</a><br>
 Modify Group - $data->{'description'}</em></FONT><br>             
-<form action=updatebibitem.pl method=post>
+<form action="updatebibitem.pl" method="post">
 <table border=0 cellspacing=0 cellpadding=5 align=left>
 
 <TR VALIGN=TOP  bgcolor="99cc33">
@@ -97,6 +96,11 @@ print <<printend
 
 <tr valign=top bgcolor=white><td>Item Type</td><td><input type=text name=Item Type value="$data->{'itemtype'}" size=20></td></tr>
 
+<tr valign="top" bgcolor="white">
+<td>URL</td>
+<td><input type="text" name="url" value="$data->{'url'}" size="20"></td>
+</tr>
+
 <tr valign=top bgcolor=white><td>Class</td><td><input type=text name=Class value="$data->{'classification'}$dewey$data->{'subclass'}" size=20></td></tr>
 
 
index 06f221a..4333d10 100755 (executable)
@@ -4,18 +4,18 @@
 #written 8/11/99
 
 use strict;
-#use DBI;
 use C4::Search;
 use C4::Koha;
 use C4::Output;
 use C4::Acquisitions;
-
 use CGI;
+
 my $input = new CGI;
-print $input->header;
-#whether it is called from the opac of the intranet
 my $type=$input->param('type');
-#setup colours
+
+print $input->header;
+
+# setup colours
 my $main;
 my $secondary;
 if ($type eq 'opac'){
@@ -78,6 +78,7 @@ print <<printend
 <FONT SIZE=2  face="arial, helvetica">
 <b>Biblionumber:</b> $bib<br>
 <b>Item Type:</b> $data->{'itemtype'}<br>
+<b>URL:</b> $data->{'url'}<br>
 <b>Loan Length:</b> $data->{'loanlength'}<br>
 <b>Rental Charge:</b> $data->{'rentalcharge'}<br>
 <b>Classification:</b> $data->{'classification'}$dewey$data->{'subclass'}<br>
index 21274f6..9d1d4ff 100755 (executable)
@@ -8,52 +8,49 @@ use C4::Output;
 use C4::Search;
 
 my $input= new CGI;
-#print $input->header;
-#print $input->Dump;
 
-
-my $bibitemnum=checkinp($input->param('bibitemnum'));
-my $bibnum=checkinp($input->param('bibnum'));
-my $itemtype=checkinp($input->param('Item'));
-my $isbn=checkinp($input->param('ISBN'));
-my $publishercode=checkinp($input->param('Publisher'));
-my $publicationdate=checkinp($input->param('Publication'));
-my $class=checkinp($input->param('Class'));
+my $bibitemnum      = checkinp($input->param('bibitemnum'));
+my $bibnum          = checkinp($input->param('bibnum'));
+my $itemtype        = checkinp($input->param('Item'));
+my $url             = checkinp($input->param('url'));
+my $isbn            = checkinp($input->param('ISBN'));
+my $publishercode   = checkinp($input->param('Publisher'));
+my $publicationdate = checkinp($input->param('Publication'));
+my $class           = checkinp($input->param('Class'));
 my $classification;
 my $dewey;
 my $subclass;
-if ($itemtype ne 'NF'){
+
+if ($itemtype ne 'NF') {
   $classification=$class;
-}
-if ($class =~/[0-9]+/){
-#   print $class;
+} # if
+
+if ($class =~/[0-9]+/) {
    $dewey= $class;
    $dewey=~ s/[a-z]+//gi;
    my @temp;
-   if ($class =~ /\./){
+   if ($class =~ /\./) {
      @temp=split(/[0-9]+\.[0-9]+/,$class);
    } else {
      @temp=split(/[0-9]+/,$class);
-   }
+   } # else
    $classification=$temp[0];
    $subclass=$temp[1];
-#   print $classification,$dewey,$subclass;
-}else{
+
+} else {
   $dewey='';
   $subclass='';
-}
-my $illus=checkinp($input->param('Illustrations'));
-my $pages=checkinp($input->param('Pages'));
-my $volumeddesc=checkinp($input->param('Volume'));
-my $notes=checkinp($input->param('Notes'));
-my $size=checkinp($input->param('Size'));
-my $place=checkinp($input->param('Place'));
-my (@items)=itemissues($bibitemnum);
-#print @items;           
-my $count=@items;
-#print $count;
-my @barcodes;
+} # else
 
+my $illus       = checkinp($input->param('Illustrations'));
+my $pages       = checkinp($input->param('Pages'));
+my $volumeddesc = checkinp($input->param('Volume'));
+my $notes       = checkinp($input->param('Notes'));
+my $size        = checkinp($input->param('Size'));
+my $place       = checkinp($input->param('Place'));
+my (@items) = &itemissues($bibitemnum);
+my $count   = @items;
+my @barcodes;
 
 my $existing=$input->param('existing');
 if ($existing eq 'YES'){
@@ -83,11 +80,22 @@ if ($existing eq 'YES'){
    }
    my $loan;
    if ($flag eq 'notall' && $flag2 eq 'leastone'){
-      $bibitemnum = &newbiblioitem({ biblionumber   => $bibnum,
-                                    itemtype       => $itemtype,
-                                    volumeddesc    => $volumeddesc,
-                                    classification => $classification });
-      modbibitem($bibitemnum,$itemtype,$isbn,$publishercode,$publicationdate,$classification,$dewey,$subclass,$illus,$pages,$volumeddesc,$notes,$size,$place);
+      $bibitemnum = &newbiblioitem({
+         biblionumber    => $bibnum,
+         itemtype        => $itemtype?$itemtype:"",
+         url             => $url?$url:"",
+         isbn            => $isbn?$isbn:"",
+         publishercode   => $publishercode?$publishercode:"",
+         publicationyear => $publicationdate?$publicationdate:"",
+         volumeddesc     => $volumeddesc?$volumeddesc:"",
+         classification  => $classification?$classification:"",
+         dewey           => $dewey?$dewey:"",
+         subclass        => $subclass?$subclass:"",
+         illus           => $illus?$illus:"",
+         pages           => $pages?$pages:"",
+         notes           => $notes?$notes:"",
+         size            => $size?$size:"",
+         place           => $place?$place:"" });
       if ($itemtype =~ /REF/){
         $loan=1;
       } else {
@@ -100,7 +108,21 @@ if ($existing eq 'YES'){
       }
       
    } elsif ($flag2 eq 'leastone') {
-      modbibitem($bibitemnum,$itemtype,$isbn,$publishercode,$publicationdate,$classification,$dewey,$subclass,$illus,$pages,$volumeddesc,$notes,$size,$place);
+      &modbibitem({
+         biblioitemnumber => $bibitemnum,
+         itemtype         => $itemtype?$itemtype:"",
+         isbn             => $isbn?$isbn:"",
+         publishercode    => $publishercode?$publishercode:"",
+         publicationyear  => $publicationdate?$publicationdate:"",
+         classification   => $classification?$classification:"",
+         dewey            => $dewey?$dewey:"",
+         subclass         => $subclass?$subclass:"",
+         illus            => $illus?$illus:"",
+         pages            => $pages?$pages:"",
+         volumeddesc      => $volumeddesc?$volumeddesc:"",
+         notes            => $notes?$notes:"",
+         size             => $size?$size:"",
+         place            => $place?$place:"" });
       if ($itemtype =~ /REF/){
         $loan=1;
       } else {