From 7ee8e1baeedcb458d83388102504b8244364875b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 Jul 2015 14:21:01 +0100 Subject: [PATCH] Bug 14544: Add Koha::Virtualshelf and Koha::Virtualshelves The 2 modules C4::VirtualShelves and C4::VirtualShelves::Page are really badly coded and buggy. It became complicated to fix and enhance them. This rewrite will make the code more robust and the list feature will be easier to change. Some new modules are added to the Koha namespace (Koha::Virtualshelf, Koha::Virtualshelves, Koha::Virtualshelfshare[s] and Koha::Virtualshelfcontent[s]) to take advantage of Dbix::Class. The patchset fixes some bugs: 1/ Bug 6279 - Can't delete lists from the second page of lists in the OPAC 2/ The owner of a list should not need any permission to remove content from his lists. 3/ No feedback messages when actions are done Test plan: A) Intranet and OPAC 1/ Create more than 20 private and public lists with different users 2/ Edit some and confirm that the changes are taken into account 3/ Share some lists with other users 4/ Add / remove contents Be sure you have some lists with more than 20 items (to test the pagination) 5/ Play with permissions and confirm it works as expected. For private lists: They should not be viewed by anyone else, if they are not shared If they are shared (OPAC only): a. "Allow anyone else to add entries" Should allow the user with whom the list is shared to add entries. b. "Allow anyone to remove his own contributed entries." Should allow the user with whom the list is shared to remove his own entries. c. "Allow anyone to remove other contributed entries." Should allow the user with whom the list is shared to remove any entries. For public lists: They should be viewed by anyone else. a. "Allow anyone else to add entries" Should allow any user to add entries. b. "Allow anyone to remove his own contributed entries." Should allow any user to remove his own entries. c. "Allow anyone to remove other contributed entries." Should allow any user to remove any entries. 6/ Download and sent lists. 7/ Confirm that the "Add to" feature works as expected. 8/ Confirm that the "Add an item to" works as expected. 9/ Delete some lists. 10/ Print some lists and subscribe to the RSS feed (OPAC only) (with more than 20 items). 11/ Use the remove "Remove share" links. Signed-off-by: Alex Arnaud Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- Koha/Virtualshelf.pm | 44 +++++++++++++++++++++++++++++++++++++ Koha/Virtualshelves.pm | 50 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 Koha/Virtualshelf.pm create mode 100644 Koha/Virtualshelves.pm diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm new file mode 100644 index 0000000000..98877a108e --- /dev/null +++ b/Koha/Virtualshelf.pm @@ -0,0 +1,44 @@ +package Koha::Virtualshelf; + +# 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::Virtualshelf - Koha Virtualshelf Object class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 type + +=cut + +sub type { + return 'Virtualshelf'; +} + +1; diff --git a/Koha/Virtualshelves.pm b/Koha/Virtualshelves.pm new file mode 100644 index 0000000000..5cffdfebf2 --- /dev/null +++ b/Koha/Virtualshelves.pm @@ -0,0 +1,50 @@ +package Koha::Virtualshelves; + +# 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::Virtualshelf; + +use base qw(Koha::Objects); + +=head1 NAME + +Koha::Virtualshelf - Koha Virtualshelf Object class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 type + +=cut + +sub type { + return 'Virtualshelf'; +} + +sub object_class { + return 'Koha::Virtualshelf'; +} + +1; -- 2.39.5