added support for viewing and editing existing issuance-level holds to the default...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Sep 2010 21:09:26 +0000 (21:09 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Sep 2010 21:09:26 +0000 (21:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17554 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/locale/en-US/opac.dtd
Open-ILS/web/opac/skin/default/js/holds.js
Open-ILS/web/opac/skin/default/xml/common/holds.xml

index 45fe0c4..098720c 100644 (file)
@@ -356,6 +356,7 @@ var UPDATE_HOLD                                     = 'open-ils.circ:open-ils.circ.hold.update';
 var FETCH_COPIES_FROM_VOLUME   = 'open-ils.search:open-ils.search.asset.copy.retrieve_by_cn_label:1';
 var FETCH_VOLUME_BY_INFO               = 'open-ils.search:open-ils.search.call_number.retrieve_by_info'; /* XXX staff method? */
 var FETCH_VOLUME                                       = 'open-ils.search:open-ils.search.asset.call_number.retrieve';
+var FETCH_ISSUANCE                                     = 'open-ils.serial:open-ils.serial.issuance.pub_fleshed.batch.retrieve';
 var FETCH_COPY_LOCATIONS               = 'open-ils.circ:open-ils.circ.copy_location.retrieve.all';
 var FETCH_COPY_NOTES                           = 'open-ils.circ:open-ils.circ.copy_note.retrieve.all';
 var FETCH_COPY_STAT_CATS               = 'open-ils.circ:open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy';
index d1086ad..b215f73 100644 (file)
@@ -592,6 +592,7 @@ We recommend that you remove this title from any bookbags it may have been added
 <!ENTITY common.isbn.label "ISBN:">
 <!ENTITY common.issn.label "ISSN:">
 <!ENTITY common.copy.barcode.label "Copy Barcode:">
+<!ENTITY common.issuance_label.label "Issuance Label:">
 <!ENTITY common.hold.place "Place hold for my account">
 <!ENTITY common.hold.check "Checking for possibility of hold fulfillment...">
 <!ENTITY common.hold.create "Create / Edit a Hold">
@@ -599,6 +600,7 @@ We recommend that you remove this title from any bookbags it may have been added
 <!ENTITY common.hold.type.label "Hold Type:">
 <!ENTITY common.hold.volume "Volume Hold">
 <!ENTITY common.hold.copy "Copy Hold">
+<!ENTITY common.hold.issuance "Issuance Hold">
 <!ENTITY common.hold.advanced "Advanced Hold Options">
 <!ENTITY common.hold.delivery "Please select a physical location where your hold can be delivered.">
 <!ENTITY common.hold.checked_out "This item is already checked out.">
index a5a06e9..9a7d6fe 100644 (file)
@@ -11,6 +11,16 @@ item_form is specified, use item_type(s)--language
 var noEmailMessage;
 var noEmailMessageXUL;
 
+var holdTargetTypeMap = {
+    M : 'metarecord',
+    T : 'record',
+    V : 'volume',
+    I : 'issuance',
+    C : 'copy'
+};
+
+
+
 function holdsHandleStaff() {
 
     // if we know the recipient's barcode, use it
@@ -180,21 +190,7 @@ function holdArgsFromHold(hold, oargs) {
        var args = (oargs) ? oargs : {};
        args.type = hold.hold_type();
        var target = hold.target();
-
-       switch(args.type) {
-               case 'M':
-                       args.metarecord = target;
-                       break;
-               case 'T':
-                       args.record = target;
-                       break;
-               case 'V':
-                       args.volume = target;
-                       break;
-               case 'C':
-                       args.copy = target;
-                       break;
-       }
+    args[holdTargetTypeMap[args.type]] = target;
        return args;
 }
 
@@ -229,6 +225,9 @@ function holdFetchObjects(hold, doneCallback) {
                if( type == 'V' ) {
                        _h_set_vol(args, doneCallback);
 
+        } else if( type == 'I' ) {
+            _h_set_issuance(args, doneCallback);
+
                } else {
                        if( type == 'T' ) {
                                _h_set_rec(args, doneCallback);
@@ -263,6 +262,28 @@ function _h_set_vol(args, doneCallback) {
        }
 }
 
+function _h_set_issuance(args, doneCallback) {
+
+       if( args.issuanceObject ) {
+               args.issuance = args.issuanceObject.id();
+               args.record = args.issuanceObject.subscription().record_entry();
+               _h_set_rec(args, doneCallback);
+
+       } else {
+
+               var vreq = new Request(FETCH_ISSUANCE, [args.issuance]);
+               vreq.callback(
+                       function(r) {
+                               var issuance = r.getResultObject()[0];
+                               args.issuanceObject = issuance;
+                               args.record = issuance.subscription().record_entry();
+                               _h_set_rec(args, doneCallback);
+                       }
+               );
+               vreq.send();
+       }
+}
+
 function _h_set_rec(args, doneCallback) {
 
        if(args.recordObject) 
@@ -395,7 +416,13 @@ function __holdsDrawWindow() {
        appendClear($('holds_title'), text(rec.title()));
        appendClear($('holds_author'), text(rec.author()));
 
-       if( holdArgs.type == 'V' || holdArgs.type == 'C' ) {
+    if( holdArgs.type == 'I' ) {
+               unHideMe($('holds_type_row'));
+        unHideMe($('holds_is_issuance'));
+        unHideMe($('holds_issuance_row'));
+        appendClear($('holds_issuance_label'), text(holdArgs.issuanceObject.label()));
+
+    } else if( holdArgs.type == 'V' || holdArgs.type == 'C' ) {
 
                unHideMe($('holds_type_row'));
                unHideMe($('holds_cn_row'));
@@ -416,6 +443,7 @@ function __holdsDrawWindow() {
                hideMe($('holds_type_row'));
                hideMe($('holds_copy_row'));
                hideMe($('holds_cn_row'));
+               hideMe($('holds_issuance_row'));
        }
 
        removeChildren($('holds_format'));
@@ -783,20 +811,7 @@ function holdsBuildHoldFromWindow() {
        else
                hold.email_notify(0);
 
-       var target;
-
-       switch(holdArgs.type) {
-               case 'M':
-                       target = holdArgs.metarecord; break;
-               case 'T':
-                       target = holdArgs.record; break;
-               case 'V':
-                       target = holdArgs.volume; break;
-               case 'C':
-                       target = holdArgs.copy; break;
-       }
-
-
+       var target = holdArgs[holdTargetTypeMap[holdArgs.type]];
 
        hold.pickup_lib(org); 
        //hold.request_lib(org); 
index db42396..b71d812 100644 (file)
                                        <td class='holds_cell'><b id='holds_copy'/> </td>
                                </tr>
 
+                               <tr class='hide_me' id='holds_issuance_row'>
+                                       <td class='holds_cell'>&common.issuance_label.label;</td>
+                                       <td class='holds_cell'><b id='holds_issuance_label'/> </td>
+                               </tr>
+
                                <tr class='hide_me' id='holds_type_row'>
                                        <td class='holds_cell'>&common.hold.type.label;</td>
                                        <td class='holds_cell hide_me' id='holds_is_cn'><b>&common.hold.volume;</b></td>
                                        <td class='holds_cell hide_me' id='holds_is_copy'><b>&common.hold.copy;</b></td>
+                                       <td class='holds_cell hide_me' id='holds_is_issuance'><b>&common.hold.issuance;</b></td>
                                </tr>
 
                                <tr>