| Summary: | JavaScript error in when using claims return button in checkout table | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Lucas Gass (lukeg) <lucas> |
| Component: | Circulation | Assignee: | Lucas Gass (lukeg) <lucas> |
| Status: | RESOLVED DUPLICATE | QA Contact: | Marcel de Rooy <m.de.rooy> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | gmcharlt, kyle, m.de.rooy |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
| Attachments: |
Bug 33616: Make sure match() is evaluated against a string
Bug 33616: Make sure match() is evaluated against a string |
||
match() matches a string against a regular expression. We need to make sure the value passed is a string. Created attachment 150248 [details] [review] Bug 33616: Make sure match() is evaluated against a string To Test: 1. Set ClaimReturnedLostValue to a LOST value 2. Check out an item to a patron. 3. Click the Claim returned button within the checkout table. 4. Get spinning icon in place of the button 5. In the web developer tools console: Uncaught TypeError: value.match is not a function 6. Apply patch 7. Try 2 - 3 again. This time the spinning icon should turn into a grey button with the correct date. 8. There should no longer be a console error. Created attachment 150249 [details] [review] Bug 33616: Make sure match() is evaluated against a string To Test: 1. Set ClaimReturnedLostValue to a LOST value 2. Check out an item to a patron. 3. Click the Claim returned button within the checkout table. 4. Get spinning icon in place of the button 5. In the web developer tools console: Uncaught TypeError: value.match is not a function 6. Apply patch 7. Try 2 - 3 again. This time the spinning icon should turn into a grey button with the correct date. 8. There should no longer be a console error. Signed-off-by: David Nind <david@davidnind.com> (In reply to Lucas Gass from comment #1) > match() matches a string against a regular expression. We need to make sure > the value passed is a string. Looks good to me. Do you know what you got that triggered the type error? In theory we could pass something that may not have a toString method too and cause a new error? Probably not reproducable :) |
To recreate: 1. Set ClaimReturnedLostValue to a LOST value 2. Check out an item to a patron. 3. Click the Claim returned button within the checkout table. 4. Get spinning icon in place of the button 5. In the web developer tools console: Uncaught TypeError: value.match is not a function Looks like this is coming from includes/js-date-format.inc: 46 if ( ! value.match(/^\d{4}-\d{2}-\d{2}$/ ) ) { 47 m = m.tz(tz); 48 }