Bug 32005: Cleanup indenting
[koha-ffzg.git] / tags / review.pl
index 866d94c..c2c97c8 100755 (executable)
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-use Data::Dumper;
-use POSIX;
+use POSIX qw( ceil );
 use CGI qw ( -utf8 );
 use CGI::Cookie;     # need to check cookies before having CGI parse the POST request
-use URI::Escape;
-use C4::Auth qw(:DEFAULT check_cookie_auth);
+use URI::Escape qw( uri_escape_utf8 );
+use C4::Auth qw( check_cookie_auth get_template_and_user );
 use C4::Context;
-use Koha::DateUtils;
-# use C4::Koha;
-use C4::Output qw(:html :ajax pagination_bar);
-use C4::Tags qw(get_tags get_approval_rows approval_counts whitelist blacklist is_approved);
+use C4::Output qw( output_with_http_headers is_ajax pagination_bar output_html_with_http_headers );
+use C4::Tags qw(
+    approval_counts
+    blacklist
+    get_approval_rows
+    is_approved
+    whitelist
+);
 
 my $script_name = "/cgi-bin/koha/tags/review.pl";
 my $needed_flags = { tools => 'moderate_tags' };    # FIXME: replace when more specific permission is created.
@@ -40,7 +43,7 @@ sub ajax_auth_cgi { # returns CGI object
     my %cookies = CGI::Cookie->fetch;
     my $input = CGI->new;
     my $sessid = $cookies{'CGISESSID'}->value;
-    my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
+    my ($auth_status) = check_cookie_auth($sessid, $needed_flags);
     if ($auth_status ne "ok") {
         output_with_http_headers $input, undef,
             "window.alert('Your CGI session cookie ($sessid) is not current.  " .
@@ -158,23 +161,15 @@ if ($filter = $input->param('tag')) {
     $template->param(filter_tag=>$filter);
     $filters{term} = $filter;
 }
-if ($filter = $input->param('from')) {
-        $date_from = eval { output_pref( { dt => dt_from_string( $filter ), dateonly => 1, dateformat => 'iso' } ); };
-        if ( $date_from ) {
-        $template->param(filter_date_approved_from=>$filter);
-        $filters{date_approved} = ">=$date_from";
-    } else {
-        push @errors, {date_from=>$filter};
-    }
+if ( $filter = $input->param('from') ) {
+    $date_from = $filter;
+    $template->param( filter_date_approved_from => $filter );
+    $filters{date_approved} = ">=$date_from";
 }
-if ($filter = $input->param('to')) {
-        $date_to = eval { output_pref( { dt => dt_from_string( $filter ), dateonly => 1, dateformat => 'iso' } ); };
-        if ( $date_to ) {
-        $template->param(filter_date_approved_to=>$filter);
-        $filters{date_approved} = "<=$date_to";
-    } else {
-        push @errors, {date_to=>$filter};
-    }
+if ( $filter = $input->param('to') ) {
+    $date_to = $filter;
+    $template->param( filter_date_approved_to => $filter );
+    $filters{date_approved} = "<=$date_to";
 }
 if ($filter = $input->param('approver')) {      # name (or borrowernumber) from input box
     if ($filter =~ /^\d+$/ and $filter > 0) {