From: phasefx Date: Wed, 14 Oct 2009 07:35:53 +0000 (+0000) Subject: Fix Hold Note creation in staff client by replacing permacrud call with a cstore... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3ca7c0829488e6bb016057deaf1b31478d3a9110;p=evergreen%2Fmasslnc.git 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. git-svn-id: svn://svn.open-ils.org/ILS/trunk@14414 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index d640772d3a..020f99a75b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -958,6 +958,34 @@ sub create_hold_notify { 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', diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index cd324f3139..8c5f85fba4 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -92,6 +92,7 @@ const api = { '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' }, diff --git a/Open-ILS/xul/staff_client/server/patron/hold_details.js b/Open-ILS/xul/staff_client/server/patron/hold_details.js index 7f321d2c0d..14eb6b4059 100644 --- a/Open-ILS/xul/staff_client/server/patron/hold_details.js +++ b/Open-ILS/xul/staff_client/server/patron/hold_details.js @@ -266,8 +266,8 @@ function new_note() { 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) {