When trying to place a hold in staff on master, I have the following error: Template process failed: undef error - Not a HASH reference at /home/vagrant/kohaclone/Koha/Template/Plugin/Branches.pm line 96. at /home/vagrant/kohaclone/C4/Templates.pm line 122 It works pre cd4dfc6e121a8f867fee5fcf8ccfd594bf163ba7 I haven't done a git bisect, but as this is the most recent holds work, I am going to add a link suspecting it to be the cause.
It makes sense to blame that dev as it reengineers the pickup locations code. I will take a look.
Created attachment 96860 [details] [review] Bug 24350: Fix Branches.pickup_locations This will fix the following error: Template process failed: undef error - Not a HASH reference at /home/vagrant/kohaclone/Koha/Template/Plugin/Branches.pm line 96. at /home/vagrant/kohaclone/C4/Templates.pm line 122 Koha::Libraries->pickup_locations does not always return an array, but arrayref if $biblio is not a Koha::Biblio object. I do not think it's the correct fix, the pattern in Koha::Libraries->pickup_locations is wrong: we should not expect 2 different types for a given parameter, biblio should always be a Koha::Biblio (idem for item btw). That could be fixed easily if the template had the Koha::Biblio object sent.
(In reply to Jonathan Druart from comment #2) > Created attachment 96860 [details] [review] [review] > Bug 24350: Fix Branches.pickup_locations > > This will fix the following error: > Template process failed: undef error - Not a HASH reference at > /home/vagrant/kohaclone/Koha/Template/Plugin/Branches.pm line 96. > at /home/vagrant/kohaclone/C4/Templates.pm line 122 > > Koha::Libraries->pickup_locations does not always return an array, but > arrayref if $biblio is not a Koha::Biblio object. > > I do not think it's the correct fix, the pattern in > Koha::Libraries->pickup_locations is wrong: we should not expect 2 > different types for a given parameter, biblio should always be a > Koha::Biblio (idem for item btw). > That could be fixed easily if the template had the Koha::Biblio object > sent. I think we should fix this blocker with your patch, Jonathan, and file a separate bug for refactoring things. This way people can keep testing the feature and writing the manual pages, while we implement things in a different way.
*** Bug 24362 has been marked as a duplicate of this bug. ***
Created attachment 96912 [details] [review] Bug 24350: Fix Branches.pickup_locations This will fix the following error: Template process failed: undef error - Not a HASH reference at /home/vagrant/kohaclone/Koha/Template/Plugin/Branches.pm line 96. at /home/vagrant/kohaclone/C4/Templates.pm line 122 Koha::Libraries->pickup_locations does not always return an array, but arrayref if $biblio is not a Koha::Biblio object. I do not think it's the correct fix, the pattern in Koha::Libraries->pickup_locations is wrong: we should not expect 2 different types for a given parameter, biblio should always be a Koha::Biblio (idem for item btw). That could be fixed easily if the template had the Koha::Biblio object sent. Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Agreed that longer term we should do the refactoring fix.. but this is a pragmatic solution to get things working again so I'm happy to take it as is.. I'll add a dependant bug for the refactor now so we don't forget it.
Created attachment 96913 [details] [review] Bug 24350: Fix Branches.pickup_locations This will fix the following error: Template process failed: undef error - Not a HASH reference at /home/vagrant/kohaclone/Koha/Template/Plugin/Branches.pm line 96. at /home/vagrant/kohaclone/C4/Templates.pm line 122 Koha::Libraries->pickup_locations does not always return an array, but arrayref if $biblio is not a Koha::Biblio object. I do not think it's the correct fix, the pattern in Koha::Libraries->pickup_locations is wrong: we should not expect 2 different types for a given parameter, biblio should always be a Koha::Biblio (idem for item btw). That could be fixed easily if the template had the Koha::Biblio object sent. Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nice work everyone! Pushed to master for 20.05
I'm getting a slightly different error when trying to place a hold now: Template process failed: undef error - Can't call method "unblessed" on unblessed reference at /kohadevbox/koha/Koha/Template/Plugin/Branches.pm line 93.
Created attachment 97231 [details] [review] Bug 24350: follow-up - unbless each library, not the array
Followup pushed, though I'm slightly sceptical.. it'll be interesting to see if anything falls out in the Jenkins run.
Still getting this error when placing a hold: Template process failed: undef error - Not an ARRAY reference at /home/vagrant/kohaclone/Koha/Template/Plugin/Branches.pm line 95. at /home/vagrant/kohaclone/C4/Templates.pm line 122 A new bug, or this one is still broken?
Still this one.. Agustin is working of fixes I believe... Jonathan and Nick just flip flopped the issue with their patches unfortunately.. it needs fixing further up the stack.
On Friday I worked on refactoring the template methods to work in a different way. I think we should 'do it right' and think a bit about this. Agustín is back from vacation and will step in
Created attachment 97258 [details] [review] Bug 24350: (follow-up) Clear Koha::Libraries->pickup_locations() and move logic to Koha::Template::Plugin::Branches->pickup_locations().
Created attachment 97259 [details] [review] Bug 24350: (follow-up) Clear Koha::Libraries->pickup_locations() and move logic to Koha::Template::Plugin::Branches->pickup_locations().
Created attachment 97260 [details] [review] Bug 24350: (follow-up) Clear Koha::Libraries->pickup_locations() and move logic to Koha::Template::Plugin::Branches->pickup_locations().
Created attachment 97261 [details] [review] Bug 24350: (follow-up) Fix pickup_location test in t/db_dependent/Template/Plugin/Branches.t
Followups pushed, thanks Agustin :)
Tests are failing: t/db_dependent/Koha/Libraries.t .. 4/9 # Looks like you planned 11 tests but ran 2. # Failed test 'Given BranchTransferLimitsType = itemtype and item-level_itypes = ON' # at t/db_dependent/Koha/Libraries.t line 258. # Looks like you planned 4 tests but ran 2. # Looks like you failed 1 test of 2 run. # Failed test 'UseBranchTransferLimits = ON' # at t/db_dependent/Koha/Libraries.t line 422. # Looks like you failed 1 test of 2. # Failed test 'pickup_locations' # at t/db_dependent/Koha/Libraries.t line 423. Can't call method "branchcode" on unblessed reference at t/db_dependent/Koha/Libraries.t line 195.
Not backported to 19.11.x due to dependencies
Created attachment 97352 [details] [review] Bug 24350: ->pickup_locations returns unblessed objects Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Followup pushed, thanks Tomas.