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 |
} |