When you've got branches with similar branchcodes, the OPAC can get confused about which should be blocked by transfer limits. To test: - have a branch whose code contains the code for another branch, like "TOWN" and "TOWNSCHOOL" - Have a third branch with an unrealated code. I'll use "COUNTRY" - Have an item of item type BOOK, owned by branch COUNTRY - Set branch transfer limit to not allow BOOKs to go from COUNTRY to TOWNSCHOOL - confirm that no transfer limit exists for BOOKS from COUNTRY to TOWN - On staff client, confirm item allows hold for pickup at TOWN but not at TOWNSCHOOL - On OPAC, confirm hold is not allowed for pickup at TOWN or TOWNSCHOOL This seems to be the problematic bit of code: [% SET pickup_available_at = bibitemloo.not_available_at.grep(library.branchcode).size ? 0 : 1 %] So when we grep "TOWN" it also finds "TOWNSCHOOL," sees that block for TOWNSCHOOL, and applies it to TOWN in error. This has come to light as library systems deal with closures of some of their libraries due to coronavirus and start using branch transfer limits more intensively.
Created attachment 102139 [details] [review] Bug 25024: Make grep match full string To test: 1 - Create or have a branch with code CPL 2 - Create two new branches 'ACPL' and 'CPLA' 3 - In branch transfer limits disallow some itype or collection from another branch (FPL) to ACPL and CPLA 4 - Set UseBranchTransferLimits to 'Enforce' 5 - Find a biblio with one item belonging to FPL 6 - On opac, attempt to place a hold 7 - Note that ACPL and CPLA don't show in dropdown, OK 8 - Note that CPL is disabled, NOT OK 9 - Apply patch 10 - Place hold 11 - CPL is now enabled
Created attachment 102142 [details] [review] Bug 25024: Make grep match full string To test: 1 - Create or have a branch with code CPL 2 - Create two new branches 'ACPL' and 'CPLA' 3 - In branch transfer limits disallow some itype or collection from another branch (FPL) to ACPL and CPLA 4 - Set UseBranchTransferLimits to 'Enforce' 5 - Find a biblio with one item belonging to FPL 6 - On opac, attempt to place a hold 7 - Note that ACPL and CPLA don't show in dropdown, OK 8 - Note that CPL is disabled, NOT OK 9 - Apply patch 10 - Place hold 11 - CPL is now enabled Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Nick, what about the existing syntax: koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt:[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %] The '^' _ var _ '$' seems more readable to me, don't you think?
Created attachment 102146 [details] [review] Bug 25024: Make grep match full string To test: 1 - Create or have a branch with code CPL 2 - Create two new branches 'ACPL' and 'CPLA' 3 - In branch transfer limits disallow some itype or collection from another branch (FPL) to ACPL and CPLA 4 - Set UseBranchTransferLimits to 'Enforce' 5 - Find a biblio with one item belonging to FPL 6 - On opac, attempt to place a hold 7 - Note that ACPL and CPLA don't show in dropdown, OK 8 - Note that CPL is disabled, NOT OK 9 - Apply patch 10 - Place hold 11 - CPL is now enabled Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Joel Sasse <jsasse@plumcreeklibrary.net>
Created attachment 102177 [details] [review] Bug 25024: Make grep match full string To test: 1 - Create or have a branch with code CPL 2 - Create two new branches 'ACPL' and 'CPLA' 3 - In branch transfer limits disallow some itype or collection from another branch (FPL) to ACPL and CPLA 4 - Set UseBranchTransferLimits to 'Enforce' 5 - Find a biblio with one item belonging to FPL 6 - On opac, attempt to place a hold 7 - Note that ACPL and CPLA don't show in dropdown, OK 8 - Note that CPL is disabled, NOT OK 9 - Apply patch 10 - Place hold 11 - CPL is now enabled Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Joel Sasse <jsasse@plumcreeklibrary.net> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 102178 [details] [review] Bug 25024: Do not escape $ Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The test plan should have contained testing OPACHoldsIfAvailableAtPickup to be complete.
Nice work everyone! Pushed to master for 20.05
rebased (thanks nick) and backported to 19.11.x for 19.11.06
backported to 19.05.x for 19.05.11