[open-ils-commits] [GIT] Evergreen ILS branch rel_2_0 updated. b1d1e4bb08a9966889e17b62a789c958b8cf298c

Evergreen Git git at git.evergreen-ils.org
Wed Jun 22 09:41:52 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_0 has been updated
       via  b1d1e4bb08a9966889e17b62a789c958b8cf298c (commit)
       via  924294909633331f4dec3ee8cd4011c9458baf13 (commit)
      from  0b0eac3f88fa4c26a2997f8a26ae795b38e32525 (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 b1d1e4bb08a9966889e17b62a789c958b8cf298c
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Tue Jun 21 17:09:58 2011 -0400

    Further clean-up of Serials interfaces
    
    When trying to come up with good tests, found a few bugs (imagine!).
    Some have been nagging for a while now.
    
    1) For 'MFHDDrawn' event, make sure it runs if deleting the last
    serials data of any kind for that record (to unpopulate the menus
    properly)
    
    2) Make sure global mfhd member (g.mfhd) is cleared in the same case
    (i.e. deleting the last serials data for that record)
    
    3) Add a string to better indicate when no MFHD records are available
    for 'Legacy Record Entry' drop-down
    
    4) Convert submitted empty drop-down values to 'null' as needed in
    distribution editor
    
    5) Mark subscription 'start date' as a required field
    
    6) Make serial virtual records better handle deleted 'legacy record
    entries' attached to distributions, and also expose non-deleted
    record entries even if in 'use_sdist_only' summary mode
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Serial.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Serial.pm
index 15fb40e..2b4afbb 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Serial.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Serial.pm
@@ -122,7 +122,7 @@ sub bib_to_svr {
 	my $mfhd_parser = OpenILS::Utils::MFHDParser->new();
 	foreach (@$sdists) {
         my $svr;
-        if (ref $_->record_entry) {
+        if (ref $_->record_entry and !$U->is_true($_->record_entry->deleted)) {
             $svr = $mfhd_parser->generate_svr($_->record_entry->id, $_->record_entry->marc, $_->record_entry->owning_lib);
         } else {
             $svr = Fieldmapper::serial::virtual_record->new;
diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js
index 9c8185e..9742040 100644
--- a/Open-ILS/web/opac/skin/default/js/rdetail.js
+++ b/Open-ILS/web/opac/skin/default/js/rdetail.js
@@ -272,19 +272,20 @@ function loadMarcEditor(recId) {
  */
 function _holdingsDraw(h) {
     holdings = h.getResultObject();
-    if (!holdings) { return null; }
-
-    // Only draw holdings within our OU scope
-    var here = findOrgUnit(getLocation());
-    var entryNum = 0;
-    dojo.forEach(holdings, function (item) {
-        if (orgIsMine(here, findOrgUnit(item.owning_lib()))) {
-            _holdingsDrawMFHD(item, entryNum);
-            entryNum++;
-        }
-    });
 
-    // Populate XUL menus
+    if (holdings) {
+        // Only draw holdings within our OU scope
+        var here = findOrgUnit(getLocation());
+        var entryNum = 0;
+        dojo.forEach(holdings, function (item) {
+            if (orgIsMine(here, findOrgUnit(item.owning_lib()))) {
+                _holdingsDrawMFHD(item, entryNum);
+                entryNum++;
+            }
+        });
+    }
+
+    // Populate (or unpopulate) XUL menus
     if (isXUL()) {
         runEvt('rdetail','MFHDDrawn');
     }
diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
index 5ebd6ff..f44aeae 100644
--- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
+++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
@@ -449,10 +449,12 @@ function set_opac() {
                                 item = mfhd_delete_menu.appendItem(label);
                                 item.setAttribute('oncommand','delete_mfhd('+mfhd_details.id+')');
                             }
-                            var change_event = document.createEvent("Event");
-                            change_event.initEvent("MFHDChange",false,false);
-                            window.dispatchEvent(change_event);
+                        } else if (g.mfhd) { // clear from previous runs if deleting last MFHD
+                            delete g.mfhd;
                         }
+                        var change_event = document.createEvent("Event");
+                        change_event.initEvent("MFHDChange",false,false);
+                        window.dispatchEvent(change_event);
                     }
                 );
             },
diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties b/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties
index 2b01ddb..a26c0fc 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties
@@ -26,6 +26,7 @@ staff.serial.sdist_editor.create.accesskey=C
 staff.serial.sdist_editor.modify.label=Modify Distribution(s)
 staff.serial.sdist_editor.modify.accesskey=M
 staff.serial.sdist_editor.notes=Distribution Notes
+staff.serial.sdist_editor.no_mfhd_available.label=No MFHD records for this Holding Lib
 staff.serial.siss_editor.count=1 issuance
 staff.serial.siss_editor.count.plural=%1$s issuances
 staff.serial.siss_editor.create.label=Create Issuance(s)
diff --git a/Open-ILS/xul/staff_client/server/serial/sdist_editor.js b/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
index 2e55ca7..6f29ba5 100644
--- a/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
+++ b/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
@@ -72,17 +72,26 @@ serial.sdist_editor.prototype = {
     'apply' : function(field,value) {
         var obj = this;
 
+        var field_name_list = ['bind_call_number','receive_call_number','bind_unit_template','receive_unit_template','record_entry'];
+
         // null out call number if the holding lib is changed
         obj.holding_lib_changed = (field == 'holding_lib');
         var loop_func = function(sdist) {
             if (obj.holding_lib_changed) {
-                var field_name_list = ['bind_call_number','receive_call_number','bind_unit_template','receive_unit_template','record_entry'];
                 for (var i = 0; i < field_name_list.length; i++) {
                     sdist[field_name_list[i]](null);
                     obj.changed[fieldmapper.IDL.fmclasses.sdist.field_map[field_name_list[i]].label] = true;
                 }
             }
         }
+
+        // check for blank drop-down submits
+        for (var i = 0; i < field_name_list.length; i++) {
+            if (field == field_name_list[i] && value === '') {
+                value = null;
+                break;
+            }
+        }
         obj.editor_base_apply(field, value, loop_func);
         obj.holding_lib_changed = false;
     },
@@ -311,7 +320,7 @@ serial.sdist_editor.prototype = {
             var lib_id = typeof obj.sdists[0].holding_lib() == 'object' ? obj.sdists[0].holding_lib().id() : obj.sdists[0].holding_lib();
             var sre_details_list = obj.sres_ou_map[lib_id];
             if (sre_details_list == null) {
-                return [];
+                return [{'label' : $('serialStrings').getString('staff.serial.sdist_editor.no_mfhd_available.label'), 'id' : ''}];
             } else {
                 return sre_details_list;
             }
diff --git a/Open-ILS/xul/staff_client/server/serial/ssub_editor.js b/Open-ILS/xul/staff_client/server/serial/ssub_editor.js
index 38b4fe3..20a0597 100644
--- a/Open-ILS/xul/staff_client/server/serial/ssub_editor.js
+++ b/Open-ILS/xul/staff_client/server/serial/ssub_editor.js
@@ -126,7 +126,8 @@ serial.ssub_editor.prototype = {
                 { 
                     render: 'fm.start_date() == null ? "" : util.date.formatted_date( fm.start_date(), "%F");',
                     input: 'c = function(v){ obj.apply("start_date",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("value",obj.editor_values.start_date); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
-                    value_key: 'start_date'
+                    value_key: 'start_date',
+                    required: true
                 }
             ],
             [

commit 924294909633331f4dec3ee8cd4011c9458baf13
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Fri Jun 17 15:26:39 2011 -0400

    Better coordination of MFHD/SRE adding/deleting
    
    Adding or deleting MFHD records from the XUL menus requires
    coordinating the OPAC display, the XUL menus, and the Serial
    Control distribution editors.  The previous code frequently
    required some non-obvious manual refreshing to make it work.
    
    This commit keeps them in sync using custom events instead.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
index c4f4cdc..5ebd6ff 100644
--- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
+++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
@@ -449,6 +449,9 @@ function set_opac() {
                                 item = mfhd_delete_menu.appendItem(label);
                                 item.setAttribute('oncommand','delete_mfhd('+mfhd_details.id+')');
                             }
+                            var change_event = document.createEvent("Event");
+                            change_event.initEvent("MFHDChange",false,false);
+                            window.dispatchEvent(change_event);
                         }
                     }
                 );
@@ -513,7 +516,7 @@ function create_mfhd() {
             throw(r);
         }
         alert("MFHD record created."); //TODO: better success message
-        //TODO: refresh opac display
+        browser_frame.contentWindow.g.browser.controller.view.cmd_reload.doCommand();
     } catch(E) {
         g.error.standard_unexpected_error_alert("Create MFHD failed", E); //TODO: better error handling
     }
@@ -535,7 +538,7 @@ function delete_mfhd(sre_id) {
             alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error',  [docid, robj.textcode, robj.desc]) + '\n');
         } else {
             alert(document.getElementById('offlineStrings').getString('cat.opac.record_deleted'));
-            //TODO: refresh opac display
+            browser_frame.contentWindow.g.browser.controller.view.cmd_reload.doCommand();
         }
     }
 }
