3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
28 this script modify the status of a subscription to ACCEPTED or to REJECTED
59 * aorr_confirm : to confirm accept or reject
60 * delete_confirm : to confirm the deletion
61 * accepted : to display only accepted.
72 use C4::Auth; # get_template_and_user
75 use C4::Koha; # GetAuthorisedValue
78 my $title = $input->param('title');
79 my $author = $input->param('author');
80 my $note = $input->param('note');
81 my $copyrightdate = $input->param('copyrightdate');
82 my $publishercode = $input->param('publishercode');
83 my $volumedesc = $input->param('volumedesc');
84 my $publicationyear = $input->param('publicationyear');
85 my $place = $input->param('place');
86 my $isbn = $input->param('isbn');
87 my $status = $input->param('status');
88 my $suggestedbyme = $input->param('suggestedbyme');
89 my $op = $input->param('op') || "aorr_confirm";
91 my $dbh = C4::Context->dbh;
92 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
94 template_name => "suggestion/acceptorreject.tmpl",
98 flagsrequired => { catalogue => 1 },
104 if ( $op eq "aorr_confirm" ) {
105 my @suggestionlist = $input->param("aorr");
107 foreach my $suggestion (@suggestionlist) {
108 if ( $suggestion =~ /(A|R)(.*)/ ) {
109 my ( $newstatus, $suggestionid ) = ( $1, $2 );
110 $newstatus = "REJECTED" if $newstatus eq "R";
111 $newstatus = "ACCEPTED" if $newstatus eq "A";
112 my $reason = $input->param( "reason" . $suggestionid );
113 if ( $reason eq "other" ) {
114 $reason = $input->param( "other-reason" . $suggestionid );
116 ModStatus( $suggestionid, $newstatus, $loggedinuser, '', $reason );
120 $suggestions = &SearchSuggestion( "", "", "", "", 'ASKED', "" );
123 if ( $op eq "delete_confirm" ) {
124 my @delete_field = $input->param("delete_field");
125 foreach my $delete_field (@delete_field) {
126 &DelSuggestion( $loggedinuser, $delete_field );
129 $suggestions = &SearchSuggestion( "", "", "", "", 'ASKED', "" );
132 if ( $op eq "accepted" ) {
133 $suggestions = &GetSuggestionByStatus('ACCEPTED');
134 $template->param(done => 1);
137 if ( $op eq "rejected" ) {
138 $suggestions = &GetSuggestionByStatus('REJECTED');
139 $template->param(done => 1);
142 my $reasonsloop = GetAuthorisedValues("SUGGEST");
143 my @suggestions_loop;
144 foreach my $suggestion (@$suggestions) {
145 $suggestion->{'reasonsloop'} = $reasonsloop;
146 push @suggestions_loop, $suggestion;
150 suggestions_loop => \@suggestions_loop,
152 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
153 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
154 IntranetNav => C4::Context->preference("IntranetNav"),
157 output_html_with_http_headers $input, $cookie, $template->output;