hold capture on checkin
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 20 Jul 2005 15:06:18 +0000 (15:06 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 20 Jul 2005 15:06:18 +0000 (15:06 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1307 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/circ/circ_utils.js

index 3c3a2cc..d69b7b8 100644 (file)
@@ -57,6 +57,20 @@ function checkout_by_copy_barcode(barcode, patron_id, f) {
        }
 }
 
+function capture_hold( barcode ) {
+       try {
+               var ou_id = user_request(
+                       'open-ils.circ',
+                       'open-ils.circ.hold.capture_copy.barcode',
+                       [ mw.G.auth_ses[0], barcode ]
+               )[0];
+               return ou_id;
+       } catch(E) {
+               handle_error(E);
+               return null;
+       }
+}
+
 function checkin_by_copy_barcode(barcode, f) {
        sdump('D_CIRC_UTILS',arg_dump(arguments,{0:true}));
        try {
@@ -66,6 +80,14 @@ function checkin_by_copy_barcode(barcode, f) {
                        [ mw.G.auth_ses[0], barcode ],
                        f
                )[0];
+
+               /*
+               { // REMOVE_ME, forcing a condition for testing
+                       check.status = 1;
+                       check.text = 'This copy is the first that could fulfill a hold.  Do it?';
+               }
+               */
+
                if (!f) {
                        sdump('D_CIRC_UTILS','check = ' + js2JSON(check) + '\n');
                        if (check.status != 0) {
@@ -82,10 +104,18 @@ function checkin_by_copy_barcode(barcode, f) {
                                                switch(rv) {
                                                        case 0: /* capture */
                                                        try {
-                                                               capture_hold( barcode );
+                                                               var ou_id = capture_hold( barcode );
                                                                check.text = 'Captured for Hold';
+                                                               check.route_to = mw.G.org_tree_hash[ ou_id ].shortname();
 
-                                                       } catch(E) { sdump('D_ERROR',E + '\n'); }
+                                                       } catch(E) { 
+                                                               sdump('D_ERROR',E + '\n'); 
+                                                               /* 
+                                                               // demo testing 
+                                                               check.text = 'Captured for Hold';
+                                                               check.route_to = 'ARL-ATH';
+                                                               */
+                                                       }
                                                        break;
                                                        case 1: /* don't capture */
 
@@ -215,7 +245,7 @@ function checkin_cols() {
        var cols = [
                {
                        'id' : 'checkin_status', 'label' : getString('checkin_label_status'), 'flex' : 1,
-                       'primary' : false, 'hidden' : false, 'fm_class' : '', 'fm_field_render' : '.status.toString()'
+                       'primary' : false, 'hidden' : true, 'fm_class' : '', 'fm_field_render' : '.status.toString()'
                },
                {
                        'id' : 'checkin_route_to', 'label' : getString('checkin_label_route_to'), 'flex' : 1,