[open-ils-commits] r14414 - in trunk/Open-ILS: src/perlmods/OpenILS/Application/Circ xul/staff_client/chrome/content/main xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Oct 14 03:35:58 EDT 2009


Author: phasefx
Date: 2009-10-14 03:35:53 -0400 (Wed, 14 Oct 2009)
New Revision: 14414

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/patron/hold_details.js
Log:
Fix Hold Note creation in staff client by replacing permacrud call with a cstore-using OpenSRF method.  It looks like pcrud.create isn't always closing the transaction that it starts here.



Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2009-10-14 06:36:58 UTC (rev 14413)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2009-10-14 07:35:53 UTC (rev 14414)
@@ -958,7 +958,35 @@
    return $note->id;
 }
 
+__PACKAGE__->register_method (
+	method		=> 'create_hold_note',
+	api_name		=> 'open-ils.circ.hold_note.create',
+	signature	=> q/
+		Creates a new hold request note object
+		@param authtoken The login session key
+		@param note The hold note object to create
+		@return ID of the new object on success, Event on error
+		/
+);
 
+sub create_hold_note {
+   my( $self, $conn, $auth, $note ) = @_;
+   my $e = new_editor(authtoken=>$auth, xact=>1);
+   return $e->die_event unless $e->checkauth;
+
+   my $hold = $e->retrieve_action_hold_request($note->hold)
+      or return $e->die_event;
+   my $patron = $e->retrieve_actor_user($hold->usr) 
+      or return $e->die_event;
+
+   return $e->die_event unless 
+      $e->allowed('UPDATE_HOLD', $patron->home_ou); # FIXME: Using permcrud perm listed in fm_IDL.xml for ahrn.  Probably want something more specific
+
+   $e->create_action_hold_request_note($note) or return $e->die_event;
+   $e->commit;
+   return $note->id;
+}
+
 __PACKAGE__->register_method(
 	method	=> 'reset_hold',
 	api_name	=> 'open-ils.circ.hold.reset',

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-10-14 06:36:58 UTC (rev 14413)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-10-14 07:35:53 UTC (rev 14414)
@@ -92,6 +92,7 @@
 	'FM_ACPN_DELETE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_note.delete', 'secure' : false },
 	'FM_ACTSC_RETRIEVE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.actor.retrieve.batch', 'secure' : false },
 	'FM_ACTSC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.actor.retrieve.all', 'secure' : false },
+	'FM_AHRN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_note.create' },
 	'FM_AHN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.create' },
 	'FM_AHN_RETRIEVE_VIA_AHR' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.retrieve_by_hold' },
 	'FM_AHN_RETRIEVE_VIA_AHR.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.retrieve_by_hold.authoritative' },

Modified: trunk/Open-ILS/xul/staff_client/server/patron/hold_details.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/hold_details.js	2009-10-14 06:36:58 UTC (rev 14413)
+++ trunk/Open-ILS/xul/staff_client/server/patron/hold_details.js	2009-10-14 07:35:53 UTC (rev 14414)
@@ -266,8 +266,8 @@
             note.pub( get_bool( fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
             note.slip( get_bool( fancy_prompt_data.slip ) ? get_db_true() : get_db_false() );
             note.staff( true );
-            //var r = g.network.simple_request('FM_AHN_CREATE',[ ses(), notification ]); if (typeof r.ilsevent != 'undefined') throw(r);
-            g.pcrud.create(note);
+            var r = g.network.simple_request('FM_AHRN_CREATE',[ ses(), note ]); if (typeof r.ilsevent != 'undefined') throw(r);
+            //g.pcrud.create(note);
             setTimeout(function(){fetch_and_render_all();},0);
         }
     } catch(E) {



More information about the open-ils-commits mailing list