Bug 20434: Add missing authority types
[koha.git] / serials / subscription-history.pl
blob8934cf1c060cd36815e06bc816bd003be06963cd
1 #!/usr/bin/perl
3 # Copyright 2011-2013 Biblibre SARL
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 =head1 NAME
22 subscription-history.pl
24 =head1 DESCRIPTION
26 Modify subscription history
28 =cut
30 use Modern::Perl;
32 use CGI qw ( -utf8 );
33 use C4::Auth;
34 use C4::Output;
36 use C4::Biblio;
37 use C4::Serials;
38 use Koha::Biblios;
39 use Koha::DateUtils;
41 my $input = new CGI;
42 my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
43 template_name => 'serials/subscription-history.tt',
44 query => $input,
45 type => 'intranet',
46 authnotrequired => 0,
47 flagsrequired => { 'serials' => 'edit_subscription' },
48 debug => 1,
49 } );
51 my $subscriptionid = $input->param('subscriptionid');
52 my $op = $input->param('op');
54 if(!defined $subscriptionid || $subscriptionid eq '') {
55 print $input->redirect('/cgi-bin/koha/serials/serials-home.pl');
56 exit;
59 if($op && $op eq 'mod') {
60 my $histstartdate = $input->param('histstartdate');
61 my $histenddate = $input->param('histenddate');
62 my $receivedlist = $input->param('receivedlist');
63 my $missinglist = $input->param('missinglist');
64 my $opacnote = $input->param('opacnote');
65 my $librariannote = $input->param('librariannote');
67 $histstartdate = output_pref( { str => $histstartdate, dateonly => 1, dateformat => 'iso' } );
68 $histenddate = output_pref( { str => $histenddate, dateonly => 1, dateformat => 'iso' } );
70 ModSubscriptionHistory( $subscriptionid, $histstartdate, $histenddate, $receivedlist, $missinglist, $opacnote, $librariannote );
72 print $input->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
73 exit;
74 } else {
75 my $history = GetSubscriptionHistoryFromSubscriptionId($subscriptionid);
76 my $biblio = Koha::Biblios->find( $history->{biblionumber} );
78 $template->param(
79 subscriptionid => $subscriptionid,
80 title => $biblio->title,
81 histstartdate => $history->{'histstartdate'},
82 histenddate => $history->{'histenddate'},
83 receivedlist => $history->{'recievedlist'},
84 missinglist => $history->{'missinglist'},
85 opacnote => $history->{'opacnote'},
86 librariannote => $history->{'librariannote'},
89 output_html_with_http_headers $input, $cookie, $template->output;