Have the Place Hold function in the Patron Holds interface update said interface...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 19 Aug 2009 03:07:41 +0000 (03:07 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 19 Aug 2009 03:07:41 +0000 (03:07 +0000)
Also, rework how the Patron Holds interface encourages the summary sidebar (and the label under the Holds button) to refresh itself with regard to holds.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13873 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/display.js
Open-ILS/xul/staff_client/server/patron/holds.js

index 945922c..455381e 100644 (file)
@@ -407,10 +407,12 @@ patron.display.prototype = {
                                         'patron_id' : obj.patron.id(),
                                         'patron_barcode' : obj.patron.card().barcode(),
                                         'on_list_change' : function(h) {
-                                            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-                                            //obj.summary_window.g.summary.controller.render('patron_holds');
-                                            //obj.summary_window.g.summary.controller.render('patron_standing_penalties');
-                                            obj.refresh_all();
+                                            try {
+                                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                                                obj.summary_window.g.summary.controller.render('patron_holds');
+                                            } catch(E) {
+                                                alert(E);
+                                            }
                                         },
                                         'url_prefix' : xulG.url_prefix,
                                         'new_tab' : xulG.new_tab,
index 6035099..45e1f9e 100644 (file)
@@ -948,6 +948,24 @@ patron.holds.prototype = {
                                                 obj.error.standard_unexpected_error_alert('window_open',E);
                                             }
                                         },
+                                        'opac_hold_placed' : function(hold) {
+                                            try {
+                                                obj.list.append(
+                                                    {
+                                                        'row' : {
+                                                            'my' : {
+                                                                'hold_id' : typeof hold == 'object' ? hold.id() : hold
+                                                            }
+                                                        }
+                                                    }
+                                                );
+                                                if (window.xulG && typeof window.xulG.on_list_change == 'function') {
+                                                    window.xulG.on_list_change(); 
+                                                }
+                                            } catch(E) {
+                                                obj.error.standard_unexpected_error_alert('holds.js, opac_hold_placed(): ',E);
+                                            }
+                                        },
                                         'patron_barcode' : obj.patron_barcode
                                     },
                                     'url_prefix' : xulG.url_prefix,
@@ -1033,13 +1051,20 @@ patron.holds.prototype = {
                }
     },
 
-    'clear_and_retrieve' : function(dont_show_me_the_list_change) {
-        this.list.clear();
-        this.pull_from_shelf_interface.current.offset = this.pull_from_shelf_interface._default.offset;
-        this.retrieve(dont_show_me_the_list_change);
+    'clear_and_retrieve' : function() {
+        try {
+            this.list.clear();
+            this.pull_from_shelf_interface.current.offset = this.pull_from_shelf_interface._default.offset;
+            this.retrieve();
+            if (window.xulG && typeof window.xulG.on_list_change == 'function') {
+                window.xulG.on_list_change(); 
+            }
+        } catch(E) {
+            this.error.standard_unexpected_error_alert('holds.js, clear_and_retrieve(): ',E);
+        }
     },
 
-       'retrieve' : function(dont_show_me_the_list_change) {
+       'retrieve' : function() {
                var obj = this; var holds = [];
                if (window.xulG && window.xulG.holds) {
                        holds = window.xulG.holds;
@@ -1109,50 +1134,49 @@ patron.holds.prototype = {
             if (x_fetch_more) x_fetch_more.disabled = true;
         } else {
             if (x_fetch_more) x_fetch_more.disabled = false;
-            obj.render(holds,dont_show_me_the_list_change);
+            obj.render(holds);
         }
 
     },
 
-    'render' : function(holds,dont_show_me_the_list_change) {
-        var obj = this;
+    'render' : function(holds) {
+        try {
+            var obj = this;
 
-               function list_append(hold_id) {
-                       obj.list.append(
-                               {
-                                       'row' : {
-                                               'my' : {
-                                                       'hold_id' : hold_id
-                                               }
-                                       }
-                               }
-                       );
-               }
+            function list_append(hold_id) {
+                obj.list.append(
+                    {
+                        'row' : {
+                            'my' : {
+                                'hold_id' : hold_id
+                            }
+                        }
+                    }
+                );
+            }
 
-               function gen_list_append(hold) {
-                       return function() {
-                               if (typeof obj.controller.view.lib_menu == 'undefined') {
-                                       list_append(typeof hold == 'object' ? hold.id() : hold);
-                               } else {
-                                       list_append(typeof hold == 'object' ? hold.id() : hold);
-                               }
-                       };
-               }
+            function gen_list_append(hold) {
+                return function() {
+                    if (typeof obj.controller.view.lib_menu == 'undefined') {
+                        list_append(typeof hold == 'object' ? hold.id() : hold);
+                    } else {
+                        list_append(typeof hold == 'object' ? hold.id() : hold);
+                    }
+                };
+            }
 
-               //obj.list.clear();
+            //obj.list.clear();
 
-               JSAN.use('util.exec'); var exec = new util.exec(2);
-               var rows = [];
-               for (var i in holds) {
-                       rows.push( gen_list_append(holds[i]) );
-               }
-               exec.chain( rows );
+            JSAN.use('util.exec'); var exec = new util.exec(2);
+            var rows = [];
+            for (var i in holds) {
+                rows.push( gen_list_append(holds[i]) );
+            }
+            exec.chain( rows );
 
-               if (!dont_show_me_the_list_change) {
-                       if (window.xulG && typeof window.xulG.on_list_change == 'function') {
-                               try { window.xulG.on_list_change(holds); } catch(E) { this.error.sdump('D_ERROR',E); }
-                       }
-               }
+        } catch(E) {
+                       this.error.standard_unexpected_error_alert('holds.js, render():',E);
+        }
        },
 
        'render_lib_menus' : function(types) {