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/
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-09-24 18:00:00 -03:00 committed by Martin Renvoize
parent 42d40e372e
commit cd4dfc6e12
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
9 changed files with 439 additions and 0 deletions

42
Koha/Old/Biblio.pm Normal file
View File

@ -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;

42
Koha/Old/Biblioitem.pm Normal file
View File

@ -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;

54
Koha/Old/Biblioitems.pm Normal file
View File

@ -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;

54
Koha/Old/Biblios.pm Normal file
View File

@ -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;

42
Koha/Old/Item.pm Normal file
View File

@ -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;

54
Koha/Old/Items.pm Normal file
View File

@ -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;

42
Koha/Old/Patron.pm Normal file
View File

@ -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;

54
Koha/Old/Patrons.pm Normal file
View File

@ -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 'Deletedborrower';
}
=head3 object_class
Single object class
=cut
sub object_class {
return 'Koha::Old::Patron';
}
1;

55
t/db_dependent/Koha/Old.t Normal file
View File

@ -0,0 +1,55 @@
#!/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 <http://www.gnu.org/licenses>.
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;