koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/suggestion acceptorreject.pl


From: paul poulain
Subject: [Koha-cvs] koha/suggestion acceptorreject.pl
Date: Fri, 09 Mar 2007 15:14:34 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     paul poulain <tipaul>   07/03/09 15:14:34

Modified files:
        suggestion     : acceptorreject.pl 

Log message:
        rel_3_0 moved to HEAD

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/suggestion/acceptorreject.pl?cvsroot=koha&r1=1.4&r2=1.5

Patches:
Index: acceptorreject.pl
===================================================================
RCS file: /sources/koha/koha/suggestion/acceptorreject.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- acceptorreject.pl   12 Jul 2006 17:03:49 -0000      1.4
+++ acceptorreject.pl   9 Mar 2007 15:14:34 -0000       1.5
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: acceptorreject.pl,v 1.4 2006/07/12 17:03:49 toins Exp $
+# $Id: acceptorreject.pl,v 1.5 2007/03/09 15:14:34 tipaul Exp $
 
 =head1 NAME
 
@@ -54,29 +54,31 @@
 =item suggestedbyme
 
 =item op
+
 op can be :
  * aorr_confirm : to confirm accept or reject
  * delete_confirm : to confirm the deletion
+ * accepted : to display only accepted. 
 
 =back
 
 
 =cut
 
-
 use strict;
 require Exporter;
 use CGI;
-use HTML::Template;
+
 use C4::Auth;       # get_template_and_user
 use C4::Interface::CGI::Output;
 use C4::Suggestions;
+use C4::Koha;    # GetAuthorisedValue
 
 my $input = new CGI;
 my $title = $input->param('title');
 my $author = $input->param('author');
 my $note = $input->param('note');
-my $copyrightdate =$input->param('copyrightdate');
+my $copyrightdate   = $input->param('copyrightdate');
 my $publishercode = $input->param('publishercode');
 my $volumedesc = $input->param('volumedesc');
 my $publicationyear = $input->param('publicationyear');
@@ -84,43 +86,72 @@
 my $isbn = $input->param('isbn');
 my $status = $input->param('status');
 my $suggestedbyme = $input->param('suggestedbyme');
-my $op = $input->param('op');
-$op = 'else' unless $op;
+my $op              = $input->param('op') || "aorr_confirm";
 
 my $dbh = C4::Context->dbh;
-my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "suggestion/acceptorreject.tmpl",
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "suggestion/acceptorreject.tmpl",
                             type => "intranet",
                             query => $input,
                             authnotrequired => 1,
-                            flagsrequired => {borrow => 1},
-                        });
-if ($op eq "aorr_confirm") {
+        flagsrequired   => { catalogue => 1 },
+    }
+);
+
+my $suggestions;
+
+if ( $op eq "aorr_confirm" ) {
        my @suggestionlist = $input->param("aorr");
+
        foreach my $suggestion (@suggestionlist) {
-               if ($suggestion =~ /(A|R)(.*)/) {
-                       my ($newstatus,$suggestionid) = ($1,$2);
-                       $newstatus="REJECTED" if $newstatus eq "R";
-                       $newstatus="ACCEPTED" if $newstatus eq "A";
-                       ModStatus($suggestionid,$newstatus,$loggedinuser);
+        if ( $suggestion =~ /(A|R)(.*)/ ) {
+            my ( $newstatus, $suggestionid ) = ( $1, $2 );
+            $newstatus = "REJECTED" if $newstatus eq "R";
+            $newstatus = "ACCEPTED" if $newstatus eq "A";
+            my $reason = $input->param( "reason" . $suggestionid );
+            if ( $reason eq "other" ) {
+                $reason = $input->param( "other-reason" . $suggestionid );
                }
+            ModStatus( $suggestionid, $newstatus, $loggedinuser, '', $reason );
        }
-       $op="else";
+    }
+    $op = "else";
+    $suggestions = &SearchSuggestion( "", "", "", "", 'ASKED', "" );
 }
 
-if ($op eq "delete_confirm") {
+if ( $op eq "delete_confirm" ) {
        my @delete_field = $input->param("delete_field");
        foreach my $delete_field (@delete_field) {
-               &DelSuggestion($loggedinuser,$delete_field);
+        &DelSuggestion( $loggedinuser, $delete_field );
        }
-       $op='else';
+    $op = 'else';
+    $suggestions = &SearchSuggestion( "", "", "", "", 'ASKED', "" );
+}
+
+if ( $op eq "accepted" ) {
+    $suggestions = &GetSuggestionByStatus('ACCEPTED');
+    $template->param(done => 1);
+}
+
+if ( $op eq "rejected" ) {
+    $suggestions = &GetSuggestionByStatus('REJECTED');
+    $template->param(done => 1);
+}
+
+my $reasonsloop = GetAuthorisedValues("SUGGEST");
+my @suggestions_loop;
+foreach my $suggestion (@$suggestions) {
+    $suggestion->{'reasonsloop'} = $reasonsloop;
+    push @suggestions_loop, $suggestion;
 }
 
-my $suggestions_loop= &SearchSuggestion("","","","",'ASKED',"");
-$template->param(suggestions_loop => $suggestions_loop,
+$template->param(
+    suggestions_loop        => address@hidden,
                "op_$op" => 1,
                intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
                intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
                IntranetNav => C4::Context->preference("IntranetNav"),
 );
+
 output_html_with_http_headers $input, $cookie, $template->output;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]