Bugzilla – Attachment 62247 Details for
Bug 17602
Integrate support for RecordedBooks (formerly OneClickDigital) API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17602 Koha::ExternalContent->koha_patron() will return undef rather than die if user not logged in
Bug-17602-KohaExternalContent-kohapatron-will-retu.patch (text/plain), 2.17 KB, created by
Srdjan Jankovic
on 2017-04-18 02:44:31 UTC
(
hide
)
Description:
Bug 17602 Koha::ExternalContent->koha_patron() will return undef rather than die if user not logged in
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2017-04-18 02:44:31 UTC
Size:
2.17 KB
patch
obsolete
>From 181d2b000119a56005a1d19c3cb4028136de547d Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Tue, 18 Apr 2017 14:33:38 +1200 >Subject: [PATCH] Bug 17602 Koha::ExternalContent->koha_patron() will retutn > undef rather than die if user not logged in > >--- > Koha/ExternalContent.pm | 2 +- > Koha/ExternalContent/OverDrive.pm | 11 ++++++++--- > 2 files changed, 9 insertions(+), 4 deletions(-) > >diff --git a/Koha/ExternalContent.pm b/Koha/ExternalContent.pm >index 7f5d8ed..567d589 100644 >--- a/Koha/ExternalContent.pm >+++ b/Koha/ExternalContent.pm >@@ -86,7 +86,7 @@ sub koha_patron { > } > > my $id = $self->get_from_koha_session('number') >- or die "No patron number in session"; >+ or return; > my $patron = Koha::Patrons->find($id) > or die "Invalid patron number in session"; > return $self->_koha_patron_accessor($patron); >diff --git a/Koha/ExternalContent/OverDrive.pm b/Koha/ExternalContent/OverDrive.pm >index 4cde086..da84a4d 100644 >--- a/Koha/ExternalContent/OverDrive.pm >+++ b/Koha/ExternalContent/OverDrive.pm >@@ -135,7 +135,9 @@ sub auth_by_code { > $access_token or die "Invalid OverDrive code returned"; > $self->set_token_in_koha_session($access_token, $access_token_type); > >- $self->koha_patron->set({overdrive_auth_token => $auth_token})->store; >+ if (my $koha_patron = $self->koha_patron) { >+ $koha_patron->set({overdrive_auth_token => $auth_token})->store; >+ } > return $self->get_return_page_from_koha_session; > } > >@@ -202,7 +204,8 @@ sub is_logged_in { > sub auth_by_saved_token { > my $self = shift; > >- my $koha_patron = $self->koha_patron; >+ my $koha_patron = $self->koha_patron or return; >+ > if (my $auth_token = $koha_patron->overdrive_auth_token) { > my ($access_token, $access_token_type, $new_auth_token) > = $self->client->auth_by_token($auth_token); >@@ -224,7 +227,9 @@ sub forget { > my $self = shift; > > $self->set_token_in_koha_session("", ""); >- $self->koha_patron->set({overdrive_auth_token => undef})->store; >+ if (my $koha_patron = $self->koha_patron) { >+ $koha_patron->set({overdrive_auth_token => undef})->store; >+ } > } > > use vars qw{$AUTOLOAD}; >-- >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 17602
:
57402
|
57403
|
57404
|
60855
|
60856
|
60857
|
61866
|
61932
|
62247
|
62248
|
62249
|
62250
|
63392
|
63778
|
63779
|
63780
|
63857
|
64070
|
64071
|
64095
|
64096
|
64098
|
64099
|
64100
|
65988
|
65989
|
66341
|
66342
|
66343
|
67236
|
67237
|
67238
|
67240
|
67859
|
67860
|
69019
|
69020
|
69021
|
69022
|
69023
|
69024
|
69025
|
69026
|
69027
|
69101
|
69357
|
69358
|
69359
|
73708
|
73709
|
73710
|
73711
|
73712
|
73713
|
73714
|
73715
|
73716
|
73717
|
73718
|
73719
|
73725
|
76180
|
76181
|
76182
|
76183
|
76184
|
76185
|
76186
|
76187
|
76188
|
76189
|
76190
|
76191
|
76192
|
76193
|
78602
|
78603
|
78604
|
78605
|
78606
|
78607
|
78608
|
78609
|
78610
|
78611
|
78612
|
78613
|
78614
|
78615
|
79247
|
79668
|
79669
|
79670
|
79671
|
79672
|
79673
|
79674
|
79675
|
79676
|
79677
|
79678
|
79679
|
79680
|
79681
|
79682
|
79752