Lines 550-572
my $export_user_email = undef;
Link Here
|
550 |
|
550 |
|
551 |
if ($template_name eq 'catalogue/results.tt' && $export && $preferred_format && C4::Context->preference('SearchEngine') eq 'Elasticsearch') { |
551 |
if ($template_name eq 'catalogue/results.tt' && $export && $preferred_format && C4::Context->preference('SearchEngine') eq 'Elasticsearch') { |
552 |
|
552 |
|
553 |
my $uid; |
553 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
554 |
my $userenv = C4::Context->userenv; |
554 |
|
555 |
if ($userenv) { |
555 |
if ($patron) { |
556 |
$uid = $userenv->{number}; |
556 |
if ($patron->email) { |
557 |
if ($userenv->{emailaddress}) { |
557 |
$export_user_email = $patron->email; |
558 |
$export_user_email = $userenv->{emailaddress}; |
|
|
559 |
} |
558 |
} |
560 |
else { |
559 |
else { |
561 |
die "Unable to fetch user email"; |
560 |
die "Unable to fetch user email"; |
562 |
} |
561 |
} |
563 |
} |
562 |
} |
564 |
else { |
563 |
else { |
565 |
die "Unable to fetch userenv"; |
564 |
die "Unable to fetch user"; |
566 |
} |
565 |
} |
567 |
|
566 |
|
568 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
|
|
569 |
|
570 |
if (!($patron && $patron->has_permission({ tools => 'export_catalog' }))) { |
567 |
if (!($patron && $patron->has_permission({ tools => 'export_catalog' }))) { |
571 |
die "Missing permission \"export_catalog\" required for exporting search results"; |
568 |
die "Missing permission \"export_catalog\" required for exporting search results"; |
572 |
} |
569 |
} |
Lines 647-653
if ($template_name eq 'catalogue/results.tt' && $export && $preferred_format &&
Link Here
|
647 |
filename => $filename, |
644 |
filename => $filename, |
648 |
dir => $category, |
645 |
dir => $category, |
649 |
filesize => $size, |
646 |
filesize => $size, |
650 |
owner => $uid, |
647 |
owner => $borrowernumber, |
651 |
uploadcategorycode => 'search_marc_export', |
648 |
uploadcategorycode => 'search_marc_export', |
652 |
public => 0, |
649 |
public => 0, |
653 |
permanent => 1, |
650 |
permanent => 1, |
654 |
- |
|
|