fixes to moredetail.pl to allow status editing using updateitem.pl
authorJoshua Ferraro <jmf@liblime.com>
Mon, 22 Oct 2007 04:40:50 +0000 (23:40 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 22 Oct 2007 12:13:43 +0000 (07:13 -0500)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Koha.pm
catalogue/moredetail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl

index 22dae29..3d15b91 100644 (file)
@@ -53,8 +53,6 @@ $VERSION = 3.00;
   &GetPrinters &GetPrinter
   &GetItemTypes &getitemtypeinfo
   &GetCcodes
-  &GetAuthItemlost
-  &GetAuthItembinding
   &get_itemtypeinfos_of
   &getframeworks &getframeworkinfo
   &getauthtypes &getauthtype
@@ -294,36 +292,6 @@ sub GetCcodes {
     return ( $count, @results );
 }
 
-=head2
-
-grab itemlost authorized values
-
-=cut
-
-sub GetAuthItemlost {
-    my $itemlost = shift;
-    my $count    = 0;
-    my @results;
-    my $dbh = C4::Context->dbh;
-    my $sth =
-      $dbh->prepare(
-        "SELECT * FROM authorised_values ORDER BY authorised_value");
-    $sth->execute;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        if ( $data->{category} eq "ITEMLOST" ) {
-            $count++;
-            if ( $itemlost eq $data->{'authorised_value'} ) {
-                $data->{'selected'} = 1;
-            }
-            $results[$count] = $data;
-
-            #warn "data: $data";
-        }
-    }
-    $sth->finish;
-    return ( $count, @results );
-}
-
 =head2 getauthtypes
 
   $authtypes = &getauthtypes();
@@ -829,15 +797,24 @@ Set C<$category> on input args if you want to limits your query to this one. Thi
 =cut
 
 sub GetAuthorisedValues {
-    my $category = shift;
+    my ($category,$selected) = @_;
+       my $count = 0;
+       my @results;
     my $dbh      = C4::Context->dbh;
     my $query    = "SELECT * FROM authorised_values";
     $query .= " WHERE category = '" . $category . "'" if $category;
 
     my $sth = $dbh->prepare($query);
     $sth->execute;
-    my $data = $sth->fetchall_arrayref({});
-    return $data;
+       while (my $data=$sth->fetchrow_hashref) {
+               if ($selected eq $data->{'authorised_value'} ) {
+                       $data->{'selected'} = 1;
+               }
+               $results[$count] = $data;
+               $count++;
+       }
+    #my $data = $sth->fetchall_arrayref({});
+    return \@results; #$data;
 }
 
 =item fixEncoding
index 6f3542c..ddb2eb5 100755 (executable)
@@ -76,8 +76,8 @@ my $order = GetOrder($ordernum);
 $results[0]=$data;
 
 foreach my $item (@$items){
-       $item->{itemlostloop}= GetAuthorisedValues('ITEMLOST');
-       $item->{itemdamagedloop}= GetAuthorisedValues('DAMAGED');
+       $item->{itemlostloop}= GetAuthorisedValues('LOST',$item->{itemlost});
+       $item->{itemdamagedloop}= GetAuthorisedValues('DAMAGED',$item->{damaged});
     $item->{'replacementprice'}=sprintf("%.2f", $item->{'replacementprice'});
     $item->{'datelastborrowed'}= format_date($item->{'datelastborrowed'});
     $item->{'dateaccessioned'} = format_date($item->{'dateaccessioned'});
index 5dccc38..b535e7e 100644 (file)
@@ -54,7 +54,7 @@ NAME="biblionumber"-->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">Modif
                        <li><span class="label">Current Library:</span> <!-- TMPL_VAR NAME="holdingbranch" --></li>
                        <li><span class="label">Last seen:</span> <!-- TMPL_VAR NAME="datelastseen" --></li>
                        <li><span class="label">Last borrowed:</span> <!-- TMPL_IF NAME="datelastborrowed" --><!-- TMPL_VAR NAME="datelastborrowed" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></li>
-                       <li><span class="label">Item Status:</span> <!-- TMPL_IF NAME="issue" -->On issue to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="cardnumber" --></a><!-- TMPL_ELSE -->Available <!-- /TMPL_IF --></li>
+                       <li><span class="label">Item Status:</span> <!-- TMPL_IF NAME="issue" -->Checked out to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="cardnumber" --></a><!-- TMPL_ELSE -->Not Checked out <!-- /TMPL_IF --></li>
                        <!-- TMPL_IF NAME="issue" --><li><span class="label">Date Due:</span> <!-- TMPL_VAR NAME="date_due" --></li><!-- /TMPL_IF -->
                        <li><span class="label">Last Borrower 1:</span> <!-- TMPL_IF NAME="card0" --><!-- TMPL_VAR NAME="card0" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></li>
                        <li><span class="label">Last Borrower 2:</span> <!-- TMPL_IF NAME="card1" --><!-- TMPL_VAR NAME="card1" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></li>