From 01631b6e3146906984aa497a2937365dd3b3ab9e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 12 Jul 2016 11:28:25 +0100 Subject: [PATCH] Bug 17089: Koha::Ratings - Add Koha::Rating[s] classes The subroutines in C4::Ratings are only CRUD operations. This patch set moves the entire module to Koha::Rating[s] based on Koha::Object[s] Test plan for the whole patch set: 0/ Set OpacStarRatings to "results and details" 1/ Log in at the OPAC 2/ Launch a search, you should see the star ratings 3/ Go on a detail page, you should see the star ratings 4/ Rate the record 5/ Log in with another patron 6/ Go on the same detail page, you should see the previous rating 7/ Rate the racord, you should see "2 votes" and the average rating value. 8/ Cancel your rate 9/ Disable JavaScript and repeat 7 Note: You cannot cancel your rate if JavaScript is disabled (not a regression). Signed-off-by: Owen Leonard Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- Koha/Rating.pm | 44 +++++++++++++++++++++++++++++++++++++++++++ Koha/Ratings.pm | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 Koha/Rating.pm create mode 100644 Koha/Ratings.pm diff --git a/Koha/Rating.pm b/Koha/Rating.pm new file mode 100644 index 0000000000..1bdeb69e99 --- /dev/null +++ b/Koha/Rating.pm @@ -0,0 +1,44 @@ +package Koha::Rating; + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Carp; + +use Koha::Database; + +use base qw(Koha::Object); + +=head1 NAME + +Koha::Rating - Koha Rating Object class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 type + +=cut + +sub _type { + return 'Rating'; +} + +1; diff --git a/Koha/Ratings.pm b/Koha/Ratings.pm new file mode 100644 index 0000000000..27ee47e07e --- /dev/null +++ b/Koha/Ratings.pm @@ -0,0 +1,50 @@ +package Koha::Ratings; + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Carp; + +use Koha::Database; + +use Koha::Rating; + +use base qw(Koha::Objects); + +=head1 NAME + +Koha::Ratings - Koha Rating Object set class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 type + +=cut + +sub _type { + return 'Rating'; +} + +sub object_class { + return 'Koha::Rating'; +} + +1; -- 2.39.5