Bug 12320

Summary: $.cookie('foo', null) deprecated
Product: Koha Reporter: Galen Charlton <gmcharlt>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: bgkriegel, chris, jonathan.druart, katrin.fischer, tomascohen, wizzyrea
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 12777    
Attachments: Bug 12320: Remove deprecated construct to delete cookie holdfor
Bug 12320: Remove deprecated construct to delete cookie showColumns
[SIGNED-OFF] Bug 12320: Remove deprecated construct to delete cookie holdfor
[SIGNED-OFF] Bug 12320: Remove deprecated construct to delete cookie showColumns
[PASSED QA] Bug 12320: Remove deprecated construct to delete cookie holdfor
[PASSED QA] Bug 12320: Remove deprecated construct to delete cookie showColumns

Description Galen Charlton 2014-05-27 21:35:02 UTC
With the upgrade of jquery-cookie to the latest version (see bug 11369), the following construct to delete a cookie is no longer supported:

$.cookie('foo', null)

Instead, per https://github.com/carhartl/jquery-cookie/blob/master/CHANGELOG.md, it should now be

$.removeCookie('foo');

There is at least one direct use of the deprecated construct:

koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js:    $.cookie("showColumns",null);

and possibly others:

koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js:     $.cookie("holdfor",null, { path: "/", expires: 0 });
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt:    $.cookie("holdfor",null, { path: "/", expires: 0 });
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt:[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %]
Comment 1 Jonathan Druart 2015-04-28 10:58:31 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2015-04-28 10:58:35 UTC Comment hidden (obsolete)
Comment 3 Bernardo Gonzalez Kriegel 2015-05-21 17:49:15 UTC Comment hidden (obsolete)
Comment 4 Bernardo Gonzalez Kriegel 2015-05-21 17:49:22 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall 2015-05-22 14:57:53 UTC
Created attachment 39424 [details] [review]
[PASSED QA] Bug 12320: Remove deprecated construct to delete cookie holdfor

$.cookie('foo', null);
is deprecated and should be replaced with
  $.removeCookie('foo');

This patch replaces the occurrences for the "holdfor" cookie.

Test plan:
1/ Search for a patron
2/ On the patron detail page, click on "search to hold"
3/ Search for records
4/ On the results page, click on "Place hold" > "Forget PATRON"
5/ Reload the page.
6/ The "Place hold" button should not contain the patron anymore

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described, no errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall 2015-05-22 14:57:59 UTC
Created attachment 39425 [details] [review]
[PASSED QA] Bug 12320: Remove deprecated construct to delete cookie showColumns

  $.cookie('foo', null);
is deprecated and should be replaced with
  $.removeCookie('foo');

This patch replaces the occurrences for the "showColumns" cookie.

Before this patch, there was a bug on the batchmod tools.
To reproduce the issue:
1/ Go on the Batch item modification tool
2/ Fill the textarea with barcodes and submit
3/ Click on some column names (to create the cookie)
4/ Click on 'Show all columns" (to set the cookie to null)
5/ Don't submit and repeat steps 1 & 2
6/ You should see a js error:
  Error: Syntax error, unrecognized expression: :nth-child
    ...break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecogni...

Test plan:
Confirm the issue has gone away and there is no regression on the column
selection

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No js error, no regressions, no errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Bernardo Gonzalez Kriegel 2015-05-30 13:46:06 UTC
*** Bug 12777 has been marked as a duplicate of this bug. ***
Comment 8 Tomás Cohen Arazi 2015-06-04 13:18:29 UTC
Patches pushed to master.

Thanks Jonathan!
Comment 9 Chris Cormack 2015-06-07 07:56:44 UTC
Pushed to 3.20.x will be in 3.20.1
Comment 10 Liz Rea 2015-06-08 04:49:55 UTC
Hi, 

This patch does not apply cleanly to 3.18.x, if you feel it should be included, please rebase for 3.18.x.

Cheers,
Liz