kohabug 2154 Modifying form input controls to accomodate translations
authorChris Nighswonger <chris.nighswonger@liblime.com>
Thu, 24 Jul 2008 23:24:41 +0000 (18:24 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 25 Jul 2008 13:56:10 +0000 (08:56 -0500)
Due to the logic of the underlying picture-upload.pl depending upon the "value" of the
form input controls and this value being translated, the script then failed to function.
This patch changes the input controls so that this should not be an issue.

This issue should be kept in mind, though, so that it can be avoided in the future.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tmpl
tools/picture-upload.pl

index 75b8b7d..0da1c48 100644 (file)
@@ -218,8 +218,9 @@ if (nodename =="barcodes[]"){
                          </li>
                     </ol>
                     <fieldset class="action">
-                        <input name="op" type="submit" value="Upload" class="submit" />
-                        <!-- TMPL_IF NAME="picture" --><input name="op" type="submit" value="Delete" class="submit" /><!-- /TMPL_IF -->
+                        <input type="submit" value="Upload" class="submit" />
+                        <input name="op" type="hidden" value="Upload" />
+                        <!-- TMPL_IF NAME="picture" --><a href="/cgi-bin/koha/tools/picture-upload.pl?op=Delete&cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->" class="delete">Delete</a><!-- /TMPL_IF -->
                     </fieldset>
                 </fieldset>
                 </form>
index beaaac5..7bb47b3 100644 (file)
                                        </li></ol>
                    </fieldset>
                     <fieldset class="action">
-                        <input type="submit" name="op" value="Upload" class="submit" />
-                        <input type="submit" name="op" value="Cancel" class="submit" />
+                        <input type="hidden" name="op" value="Upload" />
+                        <input type="submit" value="Upload" class="submit" />
+                                               <a href="/cgi-bin/koha/tools/tools-home.pl" class="cancel">Cancel</a>
                     </fieldset>
                 </form>
        
index 695adb3..6f29eaa 100755 (executable)
@@ -52,7 +52,7 @@ my $op                  = $input->param('op');
 #       Other parts of this code could be optimized as well, I think. Perhaps the file upload could be done with YUI's upload
 #       coded. -fbcit
 
-$debug and warn "Params are: filetype=$filetype, cardnumber=$cardnumber, uploadfile=$uploadfilename";
+$debug and warn "Params are: filetype=$filetype, cardnumber=$cardnumber, borrowernumber=$borrowernumber, uploadfile=$uploadfilename";
 
 =head1 NAME
 
@@ -140,11 +140,9 @@ if ( ($op eq 'Upload') && $uploadfile ) {       # Case is important in these ope
     $template->param(filetype => $filetype);
 } elsif ( $op eq 'Delete' ) {
     my $dberror = RmPatronImage($cardnumber);
+       $debug and warn "Patron image deleted for $cardnumber";
     warn "Database returned $dberror" if $dberror;
-} elsif ( $op eq 'Cancel' ) {
-    print $input->redirect ("/cgi-bin/koha/tools/picture-upload.pl");
 }
-
 if ( $borrowernumber && !$errors && !$template->param('ERRORS') ) {
     print $input->redirect ("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber");
 } else {