From a33abdd2c8655c400ec1e4fa5d5aae6947fcf01f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 24 Sep 2019 18:00:00 -0300 Subject: [PATCH] Bug 24150: Add Koha::Old::*[s] This bug report will add new classes for: * Koha::Old::Patron[s] * Koha::Old::Biblio[s] * Koha::Old::Item[s] * Koha::Old::Biblioitem[s] Sponsored-by: Association KohaLa - https://koha-fr.org/ --- Koha/Old/Biblio.pm | 42 +++++++++++++++++++++++++++++++++++ Koha/Old/Biblioitem.pm | 42 +++++++++++++++++++++++++++++++++++ Koha/Old/Biblioitems.pm | 54 +++++++++++++++++++++++++++++++++++++++++++++ Koha/Old/Biblios.pm | 54 +++++++++++++++++++++++++++++++++++++++++++++ Koha/Old/Item.pm | 42 +++++++++++++++++++++++++++++++++++ Koha/Old/Items.pm | 54 +++++++++++++++++++++++++++++++++++++++++++++ Koha/Old/Patron.pm | 42 +++++++++++++++++++++++++++++++++++ Koha/Old/Patrons.pm | 54 +++++++++++++++++++++++++++++++++++++++++++++ t/db_dependent/Koha/Old.t | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 440 insertions(+) create mode 100644 Koha/Old/Biblio.pm create mode 100644 Koha/Old/Biblioitem.pm create mode 100644 Koha/Old/Biblioitems.pm create mode 100644 Koha/Old/Biblios.pm create mode 100644 Koha/Old/Item.pm create mode 100644 Koha/Old/Items.pm create mode 100644 Koha/Old/Patron.pm create mode 100644 Koha/Old/Patrons.pm create mode 100644 t/db_dependent/Koha/Old.t diff --git a/Koha/Old/Biblio.pm b/Koha/Old/Biblio.pm new file mode 100644 index 0000000000..71a1871942 --- /dev/null +++ b/Koha/Old/Biblio.pm @@ -0,0 +1,42 @@ +package Koha::Old::Biblio; + +# 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 base qw(Koha::Object); + +=head1 NAME + +Koha::Old::Biblio - Koha Old::Biblio Object class + +=head1 API + +=head2 Class methods + +=cut + +=head2 Internal methods + +=head3 _type + +=cut + +sub _type { + return 'Deletedbiblio'; +} + +1; diff --git a/Koha/Old/Biblioitem.pm b/Koha/Old/Biblioitem.pm new file mode 100644 index 0000000000..7057ad0a6f --- /dev/null +++ b/Koha/Old/Biblioitem.pm @@ -0,0 +1,42 @@ +package Koha::Old::Biblioitem; + +# 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 base qw(Koha::Object); + +=head1 NAME + +Koha::Old::Biblioitem - Koha Old::Biblioitem Object class + +=head1 API + +=head2 Class methods + +=cut + +=head2 Internal methods + +=head3 _type + +=cut + +sub _type { + return 'Deletedbiblioitem'; +} + +1; diff --git a/Koha/Old/Biblioitems.pm b/Koha/Old/Biblioitems.pm new file mode 100644 index 0000000000..2af7ecc04c --- /dev/null +++ b/Koha/Old/Biblioitems.pm @@ -0,0 +1,54 @@ +package Koha::Old::Biblioitems; + +# 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 base qw(Koha::Objects); + +use Koha::Old::Biblioitem; + +=head1 NAME + +Koha::Old::Biblioitems - Koha Old::Biblioitem Object set class + +=head1 API + +=head2 Class Methods + +=cut + +=head2 Internal Methods + +=head3 _type + +=cut + +sub _type { + return 'Deletedbiblioitem'; +} + +=head3 object_class + +Single object class + +=cut + +sub object_class { + return 'Koha::Old::Biblioitem'; +} + +1; diff --git a/Koha/Old/Biblios.pm b/Koha/Old/Biblios.pm new file mode 100644 index 0000000000..876671695c --- /dev/null +++ b/Koha/Old/Biblios.pm @@ -0,0 +1,54 @@ +package Koha::Old::Biblios; + +# 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 base qw(Koha::Objects); + +use Koha::Old::Biblio; + +=head1 NAME + +Koha::Old::Biblios - Koha Old::Biblio Object set class + +=head1 API + +=head2 Class Methods + +=cut + +=head2 Internal Methods + +=head3 _type + +=cut + +sub _type { + return 'Deletedbiblio'; +} + +=head3 object_class + +Single object class + +=cut + +sub object_class { + return 'Koha::Old::Biblio'; +} + +1; diff --git a/Koha/Old/Item.pm b/Koha/Old/Item.pm new file mode 100644 index 0000000000..27d65f1df6 --- /dev/null +++ b/Koha/Old/Item.pm @@ -0,0 +1,42 @@ +package Koha::Old::Item; + +# 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 base qw(Koha::Object); + +=head1 NAME + +Koha::Old::Item - Koha Old::Item Object class + +=head1 API + +=head2 Class methods + +=cut + +=head2 Internal methods + +=head3 _type + +=cut + +sub _type { + return 'Deleteditem'; +} + +1; diff --git a/Koha/Old/Items.pm b/Koha/Old/Items.pm new file mode 100644 index 0000000000..e449bf3d87 --- /dev/null +++ b/Koha/Old/Items.pm @@ -0,0 +1,54 @@ +package Koha::Old::Items; + +# 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 base qw(Koha::Objects); + +use Koha::Old::Item; + +=head1 NAME + +Koha::Old::Items - Koha Old::Item Object set class + +=head1 API + +=head2 Class Methods + +=cut + +=head2 Internal Methods + +=head3 _type + +=cut + +sub _type { + return 'Deleteditem'; +} + +=head3 object_class + +Single object class + +=cut + +sub object_class { + return 'Koha::Old::Item'; +} + +1; diff --git a/Koha/Old/Patron.pm b/Koha/Old/Patron.pm new file mode 100644 index 0000000000..b3db395c90 --- /dev/null +++ b/Koha/Old/Patron.pm @@ -0,0 +1,42 @@ +package Koha::Old::Patron; + +# 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 base qw(Koha::Object); + +=head1 NAME + +Koha::Old::Patron - Koha Old::Patron Object class + +=head1 API + +=head2 Class methods + +=cut + +=head2 Internal methods + +=head3 _type + +=cut + +sub _type { + return 'Deletedborrower'; +} + +1; diff --git a/Koha/Old/Patrons.pm b/Koha/Old/Patrons.pm new file mode 100644 index 0000000000..edc74bd8a3 --- /dev/null +++ b/Koha/Old/Patrons.pm @@ -0,0 +1,54 @@ +package Koha::Old::Patrons; + +# 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 base qw(Koha::Objects); + +use Koha::Old::Patron; + +=head1 NAME + +Koha::Old::Patrons - Koha Old::Patron Object set class + +=head1 API + +=head2 Class Methods + +=cut + +=head2 Internal Methods + +=head3 _type + +=cut + +sub _type { + return 'Deleteborrower'; +} + +=head3 object_class + +Single object class + +=cut + +sub object_class { + return 'Koha::Old::Patron'; +} + +1; diff --git a/t/db_dependent/Koha/Old.t b/t/db_dependent/Koha/Old.t new file mode 100644 index 0000000000..00a9107fe0 --- /dev/null +++ b/t/db_dependent/Koha/Old.t @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +# Copyright 2019 Koha Development team +# +# 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, see . + +use Modern::Perl; + +use Test::More tests => 2; + +use Koha::Database; +use Koha::Old::Patrons; +use Koha::Old::Biblios; +use Koha::Old::Items; + +use t::lib::TestBuilder; + +my $schema = Koha::Database->new->schema; +$schema->storage->txn_begin; + +my $builder = t::lib::TestBuilder->new; + +subtest 'Koha::Old::Patrons' => sub { + plan tests => 1; + + my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); + my $patron_unblessed = $patron->unblessed; + $patron->move_to_deleted; + $patron->delete; + my $deleted_patron = Koha::Old::Patrons->search( + { + borrowernumber => $patron->borrowernumber; + } + )->next; + is_deeply( $deleted_patron->unblessed, $patron_unblessed ); +}; + +subtest 'Koha::Old::Biblios and Koha::Old::Items' => sub { + # Cannot be tested in a meaningful way so far + ok(1); +}; +$schema->storage->txn_rollback; + -- 2.11.0