Browse files

fix for 582 (Move error message contents out of newmember.pl)

  • Loading branch information...
1 parent b36dc75 commit ee79c360702e5e3b9fbfd1486fdb970bd1db84ad tipaul committed Sep 4, 2003
Showing with 60 additions and 15 deletions.
  1. +24 −2 koha-tmpl/intranet-tmpl/default/en/newmember.tmpl
  2. +24 −2 koha-tmpl/intranet-tmpl/default/fr/newmember.tmpl
  3. +12 −11 newmember.pl
View
26 koha-tmpl/intranet-tmpl/default/en/newmember.tmpl
@@ -1,7 +1,7 @@
<TMPL_INCLUDE Name="members-top.inc">
-<H1> Confirm Record </H1>
<TMPL_IF Name="OK">
+ <H1> Confirm Record </H1>
<table border=0 cellspacing=0 cellpadding=5>
<tr valign=top bgcolor="<TMPL_VAR Name="main">" >
<td colspan=2 background="<TMPL_VAR name="themelang">/images/background-mem.gif">
@@ -222,7 +222,29 @@
<input type=submit name=submit value=Submit>
</form>
<TMPL_ELSE>
- <TMPL_VAR Name="string">
+ <h1>ERROR</H1>
+ <p>The following fields have a forbidden value. Please push the back button and try again : </p>
+ <TMPL_IF name="cardnumber">
+ Cardnumber<br/>
+ </TMPL_IF>
+ <TMPL_IF name="invalid_cardnumber">
+ Invalid_cardnumber<br/>
+ </TMPL_IF>
+ <TMPL_IF name="gender">
+ Gender<br/>
+ </TMPL_IF>
+ <TMPL_IF name="firstname">
+ Given Names<br/>
+ </TMPL_IF>
+ <TMPL_IF name="surname">
+ Surname<br/>
+ </TMPL_IF>
+ <TMPL_IF name="address">
+ Postal Street Address<br/>
+ </TMPL_IF>
+ <TMPL_IF name="city">
+ Postal city<br/>
+ </TMPL_IF>
</TMPL_IF>
View
26 koha-tmpl/intranet-tmpl/default/fr/newmember.tmpl
@@ -1,7 +1,7 @@
<TMPL_INCLUDE Name="members-top.inc">
-<H1> Confirmer l'enregistrement </H1>
<TMPL_IF Name="OK">
+ <H1> Confirmer l'enregistrement </H1>
<table border=0 cellspacing=0 cellpadding=5>
<tr valign=top bgcolor="<TMPL_VAR Name="main">" >
<td colspan=2 background="<TMPL_VAR name="themelang">/images/background-mem.gif">
@@ -222,7 +222,29 @@
<input type=submit name=submit value=Submit>
</form>
<TMPL_ELSE>
- <TMPL_VAR Name="string">
+ <h1>ERREUR</H1>
+ <p>Les champs suivants sont erron�s. Cliquer sur le bouton "retour" et corrigez.</p>
+ <TMPL_IF name="cardnumber">
+ Num�ro carte lecteur vide<br/>
+ </TMPL_IF>
+ <TMPL_IF name="invalid_cardnumber">
+ Num�ro de carte invalide<br/>
+ </TMPL_IF>
+ <TMPL_IF name="gender">
+ Zone sexe vide<br/>
+ </TMPL_IF>
+ <TMPL_IF name="firstname">
+ Zone nom vide<br/>
+ </TMPL_IF>
+ <TMPL_IF name="surname">
+ Zone pr�nom vide<br/>
+ </TMPL_IF>
+ <TMPL_IF name="address">
+ Adresse vide<br/>
+ </TMPL_IF>
+ <TMPL_IF name="city">
+ Commune vide<br/>
+ </TMPL_IF>
</TMPL_IF>
View
23 newmember.pl
@@ -16,7 +16,6 @@
# error message to display
# FIXME - What is the correct value of "flagsrequired"?
-# FIXME - untranslatable strings here
# Copyright 2000-2002 Katipo Communications
#
@@ -71,9 +70,9 @@
my $ok=0;
my $string = "The following compulsary fields have been left blank. "
. "Please push the back button and try again<p>";
-
+my @errors;
if ($data{'cardnumber'} eq ''){
- $string.=" Cardnumber<br>";
+ push @errors,"cardnumber";
$ok=1;
} else {
#check cardnumber is valid
@@ -89,33 +88,35 @@
my $valid=checkdigit(\%env,$data{'cardnumber'}, $nounique);
if ($valid != 1){
$ok=1;
- $string.=" Invalid Cardnumber<br>";
+ push @errors, "invalid_cardnumber";
}
}
if ($data{'sex'} eq ''){
- $string.=" Gender <br>";
+ push @errors, "gender";
$ok=1;
}
if ($data{'firstname'} eq ''){
- $string.=" Given Names<br>";
+ push @errors,"firstname";
$ok=1;
}
if ($data{'surname'} eq ''){
- $string.=" Surname<br>";
+ push @errors,"surname";
$ok=1;
}
if ($data{'address'} eq ''){
- $string.=" Postal Street Address<br>";
+ push @errors, "address";
$ok=1;
}
if ($data{'city'} eq ''){
- $string.=" Postal City<br>";
+ push @errors, "city";
$ok=1;
}
# Pass the ok/not ok status and the error message to the template
-$template->param( OK=> ($ok==0),
- string=> $string);
+$template->param( OK=> ($ok==0));
+foreach my $error (@errors) {
+ $template->param( $error => 1);
+}
# If things are ok, display the confirmation page
if ($ok == 0) {

0 comments on commit ee79c36

Please sign in to comment.