Bugzilla – Attachment 62000 Details for
Bug 18408
Remainder of title (245$b) in Koha::Biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18408: Store $record in Koha::Biblio and invalidate it when ->store
Bug-18408-Store-record-in-KohaBiblio-and-invalidat.patch (text/plain), 1.86 KB, created by
Lari Taskula
on 2017-04-10 12:36:14 UTC
(
hide
)
Description:
Bug 18408: Store $record in Koha::Biblio and invalidate it when ->store
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2017-04-10 12:36:14 UTC
Size:
1.86 KB
patch
obsolete
>From 1e4126a0e3ad5a9f65b168af5f384b4c1461ddc6 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@jns.fi> >Date: Mon, 10 Apr 2017 12:32:11 +0000 >Subject: [PATCH] Bug 18408: Store $record in Koha::Biblio and invalidate it > when ->store > >--- > Koha/Biblio.pm | 15 ++++++++++++++- > t/db_dependent/Koha/Biblios.t | 15 ++++++++++++++- > 2 files changed, 28 insertions(+), 2 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 2e7b6e2..5fc47c9 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -381,10 +381,23 @@ Returns the Remainder of title, 245$b. > sub title_remainder { > my ($self) = @_; > >- return unless my $record = C4::Biblio::GetMarcBiblio($self->biblionumber); >+ $self->{_record} ||= C4::Biblio::GetMarcBiblio($self->biblionumber); >+ return unless my $record = $self->{_record}; > return $record->subfield('245','b'); > } > >+=head3 store >+ >+=cut >+ >+sub store { >+ my ($self) = @_; >+ >+ $self->{_record} = undef; >+ >+ $self->SUPER::store; >+} >+ > =head3 type > > =cut >diff --git a/t/db_dependent/Koha/Biblios.t b/t/db_dependent/Koha/Biblios.t >index b46d433..0a3d5dd 100644 >--- a/t/db_dependent/Koha/Biblios.t >+++ b/t/db_dependent/Koha/Biblios.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > > use C4::Biblio; > use C4::Items; >@@ -125,6 +125,19 @@ subtest 'title_remainder' => sub { > is($biblio->title_remainder, 'Remainder', 'Got remainder of title'); > }; > >+subtest 'store' => sub { >+ plan tests => 2; >+ >+ my ($bibnum, $title, $bibitemnum) = create_helper_biblio('BK'); >+ >+ my $biblio = Koha::Biblios->find($bibnum); >+ $biblio->title_remainder; >+ is(ref($biblio->{_record}), 'MARC::Record', >+ 'MARC::Record is cached in the object'); >+ $biblio->store; >+ is($biblio->{_record}, undef, 'store invalidates ->{_record}'); >+}; >+ > $schema->storage->txn_rollback; > > >-- >2.7.4
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 18408
:
61999
| 62000