Bugzilla – Attachment 67974 Details for
Bug 10858
Browse selected biblios - OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10858: Browse selected biblios
Bug-10858-Browse-selected-biblios.patch (text/plain), 24.89 KB, created by
Jonathan Druart
on 2017-10-11 19:55:11 UTC
(
hide
)
Description:
Bug 10858: Browse selected biblios
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-10-11 19:55:11 UTC
Size:
24.89 KB
patch
obsolete
>From 7e5c2dd16d3251d7f0c90268d68a613a78bbba43 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 14 Nov 2012 17:05:45 +0100 >Subject: [PATCH] Bug 10858: Browse selected biblios > >After launching a search, some people would like to browse some results >from several pages. > >This patch adds, at the OPAC, a link "Browse selected biblios >>" when >at least one biblio is checked. You can choose biblios from several >page, not the current one. In this way, checkboxes already checked >become again checked when you come back on this results page. >After clicking the link, the "Browse results" block is filled with >selected biblios, not (like as the current behavior) with the classic >results. > >Test plan: >- Launch a search at the OPAC >- Check some biblios >- Go on another page >- Check some biblios >- Come back to the first page and check that already checked biblio is > automatically checked. >- Click on the "Browse selected biblios >>" link >- Check that you are able to browse results you had checked. > >You can also: >- check some biblios from several pages >- add them to the cart >- add them to a list > >Signed-off-by: Cedric Vita <cedric.vita@dracenie.com> > >Signed-off-by: Koha Team Amu <koha.aixmarseille@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr> >--- > .../bootstrap/en/includes/opac-bottom.inc | 3 + > .../bootstrap/en/includes/page-numbers.inc | 6 +- > .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 64 +++++++++++--------- > .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 54 ++++++++++++++++- > koha-tmpl/opac-tmpl/bootstrap/js/basket.js | 42 +++++++++---- > koha-tmpl/opac-tmpl/bootstrap/js/commons.js | 69 ++++++++++++++++++++++ > opac/opac-detail.pl | 20 ++++++- > 7 files changed, 207 insertions(+), 51 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/commons.js > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 834669144d..313b66c1f5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -85,6 +85,8 @@ $.widget.bridge('uitooltip', $.ui.tooltip); > </script> > <script type="text/javascript" src="[% interface %]/[% theme %]/lib/bootstrap/js/bootstrap.min.js"></script> > <script type="text/javascript" src="[% interface %]/[% theme %]/js/global.js"></script> >+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script> >+<script type="text/javascript" src="[% interface %]/[% theme %]/js/commons.js"></script> > <script type="text/javascript"> > Modernizr.load([ > // Test need for polyfill >@@ -127,6 +129,7 @@ $.widget.bridge('uitooltip', $.ui.tooltip); > var MSG_ITEM_IN_CART = _("In your cart"); > var MSG_IN_YOUR_CART = _("Items in your cart: "); > var MSG_ITEM_NOT_IN_CART = _("Add to your cart"); >+ var MSG_NEED_COOKIE_ENABLED = _("Your browser does not accept cookies, you must accept them to browse selected results."); > [% END %] > [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %] > var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system."); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >index fbfdfc8124..8838cd29e4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >@@ -9,12 +9,12 @@ > [% IF ( PAGE_NUMBER.highlight ) %] > <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li> > [% ELSE %] >- <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li> >+ <li><a class="nav" href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li> > [% END %] > [% END %] > [% IF ( next_page_offset ) %] >- <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% next_page_offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">Next »</a></li> >- <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% last_page_offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">Last</a></li> >+ <li><a class="nav" href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% next_page_offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">Next »</a></li> >+ <li><a class="nav" href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% last_page_offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">Last</a></li> > [% END %] > </ul> > </div> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index f450d0e94f..9596b28b6d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1093,7 +1093,7 @@ > [% END %] > </li> > [%# busc is already URI encoded %] >- <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list">Back to results</a></li> >+ <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list" class="searchwithcontext">Back to results</a></li> > <li class="right_results"> > [% IF ( nextBiblionumber ) %] > <a href="opac-detail.pl?biblionumber=[% nextBiblionumber %][% IF ( query_desc && OpacHighlightedWords ) %]&query_desc=[% query_desc |uri %][% END %]" title="See: [% IF ( nextTitle ) %][% nextTitle |html %][% ELSE %]next biblio[% END %]">Next »</a> >@@ -1116,33 +1116,35 @@ > </div> > [% END # / IF OpacBrowseResults && busc %] > >- [% INCLUDE 'opac-detail-sidebar.inc' %] >+ <div id="sidebar"> >+ [% INCLUDE 'opac-detail-sidebar.inc' %] > >- [% IF ( NovelistSelectProfile && NovelistSelectView == 'right' && ( normalized_isbn || normalized_upc ) ) %] >- <div id="NovelistSelect"> >- <h4>Novelist Select</h4> >- <div data-novelist-novelistselect=[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]></div> >- </div> >- [% END %] >+ [% IF ( NovelistSelectProfile && NovelistSelectView == 'right' && ( normalized_isbn || normalized_upc ) ) %] >+ <div id="NovelistSelect"> >+ <h4>Novelist Select</h4> >+ <div data-novelist-novelistselect=[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]></div> >+ </div> >+ [% END %] > >- [% IF ( Babeltheque ) %] >- <div class="babeltheque_adds"> >- <div id="BW_critiques_aj"></div> >- <div id="BW_citations_aj"></div> >- </div> >- [% END %] >+ [% IF ( Babeltheque ) %] >+ <div class="babeltheque_adds"> >+ <div id="BW_critiques_aj"></div> >+ <div id="BW_citations_aj"></div> >+ </div> >+ [% END %] > >- [% IF ( SocialNetworks ) %] >- <div id="social_networks" class="clearfix"> >- <span>Share</span> >- <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&t=[% title |url %]" title="Share on Facebook">Facebook</a></div> >- <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&url=[% current_url |url %]&title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div> >- <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&title=[% title |url %]" title="Share on Delicious">Delicious</a></div> >- <div><a id="email" href="mailto:?subject=[% title |url %]&body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div> >- <div><div class="g-plusone" data-size="small" data-count="false"></div></div> >- <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title |url %]" data-lang="[% lang %]">Tweet</a></div> >- </div> >- [% END %] >+ [% IF ( SocialNetworks ) %] >+ <div id="social_networks" class="clearfix"> >+ <span>Share</span> >+ <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&t=[% title |url %]" title="Share on Facebook">Facebook</a></div> >+ <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&url=[% current_url |url %]&title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div> >+ <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&title=[% title |url %]" title="Share on Delicious">Delicious</a></div> >+ <div><a id="email" href="mailto:?subject=[% title |url %]&body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div> >+ <div><div class="g-plusone" data-size="small" data-count="false"></div></div> >+ <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title |url %]" data-lang="[% lang %]">Tweet</a></div> >+ </div> >+ [% END %] >+ </div> > </div> <!-- / .ulactioncontainer --> > </div> <!-- / .span4 --> > </div> <!-- / .row-fluid --> >@@ -1542,6 +1544,7 @@ > renderPagIndexList(pag_index_ini, $("#listResults")); > } > $("#a_listResults").click(function(e) { >+ $("#sidebar").toggle(); > if (arrPagination.length > 0) { > e.preventDefault(); > var navigation = $(".results-pagination"); >@@ -1561,6 +1564,7 @@ > e.preventDefault(); > var navigation = $(".results-pagination"); > navigation.hide(); >+ $("#sidebar").toggle(); > }); > [% END %] > [% IF ( OPACShelfBrowser ) %] >@@ -1731,8 +1735,9 @@ > var timeoutRFW; > var totalPagItemList = 10; > >- function rewindList() >+ function rewindList(e) > { >+ e.preventDefault(); > var ul = $("#listResults"); > var li_ini = ul.children(':first').next(); > var index_ini = pag_index_ini; >@@ -1750,8 +1755,9 @@ > } > }//rewindList > >- function forwardList() >+ function forwardList(e) > { >+ e.preventDefault(); > var ul = $("#listResults"); > var li_ini = ul.children(':first').next(); > var index_ini = pag_index_ini; >@@ -1782,7 +1788,7 @@ > var ini = index - 1; > var end = ini + totalPagItemList - 1; > li = $("<li />"); >- html = (index > pag_index_ini)?"<a href='#' id='rew_list_index' onclick='rewindList()' title='" + _("Click to rewind the list to") + " " + ini + " - " + end + "'>«</a>":"«"; >+ html = (index > pag_index_ini)?"<a href='#' id='rew_list_index' onclick='rewindList(event)' title='" + _("Click to rewind the list to") + " " + ini + " - " + end + "'>«</a>":"«"; > li.html(html); > ul.append(li); > var title = ""; >@@ -1804,7 +1810,7 @@ > li = $("<li />"); > ini = index + 1; > end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1; >- html = (end <= arrPagination.length - 1 && (end - index) >= totalPagItemList)?"<a href='#' id='fw_list_index' onclick='forwardList()' title='" + _("Click to forward the list to") + " " + ini + " - " + end + "'>»</a>":"»"; >+ html = (end <= arrPagination.length - 1 && (end - index) >= totalPagItemList)?"<a href='#' id='fw_list_index' onclick='forwardList(event)' title='" + _("Click to forward the list to") + " " + ini + " - " + end + "'>»</a>":"»"; > li.html(html); > ul.append(li); > }//renderPagIndexList >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index a5a7c707f5..c00f2ec1ca 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -175,6 +175,9 @@ > Tag status here. > </div> > [% END %] >+ [% IF Koha.Preference('OpacBrowseResults') %] >+ <span class="details_link"></span> >+ [% END %] > </span> <!-- / .links --> > </div> <!-- / #selections-toolbar --> > >@@ -666,11 +669,14 @@ function tagAdded() { > > function enableCheckboxActions(){ > // Enable/disable controls if checkboxes are checked >- var checkedBoxes = $(".checkboxed input:checkbox:checked"); >+ var bibnums = getContextBiblioNumbers(); > var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label") >- if ($(checkedBoxes).size()) { >+ if ( bibnums.length > 0 ) { > $("#selections").html(_("With selected titles: ")); > $(controls).removeClass("disabled"); >+ // Hide or show details link >+ // Update with first biblionumber in queue >+ $(".details_link a").attr("href", "/cgi-bin/koha/opac-detail.pl?biblionumber=" + bibnums[0]); > } else { > $("#selections").html(_("Select titles to: ")); > $(controls).addClass("disabled"); >@@ -699,6 +705,7 @@ function highlightOn() { > $(".highlight_toggle").toggle(); > } > [% END %] >+ > $(document).ready(function(){ > [% IF ( OpacHighlightedWords ) %] > $('a.title').each(function() { >@@ -706,11 +713,46 @@ $(document).ready(function(){ > }); > [% END %] > >- $(".cb").click(function(){ >+ $(".cb").change(function(){ >+ [% IF Koha.Preference('OpacBrowseResults') %] >+ if ( $(this).is(':checked') == true ) { >+ addBibToContext( $(this).val() ); >+ } else { >+ delBibToContext( $(this).val() ); >+ } >+ [% END %] > enableCheckboxActions(); > }); >+ >+ $("span.details_link").html("<a href=\"#\" class=\"disabled\">"+_("Browse selected records")+"<\/a>"); >+ $(".details_link a").click(function(e) { >+ if ( $(this).hasClass("disabled") == true ) { >+ e.preventDefault(); >+ var checkedBoxes = $(".searchresults :checkbox:checked"); >+ if ($(checkedBoxes).size() == 0) { >+ alert(MSG_NO_RECORD_SELECTED); >+ } else { >+ alert(MSG_NEED_COOKIE_ENABLED); >+ } >+ return false; >+ } >+ }); > enableCheckboxActions(); > >+ >+ $("#bookbag_form").ready(function(){ >+ $("#bookbag_form").unCheckCheckboxes(); >+ var bibnums = getContextBiblioNumbers(); >+ if (bibnums) { >+ for (var i=0; i < bibnums.length; i++) { >+ var id = ('#bib' + bibnums[i]); >+ if ($(id)) { >+ $(id).attr('checked', true); >+ } >+ } >+ } >+ }); >+ > [% IF ( IDreamBooksResults ) %] > $('.idbresult').each(function() { > var isbn = $(this).children('a').text().replace(/\s*/,''); >@@ -854,11 +896,17 @@ $(document).ready(function(){ > $("#CheckAll").click(function(){ > $("#bookbag_form").checkCheckboxes(); > enableCheckboxActions(); >+ $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){ >+ $(this).change(); >+ } ); > return false; > }); > $("#CheckNone").click(function(){ > $("#bookbag_form").unCheckCheckboxes(); > enableCheckboxActions(); >+ $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){ >+ $(this).change(); >+ } ); > return false; > }); > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >index a4227535a6..3b7a439ec1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >@@ -157,17 +157,25 @@ function SelectAll(){ > } > > function addMultiple(){ >+ var bibnums = getContextBiblioNumbers(); > var c_value = ""; >- if(document.bookbag_form.biblionumber.length > 0) { >- for (var i=0; i < document.bookbag_form.biblionumber.length; i++) { >- if (document.bookbag_form.biblionumber[i].checked) { >- c_value = c_value + document.bookbag_form.biblionumber[i].value + "/"; >- } >+ if ( bibnums.length > 0 ) { >+ for ( var i = 0 ; i < bibnums.length ; i++ ) { >+ c_value = c_value + bibnums[i] + "/"; > } > addSelRecords(c_value); > } else { >- c_value = c_value + document.bookbag_form.biblionumber.value + "/"; >- addSelRecords(c_value); >+ if(document.bookbag_form.biblionumber.length > 0) { >+ for (var i=0; i < document.bookbag_form.biblionumber.length; i++) { >+ if (document.bookbag_form.biblionumber[i].checked) { >+ c_value = c_value + document.bookbag_form.biblionumber[i].value + "/"; >+ } >+ } >+ addSelRecords(c_value); >+ } else { >+ c_value = c_value + document.bookbag_form.biblionumber.value + "/"; >+ addSelRecords(c_value); >+ } > } > } > >@@ -442,20 +450,28 @@ function addSelToShelf() { > /// vShelfAdd() builds url string for multiple-biblio adds. > > function vShelfAdd() { >- bibs= new Array; >+ var bibnums = getContextBiblioNumbers(); >+ bibs = new Array; >+ if ( bibnums.length > 0 ) { >+ for ( var i = 0 ; i < bibnums.length ; i++ ) { >+ bibs.push("biblionumber=" + bibnums[i]); >+ } >+ return bibs.join("&"); >+ } else { > if(document.bookbag_form.biblionumber.length > 0) { >- for (var i=0; i < document.bookbag_form.biblionumber.length; i++) { >- if (document.bookbag_form.biblionumber[i].checked) { >- bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value); >- } >+ for (var i=0; i < document.bookbag_form.biblionumber.length; i++) { >+ if (document.bookbag_form.biblionumber[i].checked) { >+ bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value); > } >- if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); } >+ } >+ if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); } > return bibs.join("&"); > } else { > if (document.bookbag_form.biblionumber.checked) { > return "biblionumber=" + document.bookbag_form.biblionumber.value; > } > } >+ } > } > > function showCart(){ >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/commons.js b/koha-tmpl/opac-tmpl/bootstrap/js/commons.js >new file mode 100644 >index 0000000000..d0feed66b6 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/commons.js >@@ -0,0 +1,69 @@ >+// Extends jQuery API >+// http://www.wskidmore.com/downloads/jquery-uniqueArray.min.js >+jQuery.extend({uniqueArray:function(e){if($.isArray(e)){var c={};var a,b;for(b=0,a=e.length;b<a;b++){var d=e[b].toString();if(c[d]){e.splice(b,1);a--;b--}else{c[d]=true}}}return(e)}}); >+ >+function removeByValue(arr, val) { >+ for(var i=0; i<arr.length; i++) { >+ if(arr[i] == val) { >+ arr.splice(i, 1); >+ break; >+ } >+ } >+} >+ >+function paramOfUrl( url, param ) { >+ param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); >+ var regexS = "[\\?&]"+param+"=([^&#]*)"; >+ var regex = new RegExp( regexS ); >+ var results = regex.exec( url ); >+ if( results == null ) { >+ return ""; >+ } else { >+ return results[1]; >+ } >+} >+ >+function addBibToContext( bibnum ) { >+ var bibnums = getContextBiblioNumbers(); >+ bibnums.push(bibnum); >+ setContextBiblioNumbers( bibnums ); >+ setContextBiblioNumbers( $.uniqueArray( bibnums ) ); >+} >+ >+function delBibToContext( bibnum ) { >+ var bibnums = getContextBiblioNumbers(); >+ removeByValue( bibnums, bibnum ); >+ setContextBiblioNumbers( $.uniqueArray( bibnums ) ); >+} >+ >+function setContextBiblioNumbers( bibnums ) { >+ $.cookie('bibs_selected', JSON.stringify( bibnums )); >+} >+ >+function getContextBiblioNumbers() { >+ var r = $.cookie('bibs_selected'); >+ if ( r ) { >+ return JSON.parse(r); >+ } >+ r = new Array(); >+ return r; >+} >+ >+function resetSearchContext() { >+ setContextBiblioNumbers( new Array() ); >+} >+ >+$(document).ready(function(){ >+ // forms with action leading to search >+ $("form[action*='opac-search.pl']").submit(function(){ >+ resetSearchContext(); >+ }); >+ // any link to launch a search except navigation links >+ $("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){ >+ resetSearchContext(); >+ }); >+ // any link to a detail page from the results page. >+ $("#bookbag_form a[href*='opac-detail.pl?']").click(function(){ >+ resetSearchContext(); >+ }); >+}); >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index b31a00fe03..4f54c85672 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -24,6 +24,7 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Acquisition qw( SearchOrders ); >+use JSON; > use C4::Auth qw(:DEFAULT get_session); > use C4::Koha; > use C4::Serials; #uses getsubscriptionfrom biblionumber >@@ -267,11 +268,21 @@ if ($session->param('busc')) { > push @{$arrParamsBusc{$key}}, uri_unescape($value); > } > } >+ > my $searchAgain = 0; >+ my ( $offset, $results_per_page ); >+ >+ my $bibnums = JSON::from_json( $query->cookie('bibs_selected') || '[]' ); >+ if ( scalar( @$bibnums ) ) { >+ $arrParamsBusc{count} = scalar( @$bibnums ); >+ $arrParamsBusc{listBiblios} = join ',', @$bibnums; >+ $results_per_page = $arrParamsBusc{count}; >+ $offset = 0; >+ } else { >+ $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0; > my $count = C4::Context->preference('OPACnumSearchResults') || 20; >- my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count; >+ $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count; > $arrParamsBusc{'count'} = $results_per_page; >- my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0; > # The value OPACnumSearchResults has changed and the search has to be rebuild > if ($count != $results_per_page) { > if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) { >@@ -331,6 +342,9 @@ if ($session->param('busc')) { > @arrBusc = split(/\&(?:amp;)?/, $newbusc); > } > } >+ >+ } # end if cookie bibs_selected exists >+ > my $buscParam = ''; > my $j = 0; > # Rebuild the query for the button "back to results" >@@ -397,7 +411,7 @@ if ($session->param('busc')) { > } > $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0); > } >- if ($searchAgain) { >+ if ($searchAgain and not scalar( @$bibnums )) { > my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page); > my @newresults = @$newresultsRef; > # build the new listBiblios >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10858
:
20947
|
21476
|
21483
|
21646
|
21647
|
21966
|
21967
|
23541
|
23542
|
23543
|
23633
|
23781
|
23782
|
25427
|
25428
|
25429
|
25430
|
25431
|
25432
|
25433
|
25434
|
25435
|
25436
|
25450
|
25451
|
25452
|
25453
|
25454
|
25455
|
25456
|
25457
|
25512
|
25513
|
25514
|
25643
|
25644
|
25645
|
25646
|
25647
|
25648
|
25649
|
25650
|
25651
|
25652
|
25653
|
36757
|
38033
|
38405
|
39502
|
39938
|
41838
|
41839
|
41840
|
41841
|
41842
|
44903
|
56479
|
56480
|
56481
|
56482
|
67073
|
67074
|
67075
|
67076
|
67086
|
67089
|
67090
|
67092
|
67093
|
67974
|
67975
|
67976
|
67977
|
67978
|
71218
|
71219
|
71220
|
71221
|
71222
|
71223
|
91584
|
91585
|
91586
|
91587
|
91588
|
91589
|
94833