Bug 10357: Adding link for email notification for new subscription issues to opac-detail

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 <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Re-tested, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Aleisha Amohia 2017-02-06 21:26:54 +00:00 committed by Kyle M Hall
parent 7cbd956127
commit 925734ee78
6 changed files with 50 additions and 12 deletions

View file

@ -25,7 +25,7 @@
<h4>[% bibliotitle %]</h4>
[% IF ( notes ) %]<p>[% notes %]</p>[% END %]
<input type="hidden" name="externalid" value="[% externalid %]">
<input type="hidden" name="alerttype" value="issue">
<input type="hidden" name="alerttype" value="[% alerttype %]">
<input type="hidden" name="biblionumber" value="[% biblionumber %]">
<input type="hidden" name="op" value="alert_confirmed">
<input type="submit" class="btn" value="Yes">
@ -39,7 +39,7 @@
<h4>[% bibliotitle %]</h4>
[% IF ( notes ) %]<p>[% notes %]</p>[% END %]
<input type="hidden" name="externalid" value="[% externalid %]">
<input type="hidden" name="alerttype" value="issue">
<input type="hidden" name="alerttype" value="[% alerttype %]">
<input type="hidden" name="biblionumber" value="[% biblionumber %]">
<input type="hidden" name="op" value="cancel_confirmed">
<input type="submit" value="Yes" class="btn">

View file

@ -810,6 +810,17 @@
<p>[% subscription.subscriptionnotes FILTER html_line_break %] </p>
[% END %]
<p>Subscription from: [% subscription.histstartdate | $KohaDates %] to:[% IF ( subscription.histenddate ) %] [% subscription.histenddate | $KohaDates %] [% ELSE %] now (current)[% END %]</p>
[% IF ( subscription.letter ) %]<span class="email_notifications">
[% IF ( loggedinusername ) %]
[% IF ( subscription.hasalert ) %]
You have subscribed to email notification on new issues. <a style="color:#000;" class="btn" title="Cancel email notification" href="/cgi-bin/koha/opac-alert-subscribe.pl?op=cancel&amp;externalid=[% subscription.subscriptionid %]&amp;alerttype=issue_det&amp;biblionumber=[% subscription.biblionumber %]">Cancel email notification</a>
[% ELSE %]
<a style="color:#000;" class="btn" title="Subscribe to email notification on new issues" href="/cgi-bin/koha/opac-alert-subscribe.pl?externalid=[% subscription.subscriptionid %]&amp;alerttype=issue_det&amp;biblionumber=[% subscription.biblionumber %]">Subscribe to email notification on new issues</a>
[% END %]
[% ELSE %]
You must log in if you want to subscribe to email notification on new issues
[% END %]
</span>[% END %]
[% IF ( subscription.missinglist ) %]
<p>Missing issues: [% subscription.missinglist %] </p>
[% END %]

View file

@ -137,11 +137,11 @@
[% IF ( subscription_LOO.letter ) %]
[% IF ( loggedinusername ) %]
[% IF ( subscription_LOO.hasalert ) %]
You have subscribed to email notification on new issues <a href="opac-alert-subscribe.pl?op=cancel&amp;externalid=[% subscription_LOO.subscriptionid %]&amp;alerttype=issue&amp;biblionumber=[% subscription_LOO.biblionumber %]" class="btn" title="Cancel email notification">
You have subscribed to email notification on new issues <a href="opac-alert-subscribe.pl?op=cancel&amp;externalid=[% subscription_LOO.subscriptionid %]&amp;alerttype=issue_ser&amp;biblionumber=[% subscription_LOO.biblionumber %]" class="btn" title="Cancel email notification">
Cancel email notification
</a>
[% ELSE %]
<a href="opac-alert-subscribe.pl?externalid=[% subscription_LOO.subscriptionid %]&amp;alerttype=issue&amp;biblionumber=[% subscription_LOO.biblionumber %]" class="btn" title="Subscribe to email notification on new issues">
<a href="opac-alert-subscribe.pl?externalid=[% subscription_LOO.subscriptionid %]&amp;alerttype=issue_ser&amp;biblionumber=[% subscription_LOO.biblionumber %]" class="btn" title="Subscribe to email notification on new issues">
Subscribe to email notification on new issues
</a>
[% END %]

View file

@ -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 {
}
}

View file

@ -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;
}

View file

@ -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;
}