Self-check only accepts user name value if regex for barcode not set up

Bug #1528647 reported by Terran McCanna
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
2.10
Fix Released
Medium
Unassigned
2.11
Fix Released
Medium
Unassigned

Bug Description

When using the self-check interface... if there isn't a regex set up for the patron barcode, the interface appears to only look at the user name field. If the user name is the barcode, then the barcode works, but if the user name is different than the barcode, then only the user name works and not the barcode.

This used to be a problem with the OPAC My Account login too, and a fix for that was created that adds logic so that if the entry starts with a number, then it matches to a barcode and if it doesn't, then it matches to a user name:
https://bugs.launchpad.net/evergreen/+bug/997098

An older related fix using regex was here:
https://bugs.launchpad.net/evergreen/+bug/822874

Evergreen 2.7, 2.9

tags: added: selfcheck
Revision history for this message
Bob Wicksall (bwicksall) wrote :

I fixed this in my Evergreen instance with the following code. I believe I mimicked the behavior in the OPAC but it's been a while.

Note: I moved Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js to /circ/selfcheck/js/selfcheck.javascript.tt2 in my instance so the paths are a little different.

--- a/circ/selfcheck/js/selfcheck.javascript.tt2
+++ b/circ/selfcheck/js/selfcheck.javascript.tt2
@@ -292,8 +292,11 @@ SelfCheckManager.prototype.loadOrgSettings = function() {
             this.orgSettings[k] = settings[k].value;
     }

- if(settings[SET_BARCODE_REGEX])
- this.patronBarcodeRegex = new RegExp(settings[SET_BARCODE_REGEX].value);
+ if(settings[SET_BARCODE_REGEX]) {
+ this.patronBarcodeRegex = new RegExp(settings[SET_BARCODE_REGEX].value)
+ } else {
+ this.patronBarcodeRegex = new RegExp(/^\d/); // To avoid surprises, default to "Barcodes start with digits"
+ }

     if(settings[SET_PATRON_TIMEOUT])
         patronTimeout = parseInt(settings[SET_PATRON_TIMEOUT].value) * 1000;

Revision history for this message
Terran McCanna (tmccanna) wrote :

Great! I added this to my test server and it worked like a charm!

Revision history for this message
Terran McCanna (tmccanna) wrote :
tags: added: pullrequest
Revision history for this message
Mike Rylander (mrylander) wrote :

Terran,

Would you mind force-pushing an updated branch with Bob as the author of that commit? Or, if you're unsure how to do that, this comment can serve as a note to whichever committer pushes it to do so.

Thanks!

Revision history for this message
Terran McCanna (tmccanna) wrote :

Mike - I didn't know how to do that so I included his name in the description of the commit. Is that enough? If there is something else I should do, please let me know.

Revision history for this message
Galen Charlton (gmc) wrote :

Here's how it can be done:

[1] To amend the commit:

git commit --amend --author "Name <email address hidden>"

[2] To force-push

git push -f working branch_name

(assuming that "working" is what you've named the remote for the working/Evergreen repository).

Revision history for this message
Kathy Lussier (klussier) wrote :

Just adding a note that since Bob did not do a git sign-off for the code, he probably should declare a DCO here. Basically, since a sign-off on a branch implies that the developer has declared a developer's certificate of origin, when a developer has not done a sign-off, the DCO should explicitly stated.

Bob, you can add the DCO by copying and pasting the text at http://wiki.evergreen-ils.org/doku.php?id=dev:standing_dco into a comment on this bug.

https://bugs.launchpad.net/evergreen/+bug/578586 serves as an example of how this has been done in the past.

Revision history for this message
Terran McCanna (tmccanna) wrote :

Removing pullrequest tag for the moment because when we applied it to our production server I discovered that it only works if password is not required for self-check. I'm reviewing the code now to see what else it needs to make it work with a password.

tags: removed: pullrequest
Changed in evergreen:
assignee: nobody → Terran McCanna (tmccanna)
Revision history for this message
Terran McCanna (tmccanna) wrote :

Taking Galen's advice, I redid this so Bob's original patch is committed with his name on it at:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=commit;h=f3a92984205fdf26699fe4f1ed202a9f7f6a74b8

And added my additional patch separately:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=commit;h=abcf8ce6b8c86dd96e670f44078ae97b48935ff7

tags: added: pullrequest
Changed in evergreen:
assignee: Terran McCanna (tmccanna) → nobody
Revision history for this message
Bob Wicksall (bwicksall) wrote :

Here is the DCO for my bit:

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Signed-off-by: Bob Wicksall <email address hidden>

Revision history for this message
Chris Sharp (chrissharp123) wrote :

Bob's and Terran's changes now packaged into a single branch, which *I* have signed off on as well:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/csharp/lp1528647_selfcheck_username_regex

tags: added: signedoff
Changed in evergreen:
importance: Undecided → High
status: New → Confirmed
milestone: none → 2.next
Revision history for this message
Kathy Lussier (klussier) wrote :

Thank you Bob, Terran and Chris! The changes have been merged to master for inclusion in 2.12 and backported to 2.11 and 2.10.

Changed in evergreen:
milestone: 2.next → 2.12-rc
importance: High → Medium
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.