merging MR holds topic branch
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 5 Apr 2010 20:23:54 +0000 (20:23 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 5 Apr 2010 20:23:54 +0000 (20:23 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16137 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
Open-ILS/web/opac/skin/default/js/holds.js
Open-ILS/web/opac/skin/default/js/result_common.js
build/tools/update.sh

index 2d83155..e8e16b0 100644 (file)
@@ -1644,7 +1644,7 @@ sub do_possibility_checks {
 
        } elsif( $hold_type eq OILS_HOLD_TYPE_METARECORD ) {
 
-               my $maps = $e->search_metabib_source_map({metarecord=>$mrid});
+               my $maps = $e->search_metabib_metarecord_source_map({metarecord=>$mrid});
                my @recs = map { $_->source } @$maps;
                for my $rec (@recs) {
             my @status = _check_title_hold_is_possible(
index 8e9db05..0da1595 100644 (file)
@@ -3097,6 +3097,7 @@ sub query_parser_fts_wrapper {
     $query = "skip_check($args{skip_check}) $query" if ($args{skip_check});
     $query = "superpage($args{superpage}) $query" if ($args{superpage});
     $query = "offset($args{offset}) $query" if ($args{offset});
+    $query = "#metarecord $query" if ($self->api_name =~ /metabib/);
     $query = "#available $query" if ($args{available});
     $query = "#descending $query" if ($args{sort_dir} && $args{sort_dir} =~ /^d/i);
     $query = "#staff $query" if ($self->api_name =~ /staff/);
index d053fa3..48e17f5 100644 (file)
@@ -281,7 +281,18 @@ function _h_set_rec_descriptors(args, doneCallback) {
 
        // grab the list of record desciptors attached to this records metarecord 
        if( ! args.recordDescriptors )  {
-               var params = { record: args.record };
+               var params = {};
+
+        if (args.type == 'M') {
+               if( !args.metarecord && args.record) {
+                params.metarecord = args.metarecord = args.record;
+                delete(args.record);
+               } else {
+                               params = { metarecord : args.metarecordObject.doc_id() };
+               }
+        } else {
+               params = { record: args.record };
+        }
 
                if( ! args.record ) {
                        if( args.metarecord )
@@ -294,11 +305,11 @@ function _h_set_rec_descriptors(args, doneCallback) {
                req.callback(
                        function(r) {
                                var data = r.getResultObject();
-                               args.recordDescriptors = data.descriptors;
-                               args.metarecord = data.metarecord;
+                               holdArgs.recordDescriptors = args.recordDescriptors = data.descriptors;
+                               holdArgs.metarecord = args.metarecord = data.metarecord;
                                if( args.type == 'M' && ! args.metarecordObject) 
-                                       args.metarecordObject = findRecord(args.metarecord, 'M');       
-                                
+                                       holdArgs.metarecordObject = args.metarecordObject = findRecord(args.metarecord, 'M');   
+
                                if(doneCallback) doneCallback(args);
                        }
                );
@@ -425,7 +436,30 @@ function __holdsDrawWindow() {
        }
 
        if( holdArgs.type == 'M' ) {
-               var data = holdsParseMRFormats(holdArgs.editHold.holdable_formats());
+               var mr_formats;
+               if(holdArgs.editHold){
+                       mr_formats = holdArgs.editHold.holdable_formats();
+               }else{
+                       mr_formats = ''; // collect the item_type()s from all holdArgs.recordDescriptors
+                       for(var desc in holdArgs.recordDescriptors){
+                if (!holdArgs.recordDescriptors[desc].item_type()) continue;
+                               mr_formats += holdArgs.recordDescriptors[desc].item_type();
+                       }
+
+            var first_form = 1;
+                       for(var desc in holdArgs.recordDescriptors){
+                if (!holdArgs.recordDescriptors[desc].item_form()) continue;
+                if (first_form) {
+                    mr_formats += '-';
+                    first_form = 0;
+                }
+                               mr_formats += holdArgs.recordDescriptors[desc].item_form();
+                       }
+
+
+               }
+               
+               var data = holdsParseMRFormats(mr_formats);
                mods_formats = data.mods_formats;
                formats = data.formats;
        }
@@ -533,13 +567,20 @@ function holdsSetFormatSelector() {
        var avail_formats       = data.avail_formats;
        var sel_formats = data.sel_formats;
        holdArgs.language = data.lang;
+       if( type=='M'){         
+               hideMe($('holds_alt_formats_row_extras'));
+               unHideMe($('holds_alt_formats_row'));   
+       }else{
+               unHideMe($('holds_alt_formats_row_extras'));
+       }
 
-       unHideMe($('holds_alt_formats_row_extras'));
        var selector = $('hold_alt_form_selector');
 
        for( var i = 0; i < avail_formats.length; i++ ) {
                var form = avail_formats[i];
-               unHideMe(findSelectorOptByValue(selector, form));
+               var opt = findSelectorOptByValue(selector,form);
+               if(type=='M') opt.selected=true;
+               unHideMe(opt);
        }
 }
 
@@ -555,7 +596,15 @@ function holdsGetFormats() {
        var rec = holdArgs.record;
        var mrec = holdArgs.metarecord;
 
-       if( type == 'T' ) {
+       for( var i = 0; i < desc.length; i++ ) {
+               var d = desc[i];
+               if( type == 'T' && d.item_lang() != lang ) continue;
+               formats.push( _t_f_2_format(d.item_type(), d.item_form()));
+       }
+
+       formats = uniquify(formats);
+
+       if( type == 'T') {
 
                for( var i = 0; i < desc.length; i++ ) {
                        var d = desc[i];
@@ -566,16 +615,14 @@ function holdsGetFormats() {
                                break;
                        }
                }
-       }
+       } else if( type =='M') {
 
-       for( var i = 0; i < desc.length; i++ ) {
-               var d = desc[i];
-               if( d.item_lang() != lang ) continue;
-               formats.push( _t_f_2_format(d.item_type(), d.item_form()));
+        // All available formats are selected by default in MR holds
+               for( var i = 0; i < formats.length; i++ ) {
+                       sformats.push(formats[i]);
+               }
        }
 
-       formats = uniquify(formats);
-
        return {
                lang : lang,
                avail_formats : formats, 
@@ -586,6 +633,7 @@ function holdsGetFormats() {
 
 
 function _t_f_2_format(type, form) {
+       if( (type == 'a' || type == 't') && form == 's' ) return 'at-s';
        if( form == 'd' ) return 'at-d';
        return (type == 'a' || type == 't') ? 'at' : 
                ( type == 'i' || type == 'g' || type == 'j' ) ? type : null;
@@ -603,14 +651,16 @@ function holdsSetSelectedFormats() {
 
        var fstring = "";
 
-       if( contains(vals, 'at-d') ) {
-               if( contains(vals, 'at') )
+       if( contains(vals, 'at-d') || contains(vals, 'at-s')) {
+               if( contains(vals, 'at') ) {
                        fstring = 'at';
-               else 
+               } else if (contains(vals, 'at-s') && contains(vals, 'at-d')) {
+                       fstring = 'at-sd';
+               } else if (!contains(vals, 'at-s')) {
                        fstring = 'at-d';
        } else {
-               if( contains(vals, 'at') )
-                       fstring = 'at';
+                       fstring = 'at-s';
+               }
        }
 
        for( var i = 0; i < vals.length; i++ ) {
@@ -634,6 +684,7 @@ function holdsCheckPossibility(pickuplib, hold, recurse) {
 
        var args = { 
                titleid : holdArgs.record,
+               mrid : holdArgs.record,
                volume_id : holdArgs.volume,
                copy_id : holdArgs.copy,
                hold_type : holdArgs.type,
index 71471b5..c31f399 100644 (file)
@@ -482,7 +482,7 @@ function resultDisplayRecord(rec, pos, is_mr) {
                        pic.parentNode.setAttribute("href", buildOPACLink(args));
                        title_link.setAttribute("href", buildOPACLink(args));
                        title_link.appendChild(text(normalize(truncate(rec.title(), 65))));
-                       
+
                        var here = findOrgUnit(getLocation());
                        if (findOrgType(here.ou_type()).can_have_vols()) { // show the callnumber list
                                dojo.require('openils.BibTemplate');
@@ -511,6 +511,10 @@ function resultDisplayRecord(rec, pos, is_mr) {
                        pic.parentNode.setAttribute("href", buildOPACLink(args));
                }
 
+               unHideMe($n(r,'place_hold_span'));
+               $n(r,'place_hold_link').setAttribute(
+                       'href','javascript:holdsDrawEditor({record:"'+rec.doc_id()+'",type:"M"});');
+
        } else {
                buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', rec.doc_id());
 
index e735dac..03fe903 100755 (executable)
@@ -108,7 +108,7 @@ XUL="$INSTALL/var/web/xul";
 [ ! -d "$OSRF"    ]   && die_msg "OpenSRF Source Directory '$OSRF' does not exist!";
 which sudo >/dev/null || die_msg "sudo not installed (or in PATH)";
 
-[ -d "${ILS}/.svn" ] || [ -d "${ILS}/.git" ] || die_msg "Evergreen Source Directory '$ILS' is not a SVN or git repo";
+[ -d "${ILS}/.svn" ] || [ -d "${ILS}/.git" ] || [ -d ${ILS}/.bzr ] || die_msg "Evergreen Source Directory '$ILS' is not a SVN, bzr or git repo";
 
 if [ ! -z "$OPT_TEST" ] ; then
     feedback;