[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. 13901607c6cad0b0b489de07286dc5c28d404f93
Evergreen Git
git at git.evergreen-ils.org
Tue Jun 28 08:50:15 EDT 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_1 has been updated
via 13901607c6cad0b0b489de07286dc5c28d404f93 (commit)
from ed655c3587427d9b2c27485688e798b6a692dc2e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 13901607c6cad0b0b489de07286dc5c28d404f93
Author: Jason Etheridge <jason at esilibrary.com>
Date: Mon Jun 27 14:41:52 2011 -0400
Saner behavior for Actions for Selected Holds -> Transfer to Marked Title
* Transfer the actual selected title holds, rather than all title holds for
the bibs referenced by those selected.
* middle layer method for changing the target and resetting specified holds
* label change for clarity, Transfer All Title Holds
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
Signed-off-by: Bill Erickson <berick at esilibrary.com>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
index 7ffb6d4..a3bce99 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -3422,6 +3422,22 @@ __PACKAGE__->register_method(
}
);
+__PACKAGE__->register_method(
+ method => 'change_hold_title_for_specific_holds',
+ api_name => 'open-ils.circ.hold.change_title.specific_holds',
+ signature => {
+ desc => q/
+ Updates specified holds to target new bib./,
+ params => [
+ { desc => 'Authentication Token', type => 'string' },
+ { desc => 'New Target Bib Id', type => 'number' },
+ { desc => 'Holds Ids for holds to update', type => 'array' },
+ ],
+ return => { desc => '1 on success' }
+ }
+);
+
+
sub change_hold_title {
my( $self, $client, $auth, $new_bib_id, $bib_ids ) = @_;
@@ -3458,6 +3474,41 @@ sub change_hold_title {
return 1;
}
+sub change_hold_title_for_specific_holds {
+ my( $self, $client, $auth, $new_bib_id, $hold_ids ) = @_;
+
+ my $e = new_editor(authtoken=>$auth, xact=>1);
+ return $e->die_event unless $e->checkauth;
+
+ my $holds = $e->search_action_hold_request(
+ [
+ {
+ cancel_time => undef,
+ fulfillment_time => undef,
+ hold_type => 'T',
+ id => $hold_ids
+ },
+ {
+ flesh => 1,
+ flesh_fields => { ahr => ['usr'] }
+ }
+ ],
+ { substream => 1 }
+ );
+
+ for my $hold (@$holds) {
+ $e->allowed('UPDATE_HOLD', $hold->usr->home_ou) or return $e->die_event;
+ $logger->info("Changing hold " . $hold->id . " target from " . $hold->target . " to $new_bib_id in title hold target change");
+ $hold->target( $new_bib_id );
+ $e->update_action_hold_request($hold) or return $e->die_event;
+ }
+
+ $e->commit;
+
+ _reset_hold($self, $e->requestor, $_) for @$holds;
+
+ return 1;
+}
__PACKAGE__->register_method(
method => 'rec_hold_count',
diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd
index 7005536..1430b5d 100644
--- a/Open-ILS/web/opac/locale/en-US/lang.dtd
+++ b/Open-ILS/web/opac/locale/en-US/lang.dtd
@@ -299,7 +299,7 @@
<!ENTITY staff.cat.opac.mark_for_hold_transfer.accesskey "">
<!ENTITY staff.cat.opac.mark_for_hold_transfer.label "Mark as Title Hold Transfer Destination">
<!ENTITY staff.cat.opac.transfer_title_holds.accesskey "">
-<!ENTITY staff.cat.opac.transfer_title_holds.label "Transfer Title Holds">
+<!ENTITY staff.cat.opac.transfer_title_holds.label "Transfer All Title Holds">
<!ENTITY staff.cat.opac.delete_record.accesskey "D">
<!ENTITY staff.cat.opac.delete_record.label "Delete Record">
<!ENTITY staff.cat.opac.undelete_record.accesskey "U">
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 56ed059..03c33f3 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js
@@ -145,6 +145,7 @@ var api = {
'FM_AHR_RESET' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.reset' },
'FM_AHR_STATUS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.status.retrieve' },
'TRANSFER_TITLE_HOLDS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.change_title' },
+ 'TRANSFER_SPECIFIC_TITLE_HOLDS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.change_title.specific_holds' },
'FM_AHRCC_PCRUD_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.ahrcc.atomic', 'secure' : false },
'FM_AIHU_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.in_house_use.create' },
'FM_ANCC_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cataloged_circulation.retrieve' },
diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js
index 750de17..215d048 100644
--- a/Open-ILS/xul/staff_client/server/cat/util.js
+++ b/Open-ILS/xul/staff_client/server/cat/util.js
@@ -9,7 +9,7 @@ cat.util.EXPORT_OK = [
'spawn_copy_editor', 'add_copies_to_bucket', 'show_in_opac', 'spawn_spine_editor', 'transfer_copies',
'transfer_title_holds', 'mark_item_missing', 'mark_item_damaged', 'replace_barcode', 'fast_item_add',
'make_bookable', 'edit_new_brsrc', 'edit_new_bresv', 'batch_edit_volumes', 'render_fine_level',
- 'render_loan_duration', 'mark_item_as_missing_pieces'
+ 'render_loan_duration', 'mark_item_as_missing_pieces', 'transfer_specific_title_holds'
];
cat.util.EXPORT_TAGS = { ':all' : cat.util.EXPORT_OK };
@@ -115,6 +115,37 @@ cat.util.transfer_title_holds = function(old_targets) {
}
}
+cat.util.transfer_specific_title_holds = function(hold_ids,unique_targets) {
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data();
+ JSAN.use('util.network'); var network = new util.network();
+ try {
+ data.stash_retrieve();
+ var target = data.marked_record_for_hold_transfer;
+ if (!target) {
+ var m = $("catStrings").getString('staff.cat.opac.title_for_hold_transfer.destination_needed.label');
+ alert(m);
+ return;
+ }
+ if (unique_targets.length > 1) {
+ var m = $("catStrings").getString('staff.cat.opac.title_for_hold_transfer.many_bibs.warning');
+ if (! window.confirm(m)) {
+ return;
+ }
+ }
+ var robj = network.simple_request('TRANSFER_SPECIFIC_TITLE_HOLDS',[ ses(), target, hold_ids ]);
+ if (robj == 1) {
+ var m = $("catStrings").getString('staff.cat.opac.title_for_hold_transfer.success.label');
+ alert(m);
+ } else {
+ var m = $("catStrings").getString('staff.cat.opac.title_for_hold_transfer.failure.label');
+ alert(m);
+ }
+ } catch(E) {
+ alert('Error in cat.util.transfer_title.holds(): ' + E);
+ }
+}
+
+
cat.util.transfer_copies = function(params) {
JSAN.use('util.error'); var error = new util.error();
JSAN.use('OpenILS.data'); var data = new OpenILS.data();
diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
index d66da69..edf3aad 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
@@ -278,6 +278,7 @@ staff.cat.opac.set_tab_name=Record: %1$s
staff.cat.opac.title_for_hold_transfer.destination_needed.label=Need to mark a record as a Title Hold Transfer Destination first.
staff.cat.opac.title_for_hold_transfer.success.label=Holds transferred.
staff.cat.opac.title_for_hold_transfer.failure.label=Holds not transferred.
+staff.cat.opac.title_for_hold_transfer.many_bibs.warning=WARNING: Move selected holds from multiple bibs to single targeted bib?
staff.cat.record_buckets.tab_name=Record Buckets
staff.cat.record_buckets.save_file_as=Save File As
staff.cat.record_buckets.export_records.alert=File not downloaded.
diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js
index 085c54a..c486009 100644
--- a/Open-ILS/xul/staff_client/server/patron/holds.js
+++ b/Open-ILS/xul/staff_client/server/patron/holds.js
@@ -1198,16 +1198,23 @@ patron.holds.prototype = {
['command'],
function() {
try {
- var targets = [];
+ var hids = [];
+ var unique_targets = [];
+ var seen_target = {};
for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var htarget = obj.retrieve_ids[i].target;
+ var hid = obj.retrieve_ids[i].id;
+ var htarget = obj.retrieve_ids[i].id;
var htype = obj.retrieve_ids[i].type;
switch(htype) {
case 'M' :
continue; // not supported
break;
case 'T' :
- targets.push( htarget );
+ hids.push( hid );
+ if (! seen_target[htarget]) {
+ unique_targets.push( htarget );
+ seen_target[htarget] = 1;
+ }
break;
case 'V' :
continue; // not supported
@@ -1221,7 +1228,7 @@ patron.holds.prototype = {
}
}
JSAN.use('cat.util');
- cat.util.transfer_title_holds(targets);
+ cat.util.transfer_specific_title_holds(hids,unique_targets);
obj.clear_and_retrieve();
} catch(E) {
obj.error.standard_unexpected_error_alert('',E);
-----------------------------------------------------------------------
Summary of changes:
.../perlmods/lib/OpenILS/Application/Circ/Holds.pm | 51 ++++++++++++++++++++
Open-ILS/web/opac/locale/en-US/lang.dtd | 2 +-
.../staff_client/chrome/content/main/constants.js | 1 +
Open-ILS/xul/staff_client/server/cat/util.js | 33 ++++++++++++-
.../server/locale/en-US/cat.properties | 1 +
Open-ILS/xul/staff_client/server/patron/holds.js | 15 ++++--
6 files changed, 97 insertions(+), 6 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list