|
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 URI::Escape qw( uri_escape_utf8 ); |
| 32 |
|
| 33 |
# ======================== |
| 34 |
# MAIN |
| 35 |
#========================= |
| 36 |
my $input = CGI->new; |
| 37 |
my $biblionumber = $input->param('biblionumber'); # if biblionumber exists, it's a modif, not a new biblio. |
| 38 |
my $record_source_id = $input->param('record_source_id') // ''; |
| 39 |
my $save = $input->param('save') // ''; |
| 40 |
|
| 41 |
if ($save ne '') { |
| 42 |
my $biblio = Koha::Biblios->find($biblionumber); |
| 43 |
$biblio->metadata->set({record_source_id => $record_source_id})->store; |
| 44 |
print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber"); |
| 45 |
} |
| 46 |
|
| 47 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
| 48 |
{ |
| 49 |
template_name => "cataloguing/record_source.tt", |
| 50 |
query => $input, |
| 51 |
type => "intranet", |
| 52 |
flagsrequired => { editcatalogue => 'set_record_sources' }, |
| 53 |
}); |
| 54 |
|
| 55 |
my $record_sources = Koha::RecordSources->search(); |
| 56 |
|
| 57 |
$template->param( |
| 58 |
biblionumber => $biblionumber, |
| 59 |
record_sources => $record_sources, |
| 60 |
); |
| 61 |
|
| 62 |
output_html_with_http_headers $input, $cookie, $template->output; |