Bugzilla – Attachment 164635 Details for
Bug 35969
Improve error message, remove some logging when sending a cart from the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35969: Add error code in opac-sendbasket.pl
Bug-35969-Add-error-code-in-opac-sendbasketpl.patch (text/plain), 4.29 KB, created by
Emily Lamancusa (emlam)
on 2024-04-10 20:28:50 UTC
(
hide
)
Description:
Bug 35969: Add error code in opac-sendbasket.pl
Filename:
MIME Type:
Creator:
Emily Lamancusa (emlam)
Created:
2024-04-10 20:28:50 UTC
Size:
4.29 KB
patch
obsolete
>From b24053195445c3a29d51beabecf187449584ae43 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 1 Feb 2024 07:55:55 +0000 >Subject: [PATCH] Bug 35969: Add error code in opac-sendbasket.pl > >No need to carp about empty basket or no reply address. >Just add a simple explanation on the form. > >Note that it makes no sense to show the form if the patron >has no email address. We need it as reply-to. > >Test plan: >Try opac-sendbasket.pl?bib_list=null >Remove email address from your account, try again. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >--- > .../en/modules/opac-sendbasketform.tt | 8 ++++- > opac/opac-sendbasket.pl | 31 +++++++------------ > 2 files changed, 19 insertions(+), 20 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt >index edfec7b919..75ab018779 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt >@@ -22,7 +22,13 @@ > > [% IF ( error ) %] > <div class="alert alert-warning"> >- <p>There was an error sending the cart.</p> >+ [% IF error == 'NO_BODY' %] >+ <p>There was an error sending the cart: No valid biblio records found.</p> >+ [% ELSIF error == 'NO_REPLY_ADDRESS' %] >+ <p>Since we do not have your email address, we cannot send a mail. We need your email address as reply-to address.</p> >+ [% ELSE %] >+ <p>There was an error sending the cart.</p> >+ [% END %] > </div> > [% END %] > >diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl >index 65dc94b9e6..de984d01c3 100755 >--- a/opac/opac-sendbasket.pl >+++ b/opac/opac-sendbasket.pl >@@ -21,13 +21,9 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use Encode; >-use Carp qw( carp ); >-use Try::Tiny qw( catch try ); > >-use C4::Biblio qw( >- GetMarcSubjects >-); >-use C4::Auth qw( get_template_and_user ); >+use C4::Auth qw( get_template_and_user ); >+use C4::Biblio qw(GetMarcSubjects); > use C4::Output qw( output_html_with_http_headers ); > use C4::Templates; > use Koha::Biblios; >@@ -43,16 +39,14 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > type => "opac", > } > ); >+my $patron = Koha::Patrons->find($borrowernumber); >+my $user_email = $patron ? $patron->notice_email_address : undef; > > my $op = $query->param('op') || q{}; > my $bib_list = $query->param('bib_list') || ''; > my $email_add = $query->param('email_add'); > >-if ( $op eq "cud-send" && $email_add ) { >- >- my $patron = Koha::Patrons->find($borrowernumber); >- my $user_email = $patron->notice_email_address; >- >+if ( $op eq "cud-send" && $email_add && $user_email ) { > my $comment = $query->param('comment'); > > my @bibs = split( /\//, $bib_list ); >@@ -63,12 +57,7 @@ if ( $op eq "cud-send" && $email_add ) { > } > > if ( !defined $iso2709 ) { >- carp "Error sending mail: empty basket"; >- $template->param( error => 1 ); >- } >- elsif ( !defined $user_email or $user_email eq '' ) { >- carp "Error sending mail: sender's email address is invalid"; >- $template->param( error => 1 ); >+ $template->param( error => 'NO_BODY' ); > } > else { > my %loops = ( biblio => \@bibs, ); >@@ -111,8 +100,12 @@ if ( $op eq "cud-send" && $email_add ) { > $template->param( email_add => $email_add ); > output_html_with_http_headers $query, $cookie, $template->output, undef, > { force_no_caching => 1 }; >-} >-else { >+ >+} elsif( !$user_email ) { >+ $template->param( email_add => 1, error => 'NO_REPLY_ADDRESS' ); >+ output_html_with_http_headers $query, $cookie, $template->output; >+ >+} else { > my $new_session_id = $query->cookie('CGISESSID'); > $template->param( > bib_list => $bib_list, >-- >2.34.1
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 35969
:
161713
|
161795
|
161804
|
163773
|
163774
| 164635 |
164636