From 508636accd9b1ed01c22b72f8af1e45129d17b2b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 19 Feb 2014 11:23:41 +0100 Subject: [PATCH] Bug 10858: FIX Only one occurrence of the biblionumbers should be stored We have to remove duplicate biblionumber in the array of biblionumbers stored in the cookie. --- koha-tmpl/opac-tmpl/bootstrap/js/commons.js | 4 +--- koha-tmpl/opac-tmpl/ccsr/en/js/commons.js | 5 +---- koha-tmpl/opac-tmpl/prog/en/js/commons.js | 5 +---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/commons.js b/koha-tmpl/opac-tmpl/bootstrap/js/commons.js index 490bfdf..f459190 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/commons.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/commons.js @@ -27,7 +27,7 @@ function addBibToContext( bibnum ) { var bibnums = getContextBiblioNumbers(); bibnums.push(bibnum); setContextBiblioNumbers( bibnums ); - //var store = sessionStorage.getItem( "bibs_selected" ); + setContextBiblioNumbers( $.uniqueArray( bibnums ) ); } function delBibToContext( bibnum ) { @@ -37,12 +37,10 @@ function delBibToContext( bibnum ) { } function setContextBiblioNumbers( bibnums ) { - //sessionStorage.setItem("bibs_selected", JSON.stringify( bibnums ) ); $.cookie('bibs_selected', JSON.stringify( bibnums )); } function getContextBiblioNumbers() { - //var r = sessionStorage.getItem("bibs_selected"); var r = $.cookie('bibs_selected'); if ( r ) { return JSON.parse(r); diff --git a/koha-tmpl/opac-tmpl/ccsr/en/js/commons.js b/koha-tmpl/opac-tmpl/ccsr/en/js/commons.js index 6661a61..eb5a6c1 100644 --- a/koha-tmpl/opac-tmpl/ccsr/en/js/commons.js +++ b/koha-tmpl/opac-tmpl/ccsr/en/js/commons.js @@ -26,8 +26,7 @@ function paramOfUrl( url, param ) { function addBibToContext( bibnum ) { var bibnums = getContextBiblioNumbers(); bibnums.push(bibnum); - setContextBiblioNumbers( bibnums ); - //var store = sessionStorage.getItem( "bibs_selected" ); + setContextBiblioNumbers( $.uniqueArray( bibnums ) ); } function delBibToContext( bibnum ) { @@ -37,12 +36,10 @@ function delBibToContext( bibnum ) { } function setContextBiblioNumbers( bibnums ) { - //sessionStorage.setItem("bibs_selected", JSON.stringify( bibnums ) ); $.cookie('bibs_selected', JSON.stringify( bibnums )); } function getContextBiblioNumbers() { - //var r = sessionStorage.getItem("bibs_selected"); var r = $.cookie('bibs_selected'); if ( r ) { return JSON.parse(r); diff --git a/koha-tmpl/opac-tmpl/prog/en/js/commons.js b/koha-tmpl/opac-tmpl/prog/en/js/commons.js index 6661a61..eb5a6c1 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/commons.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/commons.js @@ -26,8 +26,7 @@ function paramOfUrl( url, param ) { function addBibToContext( bibnum ) { var bibnums = getContextBiblioNumbers(); bibnums.push(bibnum); - setContextBiblioNumbers( bibnums ); - //var store = sessionStorage.getItem( "bibs_selected" ); + setContextBiblioNumbers( $.uniqueArray( bibnums ) ); } function delBibToContext( bibnum ) { @@ -37,12 +36,10 @@ function delBibToContext( bibnum ) { } function setContextBiblioNumbers( bibnums ) { - //sessionStorage.setItem("bibs_selected", JSON.stringify( bibnums ) ); $.cookie('bibs_selected', JSON.stringify( bibnums )); } function getContextBiblioNumbers() { - //var r = sessionStorage.getItem("bibs_selected"); var r = $.cookie('bibs_selected'); if ( r ) { return JSON.parse(r); -- 1.7.10.4