From 24ac2d03131996d5e8e35bd281f8e0626200539f Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 18 Sep 2007 18:38:23 +0200 Subject: [PATCH] Adding error management for memberentry.pl Signed-off-by: Chris Cormack --- koha-tmpl/intranet-tmpl/prog/en/js/members.js | 38 ++++++------------- .../en/modules/members/memberentrygen.tmpl | 12 +++--- members/memberentry.pl | 8 ++-- 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/members.js b/koha-tmpl/intranet-tmpl/prog/en/js/members.js index 9f9a858a95..bbb1e30e56 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/members.js @@ -84,9 +84,7 @@ var myDate2=document.form.dateexpiry.value.split ('/'); // function to test all fields in forms and nav in different forms(1 ,2 or 3) function check_form_borrowers(nav){ var statut=0; -if (nav < document.form.step.value) { - document.form.step.value=nav; - if ((document.form.step.value==0) && document.form.check_member.value == 1 ) + if (document.form.check_member.value == 1 ) { if (document.form_double.answernodouble) { @@ -98,25 +96,18 @@ if (nav < document.form.step.value) { } } } - document.form.submit(); -} else { if (document.form.BorrowerMandatoryField.value==''||document.form.FormFieldList.value=='' ) {} else { var champ_verif = document.form.BorrowerMandatoryField.value.split ('|'); - var champ_form= document.form.FormFieldList.value.split('|'); var message ="The following fields are mandatory :\n"; var message_champ=""; - for (var j=0; j 0 ) + if (statut!=1 && document.form.check_member.value > 0 ) { @@ -155,16 +143,14 @@ if (nav < document.form.step.value) { } } - if (statut==1){ + if (statut==1){ //alert if at least 1 error alert(message+"\n"+message_champ); - } - else - { - document.form.step=nav; + } + else + { document.form.submit(); - } - } + } } function Dopop(link) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl index 2e9a2dbc01..6f9f46c7b2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl @@ -40,18 +40,18 @@ patron

The following fields are wrong. Please fix it/them

-

login/password already exist

+
login/password already exist
-

Cardnumber already in use

+
Cardnumber already in use
- - Patron is too young or too old for this category - + +
Patron is too young or too old for this category
+
- +
Personal Information Contacts diff --git a/members/memberentry.pl b/members/memberentry.pl index 98309726ec..6a92cc05d4 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -177,7 +177,7 @@ if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') { push @errors, "ERROR_login_exist"; $nok=1; } else { - warn Data::Dumper::Dumper(%newdata); +# warn Data::Dumper::Dumper(%newdata); $borrowernumber = &AddMember(%newdata); if ($data{'organisations'}){ # need to add the members organisations @@ -240,11 +240,11 @@ if ($delete){ } } if ($op eq 'add'){ - $template->param( updtype => 'I',step_1=>1,step_2=>1,step_3=>1); + $template->param( updtype => 'I',step_1=>1,step_2=>1,step_3=>1,allsteps=>1); } - if ($op eq "Modify") { + if ($op eq "modify") { $template->param( updtype => 'M'); - $template->param( step_1=>1,step_2=>1,step_3=>1) unless $step; + $template->param( step_1=>1,step_2=>1,step_3=>1,allsteps=>1) unless $step; } # my $cardnumber=$data{'cardnumber'}; $data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add'; -- 2.39.5