Merge remote-tracking branch 'origin/new/bug_7889'
[koha.git] / tags / review.pl
index 421da4e..7517f41 100755 (executable)
@@ -15,9 +15,9 @@
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use warnings;
 use strict;
@@ -30,12 +30,12 @@ use C4::Auth qw(:DEFAULT check_cookie_auth);
 use C4::Context;
 use C4::Dates qw(format_date format_date_in_iso);
 # use C4::Koha;
-use C4::Output 3.02 qw(:html :ajax pagination_bar);
+use C4::Output qw(:html :ajax pagination_bar);
 use C4::Debug;
-use C4::Tags 0.03 qw(get_tags get_approval_rows approval_counts whitelist blacklist is_approved);
+use C4::Tags qw(get_tags get_approval_rows approval_counts whitelist blacklist is_approved);
 
 my $script_name = "/cgi-bin/koha/tags/review.pl";
-my $needed_flags = { tools => 'moderate_comments' };   # FIXME: replace when more specific permission is created.
+my $needed_flags = { tools => 'moderate_tags' };       # FIXME: replace when more specific permission is created.
 
 sub ajax_auth_cgi ($) {                # returns CGI object
        my $needed_flags = shift;
@@ -178,11 +178,12 @@ if ($filter = $input->param('to')) {
        }
 }
 if ($filter = $input->param('approver')) {             # name (or borrowernumber) from input box
-       if (($filter =~ /^\d+$/ and $filter > 0) or
-               (1) ){  # $filter=get borrowernumber from name
+       if ($filter =~ /^\d+$/ and $filter > 0) {
+               # $filter=get borrowernumber from name
+               # FIXME: get borrowernumber from name not implemented.
                $template->param(filter_approver=>$filter);
                $filters{approved_by} = $filter;
-       } else {
+       } else {
                push @errors, {approver=>$filter};
        }
 }
@@ -196,6 +197,9 @@ if ($filter = $input->param('approved_by')) {       # borrowernumber from link
 }
 $debug and print STDERR "filters: " . Dumper(\%filters);
 my $tagloop = get_approval_rows(\%filters);
+for ( @{$tagloop} ) {
+    $_->{date_approved} = format_date( $_->{date_approved} );
+}
 my $qstring = $input->query_string;
 $qstring =~ s/([&;])*\blimit=\d+//;            # remove pagination var
 $qstring =~ s/^;+//;                                   # remove leading delims