[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. 4f1074aec9e57b0df2cfd6b371e2517929cda090

Evergreen Git git at git.evergreen-ils.org
Thu Aug 7 18:41:55 EDT 2014


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, master has been updated
       via  4f1074aec9e57b0df2cfd6b371e2517929cda090 (commit)
       via  5f0433a9c68164377c262f65ed67a7a538b28585 (commit)
       via  331983c7ff9bbec8571676a18373e9efa2aca59e (commit)
       via  916c0950fbe0d3edd831ded46217589c27856451 (commit)
       via  71241c749e2cabc1d620783a7921133fef1ac162 (commit)
      from  07e00d082410670d33606720b7f077cd8fa31257 (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 4f1074aec9e57b0df2cfd6b371e2517929cda090
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Mar 14 16:42:11 2014 -0400

    LP#1292705 trim unneeded fields from IDL2js
    
    Avoid sending fields in the web-published IDL (IDL2js) that have no
    value, as the keys in the JSON take up a lot of space.  Also avoid
    repeating fields (selector) and default values (e.g. label defaults
    to name) where the client can reasonably apply the defaults locally.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js b/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js
index 006bd09..3ef0ad9 100644
--- a/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js
+++ b/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js
@@ -112,9 +112,10 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
                 if (fieldmapper.IDL && fieldmapper.IDL.loaded) {
                     this.Structure = fieldmapper.IDL.fmclasses[this.classname];
 
+                    var array_pos = 0;
                     for (f in fieldmapper.IDL.fmclasses[this.classname].fields) {
                         var field = fieldmapper.IDL.fmclasses[this.classname].fields[f];
-                        p = field.array_position;
+                        p = array_pos++;
                         this._fields.push( field.name );
                         this[field.name]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];');
                     }
diff --git a/Open-ILS/web/js/dojo/fieldmapper/IDL.js b/Open-ILS/web/js/dojo/fieldmapper/IDL.js
index 46f0241..b2793f0 100644
--- a/Open-ILS/web/js/dojo/fieldmapper/IDL.js
+++ b/Open-ILS/web/js/dojo/fieldmapper/IDL.js
@@ -20,8 +20,16 @@ if(!dojo._hasResource["fieldmapper.IDL"]) {
                     preload.push(c);
                     fieldmapper.IDL.fmclasses[c] = window._preload_fieldmapper_IDL[c];
 
+                    if (!fieldmapper.IDL.fmclasses[c].label) {
+                        fieldmapper.IDL.fmclasses[c].label = 
+                            fieldmapper.IDL.fmclasses[c].name;
+                    }
+
                     window.fmclasses[c] = [];
-                    dojo.forEach(fieldmapper.IDL.fmclasses[c].fields, function(obj){ window.fmclasses[c].push(obj.name); });
+                    dojo.forEach(fieldmapper.IDL.fmclasses[c].fields, function(obj){ 
+                        if (!obj.label) obj.label = obj.name;
+                        window.fmclasses[c].push(obj.name); 
+                    });
 
                     if (classlist && classlist.length)
                         classlist = dojo.filter(classlist, function(x){return x != c;});
diff --git a/Open-ILS/xsl/fm_IDL2js.xsl b/Open-ILS/xsl/fm_IDL2js.xsl
index 1a857bf..ecc374f 100644
--- a/Open-ILS/xsl/fm_IDL2js.xsl
+++ b/Open-ILS/xsl/fm_IDL2js.xsl
@@ -19,7 +19,7 @@ var _preload_fieldmapper_IDL = {<xsl:apply-templates select="idl:IDL"/>};
 for (var c in _preload_fieldmapper_IDL) {
     var x = _preload_fieldmapper_IDL[c]; x.field_map = {};
     var p = x.fields.length;
-    for (var n in {isnew:1,ischanged:1,isdeleted:1}) x.fields[p] = {name:n,type:'field',virtual:true,array_position:p++};
+    for (var n in {isnew:1,ischanged:1,isdeleted:1}) x.fields[p] = {name:n,virtual:true};
     for (var f in x.fields) x.field_map[x.fields[f].name] = x.fields[f];
 }
     </xsl:template>
@@ -36,13 +36,15 @@ for (var c in _preload_fieldmapper_IDL) {
         </xsl:choose>
     </xsl:template>
  
-    <xsl:template match="idl:class"><xsl:value-of select="@id"/>:{name:"<xsl:value-of select="@id"/>",label:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:label"/><xsl:with-param name='d' select="@id"/></xsl:call-template>",restrict_primary:"<xsl:value-of select="@oils_persist:restrict_primary"/>",virtual:<xsl:call-template name='trueFalse'><xsl:with-param name='tf' select="@oils_persist:virtual"/></xsl:call-template>,pkey:"<xsl:value-of select="idl:fields/@oils_persist:primary"/>",pkey_sequence:"<xsl:value-of select="idl:fields/@oils_persist:sequence"/>",<xsl:apply-templates select="idl:fields"/><xsl:apply-templates select="permacrud:permacrud"/>}</xsl:template>
+    <xsl:template match="idl:class"><xsl:value-of select="@id"/>:{name:"<xsl:value-of select="@id"/>",<xsl:if test="@reporter:label">label:"<xsl:value-of select="@reporter:label"/>",</xsl:if><xsl:if test="@oils_persist:restrict_primary">restrict_primary:"<xsl:value-of select="@oils_persist:restrict_primary"/>",</xsl:if><xsl:if test="@oils_persist:virtual = 'true'">virtual:true,</xsl:if><xsl:if test="idl:fields/@oils_persist:primary">pkey:"<xsl:value-of select="idl:fields/@oils_persist:primary"/>",</xsl:if><xsl:if test="idl:fields/@oils_persist:sequence">pkey_sequence:"<xsl:value-of select="idl:fields/@oils_persist:sequence"/>",</xsl:if><xsl:apply-templates select="idl:fields"/><xsl:apply-templates select="permacrud:permacrud"/>}</xsl:template>
  
     <xsl:template match="idl:fields">fields:[<xsl:for-each select="idl:field"><xsl:call-template name="printField"><xsl:with-param name='pos' select="position()"/></xsl:call-template><xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>]</xsl:template>
 
     <xsl:template match="permacrud:permacrud">,permacrud:{<xsl:for-each select="permacrud:actions/*"><xsl:if test="name() = 'delete'">"</xsl:if><xsl:value-of select="name()"/><xsl:if test="name() = 'delete'">"</xsl:if>:{<xsl:call-template name='pcrudPerms'/>}<xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>}</xsl:template>
  
-<xsl:template name='printField'><xsl:param name="pos"/>{name:"<xsl:value-of select="@name"/>",label:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:label"/><xsl:with-param name='d' select="@name"/></xsl:call-template>",datatype:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:datatype"/><xsl:with-param name='d' select="string('text')"/></xsl:call-template>",primitive:"<xsl:value-of select="@oils_persist:primitive"/>",selector:"<xsl:value-of select="@reporter:selector"/>",array_position:"<xsl:value-of select="$pos - 1"/>",<xsl:call-template name='fieldOrLink'><xsl:with-param name='f' select="."/></xsl:call-template>,virtual:<xsl:call-template name='trueFalse'><xsl:with-param name='tf' select="@oils_persist:virtual"/></xsl:call-template>,required:<xsl:call-template name='trueFalse'><xsl:with-param name='tf' select="@oils_obj:required"/></xsl:call-template>,i18n:<xsl:call-template name='trueFalse'><xsl:with-pa
 ram name='tf' select="@oils_persist:i18n"/></xsl:call-template>}</xsl:template>
+<!-- to simplify the logic, the first and last field are assumed to
+     have values (and practically always will) -->
+<xsl:template name='printField'>{name:"<xsl:value-of select="@name"/>",<xsl:if test="@reporter:label != ''">label:"<xsl:value-of select="@reporter:label"/>",</xsl:if><xsl:if test="@oils_persist:primitive = 'true'">primitive:true,</xsl:if><xsl:if test="@reporter:selector != ''">selector:"<xsl:value-of select="@reporter:selector"/>",</xsl:if><xsl:if test="@oils_persist:virtual = 'true'">virtual:true,</xsl:if><xsl:if test="@oils_obj:required = 'true'">required:true,</xsl:if><xsl:if test="@oils_persist:i18n = 'true'">i18n:true,</xsl:if><xsl:call-template name='fieldOrLink'><xsl:with-param name='f' select="."/></xsl:call-template>datatype:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:datatype"/><xsl:with-param name='d' select="string('text')"/></xsl:call-template>"}</xsl:template>
  
 <xsl:template name="pcrudPerms">
     <xsl:if test="@permission">perms:[<xsl:for-each select="str:split(@permission,' ')">'<xsl:value-of select="./text()"/>'<xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>]</xsl:if>
@@ -50,10 +52,7 @@ for (var c in _preload_fieldmapper_IDL) {
 
 <xsl:template name="fieldOrLink">
     <xsl:param name="f"/>
-    <xsl:choose>
-        <xsl:when test="$f/../../idl:links/idl:link[@field=$f/@name]">type:"link",<xsl:apply-templates select="$f/../../idl:links/idl:link[@field=$f/@name]"></xsl:apply-templates></xsl:when>
-        <xsl:otherwise>type:"field"</xsl:otherwise>
-    </xsl:choose>
+    <xsl:if test="$f/../../idl:links/idl:link[@field=$f/@name]">type:"link",<xsl:apply-templates select="$f/../../idl:links/idl:link[@field=$f/@name]"></xsl:apply-templates>,</xsl:if>
 </xsl:template>
 
 <xsl:template match="idl:link">key:"<xsl:value-of select="@key"/>","class":"<xsl:value-of select="@class"/>",reltype:"<xsl:value-of select="@reltype"/>"</xsl:template>
@@ -74,6 +73,5 @@ for (var c in _preload_fieldmapper_IDL) {
         <xsl:otherwise><xsl:value-of select="$v"/></xsl:otherwise>
     </xsl:choose>
 </xsl:template>
- 
- 
+
 </xsl:stylesheet>

commit 5f0433a9c68164377c262f65ed67a7a538b28585
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Wed Jul 23 12:29:44 2014 -0400

    LP#1347793: TPAC added content by ID release notes
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/docs/RELEASE_NOTES_NEXT/OPAC/addedcontent_by_id.txt b/docs/RELEASE_NOTES_NEXT/OPAC/addedcontent_by_id.txt
new file mode 100644
index 0000000..230b005
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/OPAC/addedcontent_by_id.txt
@@ -0,0 +1,6 @@
+Added Content by Record ID
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The Template Toolkit OPAC will now load all Added Content by the Record ID, not
+just jacket images. This will allow added content providers that support it to
+load additional content by other identifiers.

commit 331983c7ff9bbec8571676a18373e9efa2aca59e
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Tue Jul 22 11:15:11 2014 -0400

    LP#1347793: Teach TPac to load AC by Bib ID
    
    So that we may get more than just jackets
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
index e372267..8170b6d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
@@ -486,8 +486,6 @@ sub added_content_stage1 {
     my $rec_id = shift;
     my $ctx = $self->ctx;
     my $sel_type = $self->cgi->param('ac') || '';
-    my $key = $self->get_ac_key($rec_id);
-    ($key = $key->{value}) =~ s/^\s+//g if $key;
 
     # Connect to this machine's IP address, using the same 
     # Host with which our caller used to connect to us.
@@ -503,31 +501,29 @@ sub added_content_stage1 {
     for my $type (@$ac_types) {
         last if $ac_failed;
         $ctx->{added_content}->{$type} = {content => ''};
-        $ctx->{added_content}->{$type}->{status} = $key ? 3 : 2;
-
-        if ($key) {
-            $logger->debug("tpac: starting added content request for $key => $type");
-
-            # Net::HTTP::NB is non-blocking /after/ the initial connect()
-            # Passing Timeout=>1 ensures we wait no longer than 1 second to 
-            # connect to the local Evergreen instance (i.e. ourself).  
-            # Connecting to oneself should either be very fast (normal) 
-            # or very slow (routing problems).
-
-            my $req = Net::HTTP::NB->new(Host => $ac_addr, Timeout => 1);
-            if (!$req) {
-                $logger->warn("Unable to connect to $ac_addr / $ac_host".
-                    " for added content lookup for $key: $@");
-                $ac_failed = 1;
-                next;
-            }
+        $ctx->{added_content}->{$type}->{status} = 3;
+
+        $logger->debug("tpac: starting added content request for $rec_id => $type");
+
+        # Net::HTTP::NB is non-blocking /after/ the initial connect()
+        # Passing Timeout=>1 ensures we wait no longer than 1 second to 
+        # connect to the local Evergreen instance (i.e. ourself).  
+        # Connecting to oneself should either be very fast (normal) 
+        # or very slow (routing problems).
+
+        my $req = Net::HTTP::NB->new(Host => $ac_addr, Timeout => 1);
+        if (!$req) {
+            $logger->warn("Unable to connect to $ac_addr / $ac_host".
+                " for added content lookup for $rec_id: $@");
+            $ac_failed = 1;
+            next;
+        }
 
-            $req->host($self->apache->hostname);
+        $req->host($self->apache->hostname);
 
-            my $http_type = ($type eq $sel_type) ? 'GET' : 'HEAD';
-            $req->write_request($http_type => "/opac/extras/ac/$type/html/" . uri_escape_utf8($key));
-            $ctx->{added_content}->{$type}->{request} = $req;
-        }
+        my $http_type = ($type eq $sel_type) ? 'GET' : 'HEAD';
+        $req->write_request($http_type => "/opac/extras/ac/$type/html/r/" . $rec_id);
+        $ctx->{added_content}->{$type}->{request} = $req;
     }
 }
 
@@ -572,40 +568,4 @@ sub added_content_stage2 {
     }
 }
 
-# XXX this is copied directly from AddedContent.pm in 
-# working/user/jeff/ac_by_record_id_rebase.  When Jeff's
-# branch is merged and Evergreen gets added content 
-# lookup by ID, this can be removed.
-# returns [{tag => $tag, value => $value}, {tag => $tag2, value => $value2}]
-sub get_ac_key {
-    my $self = shift;
-    my $rec_id = shift;
-    my $key_data = $self->editor->json_query({
-        select => {mfr => ['tag', 'value']},
-        from => 'mfr',
-        where => {
-            record => $rec_id,
-            '-or' => [
-                {
-                    '-and' => [
-                        {tag => '020'},
-                        {subfield => 'a'}
-                    ]
-                }, {
-                    '-and' => [
-                        {tag => '024'},
-                        {subfield => 'a'},
-                        {ind1 => 1}
-                    ]
-                }
-            ]
-        }
-    });
-
-    return (
-        grep {$_->{tag} eq '020'} @$key_data,
-        grep {$_->{tag} eq '024'} @$key_data
-    )[0];
-}
-
 1;
diff --git a/Open-ILS/src/templates/opac/parts/acjs.tt2 b/Open-ILS/src/templates/opac/parts/acjs.tt2
index 3b057dc..dd48374 100644
--- a/Open-ILS/src/templates/opac/parts/acjs.tt2
+++ b/Open-ILS/src/templates/opac/parts/acjs.tt2
@@ -3,52 +3,54 @@
 
     /* Checks to see if a given type of added content has data to show.
      * The first arg to callback() is boolean indicating the presence of data */
-    function acIsAvailable(ident, type, callback) {
-        var url = '/opac/extras/ac/' + type + '/html/' + ident;
+    function acIsAvailable(bre_id, type, callback) {
+        var url = '/opac/extras/ac/' + type + '/html/r/' + bre_id;
         dojo.xhr('HEAD', {
-            url : url, 
+            url : url,
             failOk : true, // http://bugs.dojotoolkit.org/ticket/11568
-            error : function(err) { callback(false, ident, type); },
-            load : function(result) { callback(true, ident, type); }
+            error : function(err) { callback(false, bre_id, type); },
+            load : function(result) { callback(true, bre_id, type); }
         });
     }
 
-    [%-  # XXX revisit when ident=ctx.bre_id
-        ident = ctx.record_attrs.isbn_clean || ctx.record_attrs.upc; 
-        IF ident; 
-            FOR type IN ctx.added_content.keys;
-                IF ctx.added_content.$type.status == '3' # status unknown %]
+    [%-
+        FOR type IN ctx.added_content.keys;
+            IF ctx.added_content.$type.status == '3' # status unknown %]
 
-                    dojo.addOnLoad(function() {
-                        var ident = '[% ident %]';
-                        var type = '[% type %]';
+                dojo.addOnLoad(function() {
+                    var bre_id = '[% ctx.bre_id %]';
+                    var type = '[% type %]';
 
-                        acIsAvailable(ident, type, function(avail, ident, type) { 
-                            if (avail) {
+                    acIsAvailable(bre_id, type, function(avail, bre_id, type) {
+                        if (avail) {
 
-                                [% IF CGI.param('expand') == 'addedcontent' %]
+                            [% IF CGI.param('expand') == 'addedcontent' %]
 
-                                    // if the content is available, un-hide the tab
-                                    dojo.removeClass(dojo.byId('ac:' + type), 'hidden');
+                                // if the content is available, un-hide the tab
+                                dojo.removeClass(dojo.byId('ac:' + type), 'hidden');
 
-                                [% ELSE %]
-                                    // if no default type is selected on the main tab link
-                                    // set one here, since we have available content
+                            [% ELSE %]
+                                // if no default type is selected on the main tab link
+                                // set one here, since we have available content
 
-                                    var link = dojo.query('[name=addedcontent]')[0];
-                                    var href = link.getAttribute('href');
-                                    if (!href.match('[\&;]ac=')) {
-                                        href = href.replace('#addedcontent', ';ac=' + type + '#addedcontent');
-                                        dojo.attr(link, 'href', href);
-                                        dojo.attr(dojo.query('[name=addedcontent_lbl]')[0], 'href', href);
-                                    }
+                                var link = dojo.query('[name=addedcontent]')[0];
+                                var href = link.getAttribute('href');
+                                if (!href.match('[\&;]ac=')) {
+                                    href = href.replace('#addedcontent', ';ac=' + type + '#addedcontent');
+                                    dojo.attr(link, 'href', href);
+                                    dojo.attr(dojo.query('[name=addedcontent_lbl]')[0], 'href', href);
+                                }
 
-                                [% END %]
-                            }
-                        });
+                            [% END %]
+                        }
                     });
-                [% END; # IF status unknown
-            END  %] 
+                });
+            [% END; # IF status unknown
+        END; # FOR type
+
+        ident = ctx.record_attrs.isbn_clean || ctx.record_attrs.upc;
+        IF ident;
+    -%]
 
 [%- IF ENV.OILS_NOVELIST_URL -%]
             /* Load novelist content */
@@ -57,7 +59,7 @@
                     ClientIdentifier : '[% ident %]',
                     ISBN : '[% ident %]',
                     version : '2.1'
-                }, 
+                },
                 '[% ENV.OILS_NOVELIST_PROFILE %]',
                 '[% ENV.OILS_NOVELIST_PASSWORD %]',
                 function(d){

commit 916c0950fbe0d3edd831ded46217589c27856451
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Oct 31 10:02:44 2013 -0400

    LP#1246745: Remove OK message from SIP2 messages
    
    Because having clients constantly say there is a message of "OK" gets annoying
    very quickly, especially if it is displayed in a popup message instead of via
    a "messages" button.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index 69232f1..ac4f05c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -392,7 +392,7 @@ sub screen_msg {
     my $expire = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($u->expire_date));
     return $b if CORE::time > $expire->epoch;
 
-    return 'OK';
+    return '';
 }
 
 sub print_line {            # not implemented

commit 71241c749e2cabc1d620783a7921133fef1ac162
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Jul 31 16:50:17 2014 -0400

    LP#1351317 ACQ fund selector filters cont.
    
    To improve load times, limit the funds we attempt to retrieve for
    various fund selectors to those the user has permission to use.
    
    Interfaces affected include the following:
    
    * Purchase order copy grid
    * Purchase order "New Charge" interface
    * Invoice "Add charge..." interface
    * Distribution formula configuration interface.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js
index 1f48b08..af9e29a 100644
--- a/Open-ILS/web/js/ui/default/acq/common/li_table.js
+++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js
@@ -29,6 +29,7 @@ var fundLabelFormat = [
     '<span class="fund_${0}">${1} (${2})</span>', 'id', 'code', 'year'
 ];
 var fundSearchFormat = ['${0} (${1})', 'code', 'year'];
+var fundSearchFilter = {active : 't'};
 
 function nodeByName(name, context) {
     return dojo.query('[name='+name+']', context)[0];
@@ -160,13 +161,24 @@ function AcqLiTable() {
     dojo.byId('acq-lit-notes-back-button').onclick = function(){self.show('list')};
     dojo.byId('acq-lit-real-copies-back-button').onclick = function(){self.show('list')};
 
+    this.setFundSearchFilter = function(callback) {
+        new openils.User().getPermOrgList(
+            ['CREATE_PURCHASE_ORDER', 'MANAGE_FUND'],
+            function(orgs) { 
+                fundSearchFilter.org = orgs;
+                if (callback) callback();
+            },
+            true, true // descendants, id_list
+        );
+    }
+
     this.afwCopyFieldArgs = function(field, perms) {
         return {
                 "fmField" : field,
                 "fmClass": 'acqlid',
                 "labelFormat": (field == 'fund') ? fundLabelFormat : null,
                 "searchFormat": (field == 'fund') ? fundSearchFormat : null,
-                "searchFilter": (field == 'fund') ? {"active": "t"} : null,
+                "searchFilter": (field == 'fund') ? fundSearchFilter : null,
                 "orgLimitPerms": [perms],
                 "dijitArgs": {
                     "required": false,
@@ -250,16 +262,13 @@ function AcqLiTable() {
                     // The list of funds can be huge. Before fetching
                     // funds for PO modification, see where the user has
                     // perms and limit the retreived funds accordingly.
-                    // Note: this code only runs once per page load, so
-                    // no caching is required.
-                    new openils.User().getPermOrgList(
-                        ['CREATE_PURCHASE_ORDER', 'MANAGE_FUND'],
-                        function(orgs) { 
-                            args.searchFilter.org = orgs;
-                            buildOneBatchWidget(field, args);
-                        },
-                        true, true // descendants, id_list
-                    );
+                    // Note:  This is the first instance of fund list
+                    // retrieval.  All future fund list retrievals will
+                    // benefit directly from having applied the fund
+                    // search filter org units here.
+                    self.setFundSearchFilter(function() { 
+                        buildOneBatchWidget(field, args); 
+                    });
                     return; 
                 }
 
@@ -2318,6 +2327,7 @@ function AcqLiTable() {
                     searchFilter = (copy.fund() ?
                         {"-or": {"active": "t", "id": copy.fund()}} :
                         {"active" : "t"});
+                    searchFilter.org = fundSearchFilter.org;
                 } else {
                     searchFilter = null;
                 }
@@ -3308,7 +3318,7 @@ function AcqLiTable() {
                 selfReference : true,
                 labelFormat : fundLabelFormat,
                 searchFormat : fundSearchFormat,
-                searchFilter : {"active": "t"},
+                searchFilter : fundSearchFilter,
                 parentNode : dojo.byId('acq-lit-batch-fund-selector'),
                 orgLimitPerms : ['CREATE_PICKLIST', 'CREATE_PURCHASE_ORDER'],
                 dijitArgs : { "required": true, "labelType": "html" },
diff --git a/Open-ILS/web/js/ui/default/acq/invoice/view.js b/Open-ILS/web/js/ui/default/acq/invoice/view.js
index f447f18..3d42e43 100644
--- a/Open-ILS/web/js/ui/default/acq/invoice/view.js
+++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js
@@ -20,6 +20,7 @@ var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
 
 var fundLabelFormat = ['${0} (${1})', 'code', 'year'];
 var fundSearchFormat = ['${0} (${1})', 'code', 'year'];
+var fundSearchFilter = {}; 
 
 var cgi = new openils.CGI();
 var pcrud = new openils.PermaCrud();
@@ -48,6 +49,19 @@ function nodeByName(name, context) {
 }
 
 function init() {
+    // before rendering any fund selectors, limit the funds to 
+    // attempt to retrieve to those the user can actually use.
+    new openils.User().getPermOrgList(
+        ['ADMIN_INVOICE','CREATE_INVOICE','MANAGE_FUND'],
+        function(orgs) { 
+            fundSearchFilter.org = orgs;
+            init2();
+        },
+        true, true // descendants, id_list
+    );
+}
+
+function init2() {
 
     attachLi = cgi.param('attach_li') || [];
     if (!dojo.isArray(attachLi)) 
@@ -101,6 +115,7 @@ function init() {
         searchFilter : {active : 't'},
         labelFormat : fundLabelFormat,
         searchFormat : fundSearchFormat,
+        searchFilter : fundSearchFilter,
         dijitArgs : {required : true},
         parentNode : dojo.byId('acq-invoice-extra-copies-fund')
     });
@@ -613,6 +628,7 @@ function addInvoiceItem(item) {
         fmField : 'fund',
         labelFormat : fundLabelFormat,
         searchFormat : fundSearchFormat,
+        searchFilter : fundSearchFilter,
         readOnly : invoice && openils.Util.isTrue(invoice.complete()),
         dijitArgs : {required : true},
         parentNode : nodeByName('fund', row)
diff --git a/Open-ILS/web/js/ui/default/acq/po/item_table.js b/Open-ILS/web/js/ui/default/acq/po/item_table.js
index 3c1f9a5..4ed9a72 100644
--- a/Open-ILS/web/js/ui/default/acq/po/item_table.js
+++ b/Open-ILS/web/js/ui/default/acq/po/item_table.js
@@ -26,6 +26,13 @@ function PoItemTable() {
             "noCache": true
         };
 
+        // limit funds fetched to those the user can use
+        new openils.User().getPermOrgList(
+            ['CREATE_PURCHASE_ORDER', 'MANAGE_FUND'],
+            function(orgs) { self.fundAWArgs.searchFilter.org = orgs },
+            true, true // descendants, id_list
+        );
+
         this.reset();
     };
 
diff --git a/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js b/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js
index a2d5eec..41bac33 100644
--- a/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js
+++ b/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js
@@ -14,6 +14,7 @@ var virtualId = -1;
 var pcrud;
 var _collection_code_textboxes = [];
 var _collection_code_kludge_active = false;
+var fundSearchFilter = {active : 't'};
 
 function gridDataLoader() {
     fListGrid.resetStore();
@@ -38,13 +39,24 @@ function gridDataLoader() {
     );
 }
 
+function setFundSearchFilter(callback) {
+    new openils.User().getPermOrgList(
+        ['ADMIN_ACQ_DISTRIB_FORMULA'],
+        function(orgs) { 
+            fundSearchFilter.org = orgs;
+            if (callback) callback();
+        },
+        true, true // descendants, id_list
+    );
+}
+
 function draw() {
 
     pcrud = new openils.PermaCrud();
 
     if(formulaId) {
         openils.Util.hide('formula-list-div');
-        drawFormulaSummary();
+        setFundSearchFilter(drawFormulaSummary);
     } else {
 
         openils.Util.hide('formula-entry-div');
@@ -153,6 +165,7 @@ function addEntry(entry) {
                 fmField : field, 
                 fmObject : entry,
                 fmClass : 'acqdfe',
+                searchFilter : (field == 'fund') ? fundSearchFilter : null,
                 parentNode : byName(row, field),
                 orgDefaultsToWs : true,
                 orgLimitPerms : ['ADMIN_ACQ_DISTRIB_FORMULA'],

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

Summary of changes:
 Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm    |    2 +-
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm |   82 +++++---------------
 Open-ILS/src/templates/opac/parts/acjs.tt2         |   70 +++++++++--------
 Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js    |    3 +-
 Open-ILS/web/js/dojo/fieldmapper/IDL.js            |   10 ++-
 Open-ILS/web/js/ui/default/acq/common/li_table.js  |   34 +++++---
 Open-ILS/web/js/ui/default/acq/invoice/view.js     |   16 ++++
 Open-ILS/web/js/ui/default/acq/po/item_table.js    |    7 ++
 .../conify/global/acq/distribution_formula.js      |   15 ++++-
 Open-ILS/xsl/fm_IDL2js.xsl                         |   16 ++--
 .../RELEASE_NOTES_NEXT/OPAC/addedcontent_by_id.txt |    6 ++
 11 files changed, 141 insertions(+), 120 deletions(-)
 create mode 100644 docs/RELEASE_NOTES_NEXT/OPAC/addedcontent_by_id.txt


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list