[Koha-patches] [PATCH] Bug 2747 for staff interface itemtype display.

Joe Atzberger joe.atzberger at liblime.com
Wed Jan 7 21:57:28 CET 2009


Prefer accuracy over graphical icon.
---
 C4/Items.pm                                        |   32 ++++++++++++++-----
 .../prog/en/modules/catalogue/detail.tmpl          |   18 +++++++----
 2 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/C4/Items.pm b/C4/Items.pm
index 98e6586..fba4a21 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -1184,14 +1184,29 @@ If this is set, it is set to C<One Order>.
 sub GetItemsInfo {
     my ( $biblionumber, $type ) = @_;
     my $dbh   = C4::Context->dbh;
-    my $query = "SELECT items.*,biblio.*,biblioitems.volume,biblioitems.number,biblioitems.itemtype,biblioitems.isbn,biblioitems.issn,biblioitems.publicationyear,biblioitems.publishercode,biblioitems.volumedate,biblioitems.volumedesc,biblioitems.lccn,biblioitems.url,items.notforloan as itemnotforloan
-                 FROM items 
-                 LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
-                 LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber";
-    $query .=  (C4::Context->preference('item-level_itypes')) ?
-                     " LEFT JOIN itemtypes on items.itype = itemtypes.itemtype "
-                    : " LEFT JOIN itemtypes on biblioitems.itemtype = itemtypes.itemtype ";
-    $query .= "WHERE items.biblionumber = ? ORDER BY items.dateaccessioned desc" ;
+    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
+    my $query = "
+    SELECT items.*,
+           biblio.*,
+           biblioitems.volume,
+           biblioitems.number,
+           biblioitems.itemtype,
+           biblioitems.isbn,
+           biblioitems.issn,
+           biblioitems.publicationyear,
+           biblioitems.publishercode,
+           biblioitems.volumedate,
+           biblioitems.volumedesc,
+           biblioitems.lccn,
+           biblioitems.url,
+           items.notforloan as itemnotforloan,
+           itemtypes.description
+     FROM items
+     LEFT JOIN biblio      ON      biblio.biblionumber     = items.biblionumber
+     LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
+     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
+     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
+    $query .= " WHERE items.biblionumber = ? ORDER BY items.dateaccessioned desc" ;
     my $sth = $dbh->prepare($query);
     $sth->execute($biblionumber);
     my $i = 0;
@@ -1309,7 +1324,6 @@ sub GetItemsInfo {
         $results[$i] = $data;
         $i++;
     }
-    $sth->finish;
 	if($serial) {
 		return( sort { ($b->{'publisheddate'} || $b->{'enumchron'}) cmp ($a->{'publisheddate'} || $a->{'enumchron'}) } @results );
 	} else {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
index 1fb6f87..eed7536 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
@@ -169,7 +169,18 @@ function verify_images() {
             </tr>
             <!-- TMPL_LOOP NAME="itemloop" -->
                 <tr>
-                    <!-- TMPL_IF NAME="item-level_itypes" --><td class="itype"><!-- TMPL_IF NAME="noItemTypeImages" --><!-- TMPL_VAR NAME="description" --><!-- TMPL_ELSE --><img src="<!-- TMPL_VAR NAME="imageurl" -->" alt="<!-- TMPL_VAR NAME="description" -->" title="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --></td><!-- /TMPL_IF -->
+                    <!-- TMPL_IF NAME="item-level_itypes" -->
+                      <td class="itype">
+                        <!-- TMPL_IF NAME="noItemTypeImages" -->
+                          <!-- TMPL_VAR NAME="description" -->
+                        <!-- TMPL_ELSE -->
+                          <!-- TMPL_IF NAME="imageurl" -->
+                            <img src="<!-- TMPL_VAR NAME="imageurl" -->" alt="<!-- TMPL_VAR NAME="description" -->" title="<!-- TMPL_VAR NAME="description" -->" />
+                          <!-- TMPL_ELSE -->
+                            <!-- TMPL_VAR NAME="description" -->
+                          <!-- /TMPL_IF -->
+                        <!-- /TMPL_IF --></td>
+                    <!-- /TMPL_IF -->
                     <td class="location"><!-- TMPL_UNLESS NAME="singlebranchmode" --><!-- TMPL_VAR NAME="branchname" --><!-- /TMPL_UNLESS --> <!-- TMPL_VAR NAME="location" --> </td>
                     <!-- TMPL_IF NAME="itemdata_ccode" --><td><!-- TMPL_VAR name="ccode" --></td><!-- /TMPL_IF -->
                     <td class="itemcallnumber"><!-- TMPL_IF NAME="itemcallnumber" --> <!-- TMPL_VAR NAME="itemcallnumber" --><!-- /TMPL_IF --></td>
@@ -312,11 +323,6 @@ function verify_images() {
                 <!-- TMPL_IF name="size" -->, <!-- /TMPL_IF --><!-- TMPL_VAR name="size" -->
 </td>
 
-    <!-- TMPL_LOOP NAME=items -->
-    <!-- <!-- TMPL_IF NAME="itype" --><img src="/opac-tmpl/prog/itemtypeimg/<!-- TMPL_VAR NAME="itype" -->.gif" title="<!-- TMPL_VAR NAME="itype" -->" /><!-- /TMPL_IF --> -->
-    <!-- barcode:<!-- TMPL_VAR NAME="barcode" --> -->
-    <!-- /TMPL_LOOP -->
-
 <!-- /TMPL_LOOP -->
 </table></div><!-- /TMPL_IF -->
 <!-- /TMPL_IF -->
-- 
1.5.5.GIT



More information about the Koha-patches mailing list