Bug 33105: Add Koha object classes
Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
1a135e5e8c
commit
56cdee5037
3 changed files with 138 additions and 0 deletions
|
@ -20,6 +20,7 @@ use Modern::Perl;
|
|||
use Koha::Acquisition::Bookseller::Aliases;
|
||||
use Koha::Acquisition::Bookseller::Contacts;
|
||||
use Koha::Acquisition::Bookseller::Interfaces;
|
||||
use Koha::Acquisition::Bookseller::Issues;
|
||||
use Koha::Subscriptions;
|
||||
|
||||
use base qw( Koha::Object );
|
||||
|
@ -137,6 +138,17 @@ sub interfaces {
|
|||
return Koha::Acquisition::Bookseller::Interfaces->_new_from_dbic( $rs );
|
||||
}
|
||||
|
||||
=head3 issues
|
||||
|
||||
my $issues = $vendor->issues
|
||||
|
||||
=cut
|
||||
|
||||
sub issues {
|
||||
my ($self) = @_;
|
||||
my $rs = $self->_result->aqbookseller_issues;
|
||||
return Koha::Acquisition::Bookseller::Issues->_new_from_dbic( $rs );
|
||||
}
|
||||
|
||||
=head3 to_api_mapping
|
||||
|
||||
|
|
77
Koha/Acquisition/Bookseller/Issue.pm
Normal file
77
Koha/Acquisition/Bookseller/Issue.pm
Normal file
|
@ -0,0 +1,77 @@
|
|||
package Koha::Acquisition::Bookseller::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, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
|
||||
use Koha::Database;
|
||||
|
||||
use base qw(Koha::Object);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Koha::Acquisition::Bookseller::Issue - Koha Issue Object class
|
||||
|
||||
=head1 API
|
||||
|
||||
=head2 Class methods
|
||||
|
||||
=head3 strings_map
|
||||
|
||||
=cut
|
||||
|
||||
sub strings_map {
|
||||
my ( $self, $params ) = @_;
|
||||
|
||||
my $strings = {};
|
||||
|
||||
if ( defined $self->type ) {
|
||||
my $type_av_category = 'VENDOR_ISSUE_TYPE';
|
||||
my $av = Koha::AuthorisedValues->search(
|
||||
{
|
||||
category => $type_av_category,
|
||||
authorised_value => $self->type,
|
||||
}
|
||||
);
|
||||
|
||||
my $type_str = $av->count
|
||||
? $params->{public}
|
||||
? $av->next->opac_description
|
||||
: $av->next->lib
|
||||
: $self->type;
|
||||
|
||||
$strings->{type} = {
|
||||
category => 'VENDOR_ISSUE_TYPE',
|
||||
str => $type_str,
|
||||
type => 'av',
|
||||
};
|
||||
}
|
||||
|
||||
return $strings;
|
||||
}
|
||||
|
||||
=head2 Internal methods
|
||||
|
||||
=head3 _type
|
||||
|
||||
=cut
|
||||
|
||||
sub _type {
|
||||
return 'AqbooksellerIssue';
|
||||
}
|
||||
|
||||
1;
|
49
Koha/Acquisition/Bookseller/Issues.pm
Normal file
49
Koha/Acquisition/Bookseller/Issues.pm
Normal file
|
@ -0,0 +1,49 @@
|
|||
package Koha::Acquisition::Bookseller::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, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
|
||||
use Koha::Database;
|
||||
|
||||
use Koha::Acquisition::Bookseller::Issue;
|
||||
|
||||
use base qw(Koha::Objects);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Koha::Acquisition::Bookseller::Issues
|
||||
|
||||
=head1 API
|
||||
|
||||
=head2 Class Methods
|
||||
|
||||
=cut
|
||||
|
||||
=head3 type
|
||||
|
||||
=cut
|
||||
|
||||
sub _type {
|
||||
return 'AqbooksellerIssue';
|
||||
}
|
||||
|
||||
sub object_class {
|
||||
return 'Koha::Acquisition::Bookseller::Issue';
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in a new issue