From 29596a87c97478f584f7b771c96a51e032ad7144 Mon Sep 17 00:00:00 2001
From: Aleisha Amohia <aleishaamohia@hotmail.com>
Date: Thu, 26 Oct 2017 01:04:49 +0000
Subject: [PATCH] Bug 19532: Module files for Recall and OldRecall

Koha/Recall.pm
Koha/Recalls.pm
Koha/Old/Recall.pm
Koha/Old/Recalls.pm

and the schema files for Recall and OldRecall.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
---
 Koha/Old/Recall.pm              |  51 ++++++++
 Koha/Old/Recalls.pm             |  60 +++++++++
 Koha/Recall.pm                  |  51 ++++++++
 Koha/Recalls.pm                 |  60 +++++++++
 Koha/Schema/Result/OldRecall.pm | 260 ++++++++++++++++++++++++++++++++++++++
 Koha/Schema/Result/Recall.pm    | 271 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 753 insertions(+)
 create mode 100644 Koha/Old/Recall.pm
 create mode 100644 Koha/Old/Recalls.pm
 create mode 100644 Koha/Recall.pm
 create mode 100644 Koha/Recalls.pm
 create mode 100644 Koha/Schema/Result/OldRecall.pm
 create mode 100644 Koha/Schema/Result/Recall.pm

