Bug 20312 - Add a link towards the last consulted patron
Summary: Add a link towards the last consulted patron
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low new feature (vote)
Assignee: Maksim Sen
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-28 18:58 UTC by Maksim Sen
Modified: 2018-08-15 15:12 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 20312 - Add a link to last consulted patron (4.68 KB, patch)
2018-02-28 19:32 UTC, Maksim Sen
Details | Diff | Splinter Review
Bug 20312 - Add a link to last consulted patron (4.73 KB, patch)
2018-03-12 10:34 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Screenshot of interface idea (51.27 KB, image/png)
2018-05-30 15:56 UTC, Owen Leonard
Details
Bug 20312: Add a link to last consulted patron (5.40 KB, patch)
2018-07-25 20:40 UTC, Pierre-Luc Lapointe
Details | Diff | Splinter Review
Bug 20312: Add a link to last consulted patron (6.12 KB, patch)
2018-08-13 20:42 UTC, Pierre-Luc Lapointe
Details | Diff | Splinter Review
Bug 20312: (follow-up) Minor CSS corrections (1.56 KB, patch)
2018-08-14 15:13 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 20312: Add a link to last consulted patron (5.75 KB, patch)
2018-08-15 15:12 UTC, Pierre-Luc Lapointe
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Sen 2018-02-28 18:58:11 UTC
This new feature will add a link (on the top-left of the site) to the last patron consulted in the staff site. The feature currently uses cookies to save this information. When a staff site user accesses a patron record, the ID, name and card number of the patron will be saved in the cookie.

(I'll add a patch and a test plan shortly)
Comment 1 Maksim Sen 2018-02-28 19:32:43 UTC Comment hidden (obsolete)
Comment 2 sandboxes@biblibre.com 2018-03-12 10:34:11 UTC
Patch tested with a sandbox, by Axelle <axelle.clarisse@univ-amu.fr>
Comment 3 sandboxes@biblibre.com 2018-03-12 10:34:32 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2018-03-12 15:49:10 UTC
Hi Maksim,

the patch contains a po file that should not be there, can you please fix?

I am also having doubts on the the placmeent of the link. This is not a link to a module, so I tihnk placing it in the top navigation is not a good spot.

Asking Owen for additional feedback.
Comment 5 Owen Leonard 2018-05-30 15:56:13 UTC
Created attachment 75672 [details]
Screenshot of interface idea

Something like this might work.
Comment 6 Pierre-Luc Lapointe 2018-07-25 20:40:46 UTC
Created attachment 77272 [details] [review]
Bug 20312: Add a link to last consulted patron

This is an update to Maksim's patch. The link "Last patron" is now on the top-right corner of the screen and has the same style as attachment 75672 [details]. Moreover, the "X" button is added to remove the link if clicked on.

To test:
1- Apply the patch
2- Go to a patron details' page
3- Verify that the link "Last patron" appears on the top-right corner of the screen
4- Go to another page
5- The link should still be here
6- Click on the link
7- Verify that you are at the patron's checkout page
8- Click on the "X" button next to the "Last patron" link
9- The link should be gone
10- Go to another page
11- The link shouldn't appear (until the next patron detail's page)
Comment 7 Pierre-Luc Lapointe 2018-07-25 20:41:53 UTC
Hi Owen, Katrin,

I created the file last-borrower.inc that contains the main code for the feature. It has a <style> tag for the link to appear like in attachment 75672 [details]. I would like to know if this tag is in the right place of it should be in another file.

Also, is the link's position appropriate?

Thank you.
Comment 8 Katrin Fischer 2018-08-01 23:22:41 UTC
Hi Pierre-Luc,

taking a quick look. The QA script notes some issues:

 FAIL	koha-tmpl/intranet-tmpl/prog/en/includes/last-borrower.inc
   FAIL	  forbidden patterns
		forbidden pattern: tab char (line 44)
		forbidden pattern: intranet-tmpl should certainly replaced with [% interface %] (line 3)
		forbidden pattern: tab char (line 41)
		forbidden pattern: tab char (line 48)
		forbidden pattern: tab char (line 38)
		forbidden pattern: tab char (line 40)
		forbidden pattern: tab char (line 37)

Please note, that once this is pushed, the new cookie should be documented here:
https://wiki.koha-community.org/wiki/Use_of_Cookies

I will leave the question of where the Javascript should go to Owen, but feel like it might be better in a separate .js file.

I wonder if libraries would like to have this optional for privacy reasons. It might be safer to add a pref.
Comment 9 Owen Leonard 2018-08-13 12:35:04 UTC
Some suggestions:

 - Use <i class="fa fa-remove"></i> instead of an image for X.
 - Put the CSS in staff-global.scss
 - Put the JavaScript in staff-global.js
   - Add the JS to the existing $(document).ready() so you don't need 'addEventListener('DOMContentLoaded')';
   - Be consistent about whether you use single or double quotes

(In reply to Katrin Fischer from comment #8)

> I wonder if libraries would like to have this optional for privacy reasons.
> It might be safer to add a pref.

A lot of this already rests in the hands of the librarian and their browser. If I have my browser configured to restore my last session, my back button will take me back to the last patron without a handy link.

The way this patch does it, the cookie should disappear when the browser is closed. I would think that is adequate.
Comment 10 Pierre-Luc Lapointe 2018-08-13 20:42:11 UTC
Created attachment 77769 [details] [review]
Bug 20312: Add a link to last consulted patron

This new feature adds a link to the last patron consulted
in the staff site. It uses cookies to save this information.
When a staff site user accesses a patron record, the ID, name
and card number of the patron will be saved in the cookie.

To test:
1- Apply the patch
2- Go to a patron details' page
3- Verify that the link "Last patron" appears on the top-right
   corner of the screen
4- Go to another page
5- The link should still be here
6- Click on the link
7- Verify that you are at the patron's checkout page
8- Click on the "X" button next to the "Last patron" link
 9- The link should be gone
10- Go to another page
11- The link shouldn't appear (until the next patron detail's
    page)
Comment 11 Owen Leonard 2018-08-14 15:13:29 UTC
Created attachment 77796 [details] [review]
Bug 20312: (follow-up) Minor CSS corrections

This patch makes a couple of minor CSS corrections to match linter style
and to correctly color the "X" link.
Comment 12 Owen Leonard 2018-08-14 15:19:23 UTC
I noticed a problem when testing this today: The first time the "last patron" link appears, it doesn't contain any parameters (i.e. /cgi-bin/koha/circ/circulation.pl instead of /cgi-bin/koha/circ/circulation.pl?borrowernumber=XXX). It's only after I open a second patron record that the "last patron" link takes me to a valid patron record.
Comment 13 Pierre-Luc Lapointe 2018-08-15 15:12:18 UTC
Created attachment 77835 [details] [review]
Bug 20312: Add a link to last consulted patron

This new feature adds a link to the last patron consulted
in the staff site. It uses cookies to save this information.
When a staff site user accesses a patron record, the ID, name
and card number of the patron will be saved in the cookie.

To test:
1- Apply the patch
2- Go to a patron details' page
3- Verify that the link "Last patron" appears on the top-right
   corner of the screen
4- Go to another page
5- The link should still be here
6- Click on the link
7- Verify that you are at the patron's checkout page
8- Click on the "X" button next to the "Last patron" link
9- The link should be gone
10- Go to another page
11- The link shouldn't appear (until the next patron detail's
    page)