+++ /dev/null
-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;
+++ /dev/null
-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;
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;
};
# 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
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) },
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;
=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>.
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;
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 );
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 );
+++ /dev/null
-#!/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 <http://www.gnu.org/licenses>.
-
-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;
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();
$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;
};
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;
$schema->storage->txn_begin;
# Delete all categories
-Koha::Issues->search->delete;
+Koha::Checkouts->search->delete;
Koha::Patrons->search->delete;
Koha::Patron::Categories->search->delete;