diff --git a/Koha/Old/Recall.pm b/Koha/Old/Recall.pm
new file mode 100644
index 0000000..38af2e7
--- /dev/null
+++ b/Koha/Old/Recall.pm
@@ -0,0 +1,51 @@
+package Koha::Old::Recall;
+
+# Copyright 2017 Aleisha Amohia <aleisha@catalyst.net.nz>
+#
+# 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 );
+
+=head1 NAME
+
+Koha::Old::Recall - Koha Old Recall Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+    return 'OldRecall';
+}
+
+=head1 AUTHOR
+
+Aleisha Amohia <aleisha@catalyst.net.nz>
+Catalyst IT
+
+=cut
+
+1;
diff --git a/Koha/Old/Recalls.pm b/Koha/Old/Recalls.pm
new file mode 100644
index 0000000..2834c15
--- /dev/null
+++ b/Koha/Old/Recalls.pm
@@ -0,0 +1,60 @@
+package Koha::Old::Recalls;
+
+# Copyright 2017 Aleisha Amohia <aleisha@catalyst.net.nz>
+#
+# 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::Recall;
+
+use base qw( Koha::Objects );
+
+=head1 NAME
+
+Koha::Old::Recalls - Koha Old Recalls Object Set class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+    return 'OldRecall';
+}
+
+=head3 object_class
+
+=cut
+
+sub object_class {
+    return 'Koha::Old::Recall';
+}
+
+=head1 AUTHOR
+
+Aleisha Amohia <aleisha@catalyst.net.nz>
+Catalyst IT
+
+=cut
+
+1;
diff --git a/Koha/Recall.pm b/Koha/Recall.pm
new file mode 100644
index 0000000..7be9bad
--- /dev/null
+++ b/Koha/Recall.pm
@@ -0,0 +1,51 @@
+package Koha::Recall;
+
+# Copyright 2017 Aleisha Amohia <aleisha@catalyst.net.nz>
+#
+# 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 );
+
+=head1 NAME
+
+Koha::Recall - Koha Recall Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+    return 'Recall';
+}
+
+=head1 AUTHOR
+
+Aleisha Amohia <aleisha@catalyst.net.nz>
+Catalyst IT
+
+=cut
+
+1;
diff --git a/Koha/Recalls.pm b/Koha/Recalls.pm
new file mode 100644
index 0000000..067af85
--- /dev/null
+++ b/Koha/Recalls.pm
@@ -0,0 +1,60 @@
+package Koha::Recalls;
+
+# Copyright 2017 Aleisha Amohia <aleisha@catalyst.net.nz>
+#
+# 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::Recall;
+
+use base qw( Koha::Objects );
+
+=head1 NAME
+
+Koha::Recalls - Koha Recalls Object Set class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+    return 'Recall';
+}
+
+=head3 object_class
+
+=cut
+
+sub object_class {
+    return 'Koha::Recall';
+}
+
+=head1 AUTHOR
+
+Aleisha Amohia <aleisha@catalyst.net.nz>
+Catalyst IT
+
+=cut
+
+1;
diff --git a/Koha/Schema/Result/OldRecall.pm b/Koha/Schema/Result/OldRecall.pm
new file mode 100644
index 0000000..e8de463
--- /dev/null
+++ b/Koha/Schema/Result/OldRecall.pm
@@ -0,0 +1,260 @@
+use utf8;
+package Koha::Schema::Result::OldRecall;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::OldRecall
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<old_recalls>
+
+=cut
+
+__PACKAGE__->table("old_recalls");
+
+=head1 ACCESSORS
+
+=head2 recall_id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 borrowernumber
+
+  data_type: 'integer'
+  default_value: 0
+  is_foreign_key: 1
+  is_nullable: 1
+
+=head2 recalldate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+=head2 biblionumber
+
+  data_type: 'integer'
+  default_value: 0
+  is_foreign_key: 1
+  is_nullable: 1
+
+=head2 branchcode
+
+  data_type: 'varchar'
+  is_nullable: 1
+  size: 10
+
+=head2 cancellationdate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+=head2 recallnotes
+
+  data_type: 'mediumtext'
+  is_nullable: 1
+
+=head2 priority
+
+  data_type: 'smallint'
+  is_nullable: 1
+
+=head2 found
+
+  data_type: 'varchar'
+  is_nullable: 1
+  size: 1
+
+=head2 timestamp
+
+  data_type: 'timestamp'
+  datetime_undef_if_invalid: 1
+  default_value: current_timestamp
+  is_nullable: 0
+
+=head2 itemnumber
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 1
+
+=head2 waitingdate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+=head2 expirationdate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+=head2 itemtype
+
+  data_type: 'varchar'
+  is_foreign_key: 1
+  is_nullable: 1
+  size: 10
+
+=cut
+
+__PACKAGE__->add_columns(
+  "recall_id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "borrowernumber",
+  {
+    data_type      => "integer",
+    default_value  => 0,
+    is_foreign_key => 1,
+    is_nullable    => 1,
+  },
+  "recalldate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "biblionumber",
+  {
+    data_type      => "integer",
+    default_value  => 0,
+    is_foreign_key => 1,
+    is_nullable    => 1,
+  },
+  "branchcode",
+  { data_type => "varchar", is_nullable => 1, size => 10 },
+  "cancellationdate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "recallnotes",
+  { data_type => "mediumtext", is_nullable => 1 },
+  "priority",
+  { data_type => "smallint", is_nullable => 1 },
+  "found",
+  { data_type => "varchar", is_nullable => 1, size => 1 },
+  "timestamp",
+  {
+    data_type => "timestamp",
+    datetime_undef_if_invalid => 1,
+    default_value => \"current_timestamp",
+    is_nullable => 0,
+  },
+  "itemnumber",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
+  "waitingdate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "expirationdate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "itemtype",
+  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</recall_id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("recall_id");
+
+=head1 RELATIONS
+
+=head2 biblionumber
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Biblio>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "biblionumber",
+  "Koha::Schema::Result::Biblio",
+  { biblionumber => "biblionumber" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "SET NULL",
+    on_update     => "SET NULL",
+  },
+);
+
+=head2 borrowernumber
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Borrower>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "borrowernumber",
+  "Koha::Schema::Result::Borrower",
+  { borrowernumber => "borrowernumber" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "SET NULL",
+    on_update     => "SET NULL",
+  },
+);
+
+=head2 itemnumber
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Item>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "itemnumber",
+  "Koha::Schema::Result::Item",
+  { itemnumber => "itemnumber" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "SET NULL",
+    on_update     => "SET NULL",
+  },
+);
+
+=head2 itemtype
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Itemtype>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "itemtype",
+  "Koha::Schema::Result::Itemtype",
+  { itemtype => "itemtype" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "SET NULL",
+    on_update     => "SET NULL",
+  },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-25 23:50:29
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:afOsAbeAPcdHR79LfYH9Hg
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
diff --git a/Koha/Schema/Result/Recall.pm b/Koha/Schema/Result/Recall.pm
new file mode 100644
index 0000000..361f888
--- /dev/null
+++ b/Koha/Schema/Result/Recall.pm
@@ -0,0 +1,271 @@
+use utf8;
+package Koha::Schema::Result::Recall;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::Recall
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<recalls>
+
+=cut
+
+__PACKAGE__->table("recalls");
+
+=head1 ACCESSORS
+
+=head2 recall_id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 borrowernumber
+
+  data_type: 'integer'
+  default_value: 0
+  is_foreign_key: 1
+  is_nullable: 0
+
+=head2 recalldate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+=head2 biblionumber
+
+  data_type: 'integer'
+  default_value: 0
+  is_foreign_key: 1
+  is_nullable: 0
+
+=head2 branchcode
+
+  data_type: 'varchar'
+  is_foreign_key: 1
+  is_nullable: 1
+  size: 10
+
+=head2 cancellationdate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+=head2 recallnotes
+
+  data_type: 'mediumtext'
+  is_nullable: 1
+
+=head2 priority
+
+  data_type: 'smallint'
+  is_nullable: 1
+
+=head2 found
+
+  data_type: 'varchar'
+  is_nullable: 1
+  size: 1
+
+=head2 timestamp
+
+  data_type: 'timestamp'
+  datetime_undef_if_invalid: 1
+  default_value: current_timestamp
+  is_nullable: 0
+
+=head2 itemnumber
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 1
+
+=head2 waitingdate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+=head2 expirationdate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+=head2 itemtype
+
+  data_type: 'varchar'
+  is_foreign_key: 1
+  is_nullable: 1
+  size: 10
+
+=cut
+
+__PACKAGE__->add_columns(
+  "recall_id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "borrowernumber",
+  {
+    data_type      => "integer",
+    default_value  => 0,
+    is_foreign_key => 1,
+    is_nullable    => 0,
+  },
+  "recalldate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "biblionumber",
+  {
+    data_type      => "integer",
+    default_value  => 0,
+    is_foreign_key => 1,
+    is_nullable    => 0,
+  },
+  "branchcode",
+  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
+  "cancellationdate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "recallnotes",
+  { data_type => "mediumtext", is_nullable => 1 },
+  "priority",
+  { data_type => "smallint", is_nullable => 1 },
+  "found",
+  { data_type => "varchar", is_nullable => 1, size => 1 },
+  "timestamp",
+  {
+    data_type => "timestamp",
+    datetime_undef_if_invalid => 1,
+    default_value => \"current_timestamp",
+    is_nullable => 0,
+  },
+  "itemnumber",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
+  "waitingdate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "expirationdate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "itemtype",
+  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</recall_id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("recall_id");
+
+=head1 RELATIONS
+
+=head2 biblionumber
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Biblio>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "biblionumber",
+  "Koha::Schema::Result::Biblio",
+  { biblionumber => "biblionumber" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
+);
+
+=head2 borrowernumber
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Borrower>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "borrowernumber",
+  "Koha::Schema::Result::Borrower",
+  { borrowernumber => "borrowernumber" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
+);
+
+=head2 branchcode
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Branch>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "branchcode",
+  "Koha::Schema::Result::Branch",
+  { branchcode => "branchcode" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "CASCADE",
+    on_update     => "CASCADE",
+  },
+);
+
+=head2 itemnumber
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Item>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "itemnumber",
+  "Koha::Schema::Result::Item",
+  { itemnumber => "itemnumber" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "CASCADE",
+    on_update     => "CASCADE",
+  },
+);
+
+=head2 itemtype
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Itemtype>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "itemtype",
+  "Koha::Schema::Result::Itemtype",
+  { itemtype => "itemtype" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "CASCADE",
+    on_update     => "CASCADE",
+  },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-25 23:50:29
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0dtkOcX0Cuc8MdpKxhcPUA
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
-- 
2.1.4