From 925734ee781c3d64b8e360c34f7036d335fce67d Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 6 Feb 2017 21:26:54 +0000 Subject: [PATCH] Bug 10357: Adding link for email notification for new subscription issues to opac-detail MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds the link to the opac-detail.pl page so it is less hard to find. Update: Fixing link to look like button, adding span ID around element Update: Changing ID to Class Update: Comment 14 fixes To test: 1) Add a subscription, attach it to a record and select a notice under 'Patron notification'. Hit Next, fill in some fields and save the subscription 2) Go to that record detail page in the OPAC. Go to the subscriptions tab, click 'More details'. Notice how many clicks it takes to see the 'Subscribe' button 3) Apply patch and go back to the details page for the record 4) Notice now there is a 'subscribe' button 5) Confirm this button works as expected and you are redirected to the detail page 6) Confirm 'Cancel' works and redirect works too 7) Go down to 'More details' and confirm the buttons work and you are redirected back to the serial-issues plage from here Sponsored-by: Catalyst IT Signed-off-by: Séverine QUEUNE Signed-off-by: Séverine QUEUNE Followed test plan, works as expected. Signed-off-by: Marc Véron Re-tested, works as expected. Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../en/modules/opac-alert-subscribe.tt | 4 ++-- .../bootstrap/en/modules/opac-detail.tt | 11 +++++++++++ .../en/modules/opac-serial-issues.tt | 4 ++-- opac/opac-alert-subscribe.pl | 19 ++++++++++++++----- opac/opac-detail.pl | 13 ++++++++++++- opac/opac-serial-issues.pl | 11 +++++++++-- 6 files changed, 50 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscribe.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscribe.tt index d4b79c5e3d..f195feb57a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscribe.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscribe.tt @@ -25,7 +25,7 @@

[% bibliotitle %]

[% IF ( notes ) %]

[% notes %]

[% END %] - + @@ -39,7 +39,7 @@

[% bibliotitle %]

[% IF ( notes ) %]

[% notes %]

[% END %] - + diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index ca6e1b1578..8a386e5ec1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -810,6 +810,17 @@

[% subscription.subscriptionnotes FILTER html_line_break %]

[% END %]

Subscription from: [% subscription.histstartdate | $KohaDates %] to:[% IF ( subscription.histenddate ) %] [% subscription.histenddate | $KohaDates %] [% ELSE %] now (current)[% END %]

+ [% IF ( subscription.letter ) %][% END %] [% IF ( subscription.missinglist ) %]

Missing issues: [% subscription.missinglist %]

[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt index 4517ffc44f..75484e9785 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt @@ -137,11 +137,11 @@ [% IF ( subscription_LOO.letter ) %] [% IF ( loggedinusername ) %] [% IF ( subscription_LOO.hasalert ) %] - You have subscribed to email notification on new issues + You have subscribed to email notification on new issues Cancel email notification [% ELSE %] - + Subscribe to email notification on new issues [% END %] diff --git a/opac/opac-alert-subscribe.pl b/opac/opac-alert-subscribe.pl index 86a72fe32c..eec71f3423 100755 --- a/opac/opac-alert-subscribe.pl +++ b/opac/opac-alert-subscribe.pl @@ -53,10 +53,14 @@ my $biblionumber = $query->param('biblionumber'); if ( $op eq 'alert_confirmed' ) { addalert( $loggedinuser, $alerttype, $externalid ); - if ( $alerttype eq 'issue' ) { + if ( $alerttype eq 'issue_ser' ) { print $query->redirect( "opac-serial-issues.pl?biblionumber=$biblionumber"); exit; + } elsif ( $alerttype eq 'issue_det' ) { + print $query->redirect( + "opac-detail.pl?biblionumber=$biblionumber"); + exit; } } elsif ( $op eq 'cancel_confirmed' ) { @@ -66,25 +70,30 @@ elsif ( $op eq 'cancel_confirmed' ) { { # we are supposed to have only 1 result, but just in case... delalert( $_->{alertid} ); } - if ( $alerttype eq 'issue' ) { + if ( $alerttype eq 'issue_ser' ) { print $query->redirect( "opac-serial-issues.pl?biblionumber=$biblionumber"); exit; + } elsif ( $alerttype eq 'issue_det' ) { + print $query->redirect( + "opac-detail.pl?biblionumber=$biblionumber"); + exit; } + } else { - if ( $alerttype eq 'issue' ) { # alert for subscription issues + if ( $alerttype eq 'issue_ser' || $alerttype eq 'issue_det' ) { # alert for subscription issues my $subscription = &GetSubscription($externalid); $template->param( + alerttype => $alerttype, "typeissue$op" => 1, bibliotitle => $subscription->{bibliotitle}, notes => $subscription->{notes}, externalid => $externalid, biblionumber => $biblionumber, ); - } - else { + } else { } } diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index bb521e2f6f..622c1fc650 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -40,6 +40,7 @@ use C4::XSLT; use C4::ShelfBrowser; use C4::Reserves; use C4::Charset; +use C4::Letters; use MARC::Record; use MARC::Field; use List::MoreUtils qw/any none/; @@ -570,15 +571,25 @@ foreach my $subscription (@subscriptions) { $cell{histstartdate} = $subscription->{histstartdate}; $cell{histenddate} = $subscription->{histenddate}; $cell{branchcode} = $subscription->{branchcode}; - $cell{hasalert} = $subscription->{hasalert}; $cell{callnumber} = $subscription->{callnumber}; $cell{closed} = $subscription->{closed}; + $cell{letter} = $subscription->{letter}; + $cell{biblionumber} = $subscription->{biblionumber}; #get the three latest serials. $serials_to_display = $subscription->{opacdisplaycount}; $serials_to_display = C4::Context->preference('OPACSerialIssueDisplayCount') unless $serials_to_display; $cell{opacdisplaycount} = $serials_to_display; $cell{latestserials} = GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display ); + if ( $borrowernumber ) { + my $sub = getalert($borrowernumber,'issue_det',$subscription->{subscriptionid}); + if ( !defined $sub ) { + $sub = getalert($borrowernumber,'issue_ser',$subscription->{subscriptionid}); + } + if (@$sub[0]) { + $cell{hasalert} = 1; + } + } push @subs, \%cell; } diff --git a/opac/opac-serial-issues.pl b/opac/opac-serial-issues.pl index 5b807ea7b5..6a55a1de90 100755 --- a/opac/opac-serial-issues.pl +++ b/opac/opac-serial-issues.pl @@ -62,7 +62,11 @@ if ( $selectview eq "full" ) { # now, check is there is an alert subscription for one of the subscriptions if ($loggedinuser) { foreach (@$subscriptions) { - if (getalert($loggedinuser,'issue',$_->{subscriptionid})) { + my $sub = getalert($loggedinuser,'issue_ser',$_->{subscriptionid}); + if (!defined $sub) { + $sub = getalert($loggedinuser,'issue_det',$_->{subscriptionid}); + } + if ($sub) { $_->{hasalert} = 1; } } @@ -101,7 +105,10 @@ else { # now, check is there is an alert subscription for one of the subscriptions if ($loggedinuser){ foreach (@$subscriptions) { - my $subscription = getalert($loggedinuser,'issue',$_->{subscriptionid}); + my $subscription = getalert($loggedinuser,'issue_ser',$_->{subscriptionid}); + if (!defined $subscription) { + $subscription = getalert($loggedinuser,'issue_det',$_->{subscriptionid}); + } if (@$subscription[0]) { $_->{hasalert} = 1; } -- 2.39.5