[Koha-patches] [PATCH] Bug 3702 add branch description as primary sort for items in staff mode

Jane Wagner jwagner at ptfs.com
Fri Oct 9 17:06:17 CEST 2009


The default sort order for items attached to a title in staff mode is
items.dateaccessioned desc.  This means that a particular library's holdings
will be scattered through the list -- a special problem when it comes to serial
issues.  I've done a change to Items.pm that makes the sort order branch
description followed by dateaccessioned.  Thus, a library's holdings will be
grouped together in the display.
---
 C4/Items.pm |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/C4/Items.pm b/C4/Items.pm
index 3f550ef..12d3cfd 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -1257,11 +1257,12 @@ sub GetItemsInfo {
            items.notforloan as itemnotforloan,
            itemtypes.description
      FROM items
+     LEFT JOIN branches ON items.homebranch = branches.branchcode
      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" ;
+    $query .= " WHERE items.biblionumber = ? ORDER BY branches.branchname,items.dateaccessioned desc" ;
     my $sth = $dbh->prepare($query);
     $sth->execute($biblionumber);
     my $i = 0;
-- 
1.5.6.5




More information about the Koha-patches mailing list