Remove 'can_have_vols' restrictions for subscriptions; assorted smaller bug/typo...
authordbwells <dbwells@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Jul 2010 20:10:34 +0000 (20:10 +0000)
committerdbwells <dbwells@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Jul 2010 20:10:34 +0000 (20:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/seials-integration@17056 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/serial/manage_subs.js

index ddc6eea..9bb0a18 100644 (file)
@@ -499,10 +499,8 @@ sub make_predictions {
                 'caption' => $caption_field,
                 'scap_id' => $scap->id,
                 'num_to_predict' => $args->{num_to_predict}
-                #'last_rec_date' => $args->{last_rec_date}
                 };
         if ($args->{base_issuance}) { # predict from a given issuance
-            #$options->{last_rec_date} = $args->{base_issuance}->date_expected;
             $options->{predict_from} = _revive_holding($args->{base_issuance}->holding_code, $caption_field, 1); # fresh MFHD Record, so we simply default to 1 for seqno
         } else { # default to predicting from last published
             my $last_published = $editor->search_serial_issuance([
@@ -512,8 +510,6 @@ sub make_predictions {
                 );
             if ($last_published->[0]) {
                 my $last_siss = $last_published->[0];
-                #my $items_for_last_published = $editor->search_serial_item({'issuance' => $last_siss->id}, {limit => 1, order_by => { sitem => "date_expected ASC" }}); # assume later expected are exceptions, TODO: move this whole date offset idea to item creation portion, not issuance creation
-                #$options->{last_rec_date} = $items_for_last_published->[0]->date_expected;
                 $options->{predict_from} = _revive_holding($last_siss->holding_code, $caption_field, 1);
             } else {
                 #TODO: throw event (can't predict from nothing!)
@@ -1448,14 +1444,22 @@ sub _create_sdist {
     # create summaries too
     my $summary = new Fieldmapper::serial::basic_summary;
     $summary->distribution($sdist->id);
+    $summary->generated_coverage('');
     return $editor->event unless $editor->create_serial_basic_summary($summary);
     $summary = new Fieldmapper::serial::supplement_summary;
     $summary->distribution($sdist->id);
+    $summary->generated_coverage('');
     return $editor->event unless $editor->create_serial_supplement_summary($summary);
     $summary = new Fieldmapper::serial::index_summary;
     $summary->distribution($sdist->id);
+    $summary->generated_coverage('');
     return $editor->event unless $editor->create_serial_index_summary($summary);
 
+    # create a starter stream (TODO: reconsider this)
+    my $stream = new Fieldmapper::serial::stream;
+    $stream->distribution($sdist->id);
+    return $editor->event unless $editor->create_serial_stream($stream);
+
     return 0;
 }
 
index efecec9..1a2e7b4 100644 (file)
@@ -423,7 +423,7 @@ var urls = {
     'XUL_RECORD_BUCKETS' : '/xul/server/cat/record_buckets.xul',
     'XUL_RECORD_BUCKETS_QUICK' : '/xul/server/cat/record_buckets_quick.xul',
     'XUL_REMOTE_BROWSER' : '/xul/server/util/rbrowser.xul',
-    'XUL_SERIAL_ITEM_EDITOR' : '/xul/server/serial/item_editor.xul',
+    'XUL_SERIAL_ITEM_EDITOR' : '/xul/server/serial/sitem_editor.xul',
     'XUL_SERIAL_NOTES' : '/xul/server/serial/notes.xul',
     'XUL_SERIAL_SELECT_AOU' : '/xul/server/serial/select_aou.xul',
     'XUL_SERIAL_SELECT_UNIT' : '/xul/server/serial/select_unit.xul',
index 174c1d1..5ac3117 100644 (file)
@@ -1136,18 +1136,23 @@ serial.manage_subs.prototype = {
 
             if (twisty) {
                 switch(row_type) {
-                    case 'aou' : obj.on_select_org(id,twisty); break;
+                    case 'aou' : obj.on_click_aou(id,twisty); break;
                     case 'ssub' : obj.on_select_ssub(id,twisty); break;
                     default: break;
                 }
             }
         }
 
+        if (!obj.focused_node_retrieve_id) return;
+
         var row_type = obj.focused_node_retrieve_id.split('_')[0];
         var id = obj.focused_node_retrieve_id.split('_')[1];
 
         if (sel_lists[row_type]) { // the type focused is in the selection (usually the case)
-            if (obj['on_click_' + row_type]) obj['on_click_' + row_type](sel_lists[row_type],twisty);
+            switch(row_type) {
+                case 'aou' : obj.on_click_aou(id,twisty); break;
+                default: if (obj['on_click_' + row_type]) obj['on_click_' + row_type](sel_lists[row_type],twisty);
+            }
         }
     },
 
@@ -1260,10 +1265,9 @@ serial.manage_subs.prototype = {
         }
     },
 
-    'on_select_org' : function(org_id,twisty) {
+    'on_click_aou' : function(org_id,twisty) {
         var obj = this;
         var org = obj.data.hash.aou[ org_id ];
-        if (obj.data.hash.aout[ org.ou_type() ].depth() == 0 && ! get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) return;
         obj.funcs.push( function() { 
             document.getElementById('cmd_refresh_list').setAttribute('disabled','true'); 
             document.getElementById('cmd_show_libs_with_distributions').setAttribute('disabled','true'); 
@@ -1393,10 +1397,8 @@ serial.manage_subs.prototype = {
             }
 
             if (document.getElementById('show_ssubs').checked) {
-                if (! ( obj.data.hash.aout[ org.ou_type() ].depth() == 0 && ! get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) )) {
-                    node.setAttribute('open','true');
-                    obj.funcs.push( function() { obj.on_select_org( org.id() ); } );
-                }
+                obj.funcs.push( function() { obj.on_click_aou( org.id() ); } );
+                node.setAttribute('open','true');
             }
 
         } catch(E) {
@@ -1609,8 +1611,10 @@ serial.manage_subs.prototype = {
                         JSAN.use('util.functional');
                         
                         // get the actual node clicked to determine which editor to use
-                        var node = obj.list.node.contentView.getItemAtIndex(obj.list.node.view.selection.currentIndex);
-                        obj.focused_node_retrieve_id = node.getAttribute('retrieve_id');
+                        if (obj.list.node.view.selection.currentIndex > -1) {
+                            var node = obj.list.node.contentView.getItemAtIndex(obj.list.node.view.selection.currentIndex);
+                            obj.focused_node_retrieve_id = node.getAttribute('retrieve_id');
+                        }
 
                         var sel = obj.list.retrieve_selection();
                         obj.controller.view.sel_clip.disabled = sel.length < 1;
@@ -1641,14 +1645,11 @@ serial.manage_subs.prototype = {
         var obj = this;
         try {
             var found_aou = false; var found_ssub = false; var found_sdist = false; var found_siss = false; var found_scap = false; var found_sdist_group = false; var found_siss_group = false; var found_scap_group = false;
-            var found_aou_with_can_have_vols = false;
             for (var i = 0; i < obj.sel_list.length; i++) {
                 var type = obj.sel_list[i].split(/_/)[0];
                 switch(type) {
                     case 'aou' : 
                         found_aou = true; 
-                        var org = obj.data.hash.aou[ obj.sel_list[i].split(/_/)[1] ];
-                        if ( get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) found_aou_with_can_have_vols = true;
                     break;
                     case 'ssub' : found_ssub = true; break;
                     case 'sdist' : found_sdist = true; break;
@@ -1672,7 +1673,7 @@ serial.manage_subs.prototype = {
             obj.controller.view.cmd_mark_subscription.setAttribute('disabled','true');
             obj.controller.view.cmd_transfer_subscription.setAttribute('disabled','true');
             obj.controller.view.cmd_transfer_sdists.setAttribute('disabled','true');
-            if (found_aou && found_aou_with_can_have_vols) {
+            if (found_aou) {
                 obj.controller.view.cmd_add_subscriptions.setAttribute('disabled','false');
                 obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
             }