[open-ils-commits] r9606 - in trunk/Open-ILS/src/perlmods/OpenILS: Application WWW

svn at svn.open-ils.org svn at svn.open-ils.org
Wed May 14 16:31:52 EDT 2008


Author: miker
Date: 2008-05-14 16:31:48 -0400 (Wed, 14 May 2008)
New Revision: 9606

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/Vandelay.pm
Log:
moving purpose to record instead of queue

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm	2008-05-14 18:48:04 UTC (rev 9605)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm	2008-05-14 20:31:48 UTC (rev 9606)
@@ -51,7 +51,6 @@
 	my $name = shift;
 	my $owner = shift;
 	my $type = shift;
-	my $purpose = shift;
 
 	my $e = new_editor(authtoken => $auth, xact => 1);
 
@@ -86,7 +85,6 @@
 	my $name = shift;
 	my $owner = shift;
 	my $type = shift;
-	my $purpose = shift;
 
 	my $e = new_editor(authtoken => $auth, xact => 1);
 
@@ -119,6 +117,7 @@
 	my $auth = shift;
 	my $queue = shift;
 	my $marc = shift;
+	my $purpose = shift;
 
 	my $e = new_editor(authtoken => $auth, xact => 1);
 
@@ -129,7 +128,7 @@
 		($e->allowed('CREATE_BIB_IMPORT_QUEUE', undef, $queue) ||
 		 $e->allowed('CREATE_BIB_IMPORT_QUEUE', $queue->owner));
 
-	my $new_id = _add_auth_rec($e, $marc, $queue->id);
+	my $new_id = _add_auth_rec($e, $marc, $queue->id, $purpose);
 
 	$e->die_event unless ($new_id);
 	$e->commit;
@@ -148,10 +147,12 @@
 	my $e = shift;
 	my $marc = shift;
 	my $queue = shift;
+	my $purpose = shift;
 
 	my $rec = new Fieldmapper::vandelay::queued_bib_record();
 	$rec->marc( $marc );
 	$rec->queue( $queue );
+	$rec->purpose( $purpose ) if ($purpose);
 
 	return $e->create_vandelay_queued_bib_record( $rec );
 }
@@ -162,6 +163,7 @@
 	my $auth = shift;
 	my $queue = shift;
 	my $marc = shift;
+	my $purpose = shift;
 
 	my $e = new_editor(authtoken => $auth, xact => 1);
 
@@ -172,7 +174,7 @@
 		($e->allowed('CREATE_AUTHORITY_IMPORT_QUEUE', undef, $queue) ||
 		 $e->allowed('CREATE_AUTHORITY_IMPORT_QUEUE', $queue->owner));
 
-	my $new_id = _add_auth_rec($e, $marc, $queue->id);
+	my $new_id = _add_auth_rec($e, $marc, $queue->id, $purpose);
 
 	$e->die_event unless ($new_id);
 	$e->commit;
@@ -195,6 +197,7 @@
 	my $rec = new Fieldmapper::vandelay::queued_authority_record();
 	$rec->marc( $marc );
 	$rec->queue( $queue );
+	$rec->purpose( $purpose ) if ($purpose);
 
 	return $e->create_vandelay_queued_authority_record( $rec );
 }
@@ -226,7 +229,8 @@
     my $cache = new OpenSRF::Utils::Cache();
 
     my $data = $cache->get_cache('vandelay_import_spool_' . $fingerprint);
-    $data = decode_base64($data);
+	my $purpose = $data->{purpose};
+    $data = decode_base64($data->{marc});
 
 	my $fh = new IO::Scalar \$data;
 
@@ -244,9 +248,9 @@
 			$xml =~ s/[\x00-\x1f]//go;
 
 			if ($self->{record_type} eq 'bib') {
-				_add_bib_rec( $e, $xml, $queue );
+				_add_bib_rec( $e, $xml, $queue, $purpose );
 			} else {
-				_add_auth_rec( $e, $xml, $queue );
+				_add_auth_rec( $e, $xml, $queue, $purpose );
 			}
 			$count++;
 			

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/Vandelay.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/Vandelay.pm	2008-05-14 18:48:04 UTC (rev 9605)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/Vandelay.pm	2008-05-14 20:31:48 UTC (rev 9606)
@@ -56,7 +56,8 @@
 
 	return Apache2::Const::FORBIDDEN unless verify_login($auth);
 
-	my $cache = new OpenSRF::Utils::Cache();
+
+	my $purpose = $cgi->param('purpose');
 	my $file = $cgi->param('marc_upload');
 	my $filename = "$file";
 
@@ -65,7 +66,10 @@
 
 	my $data_fingerprint = md5_hex($data);
 
-	$cache->put_cache('vandelay_import_spool_' . $data_fingerprint, $data);
+	OpenSRF::Utils::Cache()->new->put_cache(
+		'vandelay_import_spool_' . $data_fingerprint,
+		{ purpose => $purpose, marc => $data }
+	);
 
 	print "Content-type: text/plain; charset=utf-8\n\n$data_fingerprint";
 



More information about the open-ils-commits mailing list