JBAS-2096 implement hiding for stat cat ""Hidden in BiblioCommons"
authorBradley Bonner <bbonner@kcls.org>
Wed, 29 Aug 2018 20:39:23 +0000 (13:39 -0700)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
As discussed in JBAS-2096, this change adds item opac_visible logic changes to support the newly added "Hidden in BiblioCommons" stat cat.

Bradley Bonner
bbonner@kcls.org

KCLS/utility-scripts/bc_missing/bc_missing.sql

index c846cbe..3c0ceb5 100644 (file)
@@ -38,6 +38,23 @@ UPDATE asset.copy
             'Generic' , 'Normandy Park' , 'Choice Reads', 'Lucky Day', 'Book Club'
         )
     );
+       
+       -- hiding by stat cat  (hidden in bibliocommons)
+
+UPDATE asset.copy
+    SET (edit_date, opac_visible) = (now(), 'f')
+    WHERE id IN 
+       (
+       SELECT
+       asset."copy"."id"
+       FROM
+       asset."copy"
+       INNER JOIN asset.stat_cat_entry_copy_map ON asset."copy"."id" = asset.stat_cat_entry_copy_map.owning_copy
+       WHERE
+       asset.stat_cat_entry_copy_map.stat_cat = 6
+       and asset.copy.deleted = 'f'
+       and asset.copy.opac_visible = 't'
+       );
 
 -- make the items that should be visible again as they become some
 -- kind of "available", but still following our business rules
@@ -51,6 +68,7 @@ UPDATE asset.copy
             ON asset.copy.location = asset.copy_location.id
         INNER JOIN config.i18n_core
             ON cast(config.i18n_core.identity_value as integer) = asset.copy_location.id
+                        LEFT OUTER JOIN asset.stat_cat_entry_copy_map ON asset."copy"."id" = asset.stat_cat_entry_copy_map.owning_copy 
         WHERE asset.copy.deleted = 'f'
         AND asset.copy.opac_visible = 'f'
         AND asset.copy.status IN ('0', '1', '6', '7', '8')
@@ -66,6 +84,7 @@ UPDATE asset.copy
             'KidReach' , 'Tech Lab' , 'Storage' , 'Teen Materials' ,
             'Generic' , 'Normandy Park' , 'Choice Reads', 'Lucky Day', 'Book Club' )
         AND floating IS NULL
+               AND (stat_cat is null or stat_cat != 6)
     );