View | Details | Raw Unified | Return to bug 17273
Collapse All | Expand All

(-)a/Koha/Virtualshelf.pm (+18 lines)
Lines 276-281 sub can_biblios_be_removed { Link Here
276
    return 0;
276
    return 0;
277
}
277
}
278
278
279
280
=head3 list_biblionumbers
281
282
Returns an arrayref of all biblionumbers on this list.
283
Note: Caller should still check view permissions, if needed.
284
285
=cut
286
287
sub list_biblionumbers {
288
    my ( $self ) = @_;
289
    my $result = [];
290
    my $contents = $self->get_contents;
291
    while( my $rec = $contents->next ) {
292
        push @$result, $rec->biblionumber;
293
    }
294
    return $result;
295
}
296
279
sub _type {
297
sub _type {
280
    return 'Virtualshelve';
298
    return 'Virtualshelve';
281
}
299
}
(-)a/tools/batch_record_modification.pl (-2 / +33 lines)
Lines 27-35 use C4::Auth qw( get_template_and_user ); Link Here
27
use C4::Output qw( output_html_with_http_headers );
27
use C4::Output qw( output_html_with_http_headers );
28
use C4::AuthoritiesMarc qw( BuildSummary ModAuthority );
28
use C4::AuthoritiesMarc qw( BuildSummary ModAuthority );
29
use C4::BackgroundJob;
29
use C4::BackgroundJob;
30
use C4::Biblio qw( GetMarcBiblio ModBiblio );
30
use C4::Biblio qw( GetMarcBiblio ModBiblio GetMarcFromKohaField );
31
use C4::MarcModificationTemplates qw( GetModificationTemplateActions GetModificationTemplates ModifyRecordWithTemplate );
31
use C4::MarcModificationTemplates qw( GetModificationTemplateActions GetModificationTemplates ModifyRecordWithTemplate );
32
use Koha::MetadataRecord::Authority;
32
use Koha::MetadataRecord::Authority;
33
use Koha::SearchEngine;
34
use Koha::Virtualshelves;
33
35
34
my $input = new CGI;
36
my $input = new CGI;
35
our $dbh = C4::Context->dbh;
37
our $dbh = C4::Context->dbh;
Lines 98-106 if ( $op eq 'form' ) { Link Here
98
    # List all records to process
100
    # List all records to process
99
    my ( @records, @record_ids );
101
    my ( @records, @record_ids );
100
    if ( my $bib_list = $input->param('bib_list') ) {
102
    if ( my $bib_list = $input->param('bib_list') ) {
103
        # TODO Undocumented feature; should be added to interface
101
        # Come from the basket
104
        # Come from the basket
102
        @record_ids = split /\//, $bib_list;
105
        @record_ids = split /\//, $bib_list;
103
        $recordtype = 'biblio';
106
        $recordtype = 'biblio';
107
    } elsif( my $shelfno = $input->param('from_shelf') ) {
108
        # TODO Undocumented feature; should be added to interface
109
        my $shelf = Koha::Virtualshelves->find($shelfno);
110
        @record_ids = $shelf && $shelf->can_be_viewed( $loggedinuser )
111
            ? @{ $shelf->list_biblionumbers }
112
            : ();
113
        $recordtype = 'biblio';
114
    } elsif( my $expr = $input->param('from_search') ) {
115
        # TODO Undocumented feature; should be added to interface
116
        my $engine = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
117
        my ( $err, $results, $count ) = $engine->simple_search_compat( $expr );
118
        @record_ids = @{ _extract_biblionumbers( $results ) };
119
        $recordtype = 'biblio';
104
    } elsif ( my $uploadfile = $input->param('uploadfile') ) {
120
    } elsif ( my $uploadfile = $input->param('uploadfile') ) {
105
        # A file of id is given
121
        # A file of id is given
106
        while ( my $content = <$uploadfile> ) {
122
        while ( my $content = <$uploadfile> ) {
Lines 261-263 $template->param( Link Here
261
);
277
);
262
278
263
output_html_with_http_headers $input, $cookie, $template->output;
279
output_html_with_http_headers $input, $cookie, $template->output;
264
- 
280
281
sub _extract_biblionumbers {
282
    my ( $results ) = @_;
283
    my ( $biblionumbertagfield, $biblionumbertagsubfield ) = &GetMarcFromKohaField( "biblio.biblionumber", '' );
284
    my @biblios;
285
    foreach my $rec ( @$results ) {
286
        my $marcrecordzebra = C4::Search::new_record_from_zebra( 'biblioserver', $rec );
287
        next if ref( $marcrecordzebra ) ne 'MARC::Record';
288
289
        my $bibno = ( $biblionumbertagfield < 10 )
290
            ? $marcrecordzebra->field( $biblionumbertagfield )->data
291
            : $marcrecordzebra->subfield( $biblionumbertagfield, $biblionumbertagsubfield );
292
        push @biblios, $bibno if $bibno;
293
    }
294
    return \@biblios;
295
}

Return to bug 17273