use C4::Auth qw( get_template_and_user );
use C4::Biblio qw(
- GetBiblioData
- GetMarcAuthors
- GetMarcBiblio
GetMarcISBN
GetMarcSubjects
);
use C4::Items qw( GetItemsInfo );
-use C4::Output qw( output_html_with_http_headers );
+use C4::Output qw(
+ output_html_with_http_headers
+ output_and_exit
+);
+
+use Koha::Biblios;
use Koha::Email;
use Koha::Virtualshelves;
my $query = CGI->new;
-my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "virtualshelves/sendshelfform.tt",
query => $query,
my $shelfid = $query->param('shelfid');
my $to_address = $query->param('email');
-my $dbh = C4::Context->dbh;
+my $shelf = Koha::Virtualshelves->find( $shelfid );
+
+output_and_exit( $query, $cookie, $template, 'insufficient_permission' )
+ if $shelf && !$shelf->can_be_viewed( $loggedinuser );
if ($to_address) {
my $comment = $query->param('comment');
}
);
- my $shelf = Koha::Virtualshelves->find( $shelfid );
my $contents = $shelf->get_contents;
my $marcflavour = C4::Context->preference('marcflavour');
my $iso2709;
while ( my $content = $contents->next ) {
my $biblionumber = $content->biblionumber;
- my $biblio = Koha::Biblios->find( $biblionumber );
- my $dat = GetBiblioData($biblionumber);
- my $record = GetMarcBiblio({
- biblionumber => $biblionumber,
- embed_items => 1 });
- my $marcauthorsarray = $biblio->get_marc_authors;
+ my $biblio = Koha::Biblios->find( $biblionumber ) or next;
+ my $dat = $biblio->unblessed;
+ my $record = $biblio->metadata->record({ embed_items => 1 });
+ my $marcauthorsarray = $biblio->get_marc_contributors;
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
my @items = GetItemsInfo($biblionumber);