Bug 3702 add branch description as primary sort for items in staff mode
authorJane Wagner <jwagner@ptfs.com>
Fri, 9 Oct 2009 15:06:17 +0000 (11:06 -0400)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 10 Nov 2009 21:23:50 +0000 (22:23 +0100)
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

index 61126d9..d2eee36 100644 (file)
@@ -1267,11 +1267,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;