[open-ils-commits] [GIT] Evergreen ILS branch master updated. f93b9f4d5b8778993ceefc1b9163a2ec8bc28313
Evergreen Git
git at git.evergreen-ils.org
Mon Mar 11 17:46:37 EDT 2013
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 f93b9f4d5b8778993ceefc1b9163a2ec8bc28313 (commit)
via cad8ffe4fe66bf569c5f7030f677f12d9da046a8 (commit)
via eca8d7fe2af431f28230385bfe185c48b6eaf16a (commit)
via 415a3e98ab658f87f7ac72f62eb203cf17ec7583 (commit)
via 0f4c2455b24774091dfb452a58ca7f653d73832a (commit)
via 1aa9a8a6755aa6dc43b9c24a7d975eaa8084b860 (commit)
via f83878aa3cd91ef35665b5dde0a0dfe86c1ae737 (commit)
via 2f4f3405415751f3a61a4e40ca622cec25728923 (commit)
via b42fa9068868c55b744cf9141627955ea90773d4 (commit)
via 94813cbe6a061b95079a7a40375473e9c7914eaf (commit)
from 8b47e5eca74b1cbc78ad20db074136601648b5ca (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 f93b9f4d5b8778993ceefc1b9163a2ec8bc28313
Author: Ben Shum <bshum at biblio.org>
Date: Mon Mar 11 17:45:23 2013 -0400
Stamping upgrade for "exclude_invisible_acn" unapi holdings filter
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 9ad2ba5..9acacb1 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -90,7 +90,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0768', :eg_version); -- berick/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0769', :eg_version); -- berick/bshum
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXX.schema.unapi_exclude_invisible_acn.sql b/Open-ILS/src/sql/Pg/upgrade/0769.schema.unapi_exclude_invisible_acn.sql
similarity index 99%
rename from Open-ILS/src/sql/Pg/upgrade/XXX.schema.unapi_exclude_invisible_acn.sql
rename to Open-ILS/src/sql/Pg/upgrade/0769.schema.unapi_exclude_invisible_acn.sql
index cae5216..7bef743 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXX.schema.unapi_exclude_invisible_acn.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0769.schema.unapi_exclude_invisible_acn.sql
@@ -1,6 +1,8 @@
BEGIN;
+SELECT evergreen.upgrade_deps_block_check('0769', :eg_version);
+
DROP FUNCTION IF EXISTS
evergreen.ranked_volumes(BIGINT, INT, INT, HSTORE, HSTORE, INT);
commit cad8ffe4fe66bf569c5f7030f677f12d9da046a8
Author: Bill Erickson <berick at esilibrary.com>
Date: Wed Mar 6 16:02:37 2013 -0500
TPAC my-list call number includes child orgs
For my-list call number display, if the most relevant call number is a
child of any of the context org units (physical/pref/search), it is
considered relevant for purposes of call number display.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/templates/opac/myopac/lists.tt2 b/Open-ILS/src/templates/opac/myopac/lists.tt2
index b43ad42..0b2977d 100644
--- a/Open-ILS/src/templates/opac/myopac/lists.tt2
+++ b/Open-ILS/src/templates/opac/myopac/lists.tt2
@@ -292,12 +292,14 @@
copy = attrs.holdings.0;
IF copy;
# only show a relevant call number
- org = ctx.get_aou_by_shortname(copy.owner);
- IF org.id == ctx.search_ou OR
- org.id == ctx.pref_ou OR
- org.id == ctx.user.home_ou OR
- org.id == ctx.physical_loc;
- l('[_1] ([_2])', copy.label, org.name) | html;
+ copy_org = ctx.get_aou_by_shortname(copy.owner);
+ FOR ctx_org IN [ctx.pref_ou, ctx.search_ou, ctx.home_ou, ctx.physical_loc];
+ NEXT UNLESS ctx_org;
+ ctx_org = ctx.get_aou(ctx_org);
+ IF ctx.org_within_scope(ctx_org, copy_org, ctx_org.ou_type.depth);
+ l('[_1] ([_2])', copy.label, copy_org.name) | html;
+ LAST;
+ END;
END;
END;
%]
diff --git a/Open-ILS/src/templates/opac/parts/anon_list.tt2 b/Open-ILS/src/templates/opac/parts/anon_list.tt2
index cd39bbc..252f4ae 100644
--- a/Open-ILS/src/templates/opac/parts/anon_list.tt2
+++ b/Open-ILS/src/templates/opac/parts/anon_list.tt2
@@ -65,13 +65,14 @@
[%
copy = attrs.holdings.0;
IF copy;
- # only show a relevant call number
- org = ctx.get_aou_by_shortname(copy.owner);
- IF org.id == ctx.search_ou OR
- org.id == ctx.pref_ou OR
- org.id == ctx.user.home_ou OR
- org.id == ctx.physical_loc;
- l('[_1] ([_2])', copy.label, org.name) | html;
+ copy_org = ctx.get_aou_by_shortname(copy.owner);
+ FOR ctx_org IN [ctx.pref_ou, ctx.search_ou, ctx.home_ou, ctx.physical_loc];
+ NEXT UNLESS ctx_org;
+ ctx_org = ctx.get_aou(ctx_org);
+ IF ctx.org_within_scope(ctx_org, copy_org, ctx_org.ou_type.depth);
+ l('[_1] ([_2])', copy.label, copy_org.name) | html;
+ LAST;
+ END;
END;
END;
%]
commit eca8d7fe2af431f28230385bfe185c48b6eaf16a
Author: Bill Erickson <berick at esilibrary.com>
Date: Tue Feb 12 12:19:58 2013 -0500
tpac avoid more org_unit template var leaks
Avoid using the variable name 'org_unit' in misc_utils (when compiling
copy visibility info) since the value can leak into the org_selector
template, disrupting the rendering of the org selector.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2
index 2d2f299..bddab42 100644
--- a/Open-ILS/src/templates/opac/parts/misc_util.tt2
+++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2
@@ -379,9 +379,9 @@
FOR node IN xml.findnodes(xpath);
FOR attr IN ['count', 'available', 'unshadow', 'transcendant', 'org_unit'];
depth = node.getAttribute('depth');
- org_unit = node.getAttribute('org_unit');
+ count_org_unit = node.getAttribute('org_unit');
args.copy_counts.$depth.$attr = node.getAttribute(attr);
- args.org_copy_counts.$org_unit.$attr = node.getAttribute(attr);
+ args.org_copy_counts.$count_org_unit.$attr = node.getAttribute(attr);
END;
END;
commit 415a3e98ab658f87f7ac72f62eb203cf17ec7583
Author: Bill Erickson <berick at esilibrary.com>
Date: Mon Jan 28 13:40:12 2013 -0500
Consistent response type from TPAC pref lib lookup
In some contexts, the $user->home_ou field is fleshed with a real org
unit object. Ensure that the response value from _get_pref_lib in the
TPAC takes this into consideration when finding the ID of the user's
home org unit.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
index 39f986f..93cc3e1 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
@@ -392,7 +392,8 @@ sub _get_pref_lib {
return OpenSRF::Utils::JSON->JSON2perl($lset->value) if $lset;
# Otherwise return the user's home library
- return $ctx->{user}->home_ou;
+ my $ou = $ctx->{user}->home_ou;
+ return ref($ou) ? $ou->id : $ou;
}
if ($ctx->{physical_loc}) {
commit 0f4c2455b24774091dfb452a58ca7f653d73832a
Author: Bill Erickson <berick at esilibrary.com>
Date: Fri Jan 25 09:32:38 2013 -0500
TPAC My List Call-Number Release Notes
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/docs/RELEASE_NOTES_NEXT/tpac_bookbag_callnumbers.txt b/docs/RELEASE_NOTES_NEXT/tpac_bookbag_callnumbers.txt
new file mode 100644
index 0000000..a6a53c5
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/tpac_bookbag_callnumbers.txt
@@ -0,0 +1,15 @@
+New Feature: Show local call number in TPAC My Lists display
+============================================================
+
+If an opac-visible call number exists that is owned by an org unit
+relevant to the patron, show the most relevant call number label
+and owning branch name in the My Lists display for each record in
+the list. Call number is displayed in both saved and temporary lists.
+
+A call number is considered relevant if its owner is one of:
+
+physical location library
+preferred library (plib, home, etc.)
+search library
+
+If no relevant call number is found, no call number is diplayed.
commit 1aa9a8a6755aa6dc43b9c24a7d975eaa8084b860
Author: Bill Erickson <berick at esilibrary.com>
Date: Thu Dec 13 11:34:50 2012 -0500
Show local call number in TPAC My Lists display
If an opac-visible call number exists that is owned by an org unit
relevant to the patron, show the (most relevant) call number label in
the My Lists display for each record in the list. Call number is
displayed in both saved and temporary lists.
A call number is considered relevant if its owner is one of:
physical location library
preferred library (plib, home, etc.)
search library
This code leverages the new "exclude_invisible_acn" unapi filter to
ensure that we are only required to retrieve 1 call number in the unapi
output instead of an arbitrarily large set of call numbers, against
which we may have to filter non-visible call numbers.
This commit also addresses and outstanding TODO item in the tpac Perl:
Replace the last use of fetch_marc_xml_by_id with get_records_and_facets
and remove fetch_marc_xml_by_id
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
index 337ee52..ec7bb96 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
@@ -1755,6 +1755,7 @@ sub load_myopac_bookbags {
# transaction rollback under the covers.
$e->rollback;
+
my $query = $self->_prepare_bookbag_container_query(
$bookbag->id, $sorter, $modifier
);
@@ -1769,11 +1770,21 @@ sub load_myopac_bookbags {
my $items = $U->bib_container_items_via_search($bookbag->id, $query, $args)
or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+ # capture pref_ou for callnumber filter/display
+ $ctx->{pref_ou} = $self->_get_pref_lib() || $ctx->{search_ou};
+
+ # search for local callnumbers for display
+ my $focus_ou = $ctx->{physical_loc} || $ctx->{pref_ou};
my (undef, @recs) = $self->get_records_and_facets(
[ map {$_->target_biblio_record_entry->id} @$items ],
undef,
- {flesh => '{mra}'}
+ {
+ flesh => '{mra,holdings_xml,acp,exclude_invisible_acn}',
+ flesh_depth => 1,
+ site => $ctx->{get_aou}->($focus_ou)->shortname,
+ pref_lib => $ctx->{pref_ou}
+ }
);
$ctx->{bookbags_marc_xml}{$_->{id}} = $_->{marc_xml} for @recs;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm
index 445654d..b61ac06 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm
@@ -28,9 +28,33 @@ sub fetch_mylist {
}
}
+ { # sanitize
+ no warnings qw/numeric/;
+ $list = [map { int $_ } @$list];
+ $list = [grep { $_ > 0} @$list];
+ };
+
my $marc_xml;
if ($with_marc_xml) {
- $marc_xml = $self->fetch_marc_xml_by_id($list);
+ my $ctx = $self->ctx;
+
+ # capture pref_ou for callnumber filter/display
+ $ctx->{pref_ou} = $self->_get_pref_lib() || $ctx->{search_ou};
+
+ # search for local callnumbers for display
+ my $focus_ou = $ctx->{physical_loc} || $ctx->{pref_ou};
+
+ my (undef, @recs) = $self->get_records_and_facets(
+ $list, undef, {
+ flesh => '{mra,holdings_xml,acp,exclude_invisible_acn}',
+ flesh_depth => 1,
+ site => $ctx->{get_aou}->($focus_ou)->shortname,
+ pref_lib => $ctx->{pref_ou}
+ }
+ );
+
+ # make it look like the caller is expecting
+ $marc_xml = { map {$_->{id} => $_->{marc_xml}} @recs };
}
# Leverage QueryParser to sort the items by values of config.metabib_fields
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
index ec8b6be..39f986f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
@@ -137,6 +137,13 @@ sub init_ro_object_cache {
return [ values %{$cache{map}{$ctx->{locale}}{aou}} ];
};
+ # returns the org unit object by shortname
+ $ro_object_subs->{get_aou_by_shortname} = sub {
+ my $sn = shift or return undef;
+ my $list = $ro_object_subs->{aou_list}->();
+ return (grep {$_->shortname eq $sn} @$list)[0];
+ };
+
$ro_object_subs->{aouct_tree} = sub {
# fetch the org unit tree
@@ -340,36 +347,6 @@ sub get_records_and_facets {
return ($facets, @data);
}
-# TODO: blend this code w/ ^-- get_records_and_facets
-sub fetch_marc_xml_by_id {
- my ($self, $id_list) = @_;
- $id_list = [$id_list] unless ref($id_list);
-
- {
- no warnings qw/numeric/;
- $id_list = [map { int $_ } @$id_list];
- $id_list = [grep { $_ > 0} @$id_list];
- };
-
- return {} if scalar(@$id_list) < 1;
-
- # I'm just sure there needs to be some more efficient way to get all of
- # this.
- my $results = $self->editor->json_query({
- "select" => {"bre" => ["id", "marc"]},
- "from" => {"bre" => {}},
- "where" => {"id" => $id_list}
- }, {substream => 1}) or return $self->editor->die_event;
-
- my $marc_xml = {};
- for my $r (@$results) {
- $marc_xml->{$r->{"id"}} =
- (new XML::LibXML)->parse_string($r->{"marc"});
- }
-
- return $marc_xml;
-}
-
sub _get_search_lib {
my $self = shift;
my $ctx = $self->ctx;
diff --git a/Open-ILS/src/templates/opac/myopac/lists.tt2 b/Open-ILS/src/templates/opac/myopac/lists.tt2
index 5347d34..b43ad42 100644
--- a/Open-ILS/src/templates/opac/myopac/lists.tt2
+++ b/Open-ILS/src/templates/opac/myopac/lists.tt2
@@ -238,6 +238,9 @@
<td class="list_entry">
<a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a>
</td>
+ <td class='list_entry'>
+ [% l('Local Call Number') %]
+ </td>
<td class="list_entry">
<a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'pubdate' ? 'pubdate.descending' : 'pubdate')}) %]">[% l('Publication Date') %]</a>
</td>
@@ -285,6 +288,21 @@
-%]">[% attrs.author | html %]</a>
</td>
<td class="list_entry">
+ [%
+ copy = attrs.holdings.0;
+ IF copy;
+ # only show a relevant call number
+ org = ctx.get_aou_by_shortname(copy.owner);
+ IF org.id == ctx.search_ou OR
+ org.id == ctx.pref_ou OR
+ org.id == ctx.user.home_ou OR
+ org.id == ctx.physical_loc;
+ l('[_1] ([_2])', copy.label, org.name) | html;
+ END;
+ END;
+ %]
+ </td>
+ <td class="list_entry">
[% attrs.pubdate | html %]
</td>
<td class="list_entry">
diff --git a/Open-ILS/src/templates/opac/parts/anon_list.tt2 b/Open-ILS/src/templates/opac/parts/anon_list.tt2
index 89e771c..cd39bbc 100644
--- a/Open-ILS/src/templates/opac/parts/anon_list.tt2
+++ b/Open-ILS/src/templates/opac/parts/anon_list.tt2
@@ -23,8 +23,9 @@
for (i = 0; i < inputs.length; i++) {
if (inputs[i].name == 'record' && !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
</td>
- <td width="49%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>(CGI.param('anonsort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a></td>
- <td width="49%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>(CGI.param('anonsort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a% l('Author(s)') %]</td>
+ <td width="40%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>(CGI.param('anonsort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a></td>
+ <td width="40%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>(CGI.param('anonsort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a% l('Author(s)') %]</td>
+ <td width='18%'>[% l('Local Call Number') %]</td>
<td width="1%" class="nowrap">
<select name="action">
<option>[% l('-- Actions for these items --') %]</option>
@@ -60,6 +61,21 @@
['page', 'id', 'edit_notes']
)
-%]">[% attrs.author | html %]</a></td>
+ <td class="item_list_padding" style="padding-left: 5px;">
+ [%
+ copy = attrs.holdings.0;
+ IF copy;
+ # only show a relevant call number
+ org = ctx.get_aou_by_shortname(copy.owner);
+ IF org.id == ctx.search_ou OR
+ org.id == ctx.pref_ou OR
+ org.id == ctx.user.home_ou OR
+ org.id == ctx.physical_loc;
+ l('[_1] ([_2])', copy.label, org.name) | html;
+ END;
+ END;
+ %]
+ </td>
</tr>
[% END %]
</tbody>
diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2
index cb00059..2d2f299 100644
--- a/Open-ILS/src/templates/opac/parts/misc_util.tt2
+++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2
@@ -360,8 +360,9 @@
part_label => part_label,
location => loc.textContent,
library => circlib.textContent,
- status => status.textContent
- barcode => copy.getAttribute('barcode')
+ status => status.textContent,
+ barcode => copy.getAttribute('barcode'),
+ owner => volume.getAttribute('lib')
};
args.holdings.push(holding);
part_label = '';
commit f83878aa3cd91ef35665b5dde0a0dfe86c1ae737
Author: Bill Erickson <berick at esilibrary.com>
Date: Wed Dec 12 17:14:09 2012 -0500
"exclude_invisible_acn" unapi holdings filter
When present in the unapi includes array, this filter ensures that no
call numbers with 0 opac-visible copies are included in the holdings_xml
output.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/990.schema.unapi.sql b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
index 0cbde74..78a9a2c 100644
--- a/Open-ILS/src/sql/Pg/990.schema.unapi.sql
+++ b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
@@ -70,8 +70,8 @@ CREATE OR REPLACE FUNCTION evergreen.ranked_volumes(
depth INT DEFAULT NULL,
slimit HSTORE DEFAULT NULL,
soffset HSTORE DEFAULT NULL,
- pref_lib INT DEFAULT NULL
- includes TEXT[],
+ pref_lib INT DEFAULT NULL,
+ includes TEXT[] DEFAULT NULL::TEXT[]
) RETURNS TABLE (id BIGINT, name TEXT, label_sortkey TEXT, rank BIGINT) AS $$
SELECT ua.id, ua.name, ua.label_sortkey, MIN(ua.rank) AS rank FROM (
SELECT acn.id, aou.name, acn.label_sortkey,
@@ -79,8 +79,6 @@ CREATE OR REPLACE FUNCTION evergreen.ranked_volumes(
RANK() OVER w
FROM asset.call_number acn
JOIN asset.copy acp ON (acn.id = acp.call_number)
- JOIN asset.copy_location acl ON (acl.id = acp.location)
- JOIN config.copy_status ccs ON (ccs.id = acp.status)
JOIN actor.org_unit_descendants( $2, COALESCE(
$3, (
SELECT depth
@@ -92,10 +90,12 @@ CREATE OR REPLACE FUNCTION evergreen.ranked_volumes(
WHERE acn.record = $1
AND acn.deleted IS FALSE
AND acp.deleted IS FALSE
- AND CASE WHEN ('exclude_invisible_acn' = ANY($6))
- acp.opac_visible IS TRUE AND
- acl.opac_visible IS TRUE AND
- ccs.opac_visible IS TRUE
+ AND CASE WHEN ('exclude_invisible_acn' = ANY($7)) THEN
+ EXISTS (
+ SELECT 1
+ FROM asset.opac_visible_copies
+ WHERE copy_id = acp.id AND record = acn.record
+ ) ELSE TRUE END
GROUP BY acn.id, acp.status, aou.name, acn.label_sortkey, aou.id
WINDOW w AS (
ORDER BY evergreen.rank_ou(aou.id, $2, $6), evergreen.rank_cp_status(acp.status)
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXX.schema.unapi_exclude_invisible_acn.sql b/Open-ILS/src/sql/Pg/upgrade/XXX.schema.unapi_exclude_invisible_acn.sql
new file mode 100644
index 0000000..cae5216
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXX.schema.unapi_exclude_invisible_acn.sql
@@ -0,0 +1,143 @@
+
+BEGIN;
+
+DROP FUNCTION IF EXISTS
+ evergreen.ranked_volumes(BIGINT, INT, INT, HSTORE, HSTORE, INT);
+
+CREATE OR REPLACE FUNCTION evergreen.ranked_volumes(
+ bibid BIGINT,
+ ouid INT,
+ depth INT DEFAULT NULL,
+ slimit HSTORE DEFAULT NULL,
+ soffset HSTORE DEFAULT NULL,
+ pref_lib INT DEFAULT NULL,
+ includes TEXT[] DEFAULT NULL::TEXT[]
+) RETURNS TABLE (id BIGINT, name TEXT, label_sortkey TEXT, rank BIGINT) AS $$
+ SELECT ua.id, ua.name, ua.label_sortkey, MIN(ua.rank) AS rank FROM (
+ SELECT acn.id, aou.name, acn.label_sortkey,
+ evergreen.rank_ou(aou.id, $2, $6), evergreen.rank_cp_status(acp.status),
+ RANK() OVER w
+ FROM asset.call_number acn
+ JOIN asset.copy acp ON (acn.id = acp.call_number)
+ JOIN actor.org_unit_descendants( $2, COALESCE(
+ $3, (
+ SELECT depth
+ FROM actor.org_unit_type aout
+ INNER JOIN actor.org_unit ou ON ou_type = aout.id
+ WHERE ou.id = $2
+ ), $6)
+ ) AS aou ON (acp.circ_lib = aou.id)
+ WHERE acn.record = $1
+ AND acn.deleted IS FALSE
+ AND acp.deleted IS FALSE
+ AND CASE WHEN ('exclude_invisible_acn' = ANY($7)) THEN
+ EXISTS (
+ SELECT 1
+ FROM asset.opac_visible_copies
+ WHERE copy_id = acp.id AND record = acn.record
+ ) ELSE TRUE END
+ GROUP BY acn.id, acp.status, aou.name, acn.label_sortkey, aou.id
+ WINDOW w AS (
+ ORDER BY evergreen.rank_ou(aou.id, $2, $6), evergreen.rank_cp_status(acp.status)
+ )
+ ) AS ua
+ GROUP BY ua.id, ua.name, ua.label_sortkey
+ ORDER BY rank, ua.name, ua.label_sortkey
+ LIMIT ($4 -> 'acn')::INT
+ OFFSET ($5 -> 'acn')::INT;
+$$
+LANGUAGE SQL STABLE;
+
+CREATE OR REPLACE FUNCTION unapi.holdings_xml (
+ bid BIGINT,
+ ouid INT,
+ org TEXT,
+ depth INT DEFAULT NULL,
+ includes TEXT[] DEFAULT NULL::TEXT[],
+ slimit HSTORE DEFAULT NULL,
+ soffset HSTORE DEFAULT NULL,
+ include_xmlns BOOL DEFAULT TRUE,
+ pref_lib INT DEFAULT NULL
+)
+RETURNS XML AS $F$
+ SELECT XMLELEMENT(
+ name holdings,
+ XMLATTRIBUTES(
+ CASE WHEN $8 THEN 'http://open-ils.org/spec/holdings/v1' ELSE NULL END AS xmlns,
+ CASE WHEN ('bre' = ANY ($5)) THEN 'tag:open-ils.org:U2 at bre/' || $1 || '/' || $3 ELSE NULL END AS id,
+ (SELECT record_has_holdable_copy FROM asset.record_has_holdable_copy($1)) AS has_holdable
+ ),
+ XMLELEMENT(
+ name counts,
+ (SELECT XMLAGG(XMLELEMENT::XML) FROM (
+ SELECT XMLELEMENT(
+ name count,
+ XMLATTRIBUTES('public' as type, depth, org_unit, coalesce(transcendant,0) as transcendant, available, visible as count, unshadow)
+ )::text
+ FROM asset.opac_ou_record_copy_count($2, $1)
+ UNION
+ SELECT XMLELEMENT(
+ name count,
+ XMLATTRIBUTES('staff' as type, depth, org_unit, coalesce(transcendant,0) as transcendant, available, visible as count, unshadow)
+ )::text
+ FROM asset.staff_ou_record_copy_count($2, $1)
+ UNION
+ SELECT XMLELEMENT(
+ name count,
+ XMLATTRIBUTES('pref_lib' as type, depth, org_unit, coalesce(transcendant,0) as transcendant, available, visible as count, unshadow)
+ )::text
+ FROM asset.opac_ou_record_copy_count($9, $1)
+ ORDER BY 1
+ )x)
+ ),
+ CASE
+ WHEN ('bmp' = ANY ($5)) THEN
+ XMLELEMENT(
+ name monograph_parts,
+ (SELECT XMLAGG(bmp) FROM (
+ SELECT unapi.bmp( id, 'xml', 'monograph_part', evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'bre'), 'holdings_xml'), $3, $4, $6, $7, FALSE)
+ FROM biblio.monograph_part
+ WHERE record = $1
+ )x)
+ )
+ ELSE NULL
+ END,
+ XMLELEMENT(
+ name volumes,
+ (SELECT XMLAGG(acn ORDER BY rank, name, label_sortkey) FROM (
+ -- Physical copies
+ SELECT unapi.acn(y.id,'xml','volume',evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'holdings_xml'),'bre'), $3, $4, $6, $7, FALSE), y.rank, name, label_sortkey
+ FROM evergreen.ranked_volumes($1, $2, $4, $6, $7, $9, $5) AS y
+ UNION ALL
+ -- Located URIs
+ SELECT unapi.acn(uris.id,'xml','volume',evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'holdings_xml'),'bre'), $3, $4, $6, $7, FALSE), 0, name, label_sortkey
+ FROM evergreen.located_uris($1, $2, $9) AS uris
+ )x)
+ ),
+ CASE WHEN ('ssub' = ANY ($5)) THEN
+ XMLELEMENT(
+ name subscriptions,
+ (SELECT XMLAGG(ssub) FROM (
+ SELECT unapi.ssub(id,'xml','subscription','{}'::TEXT[], $3, $4, $6, $7, FALSE)
+ FROM serial.subscription
+ WHERE record_entry = $1
+ )x)
+ )
+ ELSE NULL END,
+ CASE WHEN ('acp' = ANY ($5)) THEN
+ XMLELEMENT(
+ name foreign_copies,
+ (SELECT XMLAGG(acp) FROM (
+ SELECT unapi.acp(p.target_copy,'xml','copy',evergreen.array_remove_item_by_value($5,'acp'), $3, $4, $6, $7, FALSE)
+ FROM biblio.peer_bib_copy_map p
+ JOIN asset.copy c ON (p.target_copy = c.id)
+ WHERE NOT c.deleted AND p.peer_record = $1
+ LIMIT ($6 -> 'acp')::INT
+ OFFSET ($7 -> 'acp')::INT
+ )x)
+ )
+ ELSE NULL END
+ );
+$F$ LANGUAGE SQL STABLE;
+
+COMMIT;
commit 2f4f3405415751f3a61a4e40ca622cec25728923
Author: Bill Erickson <berick at esilibrary.com>
Date: Wed Dec 12 14:58:26 2012 -0500
unapi exclude_invisible_acn
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/990.schema.unapi.sql b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
index 44e1c4d..0cbde74 100644
--- a/Open-ILS/src/sql/Pg/990.schema.unapi.sql
+++ b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
@@ -71,6 +71,7 @@ CREATE OR REPLACE FUNCTION evergreen.ranked_volumes(
slimit HSTORE DEFAULT NULL,
soffset HSTORE DEFAULT NULL,
pref_lib INT DEFAULT NULL
+ includes TEXT[],
) RETURNS TABLE (id BIGINT, name TEXT, label_sortkey TEXT, rank BIGINT) AS $$
SELECT ua.id, ua.name, ua.label_sortkey, MIN(ua.rank) AS rank FROM (
SELECT acn.id, aou.name, acn.label_sortkey,
@@ -78,6 +79,8 @@ CREATE OR REPLACE FUNCTION evergreen.ranked_volumes(
RANK() OVER w
FROM asset.call_number acn
JOIN asset.copy acp ON (acn.id = acp.call_number)
+ JOIN asset.copy_location acl ON (acl.id = acp.location)
+ JOIN config.copy_status ccs ON (ccs.id = acp.status)
JOIN actor.org_unit_descendants( $2, COALESCE(
$3, (
SELECT depth
@@ -89,6 +92,10 @@ CREATE OR REPLACE FUNCTION evergreen.ranked_volumes(
WHERE acn.record = $1
AND acn.deleted IS FALSE
AND acp.deleted IS FALSE
+ AND CASE WHEN ('exclude_invisible_acn' = ANY($6))
+ acp.opac_visible IS TRUE AND
+ acl.opac_visible IS TRUE AND
+ ccs.opac_visible IS TRUE
GROUP BY acn.id, acp.status, aou.name, acn.label_sortkey, aou.id
WINDOW w AS (
ORDER BY evergreen.rank_ou(aou.id, $2, $6), evergreen.rank_cp_status(acp.status)
@@ -452,7 +459,7 @@ RETURNS XML AS $F$
(SELECT XMLAGG(acn ORDER BY rank, name, label_sortkey) FROM (
-- Physical copies
SELECT unapi.acn(y.id,'xml','volume',evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'holdings_xml'),'bre'), $3, $4, $6, $7, FALSE), y.rank, name, label_sortkey
- FROM evergreen.ranked_volumes($1, $2, $4, $6, $7, $9) AS y
+ FROM evergreen.ranked_volumes($1, $2, $4, $6, $7, $9, $5) AS y
UNION ALL
-- Located URIs
SELECT unapi.acn(uris.id,'xml','volume',evergreen.array_remove_item_by_value( evergreen.array_remove_item_by_value($5,'holdings_xml'),'bre'), $3, $4, $6, $7, FALSE), 0, name, label_sortkey
commit b42fa9068868c55b744cf9141627955ea90773d4
Author: Ben Shum <bshum at biblio.org>
Date: Mon Mar 11 17:40:11 2013 -0400
Stamping upgrade for relaxing rank_ou sorting
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index ea34dd5..9ad2ba5 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -90,7 +90,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0767', :eg_version); -- senator/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0768', :eg_version); -- berick/bshum
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.relax_rank_ou.sql b/Open-ILS/src/sql/Pg/upgrade/0768.schema.relax_rank_ou.sql
similarity index 92%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.relax_rank_ou.sql
rename to Open-ILS/src/sql/Pg/upgrade/0768.schema.relax_rank_ou.sql
index 626d40b..afb2d8a 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.relax_rank_ou.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0768.schema.relax_rank_ou.sql
@@ -1,5 +1,7 @@
BEGIN;
+SELECT evergreen.upgrade_deps_block_check('0768', :eg_version);
+
CREATE OR REPLACE FUNCTION evergreen.rank_ou(lib INT, search_lib INT, pref_lib INT DEFAULT NULL)
RETURNS INTEGER AS $$
SELECT COALESCE(
commit 94813cbe6a061b95079a7a40375473e9c7914eaf
Author: Bill Erickson <berick at esilibrary.com>
Date: Thu Feb 7 13:43:19 2013 -0500
rank_ou() honors pref-lib in non-global context
When determining how to sort an org unit (e.g. sorting copies by circ
lib for display in the catalog), allow the pref-lib to affect the sort
order in global and non-global searches.
Org units are now sorted with the following criteria in the following
order. For example, assume we are sorting a copy circ_lib:
1. circ_lib matches the search_lib
2. circ_lib matches pref_lib
3. distance of circ_lib from pref_lib when pref_lib is a child of
search_lib, if circ_lib is a child of pref_lib.
(For example, searching CONS with pref_lib SYS1, items at BR1 will
sort ahead of items at BR3, since BR1 is a child of the pref_lib).
4. proximity of circ_lib to search_lib, when circ_lib is a child of
search_lib.
5. In all other cases, circ_lib is sorted to the bottom with the rest of
the riffraff.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/src/sql/Pg/990.schema.unapi.sql b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
index 05eafcf..44e1c4d 100644
--- a/Open-ILS/src/sql/Pg/990.schema.unapi.sql
+++ b/Open-ILS/src/sql/Pg/990.schema.unapi.sql
@@ -16,17 +16,28 @@ $$ LANGUAGE SQL STABLE;
CREATE OR REPLACE FUNCTION evergreen.rank_ou(lib INT, search_lib INT, pref_lib INT DEFAULT NULL)
RETURNS INTEGER AS $$
- WITH search_libs AS (
- SELECT id, distance FROM actor.org_unit_descendants_distance($2)
- )
SELECT COALESCE(
- (SELECT -10000 FROM actor.org_unit
- WHERE $1 = $3 AND id = $3 AND $2 IN (
- SELECT id FROM actor.org_unit WHERE parent_ou IS NULL
- )
- ),
- (SELECT distance FROM search_libs WHERE id = $1),
- 10000
+
+ -- lib matches search_lib
+ (SELECT CASE WHEN $1 = $2 THEN -20000 END),
+
+ -- lib matches pref_lib
+ (SELECT CASE WHEN $1 = $3 THEN -10000 END),
+
+
+ -- pref_lib is a child of search_lib and lib is a child of pref lib.
+ -- For example, searching CONS, pref lib is SYS1,
+ -- copies at BR1 and BR2 sort to the front.
+ (SELECT distance - 5000
+ FROM actor.org_unit_descendants_distance($3)
+ WHERE id = $1 AND $3 IN (
+ SELECT id FROM actor.org_unit_descendants($2))),
+
+ -- lib is a child of search_lib
+ (SELECT distance FROM actor.org_unit_descendants_distance($2) WHERE id = $1),
+
+ -- all others pay cash
+ 1000
);
$$ LANGUAGE SQL STABLE;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.relax_rank_ou.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.relax_rank_ou.sql
new file mode 100644
index 0000000..626d40b
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.relax_rank_ou.sql
@@ -0,0 +1,29 @@
+BEGIN;
+
+CREATE OR REPLACE FUNCTION evergreen.rank_ou(lib INT, search_lib INT, pref_lib INT DEFAULT NULL)
+RETURNS INTEGER AS $$
+ SELECT COALESCE(
+
+ -- lib matches search_lib
+ (SELECT CASE WHEN $1 = $2 THEN -20000 END),
+
+ -- lib matches pref_lib
+ (SELECT CASE WHEN $1 = $3 THEN -10000 END),
+
+
+ -- pref_lib is a child of search_lib and lib is a child of pref lib.
+ (SELECT distance - 5000
+ FROM actor.org_unit_descendants_distance($3)
+ WHERE id = $1 AND $3 IN (
+ SELECT id FROM actor.org_unit_descendants($2))),
+
+ -- lib is a child of search_lib
+ (SELECT distance FROM actor.org_unit_descendants_distance($2) WHERE id = $1),
+
+ -- all others pay cash
+ 1000
+ );
+$$ LANGUAGE SQL STABLE;
+
+COMMIT;
+
-----------------------------------------------------------------------
Summary of changes:
.../lib/OpenILS/WWW/EGCatLoader/Account.pm | 13 +++-
.../lib/OpenILS/WWW/EGCatLoader/Container.pm | 26 +++++-
.../perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm | 40 ++-------
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/990.schema.unapi.sql | 42 ++++++---
.../sql/Pg/upgrade/0768.schema.relax_rank_ou.sql | 31 +++++++
...=> 0769.schema.unapi_exclude_invisible_acn.sql} | 96 ++++++++++----------
Open-ILS/src/templates/opac/myopac/lists.tt2 | 20 ++++
Open-ILS/src/templates/opac/parts/anon_list.tt2 | 21 ++++-
Open-ILS/src/templates/opac/parts/misc_util.tt2 | 9 +-
.../tpac_bookbag_callnumbers.txt | 15 +++
11 files changed, 215 insertions(+), 100 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/0768.schema.relax_rank_ou.sql
copy Open-ILS/src/sql/Pg/upgrade/{0734.tpac_holdable_check.sql => 0769.schema.unapi_exclude_invisible_acn.sql} (71%)
create mode 100644 docs/RELEASE_NOTES_NEXT/tpac_bookbag_callnumbers.txt
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list