on the "Checked Out" tab of MYOPAC, title and author info is now retrieve asynchronously
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Dec 2005 20:55:32 +0000 (20:55 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Dec 2005 20:55:32 +0000 (20:55 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2553 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/skin/default/js/myopac.js

index 69b0da2..54fe7cc 100644 (file)
@@ -74,6 +74,32 @@ sub checkouts_by_user {
 }
 
 
+
+__PACKAGE__->register_method(
+       method  => "checkouts_by_user_slim",
+       api_name        => "open-ils.circ.actor.user.checked_out.slim",
+       NOTES           => <<"  NOTES");
+       Returns a list of open circulation objects
+       NOTES
+
+sub checkouts_by_user_slim {
+       my( $self, $client, $user_session, $user_id ) = @_;
+
+       my( $requestor, $target, $copy, $record, $evt );
+
+       ( $requestor, $target, $evt ) = 
+               $apputils->checkses_requestor( $user_session, $user_id, 'VIEW_CIRCULATIONS');
+       return $evt if $evt;
+
+       return $apputils->simplereq(
+               'open-ils.storage',
+               "open-ils.storage.direct.action.open_circulation.search.atomic", 
+               { usr => $target->id } );
+}
+
+
+
+
 __PACKAGE__->register_method(
        method  => "title_from_transaction",
        api_name        => "open-ils.circ.circ_transaction.find_title",
index 7cdb2b7..21f047f 100644 (file)
@@ -1161,7 +1161,17 @@ sub biblio_search_isbn {
 }
 
 
+__PACKAGE__->register_method(
+       method  => "fetch_mods_by_copy",
+       api_name        => "open-ils.search.biblio.mods_from_copy",
+);
 
+sub fetch_mods_by_copy {
+       my( $self, $client, $copyid ) = @_;
+       my ($record, $evt) = $apputils->fetch_record_by_copy( $copyid );
+       return $evt if $evt;
+       return $apputils->record_to_mvr($record);
+}
 
 
 
index 994182d..b3f7262 100644 (file)
@@ -187,6 +187,7 @@ var FETCH_MRCOUNT                                   = "open-ils.search:open-ils.search.biblio.class.count:1";
 var FETCH_MRIDS                                        = "open-ils.search:open-ils.search.biblio.class:1";
 var FETCH_MRIDS_FULL                           = "open-ils.search:open-ils.search.biblio.class.full:1";
 var FETCH_MRMODS                                       = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
+var FETCH_MODS_FROM_COPY               = "open-ils.search:open-ils.search.biblio.mods_from_copy";
 var FETCH_MR_COPY_COUNTS               = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1";
 var FETCH_RIDS                                         = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1";
 var FETCH_RMODS                                        = "open-ils.search:open-ils.search.biblio.record.mods_slim.retrieve";
@@ -202,6 +203,7 @@ var FETCH_COPY_STATUSES                     = "open-ils.search:open-ils.search.config.copy_status.
 var FETCH_COPY_COUNTS_SUMMARY  = "open-ils.search:open-ils.search.biblio.copy_counts.summary.retrieve";
 var FETCH_MARC_HTML                            = "open-ils.search:open-ils.search.biblio.record.html";
 var FETCH_CHECKED_OUT                  = "open-ils.circ:open-ils.circ.actor.user.checked_out";
+var FETCH_CHECKED_OUT_SLIM             = "open-ils.circ:open-ils.circ.actor.user.checked_out.slim";
 var FETCH_HOLDS                                        = "open-ils.circ:open-ils.circ.holds.retrieve";
 var FETCH_FINES_SUMMARY                        = "open-ils.actor:open-ils.actor.user.fines.summary";
 var FETCH_TRANSACTIONS                 = "open-ils.actor:open-ils.actor.user.transactions.have_charge.fleshed";
index e4debd0..6d3cebc 100644 (file)
@@ -85,8 +85,8 @@ function myOPACChangePage( page ) {
 }
 
 function myOPACShowChecked() {
-       var req = new Request(FETCH_CHECKED_OUT, G.user.session);       
-       req.callback(myOPACDrawCheckedOut);
+       var req = new Request(FETCH_CHECKED_OUT_SLIM, G.user.session);  
+       req.callback(myOPACDrawCheckedOutSlim);
        req.send();
 }
 
@@ -94,8 +94,8 @@ function myOPACShowChecked() {
 var checkedRowTemplate;
 var circsCache = new Array();
 var checkedDrawn = false;
-function myOPACDrawCheckedOut(r) {
 
+function myOPACDrawCheckedOutSlim(r) {
 
        var checked                     = r.getResultObject();
        var tbody                       = $("myopac_checked_tbody");
@@ -113,22 +113,17 @@ function myOPACDrawCheckedOut(r) {
 
        for( var idx in checked ) {
 
+               var circ    = checked[idx]
                var row = checkedRowTemplate.cloneNode(true);
+               row.id = 'myopac_checked_row_ ' + circ.id();
 
-               var circ    = checked[idx].circ;
-      var record  = checked[idx].record;
-      var copy    = checked[idx].copy;
                var due = circ.due_date();
       due = due.replace(/[0-9][0-9]:.*$/,"");
 
-               var tlink = $n( row, "myopac_checked_title_link" );
-               var alink = $n( row, "myopac_checked_author_link" );
                var dlink = $n( row, "myopac_checked_due" );
                var rlink = $n( row, "myopac_checked_renewals" );
                var rnlink = $n( row, "myopac_checked_renew_link" );
 
-               buildTitleDetailLink(record, tlink);
-               buildSearchLink(STYPE_AUTHOR, record.author(), alink);
                dlink.appendChild(text(due));
                rlink.appendChild(text(circ.renewal_remaining()));
                unHideMe(row);
@@ -136,9 +131,25 @@ function myOPACDrawCheckedOut(r) {
                circsCache.push(circ);
 
                tbody.appendChild(row);
+
+               var req = new Request(FETCH_MODS_FROM_COPY, circ.target_copy() );
+               req.request.circ = circ.id();
+               req.callback(myOPACDrawCheckedTitle);
+               req.send();
        }
 }
 
+function myOPACDrawCheckedTitle(r) {
+       var circid = r.circ;
+       var row = $('myopac_checked_row_ ' + circid);
+       var record = r.getResultObject();
+       var tlink = $n( row, "myopac_checked_title_link" );
+       var alink = $n( row, "myopac_checked_author_link" );
+       buildTitleDetailLink(record, tlink);
+       buildSearchLink(STYPE_AUTHOR, record.author(), alink);
+}
+
+
 function myOPACRenewCirc(circid) {
        var circ;
        for( var i = 0; i != circsCache.length; i++ )