From 1a430ac9f5b7dd7fc9875d6faf540d4c22fa50ce Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 23 Sep 2010 23:47:49 +0000 Subject: [PATCH] reverting previous. sorry, folks git-svn-id: svn://svn.open-ils.org/ILS/trunk@17938 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/Holds.pm | 110 +-------------------- .../Application/Storage/Publisher/action.pm | 2 +- Open-ILS/web/js/dojo/openils/BibTemplate.js | 10 +- Open-ILS/web/js/dojo/openils/PermaCrud.js | 44 +-------- 4 files changed, 13 insertions(+), 153 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 877ca67e27..7dde2ef536 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -24,7 +24,6 @@ use OpenSRF::EX qw(:try); use OpenILS::Perm; use OpenILS::Event; use OpenSRF::Utils; -use OpenSRF::AppSession; use OpenSRF::Utils::Logger qw(:logger); use OpenILS::Utils::CStoreEditor q/:funcs/; use OpenILS::Utils::PermitHold; @@ -1266,123 +1265,22 @@ sub print_hold_pull_list { my $hold_ids = $U->storagereq( 'open-ils.storage.direct.action.hold_request.pull_list.id_list.current_copy_circ_lib.status_filtered.atomic', $org_id, 10000); - + return undef unless @$hold_ids; $client->status(new OpenSRF::DomainObject::oilsContinueStatus); - + # Holds will /NOT/ be in order after this ... my $holds = $e->search_action_hold_request({id => $hold_ids}, {substream => 1}); $client->status(new OpenSRF::DomainObject::oilsContinueStatus); - + # ... so we must resort. my $hold_map = +{map { $_->id => $_ } @$holds}; my $sorted_holds = []; push @$sorted_holds, $hold_map->{$_} foreach @$hold_ids; - + return $U->fire_object_event( undef, "ahr.format.pull_list", $sorted_holds, $org_id ); - -} - -__PACKAGE__->register_method( - method => "print_hold_pull_list_stream", - api_name => "open-ils.circ.hold_pull_list.print.stream", - signature => { - desc => 'Returns a stream of fleshed holds', - params => [ - { desc => 'Authtoken', type => 'string'}, - { desc => 'Hash of optional param: Org unit ID (defaults to workstation org unit), limit, offset, sort (array of: acplo.position, call_number, request_time)', - type => 'object' - }, - ], - return => { - desc => 'A stream of fleshed holds', - type => 'object' - } - } -); - -sub print_hold_pull_list_stream { - my($self, $client, $auth, $params) = @_; - - my $e = new_editor(authtoken=>$auth, xact=>1); - return $e->die_event unless $e->checkauth; - - delete($$params{org_id}) unless (int($$params{org_id})); - delete($$params{limit}) unless (int($$params{limit})); - delete($$params{offset}) unless (int($$params{offset})); - - $$params{org_id} = (defined $$params{org_id}) ? $$params{org_id}: $e->requestor->ws_ou; - return $e->die_event unless $e->allowed('VIEW_HOLD', $$params{org_id }); - - my $sort = 'ahr.request_time'; - if ($$params{sort} && @{ $$params{sort} }) { - $sort = ''; - for my $s (@{ $$params{sort} }) { - if ($s eq 'acplo.position') { - $s = 'coalesce(acplo.position,999)'; - } elsif ($s eq 'call_number') { - $s = 'acn.label'; - } elsif ($s eq 'request_time') { - $s = 'ahr.request_time'; - } else { - $s = ''; - } - - $sort .= ', ' if ($sort); - $sort .= $s; - } - } - - my $req = OpenSRF::AppSession->create('open-ils.cstore')->request( - 'open-ils.cstore.direct.action.hold_request', - { capture_time => undef, - cancel_time => undef, - '-or' => [ - { expire_time => undef }, - { expire_time => { '>' => 'now' } } - ] - },{ - flesh => 3, - flesh_fields => { - ahr => [ "usr","current_copy" ], - au => [ "card" ], - acp => [ "location", "call_number" ], - acn => [ "record" ] - }, - join => { - acp => { - field => 'id', - fkey => 'current_copy', - filter => { circ_lib => $$params{org_id}, status => [0,7] }, - join => { - acn => { - field => 'id', - fkey => 'call_number' - }, - acplo => { - field => 'org', - fkey => 'circ_lib', - type => 'left' - } - } - } - }, - order_by => $sort, - ($$params{limit} ? (limit => $$params{limit}) : ()), - ($$params{offset} ? (offset => $$params{offset}) : ()), - } - ); - - while (my $resp = $req->recv( timeout => 180 )) { - if ($req->failed) { - throw OpenSRF::EX::ERROR ($self->failed()->stringify()) - } - $self->respond( $resp->content ); - } - - return $self->respond_complete; } diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm index 471adc80f6..eff5a0a3f9 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -1294,7 +1294,7 @@ sub new_hold_copy_targeter { my %circ_lib_map = map { (''.$_->circ_lib => 1) } @$all_copies; my $circ_lib_list = [keys %circ_lib_map]; - my $cstore = OpenSRF::AppSession->create('open-ils.cstore'); + my $cstore = OpenSRF::AppSession->connect('open-ils.cstore'); # Grab the "biggest" loop for this hold so far my $current_loop = $cstore->request( diff --git a/Open-ILS/web/js/dojo/openils/BibTemplate.js b/Open-ILS/web/js/dojo/openils/BibTemplate.js index 027e90deb8..790d16a60e 100644 --- a/Open-ILS/web/js/dojo/openils/BibTemplate.js +++ b/Open-ILS/web/js/dojo/openils/BibTemplate.js @@ -36,9 +36,6 @@ if(!dojo._hasResource["openils.BibTemplate"]) { this.locale = kwargs.locale || OpenSRF.locale || 'en-US'; this.nodelay = kwargs.delay == false; - if (this.xml && this.xml instanceof String) - this.xml = dojox.xml.parser.parse(this.xml); - this.mode = 'biblio-record_entry'; this.default_datatype = 'marcxml-uris'; if (kwargs.metarecord) { @@ -59,11 +56,12 @@ if(!dojo._hasResource["openils.BibTemplate"]) { }, textContent : function (node) { + var content = ''; if (node) { - if (node instanceof HTMLElement) return node.innerText || node.textContent; - return dojox.xml.parser.textContent(node); + if(window.ActiveXObject) content = node.text; + else content = node.textContent; } - return ''; + return content; }, render : function() { diff --git a/Open-ILS/web/js/dojo/openils/PermaCrud.js b/Open-ILS/web/js/dojo/openils/PermaCrud.js index f571d7d66d..834c6cd8d0 100644 --- a/Open-ILS/web/js/dojo/openils/PermaCrud.js +++ b/Open-ILS/web/js/dojo/openils/PermaCrud.js @@ -26,13 +26,11 @@ if(!dojo._hasResource["openils.PermaCrud"]) { session : null, authtoken : null, connnected : false, - authoritative : false, constructor : function ( kwargs ) { kwargs = kwargs || {}; this.authtoken = kwargs.authtoken; - this.authoritative = kwargs.authoritative; this.session = kwargs.session || @@ -68,41 +66,7 @@ if(!dojo._hasResource["openils.PermaCrud"]) { return false; } }, - - _session_request : function ( args /* hash */, commitOnComplete /* set to true, else no */ ) { - - var me = this; - var endstyle = 'rollback'; - if (commitOnComplete) endstyle = 'commit'; - - if (me.authoritative) { - if (!me.connected) me.connect(); - if (args.timeout && !args.oncomplete && !args.onresponse) { // pure sync call - args.oncomplete = function (r) { - me.session.request('open-ils.pcrud.transaction.' + endstyle, me.auth()); - me.session.disconnect(); - me.disconnect(); - }; - } else if (args.oncomplete) { // there's an oncomplete, fire that, and then end the transaction - var orig_oncomplete = args.oncomplete; - args.oncomplete = function (r) { - var ret; - try { - ret = orig_oncomplete(r); - } finally { - me.session.request('open-ils.pcrud.transaction.' + endstyle, me.auth()); - me.session.disconnect(); - me.disconnect(); - } - return ret; - }; - } - - if (me.authoritative) me.session.request('open-ils.pcrud.transaction.begin', me.auth() ); - - return me.session.request( args ); - - }, + retrieve : function ( fm_class /* Fieldmapper class hint */, id /* Fieldmapper object primary key value */, opts /* Option hash */) { if(!opts) opts = {}; @@ -116,7 +80,7 @@ if(!dojo._hasResource["openils.PermaCrud"]) { if (!opts.async && !opts.timeout) req_hash.timeout = 10; var _pcrud = this; - var req = this._session_request( req_hash ); + var req = this.session.request( req_hash ); if (!req.onerror) req.onerror = function (r) { throw js2JSON(r); }; @@ -165,7 +129,7 @@ if(!dojo._hasResource["openils.PermaCrud"]) { if (!opts.async && !opts.timeout) req_hash.timeout = 10; var _pcrud = this; - var req = this._session_request( req_hash ); + var req = this.session.request( req_hash ); if (!req.onerror) req.onerror = function (r) { throw js2JSON(r); }; @@ -211,7 +175,7 @@ if(!dojo._hasResource["openils.PermaCrud"]) { if (!opts.async && !opts.timeout) req_hash.timeout = 10; var _pcrud = this; - var req = this._session_request( req_hash ); + var req = this.session.request( req_hash ); if (!req.onerror) req.onerror = function (r) { throw js2JSON(r); }; -- 2.11.0