use Koha::Libraries;
use Koha::Patrons;
use Koha::Util::Navigation;
+use URI::Escape;
+use Encode;
-my $input = new CGI;
+my $input = CGI->new;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
print $input->redirect("/cgi-bin/koha/errors/404.pl");
}
-my $problempage = C4::Context->preference('OPACBaseURL') . Koha::Util::Navigation::local_referer($input );
+my $referer = Koha::Util::Navigation::local_referer($input );
+$referer = Encode::decode_utf8 uri_unescape $referer,
my $patron = Koha::Patrons->find($borrowernumber);
+my $library = $patron->library;
my $username = $patron->userid;
-my $branchcode = $patron->branchcode;
-my $library = Koha::Libraries->find($branchcode);
my @messages;
$template->param(
username => $username,
- problempage => $problempage,
+ problempage => $referer,
library => $library,
);
my $subject = $input->param('subject');
my $message = $input->param('message');
my $problempage = $input->param('problempage');
+ $problempage = Encode::decode_utf8 uri_unescape $problempage;
my $recipient = $input->param('recipient') || 'admin';
try {
title => $subject,
content => $message,
borrowernumber => $borrowernumber,
- branchcode => $branchcode,
+ branchcode => $patron->branchcode,
username => $username,
problempage => $problempage,
recipient => $recipient,
my $transport = 'email';
my $reply_address = $patron->email || $patron->emailpro || $patron->B_email;
- if ( $recipient eq 'library' and defined($library->get_effective_email) and $library->get_effective_email ne C4::Context->preference('KohaAdminEmailAddress') ) {
+ if ( $recipient eq 'library' and defined($library->inbound_email_address) and $library->inbound_email_address ne C4::Context->preference('KohaAdminEmailAddress') ) {
# the problem report is intended for a librarian and will be received at a library email address
C4::Letters::EnqueueLetter({
letter => $letter,
borrowernumber => $borrowernumber,
message_transport_type => $transport,
- to_address => $library->get_effective_email,
+ to_address => $library->inbound_email_address,
reply_address => $reply_address,
});
} else {