Bugzilla – Attachment 149559 Details for
Bug 33105
Add vendor issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33105: Add Koha object classes
Bug-33105-Add-Koha-object-classes.patch (text/plain), 4.63 KB, created by
PTFS Europe Sandboxes
on 2023-04-12 15:12:09 UTC
(
hide
)
Description:
Bug 33105: Add Koha object classes
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2023-04-12 15:12:09 UTC
Size:
4.63 KB
patch
obsolete
>From 65217c2e8c2531e11bc5cde117d300c2d22c9154 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 11 Apr 2023 23:01:02 +0200 >Subject: [PATCH] Bug 33105: Add Koha object classes > >Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com> >--- > Koha/Acquisition/Bookseller.pm | 12 +++++ > Koha/Acquisition/Bookseller/Issue.pm | 77 +++++++++++++++++++++++++++ > Koha/Acquisition/Bookseller/Issues.pm | 49 +++++++++++++++++ > 3 files changed, 138 insertions(+) > create mode 100644 Koha/Acquisition/Bookseller/Issue.pm > create mode 100644 Koha/Acquisition/Bookseller/Issues.pm > >diff --git a/Koha/Acquisition/Bookseller.pm b/Koha/Acquisition/Bookseller.pm >index 0ce6b9dd95..2fc1c0a95d 100644 >--- a/Koha/Acquisition/Bookseller.pm >+++ b/Koha/Acquisition/Bookseller.pm >@@ -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 > >diff --git a/Koha/Acquisition/Bookseller/Issue.pm b/Koha/Acquisition/Bookseller/Issue.pm >new file mode 100644 >index 0000000000..40e19aad6e >--- /dev/null >+++ b/Koha/Acquisition/Bookseller/Issue.pm >@@ -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; >diff --git a/Koha/Acquisition/Bookseller/Issues.pm b/Koha/Acquisition/Bookseller/Issues.pm >new file mode 100644 >index 0000000000..e797aba163 >--- /dev/null >+++ b/Koha/Acquisition/Bookseller/Issues.pm >@@ -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; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33105
:
149509
|
149510
|
149511
|
149512
|
149513
|
149514
|
149515
|
149530
|
149531
|
149532
|
149556
|
149557
|
149558
|
149559
|
149560
|
149561
|
149562
|
152894
|
152895
|
152896
|
152897
|
152898
|
152899
|
152900
|
153117
|
153118
|
153119
|
153122
|
153123
|
153125
|
153126
|
153127
|
153128
|
153129
|
153130
|
153131
|
153132
|
153133
|
153134
|
153135
|
153136
|
153137
|
153730
|
153731