@@ -, +, @@ git grep Koha::Issue --- Koha/Issue.pm | 28 -------------- Koha/Issues.pm | 33 ---------------- Koha/Patron.pm | 6 +-- Koha/REST/V1.pm | 6 +-- t/db_dependent/Circulation.t | 4 +- t/db_dependent/Koha/Issues.t | 60 ----------------------------- t/db_dependent/Koha/Patrons.t | 8 ++-- t/db_dependent/Template/Plugin/Categories.t | 4 +- 8 files changed, 14 insertions(+), 135 deletions(-) delete mode 100644 Koha/Issue.pm delete mode 100644 Koha/Issues.pm delete mode 100644 t/db_dependent/Koha/Issues.t --- a/Koha/Issue.pm +++ a/Koha/Issue.pm @@ -1,28 +0,0 @@ -package Koha::Issue; - -# 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 Koha::Database; - -use base qw(Koha::Object); - -sub _type { - return 'Issue'; -} - -1; --- a/Koha/Issues.pm +++ a/Koha/Issues.pm @@ -1,33 +0,0 @@ -package Koha::Issues; - -# 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 Koha::Database; -use Koha::Issue; - -use base qw(Koha::Objects); - -sub _type { - return 'Issue'; -} - -sub object_class { - return 'Koha::Issue'; -} - -1; --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -24,10 +24,10 @@ use Carp; use C4::Context; use C4::Log; +use Koha::Checkouts; use Koha::Database; use Koha::DateUtils; use Koha::Holds; -use Koha::Issues; use Koha::OldIssues; use Koha::Patron::Categories; use Koha::Patron::HouseboundProfile; @@ -257,7 +257,7 @@ sub do_check_for_previous_checkout { }; # Check current issues table - my $issues = Koha::Issues->search($criteria); + my $issues = Koha::Checkouts->search($criteria); return 1 if $issues->count; # 0 || N # Check old issues table @@ -512,7 +512,7 @@ Return the overdued items sub get_overdues { my ($self) = @_; my $dtf = Koha::Database->new->schema->storage->datetime_parser; - my $issues = Koha::Issues->search( + my $issues = Koha::Checkouts->search( { 'me.borrowernumber' => $self->borrowernumber, 'me.date_due' => { '<' => $dtf->format_datetime(dt_from_string) }, --- a/Koha/REST/V1.pm +++ a/Koha/REST/V1.pm @@ -21,7 +21,7 @@ use Mojo::Base 'Mojolicious'; use C4::Auth qw( check_cookie_auth get_session haspermission ); use C4::Context; use Koha::Account::Lines; -use Koha::Issues; +use Koha::Checkouts; use Koha::Holds; use Koha::OldIssues; use Koha::Patrons; @@ -259,7 +259,7 @@ sub _object_ownership_by_borrowernumber { =head3 _object_ownership_by_checkout_id -First, attempts to find a Koha::Issue-object by C<$issue_id>. If we find one, +First, attempts to find a Koha::Checkout-object by C<$issue_id>. If we find one, compare its borrowernumber to currently logged in C<$user>. However, if an issue is not found, attempt to find a Koha::OldIssue-object instead and compare its borrowernumber to currently logged in C<$user>. @@ -269,7 +269,7 @@ borrowernumber to currently logged in C<$user>. sub _object_ownership_by_checkout_id { my ($c, $user, $issue_id) = @_; - my $issue = Koha::Issues->find($issue_id); + my $issue = Koha::Checkouts->find($issue_id); $issue = Koha::OldIssues->find($issue_id) unless $issue; return $issue && $issue->borrowernumber && $user->borrowernumber == $issue->borrowernumber; --- a/t/db_dependent/Circulation.t +++ a/t/db_dependent/Circulation.t @@ -1049,7 +1049,7 @@ subtest 'CanBookBeIssued & AllowReturnToBranch' => sub { set_userenv($holdingbranch); my $issue = AddIssue( $patron_1, $item->{barcode} ); - is( ref($issue), 'Koha::Schema::Result::Issue' ); # FIXME Should be Koha::Issue + is( ref($issue), 'Koha::Schema::Result::Issue' ); # FIXME Should be Koha::Checkout my ( $error, $question, $alerts ); @@ -1138,7 +1138,7 @@ subtest 'AddIssue & AllowReturnToBranch' => sub { set_userenv($holdingbranch); - my $ref_issue = 'Koha::Schema::Result::Issue'; # FIXME Should be Koha::Issue + my $ref_issue = 'Koha::Schema::Result::Issue'; # FIXME Should be Koha::Checkout my $issue = AddIssue( $patron_1, $item->{barcode} ); my ( $error, $question, $alerts ); --- a/t/db_dependent/Koha/Issues.t +++ a/t/db_dependent/Koha/Issues.t @@ -1,60 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2015 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 => 4; - -use Koha::Issue; -use Koha::Issues; -use Koha::Database; - -use t::lib::TestBuilder; - -my $schema = Koha::Database->new->schema; -$schema->storage->txn_begin; - -my $builder = t::lib::TestBuilder->new; -my $patron = $builder->build( { source => 'Borrower' } ); -my $item_1 = $builder->build( { source => 'Item' } ); -my $item_2 = $builder->build( { source => 'Item' } ); -my $nb_of_issues = Koha::Issues->search->count; -my $new_issue_1 = Koha::Issue->new( - { borrowernumber => $patron->{borrowernumber}, - itemnumber => $item_1->{itemnumber}, - } -)->store; -my $new_issue_2 = Koha::Issue->new( - { borrowernumber => $patron->{borrowernumber}, - itemnumber => $item_2->{itemnumber}, - } -)->store; - -like( $new_issue_1->issue_id, qr|^\d+$|, 'Adding a new issue should have set the issue_id' ); -is( Koha::Issues->search->count, $nb_of_issues + 2, 'The 2 issues should have been added' ); - -my $retrieved_issue_1 = Koha::Issues->find( $new_issue_1->issue_id ); -is( $retrieved_issue_1->itemnumber, $new_issue_1->itemnumber, 'Find a issue by id should return the correct issue' ); - -$retrieved_issue_1->delete; -is( Koha::Issues->search->count, $nb_of_issues + 1, 'Delete should delete the issue' ); - -$schema->storage->txn_rollback; - -1; --- a/t/db_dependent/Koha/Patrons.t +++ a/t/db_dependent/Koha/Patrons.t @@ -146,11 +146,11 @@ subtest 'has_overdues' => sub { is( $retrieved_patron->has_overdues, 0, ); my $tomorrow = DateTime->today( time_zone => C4::Context->tz() )->add( days => 1 ); - my $issue = Koha::Issue->new({ borrowernumber => $new_patron_1->id, itemnumber => $item_1->{itemnumber}, date_due => $tomorrow, branchcode => $library->{branchcode} })->store(); + my $issue = Koha::Checkout->new({ borrowernumber => $new_patron_1->id, itemnumber => $item_1->{itemnumber}, date_due => $tomorrow, branchcode => $library->{branchcode} })->store(); is( $retrieved_patron->has_overdues, 0, ); $issue->delete(); my $yesterday = DateTime->today(time_zone => C4::Context->tz())->add( days => -1 ); - $issue = Koha::Issue->new({ borrowernumber => $new_patron_1->id, itemnumber => $item_1->{itemnumber}, date_due => $yesterday, branchcode => $library->{branchcode} })->store(); + $issue = Koha::Checkout->new({ borrowernumber => $new_patron_1->id, itemnumber => $item_1->{itemnumber}, date_due => $yesterday, branchcode => $library->{branchcode} })->store(); $retrieved_patron = Koha::Patrons->find( $new_patron_1->borrowernumber ); is( $retrieved_patron->has_overdues, 1, ); $issue->delete(); @@ -468,12 +468,12 @@ subtest 'get_overdues' => sub { $patron = Koha::Patrons->find( $patron->{borrowernumber} ); my $overdues = $patron->get_overdues; is( $overdues->count, 2, 'Patron should have 2 overdues'); - is( ref($overdues), 'Koha::Issues', 'Koha::Patron->get_overdues should return Koha::Issues' ); + is( ref($overdues), 'Koha::Checkouts', 'Koha::Patron->get_overdues should return Koha::Checkouts' ); is( $overdues->next->itemnumber, $item_1->{itemnumber}, 'The issue should be returned in the same order as they have been done, first is correct' ); is( $overdues->next->itemnumber, $item_2->{itemnumber}, 'The issue should be returned in the same order as they have been done, second is correct' ); # Clean stuffs - Koha::Issues->search( { borrowernumber => $patron->borrowernumber } )->delete; + Koha::Checkouts->search( { borrowernumber => $patron->borrowernumber } )->delete; $patron->delete; }; --- a/t/db_dependent/Template/Plugin/Categories.t +++ a/t/db_dependent/Template/Plugin/Categories.t @@ -21,7 +21,7 @@ use Test::More tests => 4; use t::lib::TestBuilder; use Koha::Patron::Categories; -use Koha::Issues; +use Koha::Checkouts; use Koha::Patrons; use Koha::Database; use Koha::Template::Plugin::Categories; @@ -30,7 +30,7 @@ my $schema = Koha::Database->new->schema; $schema->storage->txn_begin; # Delete all categories -Koha::Issues->search->delete; +Koha::Checkouts->search->delete; Koha::Patrons->search->delete; Koha::Patron::Categories->search->delete; --