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

This commit is contained in:
tipaul 2003-09-04 14:29:44 +00:00
parent b36dc7537c
commit ee79c36070
3 changed files with 60 additions and 15 deletions

View file

@ -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 file

@ -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 file

@ -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 $dbh = C4::Context->dbh;
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 @@ if ($data{'cardnumber'} eq ''){
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) {