[open-ils-commits] r1043 - conifer/branches/rel_1_6_1/web/opac/skin/uwin/js (artunit)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Oct 17 22:03:04 EDT 2010
Author: artunit
Date: 2010-10-17 22:03:02 -0400 (Sun, 17 Oct 2010)
New Revision: 1043
Modified:
conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/myopac.js
Log:
put hold block logic back in skin, missed it in last version
Modified: conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/myopac.js
===================================================================
--- conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/myopac.js 2010-10-15 02:42:41 UTC (rev 1042)
+++ conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/myopac.js 2010-10-18 02:03:02 UTC (rev 1043)
@@ -1436,38 +1436,119 @@
/* true if 1 renewal succeeded */
var __success_count = 0;
-/* renews all selected circulations */
-function myOPACRenewSelected() {
- var rows = myopacGetCheckedOutRows();
- if(!confirm($('myopac_renew_confirm').innerHTML)) return;
- __success_count = 0;
+/*
+ holdBlock - checking for holds before allowing renewals
- for( var i = 0; i < rows.length; i++ ) {
+*/
+function holdBlock(r) {
+ var rec = r.getResultObject();
+ var circ = r.circ;
- var row = rows[i];
- if( ! $n(row, 'selectme').checked ) continue;
- var circ_id = row.getAttribute('circid');
+ //this may be inefficient, but go this route to snag needed title id
+ var new_req = new Request( FETCH_BIB_ID_BY_BARCODE, rec.barcode() );
+ new_req.send(true);
- var circ;
- for( var j = 0; j != circsCache.length; j++ )
- if(circsCache[j].id() == circ_id)
- circ = circsCache[j];
+ if (new_req) {
+ var record = new_req.result();
- __renew_circs.push(circ);
- }
+ if (record){
+ //alert(HOLDSU + ' start for ' + circ.id() + ' - ' + rec.barcode());
+ /*
+ var init_request = new Request( LOGIN_INIT, HOLDSU );
+ init_request.send(true);
+ var seed = init_request.result();
- if( __renew_circs.length == 0 ) return;
+ var args = {
+ password : hex_md5(seed + hex_md5(HOLDSP)),
+ type : "opac",
+ org : getOrigLocation(),
+ username : HOLDSU
+ };
- unHideMe($('my_renewing'));
- moClearCheckedTable();
+ var auth_request = new Request( LOGIN_COMPLETE, args );
- for( var i = 0; i < __renew_circs.length; i++ ) {
- var circ = __renew_circs[i];
- moRenewCirc( circ.target_copy(), G.user.id(), circ );
- }
-}
+ auth_request.request.alertEvent = false;
+ auth_request.send(true);
+ var auth_result = auth_request.result();
+ if(!auth_result) {
+ alertId('problem with renewing');
+ return null;
+ }
+ var temp_session = auth_result.payload.authtoken;
+ */
+ //if you needed a special session for this, would use the above
+ //and pass it in the call, however, this doesn't seem to matter
+ //for this call
+ /*
+ new_req = new Request( "open-ils.circ:open-ils.circ.open_holds.retrieve",
+ temp_session, record, 'T', getOrigLocation() );
+ */
+
+ //make the call with user's credentials
+ new_req = new Request( "open-ils.circ:open-ils.circ.open_holds.retrieve",
+ G.user.session, record, 'T', getOrigLocation() );
+
+ new_req.send(true);
+
+ //we would clean up session right away if we had created one
+ /*
+ var sess_req = new Request(LOGIN_DELETE, temp_session);
+ sess_req.send(true);
+ try { sess_req.result(); } catch(E){}
+ */
+
+ if (new_req) {
+ record = new_req.result();
+ if (record.length > 0) {
+ var renewTitle = __circ_titles[circ.id()];
+ if (renewTitle) {
+ alert('Sorry, someone has requested \"' + renewTitle +
+ '\", it can not be renewed, please return this title to the library.');
+ }//if renewTitle
+ return null;
+ } else {
+ //alert('renew for ' + circ.id());
+ moRenewCirc( circ.target_copy(), G.user.id(), circ );
+ }//if record
+ }//if new_req
+
+ }//if record
+ }//if new_req
+
+}//holdBlock
+
+/* renews all selected circulations */
+function myOPACRenewSelected() {
+
+ var rows = myopacGetCheckedOutRows();
+ if(!confirm($('myopac_renew_confirm').innerHTML)) return;
+ __success_count = 0;
+
+ for( var i = 0; i < rows.length; i++ ) {
+
+ var row = rows[i];
+ if( ! $n(row, 'selectme').checked ) continue;
+ var circ_id = row.getAttribute('circid');
+
+ var circ;
+ for( var j = 0; j != circsCache.length; j++ ) {
+ if(circsCache[j].id() == circ_id) {
+ circ = circsCache[j];
+ var cp = circ.target_copy();
+ if (cp) {
+ var hold_req = new Request(FETCH_FLESHED_COPY,
+ circ.target_copy() );
+ hold_req.request.circ = circ;
+ hold_req.callback(holdBlock);
+ hold_req.send();
+ }//if cp
+ }//if circsCache
+ }//for j
+ }//for i
+}//myOPACRenewSelected
+
/* renews a single circulation */
function moRenewCirc(copy_id, user_id, circ) {
More information about the open-ils-commits
mailing list