LP#1596595 Adds sample metarecord hold to concerto
authorBill Erickson <berickxx@gmail.com>
Wed, 5 Oct 2016 16:59:00 +0000 (12:59 -0400)
committerKathy Lussier <klussier@masslnc.org>
Fri, 17 Feb 2017 05:58:53 +0000 (00:58 -0500)
Adds a holdable_formats option to concerto's populate_hold() function.
Inserts one metarecord hold for testing.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/tests/datasets/sql/env_create.sql
Open-ILS/tests/datasets/sql/env_destroy.sql
Open-ILS/tests/datasets/sql/transactions.sql

index ad5ba85..07dae6d 100644 (file)
@@ -186,12 +186,13 @@ CREATE FUNCTION evergreen.populate_hold (
     requestor INTEGER,
     pickup_lib INTEGER,
     frozen BOOLEAN,
-    thawdate TIMESTAMP WITH TIME ZONE
+    thawdate TIMESTAMP WITH TIME ZONE,
+    holdable_formats TEXT DEFAULT NULL
 ) RETURNS void AS $$
 BEGIN
     INSERT INTO action.hold_request (
         requestor, hold_type, target, usr, pickup_lib, 
-            request_lib, selection_ou, frozen, thaw_date)
+            request_lib, selection_ou, frozen, thaw_date, holdable_formats)
     VALUES (
         requestor,
         hold_type,
@@ -201,7 +202,8 @@ BEGIN
         pickup_lib,
         pickup_lib,
         frozen,
-        thawdate
+        thawdate,
+        holdable_formats
     );
 
     -- Create hold notes for staff-placed holds: 1 public, 1 private
index 9b51ab7..9f69865 100644 (file)
@@ -11,5 +11,5 @@ DROP FUNCTION evergreen.next_bib (BIGINT);
 DROP FUNCTION evergreen.populate_circ 
     (INTEGER, INTEGER, BIGINT, INTEGER, TEXT, TEXT, TEXT, BOOLEAN);
 DROP FUNCTION evergreen.populate_hold 
-    (TEXT, BIGINT, INTEGER, INTEGER, INTEGER, BOOLEAN, TIMESTAMP WITH TIME ZONE);
+    (TEXT, BIGINT, INTEGER, INTEGER, INTEGER, BOOLEAN, TIMESTAMP WITH TIME ZONE, TEXT);
 
index e95b0d6..cb9a73c 100644 (file)
@@ -136,6 +136,14 @@ BEGIN
 
         END LOOP;                                                                   
     END LOOP;                                                                   
+
+    -- finally, add a metarecord hold w/ a holdable_format
+    -- for patron id=2 (home_ou=9)
+    PERFORM evergreen.populate_hold(
+        'M', 42, 2, 2, 9, FALSE, NULL, 
+        '{"0":[{"_attr":"mr_hold_format","_val":"score"}]}'
+    );
+
 END $$;