[Koha-patches] [PATCH] kohabug 2154 Modifying form input controls to accomodate translations

Galen Charlton galen.charlton at liblime.com
Fri Jul 25 01:24:41 CEST 2008


From: Chris Nighswonger <chris.nighswonger at liblime.com>

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 at liblime.com>
---
 .../prog/en/modules/members/moremember.tmpl        |    5 +++--
 .../prog/en/modules/tools/picture-upload.tmpl      |    5 +++--
 tools/picture-upload.pl                            |    6 ++----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
index 75b8b7d..0da1c48 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
@@ -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>
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 beaaac5..7bb47b3 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
@@ -100,8 +100,9 @@
 					</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>
 	
diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl
index 695adb3..6f29eaa 100755
--- a/tools/picture-upload.pl
+++ b/tools/picture-upload.pl
@@ -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 {
-- 
1.5.5.GIT




More information about the Koha-patches mailing list