From 04ba0cb4b666ecca4fa53c08ea42ed7a9e2b7771 Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Tue, 21 Feb 2017 16:31:31 -0500 Subject: [PATCH] LP1274999: Next Link Appears at "End" of Copy List The total number of copies wasn't checked against the copy_limit and copy_offset, so anytime that the number of copies per page mod copy_limit == 0 the Next link would appear, even if there were only copy_limit copies total. Now the offset and limit are compared to the total number of copies available at the current depth to determine if the Next link should appear. Signed-off-by: Jason Boyer Signed-off-by: Jason Etheridge --- .../src/templates/opac/parts/record/copy_table.tt2 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 index c6ab1aa5a6..3d4dae487e 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -25,7 +25,11 @@ FOREACH copy_info IN copies; END; END; -%] -[%- IF has_copies; %] +[%- +IF has_copies; + depth = CGI.param('copy_depth').defined ? CGI.param('copy_depth') : CGI.param('depth').defined ? CGI.param('depth') : ctx.copy_summary.last.depth; + total_copies = ctx.copy_summary.$depth.count; +%] @@ -256,7 +260,7 @@ END; # FOREACH bib l('Previous [_1]', ctx.copy_offset - new_offset) %] [%- END %] - [%- IF copies.size >= ctx.copy_limit AND NOT serial_holdings %] + [%- IF copies.size >= ctx.copy_limit AND NOT serial_holdings AND (ctx.copy_offset + ctx.copy_limit < total_copies) %]
[% l('Next [_1]', ctx.copy_limit) %] » @@ -267,7 +271,7 @@ END; # FOREACH bib
[%- more_copies_limit = 50 %] [%# TODO: config %] - [%- IF ctx.copy_limit != more_copies_limit AND copies.size >= ctx.copy_limit %] + [%- IF ctx.copy_limit != more_copies_limit AND copies.size >= ctx.copy_limit AND ctx.copy_limit < total_copies %]