From 80d4bd222f92ce4df9c94f249238399823c2afcc Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 31 Jan 2008 18:27:01 -0600 Subject: [PATCH] Bugfix for Bug 1618: First Installment This corrects the major template issues once files are uploaded. The changes need dressing up a bit still. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- .../prog/en/modules/tools/picture-upload.tmpl | 44 +++++++++++++------ tools/picture-upload.pl | 12 ++++- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tmpl index 143483c515..68811ceb9b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tmpl @@ -12,24 +12,38 @@
+
-

Upload Patron Images

-
-
- +

Patron Images Successfully Uploaded

+
+
    -
  • Unpacking completed
  • -
- Scanned - Processed - - Images moved from to - - To - +
  • Unpacking completed
  • +
  • directories scanned.
  • +
  • directories processed.
  • + + +
      +
    • image(s) moved from to :
    • +
    + +
      +
    • To
    • +
    + +
    +
    + +
    +

    Upload Patron Images

    +
    +
      @@ -72,10 +86,12 @@
    +
    +
    -
    +
    diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl index c5b5aec86a..2203f5da7d 100755 --- a/tools/picture-upload.pl +++ b/tools/picture-upload.pl @@ -7,6 +7,8 @@ use C4::Context; use C4::Auth; use C4::Output; +my $DEBUG = 1; + #my $destdir = "/usr/local/koha/intranet/htdocs/intranet-tmpl/images/patronpictures"; #my $uploadfile = shift @ARGV; my $input = new CGI; @@ -35,7 +37,9 @@ my ( $total, $handled, @counts ); if ( $uploadfile ) { my $dirname = File::Temp::tempdir( CLEANUP => 1); + warn "dirname = $dirname" if $DEBUG; my ( $tfh, $tempfile ) = File::Temp::tempfile( SUFFIX => '.zip', UNLINK => 1 ); + warn "tempfile = $tempfile" if $DEBUG; my ( @directories, %errors ); $errors{'NOTZIP'} = 1 unless ( $uploadfilename =~ /\.zip$/i ); @@ -59,6 +63,7 @@ if ( $uploadfile ) { opendir $dir, $recursive_dir; while ( my $entry = readdir $dir ) { push @directories, "$recursive_dir/$entry" if ( -d "$recursive_dir/$entry" and $entry !~ /^\./ ); + warn "$recursive_dir/$entry" if $DEBUG; } closedir $dir; } @@ -68,11 +73,12 @@ if ( $uploadfile ) { } $total = scalar @directories; - + warn "Total files processed: $total" if $DEBUG; $template->param( TOTAL => $total, HANDLED => $handled, COUNTS => \@counts, + TCOUNTS => scalar(@counts), ); } } @@ -96,9 +102,11 @@ sub handle_dir { my $delim = ($line =~ /\t/) ? "\t" : ","; ($cardnumber, $filename) = split $delim, $line; $cardnumber =~ s/[\"\r\n]//g; # remove offensive characters - $filename =~ s/[\"\r\n]//g; + $filename =~ s/[\"\r\n\s]//g; + warn "Cardnumber: $cardnumber Filename: $filename" if $DEBUG; if ($cardnumber && $filename) { + warn "Source: $dir/$filename Target: $destdir/$cardnumber.jpg" if $DEBUG; my $result = move ( "$dir/$filename", "$destdir/$cardnumber.jpg" ); if ( $result ) { $count{count}++; -- 2.39.5