Add option to combine parts or display individually
authorArt Rhyno <art632000@yahoo.ca>
Sun, 6 Jul 2014 21:48:14 +0000 (17:48 -0400)
committerArt Rhyno <art632000@yahoo.ca>
Sun, 6 Jul 2014 21:48:14 +0000 (17:48 -0400)
The option BIB_PART_MERGE will combine parts information
under one title. Otherwise, parts will display with their
own entry, full display will give the numbers for all
parts with the same name, 3 copies of "Vol. 2" for
example.

Signed-off-by: Art Rhyno <art632000@yahoo.ca>
conifer/integration/evergreen_site.py
conifer/settings.py
conifer/syrup/models.py

index 9cf2894..8d8be6c 100644 (file)
@@ -98,6 +98,9 @@ class EvergreenIntegration(object):
     # the given item.
 
     RESERVES_DESK_NAME = getattr(settings, 'RESERVES_DESK_NAME', None)
+
+    # BIB_PART_MERGE: if True, merge parts under one title
+    BIB_PART_MERGE = getattr(settings, 'BIB_PART_MERGE', False)
     
     # USE_Z3950: if True, use Z39.50 for catalogue search; if False, use OpenSRF.
     # Don't set this value directly here: rather, if there is a valid Z3950_CONFIG
@@ -232,9 +235,11 @@ class EvergreenIntegration(object):
 
            return bc_dups, id_dups
 
+        #syrup tries to store as little as possible about an
+        #item, which leads to a lot of hoops when combining
+        #volumes/parts
         def get_copydetails(barcode,copyids,reserves_loc,bcs,ids):
            copy_list = []
-
            bcs_set, ids_set = collect_set(barcode,bcs,ids)
 
            for copyid in copyids:
@@ -434,6 +439,9 @@ class EvergreenIntegration(object):
                     copies = get_copydetails(barcode,copyids,self.RESERVES_DESK_NAME,bcs,ids)
 
                     desk = get_desk_counts(counts)
+                    if barcode:
+                        desk = len(copies)
+
                     avail = desk
                     copy_parts = []
                     duetime = None
index 6089418..12b9733 100644 (file)
@@ -119,6 +119,11 @@ SAKAI_LINKTOOL_AUTHENTICATION  = False
 # http://code.google.com/p/django-cas/
 CAS_AUTHENTICATION       = False  
 
+# This flag will merge titles with parts into
+# one entry on public display
+BIB_PART_MERGE = False
+
+
 #---------------------------------------------------------------------------
 # local_settings.py
 
index 0138c07..26263e9 100644 (file)
@@ -443,14 +443,15 @@ class Site(BaseModel):
 
         # walk the tree
         out = []
-        out_barcodes = []
-        out_ids = []
         def walk(parent, accum):
+            out_barcodes = []
+            out_ids = []
             here = dct.get(parent, [])
             for item in here:
                 sub = []
                 walk(item, sub)
                 push_thru, bib_barcodes, syrup_ids = deal_with_dups(item,items,edit_status,out_barcodes)
+
                 if len(bib_barcodes) > 0:
                     out_barcodes.append(bib_barcodes)
                     out_ids.append(syrup_ids)