To recreate: 1 - Check out an item to a patron 2 - Make sure that item has no collection of location defined 3 - Try to view patrons checkouts - table does not load 4 - Check the console: TypeError: oObj.collection is null
Created attachment 78086 [details] [review] Bug 21257: Return blank strings instead of null in svc/checkouts To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load
Created attachment 78145 [details] [review] Bug 21257: Return blank strings instead of null in svc/checkouts To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Works as expected!
It works but I am wondering if we should not use the same method for/as lost and damaged. So either in the controller, init the var with an empty string instead of undef, or in the js: if ( oObj.damaged ) { due += "<span class='dmg'>" + oObj.damaged.escapeHtml() + "</span>"; } VS { "mDataProp": function ( oObj ) { return oObj.location.escapeHtml(); } }, As escapeHtml does not handle undef I think we should do the check in the js instead, like: { "mDataProp": function ( oObj ) { return ( oObj.location ? oObj.location.escapeHtml() : '' ) } },
Created attachment 78156 [details] [review] [ALTERNATIVE-PATCH] Bug 21257: (bug 13618 follow-up) Handle undef values in JS before escapeHtml call To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load
Created attachment 78173 [details] [review] Bug 21257: Return blank strings instead of null in svc/checkouts To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Works as expected! Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 78174 [details] [review] Bug 21257: (bug 13618 follow-up) Handle undef values in JS before escapeHtml call To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Is the second really an alternative patch? Because with only the second patch the checkouts table still won't load. Both together work well.
(In reply to Katrin Fischer from comment #7) > Is the second really an alternative patch? Because with only the second > patch the checkouts table still won't load. Both together work well. Yes, only second patch should be needed. Which JS error do you get?
With only the second patch applied, I still get: TypeError: oObj.collection is null
Created attachment 78849 [details] [review] [ALTERNATIVE-PATCH] Bug 21257: (bug 13618 follow-up) Handle undef values in JS before escapeHtml call To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(In reply to Katrin Fischer from comment #9) > With only the second patch applied, I still get: > TypeError: oObj.collection is null Can you try again with the last patch only please?
I tried last patch and it failed. Needed to refresh screen. :/
Created attachment 78973 [details] [review] Bug 21257: (bug 13618 follow-up) Handle undef values in JS before escapeHtml call To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Created attachment 78991 [details] [review] Bug 21257: (bug 13618 follow-up) Handle undef values in JS before escapeHtml call To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Awesome work all! Pushed to master for 18.11