From 79fb52783946d0bec3b07699e693ef237eef3260 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Fri, 16 Jun 2017 17:54:07 +0300
Subject: [PATCH] Improved default holdings_grouping (#991)

- Group holdings by holdings ID and location by default to accommodate a situation where the items under a single holding have multiple actual locations. This will not change anything in the more common case where there is a 1:1 correspondence between these values.
---
 config/vufind/config.ini                     | 5 +++--
 module/VuFind/src/VuFind/ILS/Logic/Holds.php | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/config/vufind/config.ini b/config/vufind/config.ini
index e951a96e6f7..699911a8200 100644
--- a/config/vufind/config.ini
+++ b/config/vufind/config.ini
@@ -250,7 +250,8 @@ title_level_holds_mode = "disabled"
 ; the item information provided by the ILS driver.
 ;
 ; Most commonly-used values:
-; - holdings_id (Use holdings record id if available, location name otherwise - Default)
+; - holdings_id,location (Use holdings record id if available, location name as
+;   secondary - Default)
 ; - location (Use location name)
 ;
 ; See https://vufind.org/wiki/development:plugins:ils_drivers#getholding for
@@ -263,7 +264,7 @@ title_level_holds_mode = "disabled"
 ;
 ; You may use multiple group keys (delimited by comma), e.g.,
 ; - item_agency_id,location
-;holdings_grouping = holdings_id
+;holdings_grouping = holdings_id,location
 
 ; Text fields such as holdings_notes gathered from items to be displayed in each
 ; holdings group in the display order.
diff --git a/module/VuFind/src/VuFind/ILS/Logic/Holds.php b/module/VuFind/src/VuFind/ILS/Logic/Holds.php
index ce6d6bfd688..137fc244d99 100644
--- a/module/VuFind/src/VuFind/ILS/Logic/Holds.php
+++ b/module/VuFind/src/VuFind/ILS/Logic/Holds.php
@@ -532,9 +532,9 @@ class Holds
      */
     protected function getHoldingsGroupKey($copy)
     {
-        // Group by holdings id unless configured otherwise
+        // Group by holdings id and location unless configured otherwise
         $grouping = isset($this->config->Catalog->holdings_grouping)
-            ? $this->config->Catalog->holdings_grouping : 'holdings_id';
+            ? $this->config->Catalog->holdings_grouping : 'holdings_id,location';
 
         $groupKey = "";
 
-- 
GitLab