From 67b95859491da7ae9b2ecfa6d8c1b136917b5c94 Mon Sep 17 00:00:00 2001 From: Art Rhyno Date: Sun, 6 Jul 2014 17:48:14 -0400 Subject: [PATCH] Add option to combine parts or display individually 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 --- conifer/integration/evergreen_site.py | 10 +++++++++- conifer/settings.py | 5 +++++ conifer/syrup/models.py | 5 +++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/conifer/integration/evergreen_site.py b/conifer/integration/evergreen_site.py index 9cf2894..8d8be6c 100644 --- a/conifer/integration/evergreen_site.py +++ b/conifer/integration/evergreen_site.py @@ -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 diff --git a/conifer/settings.py b/conifer/settings.py index 6089418..12b9733 100644 --- a/conifer/settings.py +++ b/conifer/settings.py @@ -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 diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py index 0138c07..26263e9 100644 --- a/conifer/syrup/models.py +++ b/conifer/syrup/models.py @@ -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) -- 2.11.0