|
Hi Folks, Background: In attempting to deal with a situation where a group of libraries all using simple barcodes (just a sequential number, no prefix, padding, or checkdigits), we decided that during the transition to Evergreen, before new library cards/barcodes were assigned to each patron, we'd accommodate the frequent collisions in barcodes by putting a one-letter prefix for the library branch: For example, t for Thompson Library So the old barcode 7973 becomes t7973 in Evergreen. This allows a staff member who's checking out books or just looking up the user by their card to put in the letter and then scan the old barcode. Unfortunately, it doesn't work so well in OPAC because the t7973 gets looked up as an actor.usr.usrname value rather than an actor.card.barcode value--starts with a letter so must not be a barcode. Well, so okay, I attempted to set a slightly different regular _expression_ in actor.org_unit_setting for the name opac.barcode_regex: ^\w\d+$ (A barcode can start with a letter or a digit, but the rest of it has to be all digits.) OK, so then comes the mess of trying to express the metacharacters \w and \d in the INSERT statement so it'll come out right and the _javascript_ can play with it. So, fiddling around with the _javascript_ by hardcoding the regex I wanted, it appears that to enter it in the _javascript_, it had to be expressed this way: '$\\w\\d+$' Now, to get it to save in the DB becomes an interesting challenge because it's not clear if the returned DB string should have doubled or single backslashes, but for the purposes of this report, it doesn't matter. Bug Itself: The Perl code that's trying to package this regex into JSON form isn't handling the regular _expression_ as a value, it would seem. Here's the _javascript_ console error when I attempt to get the DB to return doubled backslashes (result of SELECT is $\\w\\d+$ ): Error: uncaught exception: A server error occurred. Debug information follows:Single backslashes (result of SELECT is $\w\d+$ ): Error: uncaught exception: A server error occurred. Debug information follows: I assume that if I knew what I was doing, I could cause this error via srfsh--but that's a bit beyond me at this point. I have not tried to use a regex that does not contain metacharacters or to characterize the Perl error beyond this (sorry to just point out the problem, but this seems like such fundamental code I likely wouldn't want to mess with it anyway). I have perfectly usable work-around for this, but it seems like it might be a quite fundamental problem. John John M. Craig Alpha-G Consulting, LLC [email protected] www.alphagconsulting.com (801) 805-4963 |
