Fixing a glitch that was showing the biblio notes field where the
authorrangi <rangi>
Mon, 10 Sep 2001 23:37:09 +0000 (23:37 +0000)
committerrangi <rangi>
Mon, 10 Sep 2001 23:37:09 +0000 (23:37 +0000)
biblioitems notes should have been displaying

C4/Search.pm
modbibitem.pl
moredetail.pl

index fba21f7..33bf7dd 100755 (executable)
@@ -19,7 +19,8 @@ $VERSION = 0.01;
 &itemdata &bibdata &GetItems &borrdata &getacctlist &itemnodata &itemcount
 &OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
 &getboracctrecord &ItemType &itemissues &FrontSearch &subject &subtitle
-&addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs); 
+&addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
+&findguarantor); 
 %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
                  
 # your exported package globals go here,
@@ -72,6 +73,24 @@ sub findguarantees{
   return($i,\@dat);             
 }
 
+sub findguarantor{         
+  my ($bornum)=@_;         
+  my $dbh=C4Connect;           
+  my $query="select guarantor from borrowers where    
+  borrowernumber='$bornum'";               
+  my $sth=$dbh->prepare($query);                 
+  $sth->execute;                   
+  my $data=$sth->fetchrow_hashref;
+  $sth->finish; 
+  $query="Select * from borrowers where borrowernumber='$data->{'guarantor'}'";
+  $sth=$dbh->prepare($query);                 
+  $sth->execute;                   
+  $data=$sth->fetchrow_hashref;
+  $sth->finish; 
+  $dbh->disconnect;         
+  return($data);             
+}
+
 sub NewBorrowerNumber {           
   my $dbh=C4Connect;        
   my $sth=$dbh->prepare("Select max(borrowernumber) from borrowers");     
@@ -214,9 +233,12 @@ sub KeywordSearch {
   my $count=@key;
   my $i=1;
   my @results;
-  my $query ="Select * from biblio,bibliosubtitle,biblioitems where
-  biblio.biblionumber=bibliosubtitle.biblionumber and
-  biblioitems.biblionumber=biblio.biblionumber and
+  my $query ="Select * from biblio
+  left join bibliosubtitle on
+  bibliosubtitle.biblionumber=biblio.biblionumber
+  left join biblioitems on 
+  biblioitems.biblionumber=biblio.biblionumber
+  where
   (((title like '$key[0]%' or title like '% $key[0]%')";
   while ($i < $count){
     $query=$query." and (title like '$key[$i]%' or title like '% $key[$i]%')";
@@ -344,11 +366,11 @@ sub CatSearch  {
        my $count=@key;
        my $i=1;
         $query="select *,biblio.author,biblio.biblionumber from
-         biblioitems,biblio
+         biblio
         left join additionalauthors
         on additionalauthors.biblionumber =biblio.biblionumber
-         where biblioitems.biblionumber=biblio.biblionumber 
-        and
+        left join biblioitems on biblioitems.biblionumber=biblio.biblionumber
+        where
          ((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or
         additionalauthors.author like '$key[0]%' or additionalauthors.author 
         like '% $key[0]%'
@@ -396,10 +418,11 @@ sub CatSearch  {
            my @key=split(' ',$search->{'title'});
            my $count=@key;
            my $i=1;
-            $query="select * from biblio,bibliosubtitle,biblioitems
+            $query="select * from biblio
+           left join bibliosubtitle on
+           bibliosubtitle.biblionumber=biblio.biblionumber
+           left join biblioitems on biblioitems.biblionumber=biblio.biblionumber
            where
-            (biblio.biblionumber=bibliosubtitle.biblionumber and
-            biblioitems.biblionumber=biblio.biblionumber) and
            (((title like '$key[0]%' or title like '% $key[0]%' or title like '% $key[0]')";
            while ($i<$count){
              $query=$query." and (title like '$key[$i]%' or title like '% $key[$i]%' or title like '% $key[$i]')";
@@ -713,7 +736,8 @@ sub bibdata {
 sub bibitemdata {
   my ($bibitem)=@_;
   my $dbh=C4Connect;
-  my $query="Select * from biblio,biblioitems,itemtypes where biblio.biblionumber=
+  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;
@@ -1042,8 +1066,8 @@ sub itemcount {
   my $query="Select * from items where     
   biblionumber=$bibnum ";
   if ($type eq 'opac'){
-    $query.=" and (itemlost <>1 or itemlost is NULL) and
-    (wthdrawn <> 1 or wthdrawn is NULL)";      
+    $query.=" and (itemlost =0 or itemlost is NULL) and
+    (wthdrawn = 0 or wthdrawn is NULL)";      
   }
   my $sth=$dbh->prepare($query);         
   #  print $query;           
@@ -1077,7 +1101,7 @@ sub itemcount {
       if ($data->{'holdingbranch'} eq 'S' || $data->{'holdingbranch'} eq 'SP'){         
         $scount++;               
       }                       
-      if ($data->{'itemlost'} eq '1'){
+      if ($data->{'itemlost'} eq '1' || $data->{'itemlost'} eq '2'){
         $lostcount++;
       }
       if ($data->{'holdingbranch'} eq 'FM'){
index c87d8cc..899964d 100755 (executable)
@@ -112,7 +112,7 @@ print <<printend
 <tr valign=top bgcolor=white><td>Volume</td>
 <td><input type=text name=Volume value="$data->{'volumeddesc'}" size=20></td></tr>
 <tr valign=top bgcolor=white><td>Notes</td>
-<td><input type=text name=Notes value="$data->{'notes'}" size=20></td></tr>
+<td><input type=text name=Notes value="$data->{'bnotes'}" size=20></td></tr>
 <tr valign=top bgcolor=white><td>Size</td>
 <td><input type=text name=Size value="$data->{'size'}" size=20></td></tr>
 
index d89dd2a..a279784 100755 (executable)
@@ -34,7 +34,7 @@ my $bi=$input->param('bi');
 my $data=bibitemdata($bi);
 
 my (@items)=itemissues($bi);
-my ($order)=getorder($bi,$bib);
+my ($order,$ordernum)=getorder($bi,$bib);
 #print @items;
 my $count=@items;
 
@@ -88,8 +88,9 @@ print <<printend
 <b>Pages:</b> $data->{'pages'}<br>
 <b>Illus:</b> $data->{'illus'}<br>
 <b>Size:</b> $data->{'size'}<br>
-<b>Notes:</b> $data->{'notes'}<br>
+<b>Notes:</b> $data->{'bnotes'}<br>
 <b>No. of Items:</b> $count
+
 printend
 ;
 if ($type eq 'catmain'){
@@ -97,6 +98,7 @@ if ($type eq 'catmain'){
  
 }
 print <<printend
+
 </font>
 </TD>
 </tr>
@@ -117,6 +119,7 @@ print <<printend
 <form action=/cgi-bin/koha/moditem.pl method=post>
 <input type=hidden name=bibitem value=$bi>
 <input type=hidden name=item value=$items[$i]->{'itemnumber'}>
+<input type=hidden name=type value=$type>
 <INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 src="/images/modify-mem.gif"> 
 <INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 src="/images/delete-mem.gif"> 
 <br>
@@ -153,10 +156,10 @@ print <<printend
 <b>Current Branch:</b> $items[$i]->{'holdingbranch'}<br>
 <b>Replacement Price:</b> $items[$i]->{'replacementprice'}<br>
 <b>Item lost:</b> $items[$i]->{'itemlost'}<br>
-<b>paid by:</b><br>
+<b>Paid for:</b> $items[$i]->{'paidfor'}<br>
 <b>Notes:</b> $items[$i]->{'itemnotes'}<br>
 <b>Renewals:</b> $items[$i]->{'renewals'}<br>
-<b><a href=/cgi-bin/koha/acqui/acquire.pl?recieve=$order->{'ordernumber'}&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession</a> Date: $items[$i]->{'dateaccessioned'}<br>
+<b><a href=/cgi-bin/koha/acqui/acquire.pl?recieve=$ordernum&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession</a> Date: $items[$i]->{'dateaccessioned'}<br>
 printend
 ;
 if ($items[$i]->{'wthdrawn'} eq '1'){