Line 0
Link Here
|
|
|
1 |
#!/usr/bin/perl |
2 |
|
3 |
# Copyright 2000-2002 Katipo Communications |
4 |
# Copyright 2004-2010 BibLibre |
5 |
# |
6 |
# This file is part of Koha. |
7 |
# |
8 |
# Koha is free software; you can redistribute it and/or modify it |
9 |
# under the terms of the GNU General Public License as published by |
10 |
# the Free Software Foundation; either version 3 of the License, or |
11 |
# (at your option) any later version. |
12 |
# |
13 |
# Koha is distributed in the hope that it will be useful, but |
14 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
# GNU General Public License for more details. |
17 |
# |
18 |
# You should have received a copy of the GNU General Public License |
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
20 |
|
21 |
use Modern::Perl; |
22 |
|
23 |
use CGI; |
24 |
use C4::Output qw( output_html_with_http_headers ); |
25 |
use C4::Auth qw( get_template_and_user haspermission ); |
26 |
use C4::Biblio qw( ModBiblio ); |
27 |
use C4::Context; |
28 |
use Koha::DateUtils qw( dt_from_string ); |
29 |
use Koha::Biblios; |
30 |
use Koha::RecordSources; |
31 |
use Koha::SearchEngine; |
32 |
use Koha::SearchEngine::Indexer; |
33 |
use URI::Escape qw( uri_escape_utf8 ); |
34 |
|
35 |
# ======================== |
36 |
# MAIN |
37 |
#========================= |
38 |
my $input = CGI->new; |
39 |
my $biblionumber = $input->param('biblionumber'); |
40 |
my $record_source_id = $input->param('record_source_id') // ''; |
41 |
my $save = $input->param('save') // ''; |
42 |
my $biblio = Koha::Biblios->find($biblionumber); |
43 |
|
44 |
if ($save) { |
45 |
$biblio->metadata->set( { record_source_id => $record_source_id } )->store; |
46 |
my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
47 |
$indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" ); |
48 |
print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber"); |
49 |
} |
50 |
|
51 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
52 |
{ |
53 |
template_name => "cataloguing/record_source.tt", |
54 |
query => $input, |
55 |
type => "intranet", |
56 |
flagsrequired => { editcatalogue => 'set_record_sources' }, |
57 |
} |
58 |
); |
59 |
|
60 |
my $record_sources = Koha::RecordSources->search(); |
61 |
|
62 |
$template->param( |
63 |
biblio => $biblio, |
64 |
record_sources => $record_sources, |
65 |
current_source => { record_source_id => $biblio->metadata->record_source_id }, |
66 |
); |
67 |
|
68 |
output_html_with_http_headers $input, $cookie, $template->output; |