Bug 13998

Summary: opac-ratings-ajax.pl is broken
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: major    
Priority: P5 - low CC: katrin.fischer, m.de.rooy, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 12609, 13852    
Bug Blocks:    
Attachments: Bug 13998: Reintroduce use of Koha::Database for C4::Ratings
[SIGNED OFF] Bug 13998: Reintroduce use of Koha::Database for C4::Ratings
[PASSED QA] Bug 13998: Reintroduce use of Koha::Database for C4::Ratings
Bug 13998: (RM followup) tests expect data on the database

Description Jonathan Druart 2015-04-15 11:15:12 UTC
To reproduce: Enable the star rating at the OPAC, go on a record detail page, note with the stars, nothing happens.

Actually yes, boom in the JS console and error in Koha logs:
[Wed Apr 15 13:12:52 2015] opac-ratings-ajax.pl: Can't locate object method "new" via package "Koha::Database" (perhaps you forgot to load "Koha::Database"?) at /home/koha/src/C4/Ratings.pm line 206.
Comment 1 Jonathan Druart 2015-04-15 11:27:41 UTC
This has been introduced by
commit  f14963605924eacbbaf965c600c65401288b6f2f
Date:   Tue Mar 17 14:50:14 2015 +0100
    Bug 13852 - Manage C4::VirtualShelves in C4::Auth for performance


This is crazy, really...
Comment 2 Jonathan Druart 2015-04-15 11:33:08 UTC
For what I understand it's because, before bug 13852, Koha::Database was used in C4:Members which was used by C4::VirtualShelves which was used by C4::Auth which was finally used by C4::Ratings...
Comment 3 Jonathan Druart 2015-04-15 11:49:47 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-04-15 11:50:27 UTC
This is a blocker for 3.20.
Comment 5 Nick Clemens 2015-04-16 02:56:22 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2015-04-17 10:33:33 UTC
Created attachment 38025 [details] [review]
[PASSED QA] Bug 13998: Reintroduce use of Koha::Database for C4::Ratings

It has been removed by bug 13852, because before bug 13852,
Koha::Database was used in C4:Members which was used by
C4::VirtualShelves which was used by C4::Auth which was finally used by
C4::Ratings...

Test plan:
At the opac, record detail page, note the record using the stars.
Without this patch it does not work.

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

http://bugs.koha-community.org/show_bug.cgi?id=12998
Comment 7 Tomás Cohen Arazi 2015-04-20 13:32:35 UTC
Patch pushed to master.

Good catch Jonathan!
Comment 8 Tomás Cohen Arazi 2015-04-21 16:51:22 UTC
Created attachment 38287 [details] [review]
Bug 13998: (RM followup) tests expect data on the database

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>