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
27 this script modify the status of a subscription to ACCEPTED or to REJECTED
58 * aorr_confirm : to confirm accept or reject
59 * delete_confirm : to confirm the deletion
60 * accepted : to display only accepted.
71 use C4::Auth; # get_template_and_user
74 use C4::Koha; # GetAuthorisedValue
77 my $title = $input->param('title');
78 my $author = $input->param('author');
79 my $note = $input->param('note');
80 my $copyrightdate = $input->param('copyrightdate');
81 my $publishercode = $input->param('publishercode');
82 my $volumedesc = $input->param('volumedesc');
83 my $publicationyear = $input->param('publicationyear');
84 my $place = $input->param('place');
85 my $isbn = $input->param('isbn');
86 my $status = $input->param('status');
87 my $suggestedbyme = $input->param('suggestedbyme');
88 my $op = $input->param('op') || "aorr_confirm";
90 my $dbh = C4::Context->dbh;
91 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
93 template_name => "suggestion/acceptorreject.tmpl",
97 flagsrequired => { catalogue => 1 },
103 if ( $op eq "aorr_confirm" ) {
104 my @suggestionlist = $input->param("aorr");
106 foreach my $suggestion (@suggestionlist) {
107 if ( $suggestion =~ /(A|R)(.*)/ ) {
108 my ( $newstatus, $suggestionid ) = ( $1, $2 );
109 $newstatus = "REJECTED" if $newstatus eq "R";
110 $newstatus = "ACCEPTED" if $newstatus eq "A";
111 my $reason = $input->param( "reason" . $suggestionid );
112 if ( $reason eq "other" ) {
113 $reason = $input->param( "other-reason" . $suggestionid );
115 ModStatus( $suggestionid, $newstatus, $loggedinuser, '', $reason );
119 $suggestions = &SearchSuggestion( "", "", "", "", 'ASKED', "" );
122 if ( $op eq "delete_confirm" ) {
123 my @delete_field = $input->param("delete_field");
124 foreach my $delete_field (@delete_field) {
125 &DelSuggestion( $loggedinuser, $delete_field );
128 $suggestions = &SearchSuggestion( "", "", "", "", 'ASKED', "" );
131 if ( $op eq "accepted" ) {
132 $suggestions = &GetSuggestionByStatus('ACCEPTED');
133 $template->param(done => 1);
136 if ( $op eq "rejected" ) {
137 $suggestions = &GetSuggestionByStatus('REJECTED');
138 $template->param(done => 1);
141 my $reasonsloop = GetAuthorisedValues("SUGGEST");
142 my @suggestions_loop;
143 foreach my $suggestion (@$suggestions) {
144 $suggestion->{'reasonsloop'} = $reasonsloop;
145 push @suggestions_loop, $suggestion;
149 suggestions_loop => \@suggestions_loop,
153 output_html_with_http_headers $input, $cookie, $template->output;