[open-ils-commits] r17077 - trunk/Open-ILS/src/perlmods/OpenILS/Application (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Aug 4 15:47:04 EDT 2010
Author: miker
Date: 2010-08-04 15:46:59 -0400 (Wed, 04 Aug 2010)
New Revision: 17077
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Log:
a glue method used to apply a template to a set of records
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2010-08-04 19:12:58 UTC (rev 17076)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2010-08-04 19:46:59 UTC (rev 17077)
@@ -175,6 +175,46 @@
}
__PACKAGE__->register_method(
+ method => "template_overlay_biblio_record_entry",
+ api_name => "open-ils.cat.biblio.record_entry.template_overlay",
+ stream => 1,
+ signature => q#
+ Overlays biblio.record_entry MARC values
+ @param auth The authtoken
+ @param records The record ids to be updated by the template
+ @param template The overlay template
+ @return Stream of hashes record id in the key "record" and t or f for the success of the overlay operation in key "success"
+ #
+);
+
+sub template_overlay_biblio_record_entry {
+ my($self, $conn, $auth, $records, $template) = @_;
+ my $e = new_editor(authtoken=>$auth, xact=>1);
+ return $e->die_event unless $e->checkauth;
+
+ $records = [$records] if (!ref($records));
+
+ for my $rid ( @$records ) {
+ my $rec = $e->retrieve_biblio_record_entry($rid);
+ next unless $rec;
+
+ unless ($e->allowed('UPDATE_RECORD', $rec->owner, $rec)) {
+ $conn->respond({ record => $rid, success => 'f' });
+ next;
+ }
+
+ my $success = $e->json_query(
+ { from => [ 'vandelay.template_overlay_bib_record', $template, $rid ] }
+ )->[0]->{'vandelay.template_overlay_bib_record'};
+
+ $conn->respond({ record => $rid, success => $success });
+ }
+
+ $e->commit;
+ return undef;
+}
+
+__PACKAGE__->register_method(
method => "update_biblio_record_entry",
api_name => "open-ils.cat.biblio.record_entry.update",
signature => q/
More information about the open-ils-commits
mailing list