LP#1347774 'mfr' IDL pcrud access; added content uses pcrud
authorBill Erickson <berick@esilibrary.com>
Fri, 1 Aug 2014 20:32:44 +0000 (16:32 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 1 Aug 2014 20:32:44 +0000 (16:32 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent.pm

index e574b29..6755bf9 100644 (file)
@@ -3321,7 +3321,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             </actions>
         </permacrud>
        </class>
-       <class id="mfr" controller="open-ils.cstore" oils_obj:fieldmapper="metabib::full_rec" oils_persist:tablename="metabib.full_rec" reporter:label="Flattened MARC Fields">
+       <class id="mfr" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="metabib::full_rec" oils_persist:tablename="metabib.full_rec" reporter:label="Flattened MARC Fields">
                <fields oils_persist:primary="id" oils_persist:sequence="metabib.full_rec_id_seq">
                        <field reporter:label="Field ID" name="id" reporter:datatype="id" />
                        <field reporter:label="Indicator 1" name="ind1" oils_persist:primitive="string"  reporter:datatype="text"/>
@@ -3334,6 +3334,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                <links>
                        <link field="record" reltype="has_a" key="id" map="" class="bre"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve/>
+            </actions>
+        </permacrud>
        </class>
        <class id="mmr" controller="open-ils.cstore" oils_obj:fieldmapper="metabib::metarecord" oils_persist:tablename="metabib.metarecord" reporter:label="Metarecord">
                <fields oils_persist:primary="id" oils_persist:sequence="metabib.metarecord_id_seq">
index e1c0bf0..5c0f341 100644 (file)
@@ -15,7 +15,7 @@ use OpenSRF::EX qw(:try);
 use OpenSRF::Utils::Cache;
 use OpenSRF::System;
 use OpenSRF::Utils::Logger qw/$logger/;
-use OpenILS::Utils::CStoreEditor;
+use OpenILS::Utils::CStoreEditor (':funcs', personality => 'open-ils.pcrud');
 
 use LWP::UserAgent;
 use MIME::Base64;
@@ -200,32 +200,32 @@ sub handler {
 # returns [{tag => $tag, value => $value}, {tag => $tag2, value => $value2}]
 sub get_rec_keys {
     my $id = shift;
-    return OpenILS::Utils::CStoreEditor->new->json_query({
-        select => {mfr => ['tag', 'value']},
-        from => 'mfr',
-        where => {
-            record => $id,
-            '-or' => [
-                {
-                    '-and' => [
-                        {tag => '020'},
-                        {subfield => 'a'}
-                    ]
-                }, {
-                    '-and' => [
-                        {tag => '022'},
-                        {subfield => 'a'}
-                    ]
-                }, {
-                    '-and' => [
-                        {tag => '024'},
-                        {subfield => 'a'},
-                        {ind1 => 1}
-                    ]
-                }
-            ]
-        }
+    my $keys = new_editor()->search_metabib_full_rec({
+        record => $id,
+        '-or' => [
+            {
+                '-and' => [
+                    {tag => '020'},
+                    {subfield => 'a'}
+                ]
+            }, {
+                '-and' => [
+                    {tag => '022'},
+                    {subfield => 'a'}
+                ]
+            }, {
+                '-and' => [
+                    {tag => '024'},
+                    {subfield => 'a'},
+                    {ind1 => 1}
+                ]
+            }
+        ]
     });
+
+    return [
+        map {{tag => $_->tag, value => $_->value}} @$keys
+    ];
 }
 
 sub print_content {