diff --git a/Open-ILS/xul/staff_client/server/serial/sdist_editor.js b/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
index 780ad86..2e55ca7 100644
--- a/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
+++ b/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
@@ -23,24 +23,11 @@ serial.sdist_editor = function (params) {
     // setup sre arrays
     this.sre_id_map = {};
     this.sres_ou_map = {};
-    var parent_g = window.parent.g;
-    if (parent_g.mfhd) {
-        var mfhd_details = parent_g.mfhd.details;
-        for (var i = 0; i < mfhd_details.length; i++) {
-            var mfhd_detail = {};
-            for (j in mfhd_details[i]) {
-                mfhd_detail[j] = mfhd_details[i][j];
-            }
-            mfhd_detail.label = mfhd_detail.label + ' (' + (mfhd_detail.entryNum + 1) + ')';
-            var sre_id = mfhd_detail.id;
-            var org_unit_id = mfhd_detail.owning_lib;
-            this.sre_id_map[sre_id] = mfhd_detail;
-            if (!this.sres_ou_map[org_unit_id]) {
-                this.sres_ou_map[org_unit_id] = [];
-            }
-            this.sres_ou_map[org_unit_id].push(mfhd_detail);
-        }
-    }
+    this.build_sre_maps();
+
+    // update sre maps on demand
+    var obj = this;
+    window.parent.addEventListener("MFHDChange", function() {obj.build_sre_maps()}, false);
 };
 
 serial.sdist_editor.prototype = {
@@ -284,6 +271,37 @@ serial.sdist_editor.prototype = {
     'save_attributes' : serial.editor_base.editor_base_save_attributes,
 
     /******************************************************************************************************/
+    /* Build maps of sre details for both display and selection purposes */
+
+    'build_sre_maps' : function() {
+        var obj = this;
+        try {
+            obj.sre_id_map = {};
+            obj.sres_ou_map = {};
+            var parent_g = window.parent.g;
+            if (parent_g.mfhd) {
+                var mfhd_details = parent_g.mfhd.details;
+                for (var i = 0; i < mfhd_details.length; i++) {
+                    var mfhd_detail = {};
+                    for (j in mfhd_details[i]) {
+                        mfhd_detail[j] = mfhd_details[i][j];
+                    }
+                    mfhd_detail.label = mfhd_detail.label + ' (' + (mfhd_detail.entryNum + 1) + ')';
+                    var sre_id = mfhd_detail.id;
+                    var org_unit_id = mfhd_detail.owning_lib;
+                    obj.sre_id_map[sre_id] = mfhd_detail;
+                    if (!obj.sres_ou_map[org_unit_id]) {
+                        obj.sres_ou_map[org_unit_id] = [];
+                    }
+                    obj.sres_ou_map[org_unit_id].push(mfhd_detail);
+                }
+            }
+        } catch(E) {
+            obj.error.standard_unexpected_error_alert('build_sre_maps',E);
+        }
+    },
+
+    /******************************************************************************************************/
     /* This returns a list of sre details appropriate for the distributions being edited */
 
     'get_sre_details_list' : function() {

-----------------------------------------------------------------------

Summary of changes:
 .../perlmods/OpenILS/Application/Search/Serial.pm  |    2 +-
 Open-ILS/web/opac/skin/default/js/rdetail.js       |   25 ++++----
 .../xul/staff_client/chrome/content/cat/opac.js    |    9 ++-
 .../server/locale/en-US/serial.properties          |    1 +
 .../xul/staff_client/server/serial/sdist_editor.js |   67 ++++++++++++++------
 .../xul/staff_client/server/serial/ssub_editor.js  |    3 +-
 6 files changed, 71 insertions(+), 36 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list