Currently, in the "Holds to Pull" list, the filter is too fuzzy/not exact enough. The Scenario: 1 - You have a hold on an item at branch NM 2 - You have a hold on an item at branch NMH 3 - You have a hold on an item at either branch NM, NA, NB Currently, if you filter by 'NM', you'll get all three holds to pull, even though you really only want holds 1 and 3.
Created attachment 24047 [details] [review] Bug 11502 - Branch filter in "Holds To Pull" is too fuzzy This patch uses regex checking via the DataTables fnFilter API method to make the branch filter more precise on the "Holds to Pull" page. The ability to use regex is built into DataTables so this just adds the actual expression. _TEST PLAN_ Before applying: 1) Add library (branches) with codes of NM, NMH, and NB 2) Add items (that can be placed on hold) at all these branches 3) Place a hold on an item that is only available at NM 4) Place a hold on an item that is only available at NMH 5) Place a hold on an item that is only available at NM and NB 6) Go to "Holds to Pull" in the Circulation module 7) Filter by these three different values 8) Note that filtering by "NM" will incorrectly bring up all three holds, while "NMH" and "NB" will only pull up one (like they should). Apply the patch. 9) Shift+refresh the page so that your Javascript refreshes 10) Repeat step 7 (filtering by the different branch values) 11) Note that filtering by "NM" will now only bring up the hold for "NM" and the hold for "NM" and "NB", while the others still only bring up one hold.
Created attachment 24048 [details] [review] Bug 11502 - Branch filter in "Holds To Pull" is too fuzzy This patch uses regex checking via the DataTables fnFilter API method to make the branch filter more precise on the "Holds to Pull" page. The ability to use regex is built into DataTables so this just adds the actual expression. _TEST PLAN_ Before applying: 1) Add library (branches) with codes of NM, NMH, and NB 2) Add items (that can be placed on hold) at all these branches 3) Place a hold on an item that is only available at NM 4) Place a hold on an item that is only available at NMH 5) Place a hold on an item that is only available at NM and NB 6) Go to "Holds to Pull" in the Circulation module 7) Filter by these three different values 8) Note that filtering by "NM" will incorrectly bring up all three holds, while "NMH" and "NB" will only pull up one (like they should). Apply the patch. 9) Shift+refresh the page so that your Javascript refreshes 10) Repeat step 7 (filtering by the different branch values) 11) Note that filtering by "NM" will now only bring up the hold for "NM" and the hold for "NM" and "NB", while the others still only bring up one hold. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Hi David, Could you explain why you match the < and >? The ^$ are not enough?
(In reply to Jonathan Druart from comment #3) > Hi David, > Could you explain why you match the < and >? > The ^$ are not enough? Sure, Jonathan. It's because DataTables interprets all the data in a table cell as one long string. Sometimes, your string might be <td>BRANCH</td>. Other times, it might be <td>BRANCH<br/>BRANCH1<br/>BRANCH2</td>. If you were to only use ^$, 'BRANCH' would only match the first scenario. It wouldn't match the second, because the string ends with BRANCH2 - not BRANCH. However, we want it to match both scenarios, so we need to include < and >. In fact, there are 4 scenarios I see: 1) ^BRANCH$ (i.e. the string is only BRANCH) 2) ^BRANCH< (i.e. the string begins with BRANCH) 3) >BRANCH< (i.e. the string contains BRANCH in the middle somewhere) 4) >BRANCH$ (i.e. the string ends with BRANCH) Does that answer your question?
(In reply to David Cook from comment #4) > Does that answer your question? Yes, thanks David. Looking at the tt code, I seen that the cell contain 'reserveloo.holdingbranch', and I supposed it was a simple branch. But in fact, this field is built with a concat in the sql query. I should have read the test plan entirely... So the patch works great. Marked as Passed QA.
Created attachment 24272 [details] [review] Bug 11502 - Branch filter in "Holds To Pull" is too fuzzy This patch uses regex checking via the DataTables fnFilter API method to make the branch filter more precise on the "Holds to Pull" page. The ability to use regex is built into DataTables so this just adds the actual expression. _TEST PLAN_ Before applying: 1) Add library (branches) with codes of NM, NMH, and NB 2) Add items (that can be placed on hold) at all these branches 3) Place a hold on an item that is only available at NM 4) Place a hold on an item that is only available at NMH 5) Place a hold on an item that is only available at NM and NB 6) Go to "Holds to Pull" in the Circulation module 7) Filter by these three different values 8) Note that filtering by "NM" will incorrectly bring up all three holds, while "NMH" and "NB" will only pull up one (like they should). Apply the patch. 9) Shift+refresh the page so that your Javascript refreshes 10) Repeat step 7 (filtering by the different branch values) 11) Note that filtering by "NM" will now only bring up the hold for "NM" and the hold for "NM" and "NB", while the others still only bring up one hold. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Pushed to master. Thanks, David!
Patch pushed to 3.14.x, will be in 3.14.5
Pushed to 3.12.x will be in 3.12.12