Bug 17796: Move Koha::OldIssue[s] to Koha::Checkout[s]
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 20 Dec 2016 13:28:00 +0000 (14:28 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 20 Dec 2016 15:13:29 +0000 (15:13 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Old/Checkout.pm [new file with mode: 0644]
Koha/Old/Checkouts.pm [new file with mode: 0644]
Koha/OldIssue.pm [deleted file]
Koha/OldIssues.pm [deleted file]
Koha/Patron.pm
Koha/REST/V1.pm

diff --git a/Koha/Old/Checkout.pm b/Koha/Old/Checkout.pm
new file mode 100644 (file)
index 0000000..3a7c1eb
--- /dev/null
@@ -0,0 +1,28 @@
+package Koha::Old::Checkout;
+
+# 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 'OldIssue';
+}
+
+1;
diff --git a/Koha/Old/Checkouts.pm b/Koha/Old/Checkouts.pm
new file mode 100644 (file)
index 0000000..c7f1a6a
--- /dev/null
@@ -0,0 +1,33 @@
+package Koha::Old::Checkouts;
+
+# 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::Old::Checkout;
+
+use base qw(Koha::Objects);
+
+sub _type {
+    return 'OldIssue';
+}
+
+sub object_class {
+    return 'Koha::Old::Checkout';
+}
+
+1;
diff --git a/Koha/OldIssue.pm b/Koha/OldIssue.pm
deleted file mode 100644 (file)
index 5b3784d..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package Koha::OldIssue;
-
-# 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 'OldIssue';
-}
-
-1;
diff --git a/Koha/OldIssues.pm b/Koha/OldIssues.pm
deleted file mode 100644 (file)
index 56edfb1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-package Koha::OldIssues;
-
-# 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::OldIssue;
-
-use base qw(Koha::Objects);
-
-sub _type {
-    return 'OldIssue';
-}
-
-sub object_class {
-    return 'Koha::OldIssue';
-}
-
-1;
index fe2d844..9c6e051 100644 (file)
@@ -28,7 +28,7 @@ use Koha::Checkouts;
 use Koha::Database;
 use Koha::DateUtils;
 use Koha::Holds;
-use Koha::OldIssues;
+use Koha::Old::Checkouts;
 use Koha::Patron::Categories;
 use Koha::Patron::HouseboundProfile;
 use Koha::Patron::HouseboundRole;
@@ -261,7 +261,7 @@ sub do_check_for_previous_checkout {
     return 1 if $issues->count; # 0 || N
 
     # Check old issues table
-    my $old_issues = Koha::OldIssues->search($criteria);
+    my $old_issues = Koha::Old::Checkouts->search($criteria);
     return $old_issues->count;  # 0 || N
 }
 
index 5e1eded..e307552 100644 (file)
@@ -23,7 +23,7 @@ use C4::Context;
 use Koha::Account::Lines;
 use Koha::Checkouts;
 use Koha::Holds;
-use Koha::OldIssues;
+use Koha::Old::Checkouts;
 use Koha::Patrons;
 
 =head1 NAME
@@ -261,7 +261,7 @@ sub _object_ownership_by_borrowernumber {
 
 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
+is not found, attempt to find a Koha::Old::Checkout-object instead and compare its
 borrowernumber to currently logged in C<$user>.
 
 =cut
@@ -270,7 +270,7 @@ sub _object_ownership_by_checkout_id {
     my ($c, $user, $issue_id) = @_;
 
     my $issue = Koha::Checkouts->find($issue_id);
-    $issue = Koha::OldIssues->find($issue_id) unless $issue;
+    $issue = Koha::Old::Checkouts->find($issue_id) unless $issue;
     return $issue && $issue->borrowernumber
             && $user->borrowernumber == $issue->borrowernumber;
 }