Bugzilla – Attachment 153782 Details for
Bug 28130
Show list of serial email alerts a patron subscribed to in patron account in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28130: (QA follow-up) Tidy
Bug-28130-QA-follow-up-Tidy.patch (text/plain), 9.08 KB, created by
Nick Clemens (kidclamp)
on 2023-07-21 13:07:25 UTC
(
hide
)
Description:
Bug 28130: (QA follow-up) Tidy
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-07-21 13:07:25 UTC
Size:
9.08 KB
patch
obsolete
>From 2d497e80f11e09dd378fa572a1d7d106c3ea57bd Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 21 Jul 2023 13:00:10 +0000 >Subject: [PATCH] Bug 28130: (QA follow-up) Tidy > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Patron.pm | 6 ++--- > members/alert-subscriptions.pl | 30 ++++++++++++---------- > opac/opac-alert-subscribe.pl | 43 ++++++++++++-------------------- > opac/opac-alert-subscriptions.pl | 20 ++++++++------- > t/db_dependent/Koha/Patron.t | 10 ++++---- > 5 files changed, 52 insertions(+), 57 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 4e1bda23d41..006793711de 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -2499,12 +2499,12 @@ Return a Koha::Subscriptions object containing subscriptions for which the patro > =cut > > sub alert_subscriptions { >- my ( $self ) = @_; >+ my ($self) = @_; > >- my @alerts = $self->_result->alerts; >+ my @alerts = $self->_result->alerts; > my @subscription_ids = map { $_->externalid } @alerts; > >- return Koha::Subscriptions->search({ subscriptionid => \@subscription_ids }); >+ return Koha::Subscriptions->search( { subscriptionid => \@subscription_ids } ); > } > > =head2 Internal methods >diff --git a/members/alert-subscriptions.pl b/members/alert-subscriptions.pl >index 82fc894e275..f1bd12cffc9 100755 >--- a/members/alert-subscriptions.pl >+++ b/members/alert-subscriptions.pl >@@ -28,29 +28,33 @@ use Koha::Patrons; > my $input = CGI->new; > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >- { template_name => "members/alert-subscriptions.tt", >- query => $input, >- type => "intranet", >- flagsrequired => { serials => '*' }, >+ { >+ template_name => "members/alert-subscriptions.tt", >+ query => $input, >+ type => "intranet", >+ flagsrequired => { serials => '*' }, > } > ); > > my $borrowernumber = $input->param('borrowernumber'); > >-my $logged_in_user = Koha::Patrons->find( $loggedinuser ); >-my $patron = Koha::Patrons->find( $borrowernumber ); >-output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); >+my $logged_in_user = Koha::Patrons->find($loggedinuser); >+my $patron = Koha::Patrons->find($borrowernumber); >+output_and_exit_if_error( >+ $input, $cookie, $template, >+ { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } >+); > > my $subscription_id = $input->param('subscription_id'); >-if ( $subscription_id ) { >- my $subscription = Koha::Subscriptions->find( $subscription_id ); >- $subscription->remove_subscriber( $patron ); >- print $input->redirect("/cgi-bin/koha/members/alert-subscriptions.pl?borrowernumber=".$borrowernumber); >+if ($subscription_id) { >+ my $subscription = Koha::Subscriptions->find($subscription_id); >+ $subscription->remove_subscriber($patron); >+ print $input->redirect( "/cgi-bin/koha/members/alert-subscriptions.pl?borrowernumber=" . $borrowernumber ); > } > > $template->param( >- patron => $patron, >- alertsview => 1, >+ patron => $patron, >+ alertsview => 1, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/opac/opac-alert-subscribe.pl b/opac/opac-alert-subscribe.pl >index 1d37d945630..641c08cb224 100755 >--- a/opac/opac-alert-subscribe.pl >+++ b/opac/opac-alert-subscribe.pl >@@ -17,7 +17,6 @@ > # 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 CGI qw ( -utf8 ); > use C4::Auth qw( get_template_and_user ); >@@ -25,68 +24,58 @@ use C4::Output qw( output_html_with_http_headers ); > use C4::Context; > use C4::Serials qw( GetSubscription ); > >- > my $query = CGI->new; > my $op = $query->param('op') || ''; > my $dbh = C4::Context->dbh; > > my ( $template, $loggedinuser, $cookie ); > my $subscriptionid = $query->param('subscriptionid'); >-my $referer = $query->param('referer') || 'detail'; >-my $biblionumber = $query->param('biblionumber'); >+my $referer = $query->param('referer') || 'detail'; >+my $biblionumber = $query->param('biblionumber'); > > ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { > template_name => "opac-alert-subscribe.tt", > query => $query, > type => "opac", >- authnotrequired => 0, # user must logged in to request >- # subscription notifications >+ authnotrequired => 0, # user must logged in to request >+ # subscription notifications > } > ); > >-my $subscription = Koha::Subscriptions->find( $subscriptionid ); >-my $logged_in_patron = Koha::Patrons->find( $loggedinuser ); >+my $subscription = Koha::Subscriptions->find($subscriptionid); >+my $logged_in_patron = Koha::Patrons->find($loggedinuser); > > if ( $op eq 'alert_confirmed' ) { >- $subscription->add_subscriber( $logged_in_patron ); >+ $subscription->add_subscriber($logged_in_patron); > if ( $referer eq 'serial' ) { >- print $query->redirect( >- "opac-serial-issues.pl?biblionumber=$biblionumber"); >+ print $query->redirect("opac-serial-issues.pl?biblionumber=$biblionumber"); > exit; > } else { >- print $query->redirect( >- "opac-detail.pl?biblionumber=$biblionumber"); >+ print $query->redirect("opac-detail.pl?biblionumber=$biblionumber"); > exit; > } >-} >-elsif ( $op eq 'cancel_confirmed' ) { >- $subscription->remove_subscriber( $logged_in_patron ); >+} elsif ( $op eq 'cancel_confirmed' ) { >+ $subscription->remove_subscriber($logged_in_patron); > warn "CANCEL confirmed : $loggedinuser, $subscriptionid"; > if ( $referer eq 'serial' ) { >- print $query->redirect( >- "opac-serial-issues.pl?biblionumber=$biblionumber"); >+ print $query->redirect("opac-serial-issues.pl?biblionumber=$biblionumber"); > exit; > } elsif ( $referer eq 'patron' ) { >- print $query->redirect( >- "/cgi-bin/koha/opac-alert-subscriptions.pl" >- ); >+ print $query->redirect("/cgi-bin/koha/opac-alert-subscriptions.pl"); > } else { >- print $query->redirect( >- "opac-detail.pl?biblionumber=$biblionumber"); >+ print $query->redirect("opac-detail.pl?biblionumber=$biblionumber"); > exit; > } > >- >-} >-else { >+} else { > my $subscription = &GetSubscription($subscriptionid); > $template->param( > referer => $referer, > "typeissue$op" => 1, > bibliotitle => $subscription->{bibliotitle}, > notes => $subscription->{notes}, >- subscriptionid => $subscriptionid, >+ subscriptionid => $subscriptionid, > biblionumber => $biblionumber, > ); > } >diff --git a/opac/opac-alert-subscriptions.pl b/opac/opac-alert-subscriptions.pl >index d3a2ccea97d..f6fd488d8e3 100755 >--- a/opac/opac-alert-subscriptions.pl >+++ b/opac/opac-alert-subscriptions.pl >@@ -29,25 +29,27 @@ my $query = CGI->new(); > > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { >- template_name => 'opac-alert-subscriptions.tt', >- query => $query, >- type => 'opac', >+ template_name => 'opac-alert-subscriptions.tt', >+ query => $query, >+ type => 'opac', > } > ); > >-my $patron = Koha::Patrons->find( $borrowernumber ); >+my $patron = Koha::Patrons->find($borrowernumber); > > $template->param( > alertsview => 1, >- patron => $patron, >- referer => 'patron', >+ patron => $patron, >+ referer => 'patron', > ); > > my $new_session_id = $query->cookie('CGISESSID'); > $template->param( >- csrf_token => Koha::Token->new->generate_csrf({ >- session_id => $new_session_id, >- }), >+ csrf_token => Koha::Token->new->generate_csrf( >+ { >+ session_id => $new_session_id, >+ } >+ ), > ); > > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index 80f3b663d8b..b2bdf0e8fff 100755 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -1503,13 +1503,13 @@ subtest 'alert_subscriptions tests' => sub { > > plan tests => 3; > >- my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > >- my $subscription1 = $builder->build_object({ class => 'Koha::Subscriptions' }); >- $subscription1->add_subscriber( $patron ); >+ my $subscription1 = $builder->build_object( { class => 'Koha::Subscriptions' } ); >+ $subscription1->add_subscriber($patron); > >- my $subscription2 = $builder->build_object({ class => 'Koha::Subscriptions' }); >- $subscription2->add_subscriber( $patron ); >+ my $subscription2 = $builder->build_object( { class => 'Koha::Subscriptions' } ); >+ $subscription2->add_subscriber($patron); > > my @subscriptions = $patron->alert_subscriptions->as_list; > >-- >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 28130
:
151550
|
151619
|
151656
|
151657
|
151658
|
151659
|
151814
|
151815
|
153779
|
153780
|
153781
| 153782