From c7e54b12c72f436b0db890be69d6bf5f1b6acaab Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 24 Apr 2025 13:58:30 +0100 Subject: [PATCH] Bug 39711: Add koha objects for the aqcontract table --- Koha/Acquisition/Contract.pm | 55 ++++++++++++++++++++++++++++++++ Koha/Acquisition/Contracts.pm | 52 ++++++++++++++++++++++++++++++ Koha/Schema/Result/Aqcontract.pm | 20 ++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 Koha/Acquisition/Contract.pm create mode 100644 Koha/Acquisition/Contracts.pm diff --git a/Koha/Acquisition/Contract.pm b/Koha/Acquisition/Contract.pm new file mode 100644 index 00000000000..737a3e9e5e6 --- /dev/null +++ b/Koha/Acquisition/Contract.pm @@ -0,0 +1,55 @@ +package Koha::Acquisition::Contract; + +# 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 Koha::Database; + +use base qw(Koha::Object); + +=head1 NAME + +Koha::Acquisition::Contract - Koha Acquisition Contract Object class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 store + +=cut + +sub store { + my ($self) = @_; + + Koha::Exceptions::MissingParameter->throw("Missing mandatory parameter: booksellerid") + unless $self->booksellerid; + + return $self->SUPER::store(); +} + +=head3 _type + +=cut + +sub _type { + return 'Aqcontract'; +} + +1; diff --git a/Koha/Acquisition/Contracts.pm b/Koha/Acquisition/Contracts.pm new file mode 100644 index 00000000000..e7d21e5ebc8 --- /dev/null +++ b/Koha/Acquisition/Contracts.pm @@ -0,0 +1,52 @@ +package Koha::Acquisition::Contracts; + +# 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 Koha::Database; + +use base qw(Koha::Objects); + +use Koha::Acquisition::Contract; + +=head1 NAME + +Koha::Acquisition::Contracts - Koha Acquisition Contracts Object class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 _type + +=cut + +sub _type { + return 'Aqcontract'; +} + +=head3 object_class (internal) + +=cut + +sub object_class { + return 'Koha::Acquisition::Contract'; +} + +1; diff --git a/Koha/Schema/Result/Aqcontract.pm b/Koha/Schema/Result/Aqcontract.pm index 564d78ff2e8..0451b0766f0 100644 --- a/Koha/Schema/Result/Aqcontract.pm +++ b/Koha/Schema/Result/Aqcontract.pm @@ -124,5 +124,25 @@ __PACKAGE__->belongs_to( # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ar69aHSxYQohZDQ+GtIIqA +=head2 koha_object_class + + Koha Object class + +=cut + +sub koha_object_class { + 'Koha::Acquisition::Contract'; +} + +=head2 koha_objects_class + + Koha Objects class + +=cut + +sub koha_objects_class { + 'Koha::Acquisition::Contracts'; +} + # You can replace this text with custom content, and it will be preserved on regeneration 1; -- 2.48.1