improvements from SAN Ouest Provence :
authortipaul <tipaul>
Fri, 14 Apr 2006 09:31:24 +0000 (09:31 +0000)
committertipaul <tipaul>
Fri, 14 Apr 2006 09:31:24 +0000 (09:31 +0000)
* introducing a category_type into categories. It can be A (adult), C (children), P (Professionnal), I (institution/organisation).
* each category_type has it's own forms to create members.
* the borrowers table has been heavily modified (many fields changed), to get something more logic & readable
* reintroducing guarantor/guanrantee system that is now independant from hardcoded C/A for categories
* updating templates to fit template rules

(see mail feb, 17 on koha-devel "new features for borrowers" for more details)

16 files changed:
C4/Date.pm
C4/Koha.pm
C4/Members.pm
admin/categorie.pl
koha-tmpl/intranet-tmpl/prog/en/intranet-main.tmpl
koha-tmpl/intranet-tmpl/prog/en/members/guarantor_search.tmpl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/prog/en/members/memberentryA.tmpl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/prog/en/members/memberentryC.tmpl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/prog/en/members/memberentryI.tmpl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/prog/en/members/memberentryP.tmpl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/prog/en/members/memberentry_old.tmpl [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl
members/guarantor_search.pl [new file with mode: 0755]
members/memberentry.pl
members/moremember.pl
updater/updatedatabase

index 95e60b5..f19e9eb 100644 (file)
@@ -18,6 +18,7 @@ $VERSION = 0.01;
              &display_date_format
              &format_date
              &format_date_in_iso
+             &today
              get_date_format_string_for_DHTMLcalendar
 );
 
@@ -143,4 +144,22 @@ sub format_date_in_iso
 
        return $newdate;
 }
+
+#function to return a current date OUEST-PROVENCE
+sub today
+{
+    my ($adddate) =@_;
+        my($j,$m,$a)=(localtime)[3,4,5];
+       if ($j<10) {
+               $j= '0'.$j;     
+       }
+       $m=$m+1;
+       if ($m<10){
+               $m= '0'.$m
+       }
+       $a=$a+1900+$adddate;
+       return format_date("$a-$m-$j");
+}
+
+
 1;
index a7b9283..22429f8 100644 (file)
@@ -35,9 +35,6 @@ C4::Koha - Perl Module containing convenience functions for Koha scripts
 
 
   $date = slashifyDate("01-01-2002")
-  $ethnicity = fixEthnicity('asian');
-  ($categories, $labels) = borrowercategories();
-  ($categories, $labels) = ethnicitycategories();
 
 =head1 DESCRIPTION
 
@@ -51,9 +48,6 @@ Koha.pm provides many functions for Koha scripts.
 
 @ISA = qw(Exporter);
 @EXPORT = qw(
-                       &fixEthnicity
-                       &borrowercategories &getborrowercategory
-                       &ethnicitycategories
                        &subfield_is_koha_internal_p
                        &getbranches &getbranch &getbranchdetail
                        &getprinters &getprinter
@@ -66,109 +60,14 @@ Koha.pm provides many functions for Koha scripts.
                         getitemtypeimagedir
                         getitemtypeimagesrc
                         getitemtypeimagesrcfromurl
+                       &getcities
+                       &getroadtypes
                        $DEBUG);
 
 use vars qw();
 
 my $DEBUG = 0;
 
-# removed slashifyDate => useless
-
-=head2 fixEthnicity
-
-  $ethn_name = &fixEthnicity($ethn_code);
-
-Takes an ethnicity code (e.g., "european" or "pi") and returns the
-corresponding descriptive name from the C<ethnicity> table in the
-Koha database ("European" or "Pacific Islander").
-
-=cut
-#'
-
-sub fixEthnicity($) {
-
-    my $ethnicity = shift;
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("Select name from ethnicity where code = ?");
-    $sth->execute($ethnicity);
-    my $data=$sth->fetchrow_hashref;
-    $sth->finish;
-    return $data->{'name'};
-}
-
-=head2 borrowercategories
-
-  ($codes_arrayref, $labels_hashref) = &borrowercategories();
-
-Looks up the different types of borrowers in the database. Returns two
-elements: a reference-to-array, which lists the borrower category
-codes, and a reference-to-hash, which maps the borrower category codes
-to category descriptions.
-
-=cut
-#'
-
-sub borrowercategories {
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("Select categorycode,description from categories order by description");
-    $sth->execute;
-    my %labels;
-    my @codes;
-    while (my $data=$sth->fetchrow_hashref){
-      push @codes,$data->{'categorycode'};
-      $labels{$data->{'categorycode'}}=$data->{'description'};
-    }
-    $sth->finish;
-    return(\@codes,\%labels);
-}
-
-=item getborrowercategory
-
-  $description = &getborrowercategory($categorycode);
-
-Given the borrower's category code, the function returns the corresponding
-description for a comprehensive information display.
-
-=cut
-
-sub getborrowercategory
-{
-       my ($catcode) = @_;
-       my $dbh = C4::Context->dbh;
-       my $sth = $dbh->prepare("SELECT description FROM categories WHERE categorycode = ?");
-       $sth->execute($catcode);
-       my $description = $sth->fetchrow();
-       $sth->finish();
-       return $description;
-} # sub getborrowercategory
-
-
-=head2 ethnicitycategories
-
-  ($codes_arrayref, $labels_hashref) = &ethnicitycategories();
-
-Looks up the different ethnic types in the database. Returns two
-elements: a reference-to-array, which lists the ethnicity codes, and a
-reference-to-hash, which maps the ethnicity codes to ethnicity
-descriptions.
-
-=cut
-#'
-
-sub ethnicitycategories {
-    my $dbh = C4::Context->dbh;
-    my $sth=$dbh->prepare("Select code,name from ethnicity order by name");
-    $sth->execute;
-    my %labels;
-    my @codes;
-    while (my $data=$sth->fetchrow_hashref){
-      push @codes,$data->{'code'};
-      $labels{$data->{'code'}}=$data->{'name'};
-    }
-    $sth->finish;
-    return(\@codes,\%labels);
-}
-
 # FIXME.. this should be moved to a MARC-specific module
 sub subfield_is_koha_internal_p ($) {
     my($subfield) = @_;
@@ -655,90 +554,102 @@ Returns an array of all available languages.
 =cut
 
 sub getalllanguages {
-    my $type=shift;
-    my $theme=shift;
-    my $htdocs;
-    my @languages;
-    if ($type eq 'opac') {
-       $htdocs=C4::Context->config('opachtdocs');
-       if ($theme and -d "$htdocs/$theme") {
-           opendir D, "$htdocs/$theme";
-           foreach my $language (readdir D) {
-               next if $language=~/^\./;
-               next if $language eq 'all';
-               next if $language=~ /png$/;
-               next if $language=~ /css$/;
-               push @languages, $language;
-           }
-           return sort @languages;
-       } else {
-           my $lang;
-           foreach my $theme (getallthemes('opac')) {
-               opendir D, "$htdocs/$theme";
-               foreach my $language (readdir D) {
-                   next if $language=~/^\./;
-                   next if $language eq 'all';
-                       next if $language=~ /png$/;
-                       next if $language=~ /css$/;
-                   $lang->{$language}=1;
+       my $type=shift;
+       my $theme=shift;
+       my $htdocs;
+       my @languages;
+       if ($type eq 'opac') {
+               $htdocs=C4::Context->config('opachtdocs');
+               if ($theme and -d "$htdocs/$theme") {
+                       opendir D, "$htdocs/$theme";
+                       foreach my $language (readdir D) {
+                               next if $language=~/^\./;
+                               next if $language eq 'all';
+                               next if $language=~ /png$/;
+                               next if $language=~ /css$/;
+                               next if $language=~ /CVS$/;
+                               next if $language=~ /itemtypeimg$/;
+                               push @languages, $language;
+                       }
+                       return sort @languages;
+               } else {
+                       my $lang;
+                       foreach my $theme (getallthemes('opac')) {
+                               opendir D, "$htdocs/$theme";
+                               foreach my $language (readdir D) {
+                                       next if $language=~/^\./;
+                                       next if $language eq 'all';
+                                       next if $language=~ /png$/;
+                                       next if $language=~ /css$/;
+                                       next if $language=~ /CVS$/;
+                                       next if $language=~ /itemtypeimg$/;
+                                       $lang->{$language}=1;
+                               }
+                       }
+                       @languages=keys %$lang;
+                       return sort @languages;
                }
-           }
-           @languages=keys %$lang;
-           return sort @languages;
-       }
-    } elsif ($type eq 'intranet') {
-       $htdocs=C4::Context->config('intrahtdocs');
-       if ($theme and -d "$htdocs/$theme") {
-           opendir D, "$htdocs/$theme";
-           foreach my $language (readdir D) {
-               next if $language=~/^\./;
-               next if $language eq 'all';
-               next if $language=~ /png$/;
-               next if $language=~ /css$/;
-               push @languages, $language;
-           }
-           return sort @languages;
-       } else {
-           my $lang;
-           foreach my $theme (getallthemes('opac')) {
+       } elsif ($type eq 'intranet') {
+               $htdocs=C4::Context->config('intrahtdocs');
+               if ($theme and -d "$htdocs/$theme") {
+                       opendir D, "$htdocs/$theme";
+                       foreach my $language (readdir D) {
+                               next if $language=~/^\./;
+                               next if $language eq 'all';
+                               next if $language=~ /png$/;
+                               next if $language=~ /css$/;
+                               next if $language=~ /CVS$/;
+                               next if $language=~ /itemtypeimg$/;
+                               push @languages, $language;
+                       }
+                       return sort @languages;
+               } else {
+                       my $lang;
+                       foreach my $theme (getallthemes('opac')) {
+                               opendir D, "$htdocs/$theme";
+                               foreach my $language (readdir D) {
+                                       next if $language=~/^\./;
+                                       next if $language eq 'all';
+                                       next if $language=~ /png$/;
+                                       next if $language=~ /css$/;
+                                       next if $language=~ /CVS$/;
+                                       next if $language=~ /itemtypeimg$/;
+                                       $lang->{$language}=1;
+                               }
+                       }
+                       @languages=keys %$lang;
+                       return sort @languages;
+               }
+    } else {
+               my $lang;
+               my $htdocs=C4::Context->config('intrahtdocs');
+               foreach my $theme (getallthemes('intranet')) {
+                       opendir D, "$htdocs/$theme";
+                       foreach my $language (readdir D) {
+                               next if $language=~/^\./;
+                               next if $language eq 'all';
+                               next if $language=~ /png$/;
+                               next if $language=~ /css$/;
+                               next if $language=~ /CVS$/;
+                               next if $language=~ /itemtypeimg$/;
+                               $lang->{$language}=1;
+                       }
+               }
+               $htdocs=C4::Context->config('opachtdocs');
+               foreach my $theme (getallthemes('opac')) {
                opendir D, "$htdocs/$theme";
                foreach my $language (readdir D) {
-                   next if $language=~/^\./;
-                   next if $language eq 'all';
+                       next if $language=~/^\./;
+                       next if $language eq 'all';
                        next if $language=~ /png$/;
                        next if $language=~ /css$/;
-                   $lang->{$language}=1;
+                       next if $language=~ /CVS$/;
+                       next if $language=~ /itemtypeimg$/;
+                       $lang->{$language}=1;
+                       }
                }
-           }
-           @languages=keys %$lang;
-           return sort @languages;
-       }
-    } else {
-       my $lang;
-       my $htdocs=C4::Context->config('intrahtdocs');
-       foreach my $theme (getallthemes('intranet')) {
-           opendir D, "$htdocs/$theme";
-           foreach my $language (readdir D) {
-               next if $language=~/^\./;
-               next if $language eq 'all';
-               next if $language=~ /png$/;
-               next if $language=~ /css$/;
-               $lang->{$language}=1;
-           }
-       }
-       $htdocs=C4::Context->config('opachtdocs');
-       foreach my $theme (getallthemes('opac')) {
-           opendir D, "$htdocs/$theme";
-           foreach my $language (readdir D) {
-               next if $language=~/^\./;
-               next if $language eq 'all';
-               next if $language=~ /png$/;
-               next if $language=~ /css$/;
-               $lang->{$language}=1;
-           }
-       }
-       @languages=keys %$lang;
-       return sort @languages;
+               @languages=keys %$lang;
+               return sort @languages;
     }
 }
 
@@ -781,6 +692,81 @@ sub getnbpages {
     return int(($nb_items - 1) / $nb_items_per_page) + 1;
 }
 
+
+=head2 getcities (OUEST-PROVENCE)
+
+  ($id_cityarrayref, $city_hashref) = &getcities();
+
+Looks up the different city and zip in the database. Returns two
+elements: a reference-to-array, which lists the zip city
+codes, and a reference-to-hash, which maps the name of the city.
+WHERE =>OUEST PROVENCE OR EXTERIEUR
+
+=cut
+sub getcities {
+    #my ($type_city) = @_;
+    my $dbh = C4::Context->dbh;
+    my $sth=$dbh->prepare("Select cityid,city_name from cities order by cityid  ");
+    #$sth->execute($type_city);
+    $sth->execute();    
+    my %city;
+    my @id;
+#    insert empty value to create a empty choice in cgi popup 
+        
+while (my $data=$sth->fetchrow_hashref){
+      
+       push @id,$data->{'cityid'};
+      $city{$data->{'cityid'}}=$data->{'city_name'};
+    }
+       
+       #test to know if the table contain some records if no the function return nothing
+       my $id=@id;
+       $sth->finish;
+       if ($id eq 0)
+       {
+       return();
+       }
+       else{
+       unshift (@id ,"");
+       return(\@id,\%city);
+       }
+}
+
+
+=head2 getroadtypes (OUEST-PROVENCE)
+
+  ($idroadtypearrayref, $roadttype_hashref) = &getroadtypes();
+
+Looks up the different road type . Returns two
+elements: a reference-to-array, which lists the id_roadtype
+codes, and a reference-to-hash, which maps the road type of the road .
+
+
+=cut
+sub getroadtypes {
+    my $dbh = C4::Context->dbh;
+    my $sth=$dbh->prepare("Select roadtypeid,road_type from roadtype order by road_type  ");
+    $sth->execute();
+    my %roadtype;
+    my @id;
+#    insert empty value to create a empty choice in cgi popup 
+while (my $data=$sth->fetchrow_hashref){
+       push @id,$data->{'roadtypeid'};
+      $roadtype{$data->{'roadtypeid'}}=$data->{'road_type'};
+    }
+       #test to know if the table contain some records if no the function return nothing
+       my $id=@id;
+       $sth->finish;
+       if ($id eq 0)
+       {
+       return();
+       }
+       else{
+               unshift (@id ,"");
+               return(\@id,\%roadtype);
+       }
+}
+
 1;
 __END__
 
index d30e75f..9d4bec1 100644 (file)
@@ -24,6 +24,7 @@ require Exporter;
 use C4::Context;
 use Date::Manip;
 use C4::Date;
+use Digest::MD5 qw(md5_base64);
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
@@ -49,8 +50,13 @@ C4::Members - Perl Module containing convenience functions for member handling
 @EXPORT = qw();
 
 @EXPORT = qw(
-       &BornameSearch &getmember &borrdata &borrdata2 &fixup_cardnumber &findguarantees &findguarantor &NewBorrowerNumber &modmember &newmember &changepassword &borrissues &allissues
+       &BornameSearch &getmember &borrdata &borrdata2 &fixup_cardnumber &findguarantees &findguarantor &GuarantornameSearch &NewBorrowerNumber &modmember &newmember &changepassword &borrissues &allissues
+       &checkuniquemember &getzipnamecity &getidcity &getguarantordata &getcategorytype
+       &calcexpirydate &checkuserpassword
        &getboracctrecord
+       &borrowercategories &getborrowercategory
+       &fixEthnicity
+       &ethnicitycategories
     );
 
 
@@ -187,19 +193,20 @@ sub borrdata {
   my $dbh = C4::Context->dbh;
   my $sth;
   if ($bornum eq ''){
-    $sth=$dbh->prepare("Select * from borrowers where cardnumber=?");
+    $sth=$dbh->prepare("Select borrowers.*,categories.category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode where cardnumber=?");
     $sth->execute($cardnumber);
   } else {
-    $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
+    $sth=$dbh->prepare("Select borrowers.*,categories.category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode where borrowernumber=?");
   $sth->execute($bornum);
   }
   my $data=$sth->fetchrow_hashref;
+  warn "DATA".$data->{category_type};
   $sth->finish;
   if ($data) {
        return($data);
        } else { # try with firstname
                if ($cardnumber) {
-                       my $sth=$dbh->prepare("select * from borrowers where firstname=?");
+                       my $sth=$dbh->prepare("Select borrowers.*,categories.category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode  where firstname=?");
                        $sth->execute($cardnumber);
                        my $data=$sth->fetchrow_hashref;
                        $sth->finish;
@@ -283,34 +290,59 @@ sub modmember {
 sub newmember {
        my (%data) = @_;
        my $dbh = C4::Context->dbh;
+       $data{'userid'}='' unless $data{'password'};
+       $data{'password'}=md5_base64($data{'password'}) if $data{'password'};
        $data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
-       $data{'joining'} = &ParseDate("today") unless $data{'joining'};
-       $data{'joining'}=format_date_in_iso($data{'joining'});
-       # if expirydate is not set, calculate it from borrower category subscription duration
-       unless ($data{'expiry'}) {
-               my $sth = $dbh->prepare("select enrolmentperiod from categories where categorycode=?");
-               $sth->execute($data{'categorycode'});
-               my ($enrolmentperiod) = $sth->fetchrow;
-               $enrolmentperiod = 12 unless ($enrolmentperiod);
-               $data{'expiry'} = &DateCalc($data{'joining'},"$enrolmentperiod years");
-       }
-       $data{'expiry'}=format_date_in_iso($data{'expiry'});
-#      $data{'borrowernumber'}=NewBorrowerNumber();
-       my $query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,
-       firstname,altnotes,dateofbirth,contactname,emailaddress,textmessaging,dateenrolled,streetcity,
-       altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
-       initials,ethnicity,physstreet,branchcode,zipcode,homezipcode,sort1,sort2) values ('$data{'title'}','$data{'expiry'}','$data{'cardnumber'}',
-       '$data{'sex'}','$data{'ethnotes'}','$data{'streetaddress'}','$data{'faxnumber'}',
-       '$data{'firstname'}','$data{'altnotes'}','$data{'dateofbirth'}','$data{'contactname'}','$data{'emailaddress'}','$data{'textmessaging'}',
-       '$data{'joining'}','$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}',
-       '$data{'phoneday'}','$data{'categorycode'}','$data{'city'}','$data{'area'}','$data{'phone'}',
-       '$data{'borrowernotes'}','$data{'altphone'}','$data{'surname'}','$data{'initials'}',
-       '$data{'ethnicity'}','$data{'physstreet'}','$data{'branchcode'}','$data{'zipcode'}','$data{'homezipcode'}','$data{'sort1'}','$data{'sort2'}')";
+       $data{'dateenrolled'}=format_date_in_iso($data{'dateenrolled'});
+       $data{expiry}=format_date_in_iso($data{expiry});
+my $query="insert into borrowers set cardnumber=".$dbh->quote($data{'cardnumber'}).
+                                                                       ",surname=".$dbh->quote($data{'surname'}).
+                                                                       ",firstname=".$dbh->quote($data{'firstname'}).
+                                                                       ",title=".$dbh->quote($data{'title'}).
+                                                                       ",othernames=".$dbh->quote($data{'othernames'}).
+                                                                       ",initials=".$dbh->quote($data{'initials'}).
+                                                                       ",streetnumber=".$dbh->quote($data{'streetnumber'}).
+                                                                       ",streettype=".$dbh->quote($data{'streettype'}).
+                                                                       ",address=".$dbh->quote($data{'address'}).
+                                                                       ",address2=".$dbh->quote($data{'address2'}).
+                                                                       ",zipcode=".$dbh->quote($data{'zipcode'}).
+                                                                       ",city=".$dbh->quote($data{'city'}).
+                                                                       ",phone=".$dbh->quote($data{'phone'}).
+                                                                       ",email=".$dbh->quote($data{'email'}).
+                                                                       ",mobile=".$dbh->quote($data{'mobile'}).
+                                                                       ",phonepro=".$dbh->quote($data{'phonepro'}).
+                                                                       ",opacnote=".$dbh->quote($data{'opacnote'}).
+                                                                       ",guarantorid=".$dbh->quote($data{'guarantorid'}).
+                                                                       ",dateofbirth=".$dbh->quote($data{'dateofbirth'}).
+                                                                       ",branchcode=".$dbh->quote($data{'branchcode'}).
+                                                                       ",categorycode=".$dbh->quote($data{'categorycode'}).
+                                                                       ",dateenrolled=".$dbh->quote($data{'dateenrolled'}).
+                                                                       ",contactname=".$dbh->quote($data{'contactname'}).
+                                                                       ",borrowernotes=".$dbh->quote($data{'borrowernotes'}).
+                                                                       ",dateexpiry=".$dbh->quote($data{'dateexpiry'}).
+                                                                       ",contactnote=".$dbh->quote($data{'contactnote'}).
+                                                                       ",b_address=".$dbh->quote($data{'b_address'}).
+                                                                       ",b_zipcode=".$dbh->quote($data{'b_zipcode'}).
+                                                                       ",b_city=".$dbh->quote($data{'b_city'}).
+                                                                       ",b_phone=".$dbh->quote($data{'b_phone'}).
+                                                                       ",b_email=".$dbh->quote($data{'b_email'},).
+                                                                       ",password=".$dbh->quote($data{'password'}).
+                                                                       ",userid=".$dbh->quote($data{'userid'}).
+                                                                       ",sort1=".$dbh->quote($data{'sort1'}).
+                                                                       ",sort2=".$dbh->quote($data{'sort2'}).
+                                                                       ",contacttitle=".$dbh->quote($data{'contacttitle'}).
+                                                                       ",emailpro=".$dbh->quote($data{'emailpro'}).
+                                                                       ",contactfirstname=".$dbh->quote($data{'contactfirstname'}).
+                                                                       ",sex=".$dbh->quote($data{'sex'}).
+                                                                       ",fax=".$dbh->quote($data{'fax'}).
+                                                                       ",flags=".$dbh->quote($data{'flags'}).
+                                                                       ",relationship=".$dbh->quote($data{'relationship'})
+                                                                       ;
        my $sth=$dbh->prepare($query);
        $sth->execute;
        $sth->finish;
-       $data{borrowernumber} =$dbh->{'mysql_insertid'};
-       return $data{borrowernumber};
+       $data{'borrowerid'} =$dbh->{'mysql_insertid'};
+       return $data{'borrowerid'};
 }
 
 sub changepassword {
@@ -433,7 +465,7 @@ sub findguarantees {
   my ($bornum)=@_;
   my $dbh = C4::Context->dbh;
   my $sth=$dbh->prepare("select cardnumber,borrowernumber from borrowers where
-  guarantor=?");
+  guarantorid=?");
   $sth->execute($bornum);
   my @dat;
   my $i=0;
@@ -464,17 +496,87 @@ from the C<borrowers> database table;
 sub findguarantor{
   my ($bornum)=@_;
   my $dbh = C4::Context->dbh;
-  my $sth=$dbh->prepare("select guarantor from borrowers where borrowernumber=?");
+  my $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
   $sth->execute($bornum);
   my $data=$sth->fetchrow_hashref;
   $sth->finish;
-  $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
-  $sth->execute($data->{'guarantor'});
-  $data=$sth->fetchrow_hashref;
-  $sth->finish;
   return($data);
 }
 
+=item GuarantornameSearch
+
+  ($count, $borrowers) = &GuarantornameSearch($env, $searchstring, $type);
+
+Looks up guarantor  by name.
+
+C<$env> is ignored.
+
+BUGFIX 499: C<$type> is now used to determine type of search.
+if $type is "simple", search is performed on the first letter of the
+surname only.
+
+C<$searchstring> is a space-separated list of search terms. Each term
+must match the beginning a borrower's surname, first name, or other
+name.
+
+C<&GuarantornameSearch> returns a two-element list. C<$borrowers> is a
+reference-to-array; each element is a reference-to-hash, whose keys
+are the fields of the C<borrowers> table in the Koha database.
+C<$count> is the number of elements in C<$borrowers>.
+
+return all info from guarantor =>only category_type A
+
+=cut
+#'
+#used by member enquiries from the intranet
+#called by guarantor_search.pl
+sub GuarantornameSearch  {
+       my ($env,$searchstring,$orderby,$type)=@_;
+       my $dbh = C4::Context->dbh;
+       my $query = ""; my $count; my @data;
+       my @bind=();
+
+       if($type eq "simple")   # simple search for one letter only
+       {
+               $query="Select * from borrowers,categories  where borrowers.categorycode=categories.categorycode and category_type='A'  and  surname like ? order by $orderby";
+               @bind=("$searchstring%");
+       }
+       else    # advanced search looking in surname, firstname and othernames
+       {
+               @data=split(' ',$searchstring);
+               $count=@data;
+               $query="Select * from borrowers,categories
+               where ((surname like ? or surname like ?
+               or firstname  like ? or firstname like ?
+               or othernames like ? or othernames like ?) and borrowers.categorycode=categories.categorycode and category_type='A' 
+               ";
+               @bind=("$data[0]%","% $data[0]%","$data[0]%","% $data[0]%","$data[0]%","% $data[0]%");
+               for (my $i=1;$i<$count;$i++){
+                       $query=$query." and (".
+                       " surname like ? or surname like ?
+                        or firstname  like ? or firstname like ?
+                       or othernames like ? or othernames like ?)";
+                       push(@bind,"$data[$i]%","% $data[$i]%","$data[$i]%","% $data[$i]%","$data[$i]%","% $data[$i]%");
+                                       # FIXME - .= <<EOT;
+               }
+               $query=$query.") or cardnumber like ?
+               order by $orderby";
+               push(@bind,$searchstring);
+                                       # FIXME - .= <<EOT;
+       }
+
+       my $sth=$dbh->prepare($query);
+       $sth->execute(@bind);
+       my @results;
+       my $cnt=$sth->rows;
+       while (my $data=$sth->fetchrow_hashref){
+       push(@results,$data);
+       }
+       #  $sth->execute;
+       $sth->finish;
+       return ($cnt,\@results);
+}
+
 =item NewBorrowerNumber
 
   $num = &NewBorrowerNumber();
@@ -619,4 +721,232 @@ borrowernumber=? order by date desc,timestamp desc");
    return ($numlines,\@acctlines,$total);
 }
 
+
+=head2 checkuniquemember (OUEST-PROVENCE)
+
+  $result = &checkuniquemember($collectivity,$surname,$categorycode,$firstname,$dateofbirth);
+
+Checks that a member exists or not in the database.
+
+C<&result> is 1 (=exist) or 0 (=does not exist)
+C<&collectivity> is 1 (= we add a collectivity) or 0 (= we add a physical member)
+C<&surname> is the surname
+C<&categorycode> is from categorycode table
+C<&firstname> is the firstname (only if collectivity=0)
+C<&dateofbirth> is the date of birth (only if collectivity=0)
+
+=cut
+
+sub checkuniquemember{
+       my ($collectivity,$surname,$firstname,$dateofbirth)=@_;
+       my $dbh = C4::Context->dbh;
+       my $request;
+       if ($collectivity ) {
+#                              $request="select count(*) from borrowers where surname=? and categorycode=?";
+               $request="select borrowernumber,categorycode from borrowers where surname=? ";
+       } else {
+#                              $request="select count(*) from borrowers where surname=? and categorycode=? and firstname=? and dateofbirth=?";
+               $request="select borrowernumber,categorycode from borrowers where surname=?  and firstname=? and dateofbirth=?";
+       }
+       my $sth=$dbh->prepare($request);
+       if ($collectivity) {
+               $sth->execute(uc($surname));
+       } else {
+               $sth->execute(uc($surname),ucfirst($firstname),$dateofbirth);
+       }
+       my @data= $sth->fetchrow; 
+       if ($data[0]){
+               $sth->finish;
+       return $data[0],$data[1];                               
+#                      
+       }else{
+               $sth->finish;
+       return 0;
+       }
+}
+
+=head2 getzipnamecity (OUEST-PROVENCE)
+
+take all info from table city for the fields city and  zip
+check for the name and the zip code of the city selected
+
+=cut
+sub getzipnamecity {
+       my ($cityid)=@_;
+       my $dbh = C4::Context->dbh;
+       my $sth=$dbh->prepare("select city_name,city_zipcode from cities where cityid=? ");
+       $sth->execute($cityid);
+       my @data = $sth->fetchrow;
+       return $data[0],$data[1];
+}
+
+=head2 updatechildguarantor (OUEST-PROVENCE)
+
+check for title,firstname,surname,adress,zip code and city  from guarantor to 
+guarantorchild
+
+=cut
+sub getguarantordata{
+       my ($borrowerid)=@_;
+       my $dbh = C4::Context->dbh;
+       my $sth=$dbh->prepare("Select title,firstname,surname,streetnumber,address,streettype,address2,zipcode,city,phone,phonepro,mobile,email,emailpro  from borrowers where borrowernumber =? ");
+       $sth->execute($borrowerid);
+       my $guarantor_data=$sth->fetchrow_hashref;
+       $sth->finish;  
+       return $guarantor_data;                 
+}
+
+=head2 getdcity (OUEST-PROVENCE)
+recover cityid  with city_name condition
+=cut
+sub getidcity {
+       my ($city_name)=@_;
+       my $dbh = C4::Context->dbh;
+       my $sth=$dbh->prepare("select cityid from cities where city_name=? ");
+       $sth->execute($city_name);
+       my $data = $sth->fetchrow;
+       return $data;
+}
+
+
+=head2 getcategorytype (OUEST-PROVENCE)
+
+check for the category_type with categorycode
+and return the category_type 
+
+=cut
+sub getcategorytype {
+                       my ($categorycode)=@_;
+                       my $dbh = C4::Context->dbh;
+                       my $sth=$dbh->prepare("Select category_type,description from categories where categorycode=?  ");
+                       $sth->execute($categorycode);
+                       my ($category_type,$description) = $sth->fetchrow;
+                       return $category_type,$description;
+}
+
+sub calcexpirydate {
+       my ($categorycode,$dateenrolled)=@_;
+       my $dbh=C4::Context->dbh;
+       my $sth = $dbh->prepare("select enrolmentperiod from categories where categorycode=?");
+       $sth->execute($categorycode);
+       my ($enrolmentperiod) = $sth->fetchrow;
+       $enrolmentperiod = 12 unless ($enrolmentperiod);
+       return format_date_in_iso(&DateCalc($dateenrolled,"$enrolmentperiod months"));
+}
+
+=head2 checkuserpassword (OUEST-PROVENCE)
+
+check for the password and login are not used
+return the number of record 
+0=> NOT USED 1=> USED
+
+=cut
+sub checkuserpassword{
+                       my ($borrowerid,$userid,$password)=@_;
+                       $password=md5_base64($password);
+                       my $dbh = C4::Context->dbh;
+                       my $sth=$dbh->prepare("Select count(*) from borrowers where borrowernumber !=? and userid =? and password=? ");
+                       $sth->execute($borrowerid,$userid,$password);
+                       my $number_rows=$sth->fetchrow;
+  return $number_rows;                 
+                       
+}
+
+=head2 borrowercategories
+
+  ($codes_arrayref, $labels_hashref) = &borrowercategories();
+
+Looks up the different types of borrowers in the database. Returns two
+elements: a reference-to-array, which lists the borrower category
+codes, and a reference-to-hash, which maps the borrower category codes
+to category descriptions.
+
+=cut
+#'
+sub borrowercategories {
+       my ($category_type,$action)=@_;
+       my $dbh = C4::Context->dbh;
+       my $request;
+       $request="Select categorycode,description from categories where category_type=? order by categorycode";         
+       my $sth=$dbh->prepare($request);
+       $sth->execute($category_type);
+       my %labels;
+       my @codes;
+       while (my $data=$sth->fetchrow_hashref){
+               push @codes,$data->{'categorycode'};
+               $labels{$data->{'categorycode'}}=$data->{'description'};
+       }
+       $sth->finish;
+       return(\@codes,\%labels);
+}
+
+=item getborrowercategory
+
+  $description = &getborrowercategory($categorycode);
+
+Given the borrower's category code, the function returns the corresponding
+description for a comprehensive information display.
+
+=cut
+
+sub getborrowercategory
+{
+       my ($catcode) = @_;
+       my $dbh = C4::Context->dbh;
+       my $sth = $dbh->prepare("SELECT description FROM categories WHERE categorycode = ?");
+       $sth->execute($catcode);
+       my $description = $sth->fetchrow();
+       $sth->finish();
+       return $description;
+} # sub getborrowercategory
+
+
+=head2 ethnicitycategories
+
+  ($codes_arrayref, $labels_hashref) = &ethnicitycategories();
+
+Looks up the different ethnic types in the database. Returns two
+elements: a reference-to-array, which lists the ethnicity codes, and a
+reference-to-hash, which maps the ethnicity codes to ethnicity
+descriptions.
+
+=cut
+#'
+
+sub ethnicitycategories {
+    my $dbh = C4::Context->dbh;
+    my $sth=$dbh->prepare("Select code,name from ethnicity order by name");
+    $sth->execute;
+    my %labels;
+    my @codes;
+    while (my $data=$sth->fetchrow_hashref){
+      push @codes,$data->{'code'};
+      $labels{$data->{'code'}}=$data->{'name'};
+    }
+    $sth->finish;
+    return(\@codes,\%labels);
+}
+
+=head2 fixEthnicity
+
+  $ethn_name = &fixEthnicity($ethn_code);
+
+Takes an ethnicity code (e.g., "european" or "pi") and returns the
+corresponding descriptive name from the C<ethnicity> table in the
+Koha database ("European" or "Pacific Islander").
+
+=cut
+#'
+
+sub fixEthnicity($) {
+
+    my $ethnicity = shift;
+    my $dbh = C4::Context->dbh;
+    my $sth=$dbh->prepare("Select name from ethnicity where code = ?");
+    $sth->execute($ethnicity);
+    my $data=$sth->fetchrow_hashref;
+    $sth->finish;
+    return $data->{'name'};
+}
+
 1;
index faee98a..1352190 100755 (executable)
@@ -51,7 +51,7 @@ sub StringSearch  {
        $searchstring=~ s/\'/\\\'/g;
        my @data=split(' ',$searchstring);
        my $count=@data;
-       my $sth=$dbh->prepare("Select * from categories where (description like ?)");
+       my $sth=$dbh->prepare("Select * from categories where (description like ?) order by category_type,description");
        $sth->execute("$data[0]%");
        my @results;
        while (my $data=$sth->fetchrow_hashref){
@@ -92,29 +92,35 @@ if ($op eq 'add_form') {
        my $data;
        if ($categorycode) {
                my $dbh = C4::Context->dbh;
-               my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode=?");
+               my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired,category_type from categories where categorycode=?");
                $sth->execute($categorycode);
                $data=$sth->fetchrow_hashref;
                $sth->finish;
        }
 
-       $template->param(description             => $data->{'description'},
+       $template->param(description        => $data->{'description'},
                                enrolmentperiod         => $data->{'enrolmentperiod'},
                                upperagelimit           => $data->{'upperagelimit'},
                                dateofbirthrequired     => $data->{'dateofbirthrequired'},
                                enrolmentfee            => $data->{'enrolmentfee'},
                                overduenoticerequired   => $data->{'overduenoticerequired'},
                                issuelimit              => $data->{'issuelimit'},
-                               reservefee              => $data->{'reservefee'});
+                               reservefee              => $data->{'reservefee'},
+                               category_type           => $data->{'category_type'},
+                               "type_".$data->{'category_type'} => " SELECTED ",
+                               );
                                                                                                        # END $OP eq ADD_FORM
 ################## ADD_VALIDATE ##################################
 # called by add_form, used to insert/modify data in DB
 } elsif ($op eq 'add_validate') {
        $template->param(add_validate => 1);
        my $dbh = C4::Context->dbh;
-       my $sth=$dbh->prepare("replace categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,overduenoticerequired) values (?,?,?,?,?,?,?,?)");
-       $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired'));
+       my $sth=$dbh->prepare("replace categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?)");
+       $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type'));
        $sth->finish;
+       print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=categorie.pl\"></html>";
+       exit;
+
                                                                                                        # END $OP eq ADD_VALIDATE
 ################## DELETE_CONFIRM ##################################
 # called by default form, used to confirm deletion of data in DB
@@ -128,7 +134,7 @@ if ($op eq 'add_form') {
        $sth->finish;
        $template->param(total => $total->{'total'});
        
-       my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired from categories where categorycode=?");
+       my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired,category_type from categories where categorycode=?");
        $sth2->execute($categorycode);
        my $data=$sth2->fetchrow_hashref;
        $sth2->finish;
@@ -143,9 +149,9 @@ if ($op eq 'add_form') {
                                 enrolmentfee            => $data->{'enrolmentfee'},
                                 overduenoticerequired   => $data->{'overduenoticerequired'},
                                 issuelimit              => $data->{'issuelimit'},
-                                reservefee              => $data->{'reservefee'});
-
-
+                                reservefee              => $data->{'reservefee'},
+                                category_code           => $data->{'category_code'}
+                                );
                                                                                                        # END $OP eq DELETE_CONFIRM
 ################## DELETE_CONFIRMED ##################################
 # called by delete_confirm, used to effectively confirm deletion of data in DB
@@ -156,6 +162,9 @@ if ($op eq 'add_form') {
        my $sth=$dbh->prepare("delete from categories where categorycode=?");
        $sth->execute($categorycode);
        $sth->finish;
+       print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=categorie.pl\"></html>";
+       exit;
+
                                                                                                        # END $OP eq DELETE_CONFIRMED
 } else { # DEFAULT
        $template->param(else => 1);
@@ -173,6 +182,7 @@ if ($op eq 'add_form') {
                                overduenoticerequired => $results->[$i]{'overduenoticerequired'},
                                issuelimit => $results->[$i]{'issuelimit'},
                                reservefee => $results->[$i]{'reservefee'},
+                               category_type => $results->[$i]{'category_type'},
                                toggle => $toggle );    
                push @loop, \%row;
                if ( $toggle eq 0 )
@@ -187,11 +197,11 @@ if ($op eq 'add_form') {
        $template->param(loop => \@loop);
        # check that I (institution) and C (child) exists. otherwise => warning to the user
        my $dbh = C4::Context->dbh;
-       my $sth=$dbh->prepare("select categorycode from categories where categorycode='C'");
+       my $sth=$dbh->prepare("select category_type from categories where category_type='C'");
        $sth->execute;
        my ($categoryChild) = $sth->fetchrow;
        $template->param(categoryChild => $categoryChild);
-       $sth=$dbh->prepare("select categorycode from categories where categorycode='I'");
+       $sth=$dbh->prepare("select category_type from categories where category_type='I'");
        $sth->execute;
        my ($categoryInstitution) = $sth->fetchrow;
        $template->param(categoryInstitution => $categoryInstitution);
index 9ad6b65..01acf78 100644 (file)
                </ul>
        </li>
        <li>Koha Administration
-               <ul><li><a href="/cgi-bin/koha/admin/admin-home.pl">System Adminstration Home</a></li>
-               <li><a href="/cgi-bin/koha/admin/systempreferences.pl">System Preferences</a></li><li><a href="/cgi-bin/koha/barcodes/barcodes.pl">Barcodes generator</a></li></ul></li>
-
+               <ul>
+               <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a></li>
+               <li><a href="/cgi-bin/koha/admin/admin-home.pl">System Administration Home</a></li>
+               <li><a href="/cgi-bin/koha/admin/systempreferences.pl">System Preferences</a></li>
+               <li><a href="/cgi-bin/koha/barcodes/barcodes.pl">Barcodes generator</a></li>
+               </ul>
+       </li>
 </ul>
 <div id="news">
        <h1>News</h1>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/members/guarantor_search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/members/guarantor_search.tmpl
new file mode 100755 (executable)
index 0000000..aa76d2b
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Guarantor Search</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
+</head>
+<h1>Search guarantor</h1>
+       Search on
+       <form action="/cgi-bin/koha/members/guarantor_search.pl" method="post">
+               <input type="text" name="member" value="<!-- TMPL_VAR NAME="member" -->"> Ordered by
+               <select name="orderby">
+                       <option value="surname,firstname">Surname</option>
+                       <option value="cardnumber">cardnumber</option>
+               </select>
+               <input type="submit" class="button" value="OK">
+       </form>
+</div>
+
+<!--TMPL_IF NAME="results" -->
+       <p>filter on <!-- TMPL_VAR NAME="member" -->, <!-- TMPL_VAR Name ="numresults" --> members found</p>
+       <table>
+               <tr>
+                       <th>cardnumber</th>
+                       <th>surname</th>
+                       <th>firstname</th>
+                       <th>Date of birth</th>
+                       <th>address</th>
+               </tr>
+               <!-- TMPL_LOOP NAME="resultsloop" -->
+                       <!-- TMPL_IF NAME="background" -->
+                               <tr bgcolor="#ffffcc">
+                       <!-- TMPL_ELSE -->
+                               <tr bgcolor="white">
+                       <!-- /TMPL_IF -->
+                               <td><!-- TMPL_VAR NAME="cardnumber" --></td>
+                               <td><p><a href="javascript:window.opener.document.form.guarantorid.value=<!-- TMPL_VAR NAME="borrowernumber" -->;self.close();"><!-- TMPL_VAR NAME="surname" --></a></p>
+                               <td><b><!-- TMPL_VAR NAME="firstname" --></b></td> 
+                               <td><!-- TMPL_VAR NAME="dateofbirth" --></td>
+                               <td><p><!-- TMPL_VAR NAME="address" --> <!-- TMPL_VAR NAME="city" --></p></td>
+                       </tr>
+               <!-- /TMPL_LOOP -->
+       </table>
+</div>
+</div>
+<!--/TMPL_IF-->
+
+</html>
+
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/members/memberentryA.tmpl b/koha-tmpl/intranet-tmpl/prog/en/members/memberentryA.tmpl
new file mode 100755 (executable)
index 0000000..5060176
--- /dev/null
@@ -0,0 +1,587 @@
+<!-- templates to add/modify an <A>dult -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Member, Adult management
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-members.inc" -->
+<!-- TMPL_INCLUDE NAME="javascript/members.js" -->
+
+       <!-- TMPL_IF NAME="opadd" -->
+       <h1>
+               Add adult member (step <!-- TMPL_VAR NAME="step" -->)
+       </h1>
+       <!-- TMPL_ELSE -->
+       <h1 >
+               Modify adult member
+       </h1>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF NAME="check_member" -->
+               <!-- TMPL_IF NAME="step_2" -->
+               <p>
+               <form name="form_double">
+                       <div id="problem">
+                               Duplicate suspected 
+                               <a href="javascript:Dopop('borrowers_details.pl?borrowerid=<!--TMPL_VAR NAME="check_member"-->');" >Detail</a>
+                               Duplicate ?
+                               <a href="/cgi-bin/koha/members/memberentry.pl?borrowerid=<!--TMPL_VAR NAME="check_member"-->&category_type=<!--TMPL_VAR NAME="check_categorytype"-->">Yes</a> 
+                               &nbsp;&nbsp;&nbsp; No, it is not
+                               <!-- TMPL_IF NAME="checked"-->
+                                       <input type="checkbox" checked name="answernodouble" >
+                               <!-- TMPL_ELSE -->
+                                       <input type="checkbox" name="answernodouble" >
+                               <!-- /TMPL_IF -->
+                       </div>
+               </form>
+               </p>
+               <!--/TMPL_IF-->
+       <!--/TMPL_IF-->
+               
+               <!-- TMPL_IF Name="nok" -->
+               <!--<h1>ERREUR</h1>-->
+               <div id="problem">
+                       <p>The following fields are wrong. Please fix it/them</p>
+                       <!-- TMPL_IF NAME="ERROR_login_exist" -->
+                               <p>login/password already exist</p>
+                       <!-- /TMPL_IF -->
+               </div>
+       <!-- /TMPL_IF -->
+
+       <!-- TMPL_IF NAME="step_1"-->
+<form name="form"  action="/cgi-bin/koha/members/memberentry.pl" method="post"> 
+<!--           field always hidden in different form (1,2,3) -->
+       <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+       <input type="hidden" name="FormFieldList" value="surname|cardnumber|firstname|dateofbirth|sort1|sort2">
+       <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+       <input type="hidden" name="type" value="borrowers">
+       <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+       <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+       <input type="hidden" name="guarantor"   value="<!-- TMPL_VAR NAME="guarantor" -->">
+       <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+       <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+       <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+       <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+       <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+       <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->" />
+       
+<!--   from form 2 -->
+       <input type="hidden" name="streetnumber"  value="<!-- TMPL_VAR NAME="streetnumber" -->">
+       <input type="hidden" name="address"  value="<!-- TMPL_VAR NAME="address" -->">
+       <input type="hidden" name="streettype"  value="<!-- TMPL_VAR NAME="streettype" -->">
+       <input type="hidden" name="address2"  value="<!-- TMPL_VAR NAME="address2" -->">        
+       <input type="hidden" name="zipcode"  value="<!-- TMPL_VAR NAME="zipcode" -->">
+       <input type="hidden" name="city"  value="<!-- TMPL_VAR NAME="city" -->">        
+       <input type="hidden" name="branchcode"  value="<!-- TMPL_VAR NAME="branchcode" -->">
+       <input type="hidden" name="b_address"  value="<!-- TMPL_VAR NAME="b_address" -->">
+       <input type="hidden" name="b_zipcode"  value="<!-- TMPL_VAR NAME="b_zipcode" -->">
+       <input type="hidden" name="b_city"  value="<!-- TMPL_VAR NAME="b_city" -->">    
+       <input type="hidden" name="phone"   value="<!-- TMPL_VAR NAME="phone" -->" >
+       <input type="hidden" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+       <input type="hidden" name="mobile"  value="<!-- TMPL_VAR NAME="mobile" -->" >   
+       <input type="hidden" name="fax"  value="<!-- TMPL_VAR NAME="fax" -->"> 
+       <input type="hidden" name="email" value="<!-- TMPL_VAR NAME="email" -->" >
+       <input type="hidden" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+       
+<!--   from form 3      -->
+       <input type="hidden" name="dateenrolled" size="20" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+       <input type="hidden" name="dateexpiry" size="20" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+       <textarea  style="display:none;" name="opacnotes" cols="70" rows="3"><!-- TMPL_VAR NAME="opacnotes"--></textarea>
+       <textarea style="display:none;" name="borrowernotes" cols="70" rows="3"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+       <input type="hidden" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+       <input type="hidden" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">      
+       <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+       <input type="hidden" name="lost"  value="<!-- TMPL_VAR NAME="lost" -->" />
+       <input type="hidden" name="gonenoaddress"  value="<!-- TMPL_VAR NAME="gonenoaddress" -->" />
+
+       
+       
+       <!-- / CHECKBOX from form 3 Warning -->
+       <!-- TMPL_IF NAME="opadd" -->
+               <input type="hidden" name="op" value="add">
+       <!-- TMPL_ELSE -->
+               <input type="hidden" name="op" value="modify">
+       <!-- /TMPL_IF -->
+       <fieldset id="memberentry_identity">
+               <legend>Borrower identity</legend>
+               <p>
+               <!-- TMPL_IF NAME="female" -->
+               <input type="radio" name="sex" value="F" checked>Female
+               <input type="radio" name="sex" value="M">Male
+               <!-- TMPL_ELSE -->
+               <input type="radio" name="sex" value="F">Female
+               <input type="radio" name="sex" value="M" checked>Male
+               <!-- /TMPL_IF -->
+               </p>
+               <!-- TMPL_IF NAME="mandatorycardnumber" -->
+                       <label style="font-weight:bold">
+               <!--TMPL_ELSE -->
+                       <label>
+               <!-- /TMPL_IF--> 
+               Card number</label>
+               <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+               <p>
+               <!-- TMPL_IF NAME="mandatorytitle" -->
+                       <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+                       <label>
+               <!-- /TMPL_IF-->
+               Title</label>
+               <select  name="title" >
+                       <option <!-- TMPL_VAR NAME="title_selected_ " --> value="" >Select a value</option>
+                       <option value="Mlle" <!-- TMPL_VAR NAME="title_Mlle" -->>Mlle</option>
+                       <option value="Mme" <!-- TMPL_VAR NAME="title_Mme" -->>Mme</option>
+                       <option value="Mr" <!-- TMPL_VAR NAME="title_Mr" --> >M.</option>
+               </select>
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatorysurname" -->
+               <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Surname</label>
+               <input style="text-transform:uppercase;" type="text" name="surname" size="20"  value="<!-- TMPL_VAR NAME="surname" -->" >
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatoryfirstname" -->
+               <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Firstname</label>
+               <input style="text-transform:capitalize;" type="text" name="firstname" size="20"  value="<!-- TMPL_VAR NAME="firstname" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateofbirth" -->
+                       <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->      
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Date of Birth</label>
+                       <input type="text" name="dateofbirth" size="20" onBlur="CheckDate(document.form.dateofbirth.value);" value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryinitials" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Initials</label>
+                       <input type="text" name="initials" size="20"  value="<!-- TMPL_VAR NAME="initials" -->">        
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryothernames" -->
+                       <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Other name</label>
+                       <input style="text-transform:uppercase;" type="text" name="othernames" size="20"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+               </p>
+       </fieldset>
+       <fieldset id="memberentry_identity">
+               <legend>Borrower type</legend>
+               <p>
+               <label>Select a category</label>
+               <!-- TMPL_VAR NAME="catcodepopup" -->
+               </p>
+               <!-- TMPL_IF NAME="city_cgipopup" -->   
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryselect_city" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Select a city</label>
+                       <!-- TMPL_VAR NAME="citypopup" -->
+               </p>
+               <!-- /TMPL_IF-->
+               <p>
+                       <!-- TMPL_IF NAME="mandatorysort1" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Sort 1</label>
+                       <!--TMPL_IF NAME="CGIsort1" --> 
+                               <!-- TMPL_VAR NAME="CGIsort1" -->
+                       <!--TMPL_ELSE-->
+                               <input  type="text" name="sort1" size="20"  value="<!-- TMPL_VAR NAME="sort1" -->" >
+                       <!-- /TMPL_IF -->               
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatorysort2" -->
+               <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Sort 2</label>
+               <!--TMPL_IF NAME="CGIsort2" --> 
+                       <!-- TMPL_VAR NAME="CGIsort2" -->
+               <!--TMPL_ELSE-->
+                       <input  type="text" name="sort2" size="20"  value="<!-- TMPL_VAR NAME="sort2" -->" >
+               <!-- /TMPL_IF -->       
+               </p>
+       </fieldset>
+       <div>
+               <input type="button" name="next_step" value="Next Step" onclick="check_form_borrowers(1);">
+       </div>
+</form>
+<!-- ************************ STEP_1 *********************** -->
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="step_2"-->
+<form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+       <!--            field always hidden in different form (1,2,3) -->
+       <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+       <input type="hidden" name="FormFieldList" value="address|zipcode|city|phone|phonepro|mobile|email|emailpro|">
+       <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+       <input type="hidden" name="type" value="borrowers">
+       <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+       <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+       <input type="hidden" name="guarantor"   value="<!-- TMPL_VAR NAME="guarantor" -->">
+       <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+       <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+       <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+       <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+       <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+       <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->" />
+
+<!--   from form 1      -->
+       <input type="hidden" name="title" value="<!-- TMPL_VAR NAME="title" -->">
+       <input style="text-transform:capitalize;" type="hidden" name="firstname" size="20" value="<!-- TMPL_VAR NAME="firstname" -->">
+       <input style="text-transform:uppercase;" type="hidden" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->" >
+       <input type="hidden" name="cardnumber"  value="<!-- TMPL_VAR NAME="cardnumber" -->">
+       <input type="hidden" name="dateofbirth"  value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+       <input type="hidden" name="initials" size="20"  value="<!-- TMPL_VAR NAME="initials" -->">
+       <input type="hidden" name="othernames" size="20"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+       <input type="hidden" name="sex" value="<!-- TMPL_VAR NAME="sex" -->" >
+       <input type="hidden" name="categorycode" value="<!-- TMPL_VAR NAME="categorycode" -->" >        
+       <input type="hidden" name="select_city" value="<!-- TMPL_VAR NAME="select_city" -->">
+       <input type="hidden" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" >
+       <input type="hidden" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" >
+       <!--    from form 3      -->
+       <input type="hidden" name="dateenrolled" size="20" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+       <input type="hidden" name="dateexpiry" size="20" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+       <textarea  style="display:none;" name="opacnotes" cols="70" rows="3"><!-- TMPL_VAR NAME="opacnotes"--></textarea>
+       <textarea style="display:none;" name="borrowernotes" cols="70" rows="3"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+       <input type="hidden" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+       <input type="hidden" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">      
+       <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+       <input type="hidden" name="lost"  value="<!-- TMPL_VAR NAME="lost" -->" />
+       <input type="hidden" name="gonenoaddress"  value="<!-- TMPL_VAR NAME="gonenoaddress" -->" />    
+       <!-- TMPL_IF NAME="opadd" -->
+               <input type="hidden" name="op" value="add">
+       <!-- TMPL_ELSE -->
+               <input type="hidden" name="op" value="modify">
+       <!-- /TMPL_IF -->
+       <fieldset id="memberentry_address">
+               <legend>Address</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorybranchcode" -->
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Branch</label>
+                       <!-- TMPL_VAR NAME="CGIbranch" -->
+               </p>
+               <fieldset>
+               <legend>Main Address</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorystreetnumber" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       street number</label>
+                       <input type="text" name="streetnumber" size="5" value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               </p>
+               <!-- TMPL_IF NAME="road_cgipopup" -->
+                       <p>
+                       <!-- TMPL_IF NAME="mandatorystreettype" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Street type</label>
+                       <!-- TMPL_VAR NAME="roadpopup" -->
+                       </p>
+               <!--/TMPL_IF--> 
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryaddress" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Address</label>
+                       <input type="text" name="address" size="35" value="<!-- TMPL_VAR NAME="address" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryaddress2" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Address 2</label>
+                       <input type="text" name="address2" size="35" value="<!-- TMPL_VAR NAME="address2" -->">
+               </p>
+               <p>     
+                       <!-- TMPL_IF NAME="mandatoryzipcode" -->
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Zipcode</label>
+                       <input type="text" maxlength="5" name="zipcode" size="5" value="<!-- TMPL_VAR NAME="zipcode" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycity" -->
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       City</label>
+                       <input style="text-transform:uppercase;" type="text" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->">
+               </p>
+               </fieldset>
+               <fieldset>
+               <legend>Alt Address</legend>
+                       <p>
+                               <!-- TMPL_IF NAME="mandatoryb_address" -->
+                                       <label style="font-weight:bold">
+                               <!--TMPL_ELSE-->
+                                       <label>
+                               <!-- /TMPL_IF-->
+                               Address</label>
+                               <input type="text" name="b_address" size="40" value="<!-- TMPL_VAR NAME="b_address" -->">
+                       </p>
+                       <p>
+                               <!-- TMPL_IF NAME="mandatoryb_zipcode" -->
+                                       <label style="font-weight:bold">
+                               <!--TMPL_ELSE-->
+                                       <label>
+                               <!-- /TMPL_IF-->
+                               Zipcode</label>
+                               <input type="text" name="b_zipcode" maxlength="5" size="5" value="<!-- TMPL_VAR NAME="b_zipcode" -->">
+                       </p>
+                       <p>
+                               <!-- TMPL_IF NAME="mandatoryb_city" -->
+                                       <label style="font-weight:bold" >
+                               <!--TMPL_ELSE-->
+                                       <label>
+                               <!-- /TMPL_IF-->
+                               City</label>
+                               <input type="text" style="text-transform:uppercase;" name="b_city" size="20" value="<!-- TMPL_VAR NAME="b_city" -->">
+                       </p>
+               </fieldset>
+       </fieldset>
+       <fieldset id="memberentry_contact">
+               <legend>contact</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryphone" --> 
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Phone (home)</label>
+                       <input type="text"  name="phone" value="<!-- TMPL_VAR NAME="phone" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryphonepro" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Phone (prof)</label>
+                       <input type="text" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorymobile" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Phone (cell)</label>
+                       <input type="text" name="mobile" value="<!-- TMPL_VAR NAME="mobile" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryemail" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       E-mail (home)</label>
+                       <input type="text" name="email" value="<!-- TMPL_VAR NAME="email" -->" >        
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryemailpro" -->       
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       E-mail (prof)</label>
+                       <input type="text" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryfax" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Fax</label>
+                       <input type="text" name="fax" value="<!-- TMPL_VAR NAME="fax" -->" >
+               </p>
+       </fieldset>
+       <div>
+               <input type="button" class="borrowers_button" name="setp1" value="Previous step" onclick="check_form_borrowers(0);">    
+               <INPUT type="button" class="borrowers_button" name="step3" onclick="check_form_borrowers(2)" value="Next step">
+       </div>
+</p>
+</form>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="step_3"-->
+<form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+       <!--            field always hidden in different form (1,2,3) -->
+       <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+       <input type="hidden" name="FormFieldList" value="">
+       <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+       <input type="hidden" name="type" value="borrowers">
+       <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+       <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+       <input type="hidden" name="guarantor"   value="<!-- TMPL_VAR NAME="guarantor" -->">
+       <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+       <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+       <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+       <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+       <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+       <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->" />
+
+<!--   from form 1      -->
+       <input type="hidden" name="title" value="<!-- TMPL_VAR NAME="title" -->">
+       <input style="text-transform:capitalize;" type="hidden" name="firstname" size="20" value="<!-- TMPL_VAR NAME="firstname" -->">
+       <input style="text-transform:uppercase;" type="hidden" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->" >
+       <input type="hidden" name="cardnumber"  value="<!-- TMPL_VAR NAME="cardnumber" -->">
+       <input type="hidden" name="dateofbirth"  value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+       <input type="hidden" name="initials" size="20"  value="<!-- TMPL_VAR NAME="initials" -->">
+       <input type="hidden" name="othernames" size="20"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+       <input type="hidden" name="sex" value="<!-- TMPL_VAR NAME="sex" -->" >
+       <input type="hidden" name="categorycode" value="<!-- TMPL_VAR NAME="categorycode" -->" >        
+       <input type="hidden" name="select_city" value="<!-- TMPL_VAR NAME="select_city" -->">
+       <input type="hidden" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" >
+       <input type="hidden" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" >
+
+<!--   from form 2 -->
+       <input type="hidden" name="streetnumber"  value="<!-- TMPL_VAR NAME="streetnumber" -->">
+       <input type="hidden" name="address"  value="<!-- TMPL_VAR NAME="address" -->">
+       <input type="hidden" name="streettype"  value="<!-- TMPL_VAR NAME="streettype" -->">
+       <input type="hidden" name="address2"  value="<!-- TMPL_VAR NAME="address2" -->">        
+       <input type="hidden" name="zipcode"  value="<!-- TMPL_VAR NAME="zipcode" -->">
+       <input type="hidden" name="city"  value="<!-- TMPL_VAR NAME="city" -->">        
+       <input type="hidden" name="branchcode"  value="<!-- TMPL_VAR NAME="branchcode" -->">
+       <input type="hidden" name="b_address"  value="<!-- TMPL_VAR NAME="b_address" -->">
+       <input type="hidden" name="b_zipcode"  value="<!-- TMPL_VAR NAME="b_zipcode" -->">
+       <input type="hidden" name="b_city"  value="<!-- TMPL_VAR NAME="b_city" -->">    
+       <input type="hidden" name="phone"   value="<!-- TMPL_VAR NAME="phone" -->" >
+       <input type="hidden" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+       <input type="hidden" name="mobile"  value="<!-- TMPL_VAR NAME="mobile" -->" >   
+       <input type="hidden" name="fax"  value="<!-- TMPL_VAR NAME="fax" -->"> 
+       <input type="hidden" name="email" value="<!-- TMPL_VAR NAME="email" -->" >
+       <input type="hidden" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+       <!-- TMPL_IF NAME="opadd" -->
+               <input type="hidden" name="op" value="add">
+       <!-- TMPL_ELSE -->
+               <input type="hidden" name="op" value="modify">
+       <!-- /TMPL_IF -->
+       <fieldset id="memberentry_subscription">
+       <legend>Library set-up</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateenrolled" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Arrival date</label>
+                       <input type="text" name="dateenrolled"  maxlength="10"    size="10" onblur="CheckDate(document.form.dateenrolled.value);" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateexpiry" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Expiry date</label>
+                       <input type="text" name="dateexpiry" maxlength="10"  size="10"
+                                                       onblur="CheckDate(document.form.dateexpiry.value);check_manip_date('verify');" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryopacnotes" -->
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       OPAC note</label>
+                       <textarea  name="opacnotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="opacnotes" --></textarea>
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryborrowernotes" -->  
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Library note</label>
+                       <textarea name="borrowernotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               </p>
+       </fieldset>
+       <fieldset id="memberentry_login">
+               <legend>OPAC login</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorylogin" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       OPAC Login</label>
+                       <input type="text" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorypassword" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Password</label>
+                       <!--TMPL_IF NAME="opadd"-->
+                               <input type="text" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">
+                       <!--TMPL_ELSE-->
+                               <!--TMPL_IF NAME="password"-->
+                                       <input type="text" name="password" size="20"  value="****">
+                               <!--TMPL_ELSE-->
+                                       <input type="text" name="password" size="20"  value="">
+                               <!--/TMPL_IF-->
+                       <!--/TMPL_IF-->
+               </p>
+               <!--this zones are not necessary in modif mode -->
+               <!-- TMPL_UNLESS NAME="opadd" -->
+                       <h1>Warning</h1>
+                       <!-- TMPL_LOOP NAME="flagloop" -->
+                       <p>
+                               <label class="borrowers_labels_title"><!-- TMPL_VAR NAME="html" --></label>
+                               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="1" <!-- TMPL_VAR NAME="yes" -->>Yes
+                               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="0" <!-- TMPL_VAR NAME="no" -->>No
+                       </p>
+                       <!-- /TMPL_LOOP -->
+               <!-- /TMPL_UNLESS -->   
+               <p>
+               </fieldset>
+               <div>
+                       <input type="button" class="borrowers_button" name="etapeprec2" value="Etape precedente" onclick="check_form_borrowers(1);">    
+                       <!-- TMPL_IF NAME="opadd" -->
+                               <input type="button" name="step" onclick="unique();" value="Add member">
+                       <!-- TMPL_ELSE -->
+                               <input type="button" name="step4" onclick="check_form_borrowers();" value="Modify member">
+                       <!--/TMPL_IF -->
+               </div>
+               </form>
+       <!-- /TMPL_IF -->
+
+<!--    TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/members/memberentryC.tmpl b/koha-tmpl/intranet-tmpl/prog/en/members/memberentryC.tmpl
new file mode 100755 (executable)
index 0000000..ff9657c
--- /dev/null
@@ -0,0 +1,640 @@
+<!-- templates to add/modify a <C>hild -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Member, Child management
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-members.inc" -->
+<!-- TMPL_INCLUDE NAME="javascript/members.js" -->
+
+       <!-- TMPL_IF NAME="opadd" -->
+       <h1>
+               Add children member (step <!-- TMPL_VAR NAME="step" -->)
+       </h1>
+       <!-- TMPL_ELSE -->
+       <h1 >
+               Modify children member
+       </h1>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF NAME="check_member" -->
+               <!-- TMPL_IF NAME="step_2" -->
+       <p>
+       <form name="form_double">
+               <div id="problem">
+                       Duplicate suspected 
+                       <a href="javascript:Dopop('borrowers_details.pl?borrowerid=<!--TMPL_VAR NAME="check_member"-->');" class="borrowers_button">Details</a>
+                       Duplicate ?     
+                       <a href="/cgi-bin/koha/members/memberentry.pl?borrowerid=<!--TMPL_VAR NAME="check_member"-->&category_type=<!--TMPL_VAR NAME="check_categorytype"-->" class="borrowers_button">Yes</a> 
+                       &nbsp;&nbsp;&nbsp; No, it is not
+                       <INPUT type="checkbox" <!-- TMPL_IF NAME="checked"--> checked <!--/TMPL_IF--> name="answernodouble" >
+               </div>
+       </form> 
+       
+               </p>    
+               <!--/TMPL_IF-->
+       <!--/TMPL_IF-->
+       <!-- TMPL_IF Name="NOK" -->
+               <h1>ERROR</h1>
+               <div id="problem">
+                       <p>The following fields are wrong. Please fix it/them</p>
+                       <!-- TMPL_IF NAME="ERROR_login_exist" -->
+                               <p>login/password already exist</p>
+                       <!-- /TMPL_IF -->
+               </div>
+       <!-- /TMPL_IF -->
+
+<!--############################################################FORMULAIRE 1 #######################################-->
+<!-- TMPL_IF NAME="step_1"-->
+               <form name="form"  action="/cgi-bin/koha/members/memberentry.pl" method="post"> 
+               <!--            field always hidden in different form (1,2,3) -->               
+                       <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+                       <input type="hidden" name="FormFieldList" value="cardnumber|title|surname|firstname|dateofbirth|categorycode|sort1">
+                       <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+                       <input type="hidden" name="type" value="borrowers">
+                       <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+                       <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+                       <input type="hidden" name="guarantorid"   value="<!-- TMPL_VAR NAME="guarantorid" -->">
+                       <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+                       <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+                       <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+                       <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+                       <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+                       <input type="hidden" name="nodouble" "  value="<!-- TMPL_VAR NAME="nodouble" -->"/>
+       
+                       <!--            input from form 2 -->
+                       <input type="hidden" name="contacttitle" size="20" value="<!-- TMPL_VAR NAME="contacttitle" -->">
+                       <input type="hidden" name="contactname" value="<!-- TMPL_VAR NAME="contactname" -->">
+                       <input type="hidden" name="contactfirstname" value="<!-- TMPL_VAR NAME="contactfirstname" -->">         
+                       <input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branchcode" -->">
+                       <input type="hidden" name="streetnumber" value="<!-- TMPL_VAR NAME="streetnumber" -->">
+                       <input type="hidden" name="streettype" value="<!-- TMPL_VAR NAME="streettype" -->">
+                       <input type="hidden" name="address"  value="<!-- TMPL_VAR NAME="address" -->">
+                       <input type="hidden" name="address2"  value="<!-- TMPL_VAR NAME="address2" -->">
+                       <input type="hidden" name="zipcode" value="<!-- TMPL_VAR NAME="zipcode" -->">
+                       <input type="hidden" name="city" value="<!-- TMPL_VAR NAME="city" -->">
+                       <input type="hidden" name="relationship" value="<!-- TMPL_VAR NAME="relationship" -->"> 
+                       <input type="hidden" name="phone" value="<!-- TMPL_VAR NAME="phone" -->" >
+                       <input type="hidden" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+                       <input type="hidden" name="mobile" size="10" value="<!-- TMPL_VAR NAME="mobile" -->" >  
+                       <input type="hidden" name="email" value="<!-- TMPL_VAR NAME="email" -->" >
+                       <input type="hidden" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+                       <input type="hidden" name="b_email" value="<!-- TMPL_VAR NAME="b_email" -->" >  
+                       <input type="hidden" name="b_phone" value="<!-- TMPL_VAR NAME="b_phone" -->" >
+                       <input type="hidden" name="fax" value="<!-- TMPL_VAR NAME="fax" -->" >  
+
+                       <!--            input from form3                 -->
+                       <input type="hidden" name="dateenrolled" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+                       <input type="hidden" name="dateexpiry"  value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+                       <textarea  style="display:none;" name="opacnotes" cols="70" rows="3"><!-- TMPL_VAR NAME="opacnotes"--></textarea>
+                       <textarea style="display:none;" name="borrowernotes" cols="70" rows="3"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+                       <input type="hidden" name="login"  value="<!-- TMPL_VAR NAME="login" -->">
+                       <input type="hidden" name="password"  value="<!-- TMPL_VAR NAME="password" -->">        
+                       <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+                       <input type="hidden" name="lost"  value="<!-- TMPL_VAR NAME="lost" -->" />
+                       <input type="hidden" name="gonenoaddress"  value="<!-- TMPL_VAR NAME="gonenoaddress" -->" />    
+
+       <!-- TMPL_IF NAME="opadd" -->
+               <input type="hidden" name="op" value="add">
+       <!-- TMPL_ELSE -->
+               <input type="hidden" name="op" value="modify">
+       <!-- /TMPL_IF -->
+               <!-- TMPL_VAR NAME="member" -->
+                       <p>
+                               <!-- TMPL_IF NAME="mandatorycardnumber" -->
+                               <label  class="borrowers_mandafield">
+                               <!--TMPL_ELSE-->
+                               <label>
+                               <!-- /TMPL_IF-->
+                               Card number</label>
+                                <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+                       </p>    
+       <fieldset id="memberentry_identity">
+               <legend>Borrower identity</legend>
+               <p>
+               <!-- TMPL_IF NAME="female" -->
+               <input type="radio" name="sex" value="F" checked>Female
+               <input type="radio" name="sex" value="M">Male
+               <!-- TMPL_ELSE -->
+               <input type="radio" name="sex" value="F">Female
+               <input type="radio" name="sex" value="M" checked>Male
+               <!-- /TMPL_IF -->
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatorytitle" -->
+                       <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+                       <label>
+               <!-- /TMPL_IF-->
+               Title</label>
+               <select  name="title" >
+                       <option <!-- TMPL_VAR NAME="title_selected_ " --> value="" >Select a value</option>
+                       <option value="Mlle" <!-- TMPL_VAR NAME="title_Mlle" -->>Mlle</option>
+                       <option value="Mme" <!-- TMPL_VAR NAME="title_Mme" -->>Mme</option>
+                       <option value="Mr" <!-- TMPL_VAR NAME="title_Mr" --> >M.</option>
+               </select>
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatorysurname" -->
+               <label  style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Surname</label>
+               <input style="text-transform:uppercase;" type="text" name="surname" size="20"  value="<!-- TMPL_VAR NAME="surname" -->" >
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatoryfirstname" -->
+               <label  style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Firstname</label>
+               <input style="text-transform:capitalize;" type="text" name="firstname" size="20"  value="<!-- TMPL_VAR NAME="firstname" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateofbirth" -->
+                       <label  style="font-weight:bold">
+                       <!-- TMPL_ELSE -->      
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Date of Birth</label>
+                       <input type="text" name="dateofbirth" size="20" onBlur="CheckDate(document.form.dateofbirth.value);" value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryinitials" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Initials</label>
+                       <input type="text" name="initials" size="20"  value="<!-- TMPL_VAR NAME="initials" -->">        
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryothernames" -->
+                       <label  style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Other name</label>
+                       <input style="text-transform:uppercase;" type="text" name="othernames" size="20"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+               </p>
+               <p><a href="javascript:Dopopguarantor('guarantor_search.pl');">Find guarantor</a>
+               </p>
+       </fieldset>
+       <fieldset id="memberentry_identity">
+               <legend>Borrower type</legend>
+               <p>
+               <label>Select a category</label>
+               <!-- TMPL_VAR NAME="catcodepopup" -->
+               </p>
+               <!-- TMPL_IF NAME="city_cgipopup" -->   
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryselect_city" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Select a city</label>
+                       <!-- TMPL_VAR NAME="citypopup" -->
+               </p>
+               <!-- /TMPL_IF-->
+               <p>
+                       <!-- TMPL_IF NAME="mandatorysort1" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Sort 1</label>
+                       <!--TMPL_IF NAME="CGIsort1" --> 
+                               <!-- TMPL_VAR NAME="CGIsort1" -->
+                       <!--TMPL_ELSE-->
+                               <input  type="text" name="sort1" size="20"  value="<!-- TMPL_VAR NAME="sort1" -->" >
+                       <!-- /TMPL_IF -->               
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatorysort2" -->
+               <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Sort 2</label>
+               <!--TMPL_IF NAME="CGIsort2" --> 
+                       <!-- TMPL_VAR NAME="CGIsort2" -->
+               <!--TMPL_ELSE-->
+                       <input  type="text" name="sort2" size="20"  value="<!-- TMPL_VAR NAME="sort2" -->" >
+               <!-- /TMPL_IF -->       
+               </p>
+       </fieldset>
+       <div>
+               <input type="button" name="next_step" value="Next Step" onclick="check_form_borrowers(1);">
+       </div>
+</form>
+<!-- ************************ STEP_1 *********************** -->
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="step_2"-->
+       <form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+<!--           field always hidden in different form (1,2,3) -->
+               <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+               <input type="hidden" name="FormFieldList" value="streetnumber|address|address2|zipcode|contacttitle|city|contactname|contactfirstname|branchcode|phone|phonepro|mobile|email|emailpro|b_email|b_phone">
+               <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+               <input type="hidden" name="type" value="borrowers">
+               <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+               <input type="hidden" name="guarantorid"   value="<!-- TMPL_VAR NAME="guarantorid" -->">
+               <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+               <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+               <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+               <input type="hidden" name="nodouble" "  value="<!-- TMPL_VAR NAME="nodouble" -->"/>
+
+<!--           input from form 1               -->
+               <input type="hidden" name="title" size="10" value="<!-- TMPL_VAR NAME="title" -->">
+               <input style="text-transform:capitalize;" type="hidden" name="firstname" size="20" value="<!-- TMPL_VAR NAME="firstname" -->">
+               <input style="text-transform:uppercase;" type="hidden" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->" >
+               <input type="hidden" name="dateofbirth" size="20"  value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+               <input type="hidden" name="initials" size="20"  value="<!-- TMPL_VAR NAME="initials" -->">
+               <input type="hidden" name="othernames" size="20"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+               <input type="hidden" name="sex" value="<!-- TMPL_VAR NAME="sex" -->" >
+               <input type="hidden" name="categorycode" size="10" value="<!-- TMPL_VAR NAME="categorycode" -->">
+               <input type="hidden" name="select_city" value="<!-- TMPL_VAR NAME="select_city" -->">   
+               <input type="hidden" name="sort1"  value="<!-- TMPL_VAR NAME="sort1" -->">
+               <input type="hidden" name="sort2"  value="<!-- TMPL_VAR NAME="sort2" -->">
+
+<!--           input from form3                 -->
+               <input type="hidden" name="dateenrolled" size="20" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               <input type="hidden" name="dateexpiry" size="20" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               <textarea  style="display:none;" name="opacnotes" cols="70" rows="3"><!-- TMPL_VAR NAME="opacnotes"--></textarea>
+               <textarea style="display:none;" name="borrowernotes" cols="70" rows="3"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               <input type="hidden" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+               <input type="hidden" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">      
+               <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+               <input type="hidden" name="lost"  value="<!-- TMPL_VAR NAME="lost" -->" />
+               <input type="hidden" name="gonenoaddress"  value="<!-- TMPL_VAR NAME="gonenoaddress" -->" />
+
+               <!-- TMPL_IF NAME="opadd" -->
+                       <input type="hidden" name="op" value="add">
+               <!-- TMPL_ELSE -->
+                       <input type="hidden" name="op" value="modify">
+               <!-- /TMPL_IF -->
+               
+               <!-- TMPL_VAR NAME="member" -->
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycardnumber" -->
+                       <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Card number</label>
+                       <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+               </p>
+               <fieldset>
+               <legend>Guarantor</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycontacttitle" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Title</label>
+                       <select  name="contacttitle" >
+                                       <option <!-- TMPL_VAR NAME="contacttitle_selected " --> value="" >Select title</option>
+                                       <option value="Mlle" <!-- TMPL_VAR NAME="contacttitle_Mlle" -->>Mlle</option>
+                                       <option value="Mme" <!-- TMPL_VAR NAME="contacttitle_Mme" -->>Mme</option>
+                                       <option value="Mr" <!-- TMPL_VAR NAME="contacttitle_Mr" --> >M.</option>
+                       </select>
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycontactname" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Surname</label> 
+                       <input type="text" style="text-transform:uppercase;" name="contactname" size="20" value="<!-- TMPL_VAR NAME="contactname" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycontactfirstname" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Firstname</label>       
+                       <input type="text" style="text-transform:capitalize;" name="contactfirstname" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorybranchcode" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Branch</label>  
+                       <!-- TMPL_VAR NAME="CGIbranch" -->
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorystreetnumber" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       Street number</label> 
+                       <input type="text" name="streetnumber" size="5" value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               </p>
+                       <!-- TMPL_IF NAME="road_cgipopup" -->
+                               <p>
+                               <!-- TMPL_IF NAME="mandatorystreettype" -->
+                                       <label  class="borrowers_mandafield">
+                               <!--TMPL_ELSE-->
+                                       <label>
+                               <!-- /TMPL_IF-->
+                               Road type</label>
+                               <!-- TMPL_VAR NAME="roadpopup" -->
+                               </p>
+                       <!--/TMPL_IF-->
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryaddress" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Address</label> 
+                       <input type="text" name="address" size="35" value="<!-- TMPL_VAR NAME="address" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryaddress2" -->       
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Address 2</label>
+                       <input type="text" name="address2" size="35" value="<!-- TMPL_VAR NAME="address2" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryzipcode" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       Zipcode</label>
+                       <input type="text" maxlength="5" name="zipcode" size="10" value="<!-- TMPL_VAR NAME="zipcode" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycity" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       City</label>
+                       <input style="text-transform:uppercase;" type="text" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryrelationship" -->
+                               <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Relation</label>
+                       <select name="relationship" size="1">
+                                               <!-- TMPL_LOOP NAME="relshiploop" -->
+                                                       <option <!-- TMPL_VAR NAME="selected" -->><!-- TMPL_VAR NAME="relationship" --></option>
+                                               <!-- /TMPL_LOOP -->
+                       </select>
+               </p>
+       </fieldset>
+       <fieldset>
+               <legend>Guarantor contact</legend>
+               <h2>Guarantor</h2>
+       <p>
+               <!-- TMPL_IF NAME="mandatoryphone" -->
+                       <label  class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+                       <label>
+               <!-- /TMPL_IF-->
+               Phone (home)</label>
+               <input type="text" name="phone" value="<!-- TMPL_VAR NAME="phone" -->" >
+       </p>
+       <p>
+               <!-- TMPL_IF NAME="mandatoryphonepro" -->
+                       <label  class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+                       <label>
+               <!-- /TMPL_IF-->
+               Phone (prof)</label>
+               <input type="text" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+       </p>
+       <p>
+               <!-- TMPL_IF NAME="mandatorymobile" -->
+                       <label  class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+                       <label>
+               <!-- /TMPL_IF-->
+               Phone (cell)</label>
+               <input type="text" name="mobile" value="<!-- TMPL_VAR NAME="mobile" -->" >
+       </p>
+       <p>
+               <!-- TMPL_IF NAME="mandatoryemail" -->
+                       <label  class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+                       <label>
+               <!-- /TMPL_IF-->
+               E-mail (home)</label>
+               <input type="text" name="email" value="<!-- TMPL_VAR NAME="email" -->" >        
+       </p>
+       <p>
+               <!-- TMPL_IF NAME="mandatoryemailpro" -->
+                       <label  class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+                       <label>
+               <!-- /TMPL_IF-->
+               E-mail (prof)</label>
+               <input type="text" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >          
+       </p>
+       <p>
+               <!-- TMPL_IF NAME="mandatoryfax" -->
+                       <label  class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+                       <label>
+               <!-- /TMPL_IF-->
+               fax</label>
+               <input type="text" name="fax" value="<!-- TMPL_VAR NAME="fax" -->" >    
+       </p>
+       <h2>Member</h2>
+       <p>     
+               <!-- TMPL_IF NAME="mandatoryb_email" -->
+                       <label  class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+                       <label>
+               <!-- /TMPL_IF-->
+               E-mail (home)</label>
+               <input type="text" name="b_email" value="<!-- TMPL_VAR NAME="b_email" -->" >    
+               <!-- TMPL_IF NAME="mandatoryb_phone" -->
+                       <label  class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+                       <label>
+               <!-- /TMPL_IF-->
+               Phone (cell)</label>    
+               <input type="text" name="b_phone" value="<!-- TMPL_VAR NAME="b_phone" -->" >                    
+       </p>
+       </fieldset>
+       <div>
+               <input type="button" name="step1" value="Previous step" onclick="check_form_borrowers(0);">
+               <input type="button" name="step3" onclick="check_form_borrowers(3)" value="Next step">
+       </div>
+</form>
+
+<!--/TMPL_IF-->
+<!-- TMPL_IF NAME="step_3"-->
+       <form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+<!--           field always hidden in different form (1,2,3) -->
+               <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+               <input type="hidden" name="FormFieldList" value="">
+               <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+               <input type="hidden" name="type" value="borrowers">
+               <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+               <input type="hidden" name="guarantorid"   value="<!-- TMPL_VAR NAME="guarantorid" -->">
+               <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+               <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+               <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+               <input type="hidden" name="nodouble" "  value="<!-- TMPL_VAR NAME="nodouble" -->"/>
+
+<!--           input from form 1               -->
+               <input type="hidden" name="title" size="10" value="<!-- TMPL_VAR NAME="title" -->">
+               <input style="text-transform:capitalize;" type="hidden" name="firstname" size="20" value="<!-- TMPL_VAR NAME="firstname" -->">
+               <input style="text-transform:uppercase;" type="hidden" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->" >
+               <input type="hidden" name="dateofbirth" size="20"  value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+               <input type="hidden" name="initials" size="20"  value="<!-- TMPL_VAR NAME="initials" -->">
+               <input type="hidden" name="othernames" size="20"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+               <input type="hidden" name="sex" value="<!-- TMPL_VAR NAME="sex" -->" >
+               <input type="hidden" name="categorycode" size="10" value="<!-- TMPL_VAR NAME="categorycode" -->">
+               <input type="hidden" name="select_city" value="<!-- TMPL_VAR NAME="select_city" -->">   
+               <input type="hidden" name="sort1"  value="<!-- TMPL_VAR NAME="sort1" -->">
+               <input type="hidden" name="sort2"  value="<!-- TMPL_VAR NAME="sort2" -->">
+<!--           input from form 2 -->
+               <input type="hidden" name="contacttitle" size="20" value="<!-- TMPL_VAR NAME="contacttitle" -->">
+               <input type="hidden" name="contactname" size="35" value="<!-- TMPL_VAR NAME="contactname" -->">
+               <input type="hidden" name="contactfirstname" size="5" value="<!-- TMPL_VAR NAME="contactfirstname" -->">                
+               <input type="hidden" name="branchcode" size="20" value="<!-- TMPL_VAR NAME="branchcode" -->">
+               <input type="hidden" name="streetnumber"  value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               <input type="hidden" name="streettype"  value="<!-- TMPL_VAR NAME="streettype" -->">
+               <input type="hidden" name="address"  value="<!-- TMPL_VAR NAME="address" -->">
+               <input type="hidden" name="address2"  value="<!-- TMPL_VAR NAME="address2" -->">
+               <input type="hidden" name="zipcode" size="20" value="<!-- TMPL_VAR NAME="zipcode" -->">
+               <input type="hidden" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->">
+               <input type="hidden" name="relationship" size="20" value="<!-- TMPL_VAR NAME="relationship" -->"> 
+               <input type="hidden" name="phone" size="10"  value="<!-- TMPL_VAR NAME="phone" -->" >
+               <input type="hidden" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+               <input type="hidden" name="mobile" size="10" value="<!-- TMPL_VAR NAME="mobile" -->" >  
+               <input type="hidden" name="email" value="<!-- TMPL_VAR NAME="email" -->" >
+               <input type="hidden" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+               <input type="hidden" name="b_email" value="<!-- TMPL_VAR NAME="b_email" -->" >  
+               <input type="hidden" name="b_phone" value="<!-- TMPL_VAR NAME="b_phone" -->" >
+               <input type="hidden" name="fax" value="<!-- TMPL_VAR NAME="fax" -->" >  
+               
+               <!-- TMPL_IF NAME="opadd" -->
+                       <input type="hidden" name="op" value="add">
+               <!-- TMPL_ELSE -->
+                       <input type="hidden" name="op" value="modify">
+               <!-- /TMPL_IF -->
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycardnumber" -->
+                       <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                        Card number</label>
+                       <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+               </p>
+       <fieldset id="memberentry_subscription">
+       <legend>Library set-up</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateenrolled" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Arrival date</label>
+                       <input type="text" name="dateenrolled"  maxlength="10"    size="10" onblur="CheckDate(document.form.dateenrolled.value);" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateexpiry" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Expiry date</label>
+                       <input type="text" name="dateexpiry" maxlength="10"  size="10"
+                                                       onblur="CheckDate(document.form.dateexpiry.value);check_manip_date('verify');" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryopacnotes" -->
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       OPAC note</label>
+                       <textarea  name="opacnotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="opacnotes" --></textarea>
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryborrowernotes" -->  
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Library note</label>
+                       <textarea name="borrowernotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               </p>
+       </fieldset>
+       <fieldset id="memberentry_login">
+               <legend>OPAC login</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorylogin" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       OPAC Login</label>
+                       <input type="text" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorypassword" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Password</label>
+                       <!--TMPL_IF NAME="opadd"-->
+                               <input type="text" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">
+                       <!--TMPL_ELSE-->
+                               <!--TMPL_IF NAME="password"-->
+                                       <input type="text" name="password" size="20"  value="****">
+                               <!--TMPL_ELSE-->
+                                       <input type="text" name="password" size="20"  value="">
+                               <!--/TMPL_IF-->
+                       <!--/TMPL_IF-->
+               </p>
+               <!--this zones are not necessary in modif mode -->
+               <!-- TMPL_UNLESS NAME="opadd" -->
+                       <h1>Warning</h1>
+                       <!-- TMPL_LOOP NAME="flagloop" -->
+                       <p>
+                               <label class="borrowers_labels_title"><!-- TMPL_VAR NAME="html" --></label>
+                               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="1" <!-- TMPL_VAR NAME="yes" -->>Yes
+                               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="0" <!-- TMPL_VAR NAME="no" -->>No
+                       </p>
+                       <!-- /TMPL_LOOP -->
+               <!-- /TMPL_UNLESS -->   
+               <p>
+               </fieldset>
+               <div>
+                       <input type="button" class="borrowers_button" name="etapeprec2" value="Etape precedente" onclick="check_form_borrowers(1);">    
+                       <!-- TMPL_IF NAME="opadd" -->
+                               <input type="button" name="step" onclick="unique();" value="Add member">
+                       <!-- TMPL_ELSE -->
+                               <input type="button" name="step4" onclick="check_form_borrowers();" value="Modify member">
+                       <!--/TMPL_IF -->
+               </div>
+       </form>
+<!-- /TMPL_IF -->
+<!--    TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/members/memberentryI.tmpl b/koha-tmpl/intranet-tmpl/prog/en/members/memberentryI.tmpl
new file mode 100755 (executable)
index 0000000..90af842
--- /dev/null
@@ -0,0 +1,459 @@
+<!-- templates to add/modify a <I>nstitution -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Member, Organisation management
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-members.inc" -->
+<!-- TMPL_INCLUDE NAME="javascript/members.js" -->
+
+       <!-- TMPL_IF NAME="opadd" -->
+       <h1>
+               Add organisation member (step <!-- TMPL_VAR NAME="step" -->)
+       </h1>
+       <!-- TMPL_ELSE -->
+       <h1 >
+               Modify organisation member
+       </h1>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF NAME="check_member" -->
+               <!-- TMPL_IF NAME="step_2" -->
+                       <p>
+                       <form name="form_double">
+                               <div id="problem">
+                                       Duplicate suspected 
+                                       <a href="javascript:Dopop('borrowers_details.pl?borrowerid=<!--TMPL_VAR NAME="check_member"-->');" class="borrowers_button">Details</a>
+                                       Duplicate ?     
+                                       <a href="/cgi-bin/koha/members/memberentry.pl?borrowerid=<!--TMPL_VAR NAME="check_member"-->&category_type=<!--TMPL_VAR NAME="check_categorytype"-->" class="borrowers_button">Yes</a> 
+                                       &nbsp;&nbsp;&nbsp; No, it is not
+                                       <INPUT type="checkbox" <!-- TMPL_IF NAME="checked"--> checked <!--/TMPL_IF--> name="answernodouble" >
+                               </div>
+                       </form>
+                       </p>
+               <!--/TMPL_IF-->
+       <!--/TMPL_IF-->
+
+       <!-- TMPL_IF Name="NOK" -->
+               <h1>ERROR</h1>
+               <div id="problem">
+                       <p>The following fields are wrong. Please fix it/them</p>
+                       <!-- TMPL_IF NAME="ERROR_login_exist" -->
+                               <p>login/password already exist</p>
+                       <!-- /TMPL_IF -->
+               </div>
+       <!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="step_1"-->
+<form name="form"  action="/cgi-bin/koha/members/memberentry.pl" method="post"> 
+       <!--            field always hidden in different form (1,2,3) -->
+               <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+               <input type="hidden" name="FormFieldList" value="">
+               <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+               <input type="hidden" name="type" value="borrowers">
+               <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+               <input type="hidden" name="actionType" value="<!-- TMPL_VAR NAME="actionType" -->">
+               <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+               <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+               <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+               <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->" />
+
+<!--           from form 2 -->
+               <input type="hidden" name="streetnumber"  value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               <input type="hidden" name="streettype"  value="<!-- TMPL_VAR NAME="streettype" -->">
+               <input type="hidden" name="address"  value="<!-- TMPL_VAR NAME="address" -->">
+               <input type="hidden" name="address2"  value="<!-- TMPL_VAR NAME="address2" -->">        
+               <input type="hidden" name="zipcode"  value="<!-- TMPL_VAR NAME="zipcode" -->">  
+               <input type="hidden" name="city"  value="<!-- TMPL_VAR NAME="city" -->">
+               <input type="hidden" name="branchcode"  value="<!-- TMPL_VAR NAME="branchcode" -->">
+               <input type="hidden" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+               <input type="hidden" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+               <textarea style="display:none;" name="contactnotes" cols="70" rows="3"  ><!-- TMPL_VAR NAME="contactnotes" --></textarea>
+               <input type="hidden" name="fax"   value="<!-- TMPL_VAR NAME="fax" -->"  
+
+<!--           from form 3      -->
+               <input type="hidden" name="dateenrolled" size="20" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               <input type="hidden" name="dateexpiry" size="20" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               <textarea  style="display:none;" name="opacnotes" cols="70" rows="3"><!-- TMPL_VAR NAME="opacnotes"--></textarea>
+               <textarea style="display:none;" name="borrowernotes" cols="70" rows="3"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               <input type="hidden" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+               <input type="hidden" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">      
+               <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+               <input type="hidden" name="lost"  value="<!-- TMPL_VAR NAME="lost" -->" />
+               <input type="hidden" name="gonenoaddress"  value="<!-- TMPL_VAR NAME="gonenoaddress" -->" />
+       <!-- TMPL_IF NAME="opadd" -->
+               <input type="hidden" name="op" value="add">
+       <!-- TMPL_ELSE -->
+               <input type="hidden" name="op" value="modify">
+       <!-- /TMPL_IF -->
+       <p>
+               <!-- TMPL_IF NAME="mandatorycardnumber" -->
+               <label class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+               <label>
+               <!-- /TMPL_IF-->
+               Card number</label>
+                       <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+       </p>    
+       <fieldset id="memberentry_identity">
+               <legend>organisation identity</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorysurname" -->
+                       <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Organisation name</label>
+                       <input style="text-transform:uppercase;" type="text" name="surname" size="20"  value="<!-- TMPL_VAR NAME="surname" -->" >       
+               </p>
+               <p>
+                       <label>Select a category</label>
+                       <!-- TMPL_VAR NAME="catcodepopup" -->
+                       <!-- TMPL_IF NAME="city_cgipopup" -->   
+                                       <!-- TMPL_IF NAME="mandatoryselect_city" -->
+                                       <label   class="borrowers_mandafield">
+                                       <!-- TMPL_ELSE -->
+                                       <label>
+                                       <!-- /TMPL_IF-->
+                                       Select a city</label>
+                               <!-- TMPL_VAR NAME="citypopup" -->
+                       <!-- /TMPL_IF-->
+       </fieldset>
+       <fieldset>
+               <legend>Personal identity</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycontactname" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Surname</label>
+                       <input style="text-transform:uppercase;" type="text" name="contactname" size="20"  value="<!-- TMPL_VAR NAME="contactname" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycontactfirstname" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Firstname</label>
+                       <input style="text-transform:capitalize;" type="text" name="contactfirstname" size="20"  value="<!-- TMPL_VAR NAME="contactfirstname" -->">
+               </p>
+       </fieldset>
+               <div>
+                       <input type="button" name="step2" value="Next step" onclick="check_form_borrowers('2');">
+               </div>
+               </p>
+
+               </form>
+       <!-- /TMPL_IF -->
+
+
+<!-- TMPL_IF NAME="step_2"-->
+<form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+               <!--            field always hidden in different form (1,2,3) -->
+               <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+               <input type="hidden" name="FormFieldList" value="">
+               <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+               <input type="hidden" name="type" value="borrowers">
+               <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+               <input type="hidden" name="actionType" value="<!-- TMPL_VAR NAME="actionType" -->">
+               <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+               <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+               <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+               <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->" />
+
+
+<!--           from form 1 -->
+               <input  type="hidden" name="surname" value="<!-- TMPL_VAR NAME="surname" -->" >
+               <input type="hidden" name="categorycode" value="<!-- TMPL_VAR NAME="categorycode" -->">
+               <input type="hidden" name="contactname" value="<!-- TMPL_VAR name="contactname" -->">
+               <input type="hidden" name="select_city" value="<!-- TMPL_VAR NAME="select_city" -->">
+               <input type="hidden" name="contactfirstname" value="<!-- TMPL_VAR name="contactfirstname" -->">
+
+<!--           from form 3      -->
+               <input type="hidden" name="dateenrolled" size="20" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               <input type="hidden" name="dateexpiry" size="20" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               <textarea  style="display:none;" name="opacnotes" cols="70" rows="3"><!-- TMPL_VAR NAME="opacnotes"--></textarea>
+               <textarea style="display:none;" name="borrowernotes" cols="70" rows="3"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               <input type="hidden" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+               <input type="hidden" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">      
+               <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+               <input type="hidden" name="lost"  value="<!-- TMPL_VAR NAME="lost" -->" />
+               <input type="hidden" name="gonenoaddress"  value="<!-- TMPL_VAR NAME="gonenoaddress" -->" />
+               <!-- TMPL_IF NAME="opadd" -->
+                       <input type="hidden" name="op" value="add">
+               <!-- TMPL_ELSE -->
+                       <input type="hidden" name="op" value="modify">
+               <!-- /TMPL_IF -->
+       
+       
+       <p>
+               <!-- TMPL_IF NAME="mandatorycardnumber" -->
+               <label class="borrowers_mandafield">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Card number</label>
+               <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+       </p>
+       <fieldset is="memberentry_address">
+               <legend>Organisation address</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorystreetnumber" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Street number</label>
+                       <input type="text" name="streetnumber" size="5" value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               </p>
+               <!-- TMPL_IF NAME="road_cgipopup" -->
+                       <p>
+                       <!-- TMPL_IF NAME="mandatorystreettype" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Street type</label>
+                       <!-- TMPL_VAR NAME="roadpopup" -->
+                       <p>
+               <!--/TMPL_IF-->
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryaddress" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       Address</label>
+                       <input type="text" name="address" size="34" value="<!-- TMPL_VAR NAME="address" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryaddress2s" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Address 2</label>
+                       <input type="text" name="address2" size="33" value="<!-- TMPL_VAR NAME="address2" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryzipcode" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Zipcode</label>
+                       <input type="text" name="zipcode" size="10"  maxlength="10" value="<!-- TMPL_VAR NAME="zipcode" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycity" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       City</label>
+                       <input style="text-transform:uppercase;" type="text" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->">
+               </p>
+                       <!-- TMPL_IF NAME="mandatorybranchcode" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Branch</label>
+                       <!-- TMPL_VAR NAME="CGIbranch" -->
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryphonepro" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Phone (prof)</label>
+                       <input type="text" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+               <p>
+               </p>
+                       <!-- TMPL_IF NAME="mandatoryemailpro" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       E-mail (prof)</label>
+                       <input type="text" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryefax" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Fax</label>             
+                       <input type="text" name="fax" value="<!-- TMPL_VAR NAME="fax" -->" >    
+               </p>
+       </fieldset>
+       <fieldset>
+               <legend>Member list</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycontactnotes" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Persons that can issue books</label>
+                       <textarea  name="contactnotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="contactnotes" --></textarea>   
+               </p>
+       <fieldset>
+       <div id="action">
+               <input type="button" name="step1" value="Previous step" onclick="check_form_borrowers(0);">
+               <input type="button" name="step3" onclick="check_form_borrowers('3')" value="Next step">
+       </div>
+</form>
+<!-- ############################END FORM PROFESSIONAL############################################"-->
+<!--/TMPL_IF-->
+
+<!-- TMPL_IF NAME="step_3"-->
+       <form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+               <!--            field always hidden in different form (1,2,3) -->
+               <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+               <input type="hidden" name="FormFieldList" value="">
+               <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+               <input type="hidden" name="type" value="borrowers">
+               <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+               <input type="hidden" name="actionType" value="<!-- TMPL_VAR NAME="actionType" -->">
+               <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+               <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+               <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+               <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->"/>
+
+               <!--            from form 1 -->
+               <input  type="hidden" name="surname" value="<!-- TMPL_VAR NAME="surname" -->" >
+               <input type="hidden" name="categorycode" value="<!-- TMPL_VAR NAME="categorycode" -->">
+               <input type="hidden" name="contactname" value="<!-- TMPL_VAR name="contactname" -->">
+               <input type="hidden" name="select_city" value="<!-- TMPL_VAR NAME="select_city" -->">
+               <input type="hidden" name="contactfirstname" value="<!-- TMPL_VAR name="contactfirstname" -->">
+
+               <!--            from form 2 -->
+               <input type="hidden" name="streetnumber"  value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               <input type="hidden" name="streettype"  value="<!-- TMPL_VAR NAME="streettype" -->">
+               <input type="hidden" name="address"  value="<!-- TMPL_VAR NAME="address" -->">
+               <input type="hidden" name="address2"  value="<!-- TMPL_VAR NAME="address2" -->">        
+               <input type="hidden" name="zipcode"  value="<!-- TMPL_VAR NAME="zipcode" -->">  
+               <input type="hidden" name="city"  value="<!-- TMPL_VAR NAME="city" -->
+               <input type="hidden" name="branchcode"  value="<!-- TMPL_VAR NAME="branchcode" -->">
+               <input type="hidden" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+               <input type="hidden" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+               <textarea style="display:none;" name="contactnotes" cols="70" rows="3"  ><!-- TMPL_VAR NAME="contactnotes" --></textarea>
+               <input type="hidden" name="fax"   value="<!-- TMPL_VAR NAME="fax" -->"
+               
+               <!-- TMPL_IF NAME="opadd" -->
+                       <input type="hidden" name="op" value="add">
+               <!-- TMPL_ELSE -->
+                       <input type="hidden" name="op" value="modify">
+               <!-- /TMPL_IF -->
+       
+       <p>
+               <!-- TMPL_IF NAME="mandatorycardnumber" -->
+               <label class="borrowers_mandafield">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Cardnumber</label>
+               <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+       </p>
+       <fieldset id="memberentry_subscription">
+       <legend>Library set-up</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateenrolled" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Arrival date</label>
+                       <input type="text" name="dateenrolled"  maxlength="10"    size="10" onblur="CheckDate(document.form.dateenrolled.value);" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateexpiry" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Expiry date</label>
+                       <input type="text" name="dateexpiry" maxlength="10"  size="10"
+                                                       onblur="CheckDate(document.form.dateexpiry.value);check_manip_date('verify');" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryopacnotes" -->
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       OPAC note</label>
+                       <textarea  name="opacnotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="opacnotes" --></textarea>
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryborrowernotes" -->  
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Library note</label>
+                       <textarea name="borrowernotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               </p>
+       </fieldset>
+       <fieldset id="memberentry_login">
+               <legend>OPAC login</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorylogin" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       OPAC Login</label>
+                       <input type="text" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorypassword" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Password</label>
+                       <!--TMPL_IF NAME="opadd"-->
+                               <input type="text" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">
+                       <!--TMPL_ELSE-->
+                               <!--TMPL_IF NAME="password"-->
+                                       <input type="text" name="password" size="20"  value="****">
+                               <!--TMPL_ELSE-->
+                                       <input type="text" name="password" size="20"  value="">
+                               <!--/TMPL_IF-->
+                       <!--/TMPL_IF-->
+               </p>
+               <!--this zones are not necessary in modif mode -->
+               <!-- TMPL_UNLESS NAME="opadd" -->
+                       <h1>Warning</h1>
+                       <!-- TMPL_LOOP NAME="flagloop" -->
+                       <p>
+                               <label class="borrowers_labels_title"><!-- TMPL_VAR NAME="html" --></label>
+                               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="1" <!-- TMPL_VAR NAME="yes" -->>Yes
+                               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="0" <!-- TMPL_VAR NAME="no" -->>No
+                       </p>
+                       <!-- /TMPL_LOOP -->
+               <!-- /TMPL_UNLESS -->   
+               <p>
+               </fieldset>
+               <div>
+                       <input type="button" class="borrowers_button" name="etapeprec2" value="Etape precedente" onclick="check_form_borrowers(1);">    
+                       <!-- TMPL_IF NAME="opadd" -->
+                               <input type="button" name="step" onclick="unique();" value="Add member">
+                       <!-- TMPL_ELSE -->
+                               <input type="button" name="step4" onclick="check_form_borrowers();" value="Modify member">
+                       <!--/TMPL_IF -->
+               </div>
+       </form>
+<!-- /TMPL_IF -->
+<!--    TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/members/memberentryP.tmpl b/koha-tmpl/intranet-tmpl/prog/en/members/memberentryP.tmpl
new file mode 100755 (executable)
index 0000000..94cee98
--- /dev/null
@@ -0,0 +1,653 @@
+<!-- templates to add/modify a <P>rofessional -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Member, Professional management
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-members.inc" -->
+<!-- TMPL_INCLUDE NAME="javascript/members.js" -->
+
+       <!-- TMPL_IF NAME="opadd" -->
+       <h1>
+               Add professional member (step <!-- TMPL_VAR NAME="step" -->)
+       </h1>
+       <!-- TMPL_ELSE -->
+       <h1 >
+               Modify professional member
+       </h1>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF NAME="check_member" -->
+               <!-- TMPL_IF NAME="step_2" -->
+       <p>
+       <form name="form_double">
+               <div id="problem">
+                       Duplicate suspected 
+                       <a href="javascript:Dopop('borrowers_details.pl?borrowerid=<!--TMPL_VAR NAME="check_member"-->');" class="borrowers_button">Details</a>
+                       Duplicate ?     
+                       <a href="/cgi-bin/koha/members/memberentry.pl?borrowerid=<!--TMPL_VAR NAME="check_member"-->&category_type=<!--TMPL_VAR NAME="check_categorytype"-->" class="borrowers_button">Yes</a> 
+                       &nbsp;&nbsp;&nbsp; No, it is not
+                       <INPUT type="checkbox" <!-- TMPL_IF NAME="checked"--> checked <!--/TMPL_IF--> name="answernodouble" >
+               </div>
+       </form> 
+       
+               </p>    
+               <!--/TMPL_IF-->
+       <!--/TMPL_IF-->
+       <!-- TMPL_IF Name="NOK" -->
+               <h1>ERROR</h1>
+               <div id="problem">
+                       <p>The following fields are wrong. Please fix it/them</p>
+                       <!-- TMPL_IF NAME="ERROR_login_exist" -->
+                               <p>login/password already exist</p>
+                       <!-- /TMPL_IF -->
+               </div>
+       <!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="step_1"--><!--BEGIN OF TEST IF NOT collectivity BUT IN 1 STEP-->
+<form name="form"  action="/cgi-bin/koha/members/memberentry.pl" method="post"> 
+               <!--            field always hidden in different form (1,2,3) -->
+               <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+               <input type="hidden" name="FormFieldList" value="">
+               <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+               <input type="hidden" name="type" value="borrowers">
+               <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+               <input type="hidden" name="actionType" value="<!-- TMPL_VAR NAME="actionType" -->">
+               <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+               <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+               <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+               <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->"/>
+
+<!--           from form 2 -->
+               <input type="hidden" name="streetnumber"  value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               <input type="hidden" name="address"  value="<!-- TMPL_VAR NAME="address" -->">
+               <input type="hidden" name="address2"  value="<!-- TMPL_VAR NAME="address2" -->">
+               <input type="hidden" name="streettype"  value="<!-- TMPL_VAR NAME="streettype" -->">    
+               <input type="hidden" name="zipcode"  value="<!-- TMPL_VAR NAME="zipcode" -->">
+               <input type="hidden" name="city"  value="<!-- TMPL_VAR NAME="city" -->"> 
+               <input type="hidden" name="branchcode"  value="<!-- TMPL_VAR NAME="branchcode" -->">
+               <input type="hidden" name="phone"   value="<!-- TMPL_VAR NAME="phone" -->" >
+               <input type="hidden" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+               <input type="hidden" name="mobile"  value="<!-- TMPL_VAR NAME="mobile" -->" >   
+               <input type="hidden" name="email" value="<!-- TMPL_VAR NAME="email" -->" >
+               <input type="hidden" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+               <input type="hidden" name="contactname"  value="<!-- TMPL_VAR NAME="contactname" -->">
+               <input type="hidden" name="relationship"  value="<!-- TMPL_VAR NAME="relationship" -->">
+               <input type="hidden" name="b_address" value="<!-- TMPL_VAR NAME="b_address" -->">
+               <input type="hidden" name="b_zipcode"  value="<!-- TMPL_VAR NAME="b_zipcode" -->">
+               <input type="hidden" name="b_city"  value="<!-- TMPL_VAR NAME="b_city" -->">
+               <input type="hidden" name="b_phone"  value="<!-- TMPL_VAR NAME="b_phone" -->"> 
+               <input type="hidden" name="fax"  value="<!-- TMPL_VAR NAME="fax" -->">  
+               <textarea style="display:none;" name="contactnotes" cols="70" rows="3"  ><!-- TMPL_VAR NAME="contactnotes" --></textarea>
+
+<!--           from form 3 -->
+               <input type="hidden" name="dateenrolled"  value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               <input type="hidden" name="dateexpiry"  value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               <textarea  style="display:none;" name="opacnotes" cols="70" rows="3"><!-- TMPL_VAR NAME="opacnotes"--></textarea>
+               <textarea style="display:none;" name="borrowernotes" cols="70" rows="3"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               <input type="hidden" name="login"   value="<!-- TMPL_VAR NAME="login" -->">
+               <input type="hidden" name="password"   value="<!-- TMPL_VAR NAME="password" -->">       
+               <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+               <input type="hidden" name="lost"  value="<!-- TMPL_VAR NAME="lost" -->" />
+               <input type="hidden" name="gonenoaddress"  value="<!-- TMPL_VAR NAME="gonenoaddress" -->" />
+       <!-- TMPL_IF NAME="opadd" -->
+               <input type="hidden" name="op" value="add">
+       <!-- TMPL_ELSE -->
+               <input type="hidden" name="op" value="modify">
+       <!-- /TMPL_IF -->
+       <!-- TMPL_VAR NAME="member" -->
+       <p>
+               <!-- TMPL_IF NAME="mandatorycardnumber" -->
+               <label class="borrowers_mandafield">
+               <!--TMPL_ELSE-->
+               <label>
+               <!-- /TMPL_IF-->
+               Card number</label>
+                       <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+       </p>    
+       <fieldset id="memberentry_identity">
+               <legend>Borrower identity</legend>
+               <p>
+               <!-- TMPL_IF NAME="female" -->
+               <input type="radio" name="sex" value="F" checked>Female
+               <input type="radio" name="sex" value="M">Male
+               <!-- TMPL_ELSE -->
+               <input type="radio" name="sex" value="F">Female
+               <input type="radio" name="sex" value="M" checked>Male
+               <!-- /TMPL_IF -->
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatorytitle" -->
+                       <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+                       <label>
+               <!-- /TMPL_IF-->
+               Title</label>
+               <select  name="title" >
+                       <option <!-- TMPL_VAR NAME="title_selected_ " --> value="" >Select a value</option>
+                       <option value="Mlle" <!-- TMPL_VAR NAME="title_Mlle" -->>Mlle</option>
+                       <option value="Mme" <!-- TMPL_VAR NAME="title_Mme" -->>Mme</option>
+                       <option value="Mr" <!-- TMPL_VAR NAME="title_Mr" --> >M.</option>
+               </select>
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatorysurname" -->
+               <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Surname</label>
+               <input style="text-transform:uppercase;" type="text" name="surname" size="20"  value="<!-- TMPL_VAR NAME="surname" -->" >
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatoryfirstname" -->
+               <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Firstname</label>
+               <input style="text-transform:capitalize;" type="text" name="firstname" size="20"  value="<!-- TMPL_VAR NAME="firstname" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateofbirth" -->
+                       <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->      
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Date of Birth</label>
+                       <input type="text" name="dateofbirth" size="20" onBlur="CheckDate(document.form.dateofbirth.value);" value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryinitials" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Initials</label>
+                       <input type="text" name="initials" size="20"  value="<!-- TMPL_VAR NAME="initials" -->">        
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryothernames" -->
+                       <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Other name</label>
+                       <input style="text-transform:uppercase;" type="text" name="othernames" size="20"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+               </p>
+       </fieldset>
+       <fieldset id="memberentry_identity">
+               <legend>Borrower type</legend>
+               <p>
+               <label>Select a category</label>
+               <!-- TMPL_VAR NAME="catcodepopup" -->
+               </p>
+               <!-- TMPL_IF NAME="city_cgipopup" -->   
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryselect_city" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Select a city</label>
+                       <!-- TMPL_VAR NAME="citypopup" -->
+               </p>
+               <!-- /TMPL_IF-->
+               <p>
+                       <!-- TMPL_IF NAME="mandatorysort1" -->
+                               <label style="font-weight:bold">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Sort 1</label>
+                       <!--TMPL_IF NAME="CGIsort1" --> 
+                               <!-- TMPL_VAR NAME="CGIsort1" -->
+                       <!--TMPL_ELSE-->
+                               <input type="text" name="sort1" size="20"  value="<!-- TMPL_VAR NAME="sort1" -->" >
+                       <!-- /TMPL_IF -->               
+               </p>
+               <p>
+               <!-- TMPL_IF NAME="mandatorysort2" -->
+               <label style="font-weight:bold">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Sort 2</label>
+               <!--TMPL_IF NAME="CGIsort2" --> 
+                       <!-- TMPL_VAR NAME="CGIsort2" -->
+               <!--TMPL_ELSE-->
+                       <input type="text" name="sort2" size="20"  value="<!-- TMPL_VAR NAME="sort2" -->" >
+               <!-- /TMPL_IF -->       
+               </p>
+       </fieldset>
+       <div>
+               <input type="button" name="next_step" value="Next Step" onclick="check_form_borrowers(1);">
+       </div>
+</form>
+<!-- /TMPL_IF --><!--STEP_1    -->
+
+
+<!-- TMPL_IF NAME="step_2"-->
+<!-- ############################BEGIN FORM PROFESSIONAL############################################"-->
+       
+<form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+               <!--            field always hidden in different form (1,2,3) -->
+               <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+               <input type="hidden" name="FormFieldList" value="">
+               <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+               <input type="hidden" name="type" value="borrowers">
+               <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+               <input type="hidden" name="actionType" value="<!-- TMPL_VAR NAME="actionType" -->">
+               <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+               <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+               <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+               <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->" />
+       
+
+<!--           from form 1 -->
+               <input type="hidden" name="title"  value="<!-- TMPL_VAR NAME="title" -->">
+               <input type="hidden" name="surname"  value="<!-- TMPL_VAR NAME="surname" -->" >
+               <input type="hidden" name="firstname"  value="<!-- TMPL_VAR NAME="firstname" -->">
+               <input type="hidden" name="dateofbirth"  value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+               <input type="hidden" name="initials"  value="<!-- TMPL_VAR NAME="initials" -->">
+               <input type="hidden" name="othernames"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+               <input type="hidden" name="sex" value="<!-- TMPL_VAR NAME="sex" -->" >
+               <input type="hidden" name="categorycode"  value="<!-- TMPL_VAR NAME="categorycode" -->">
+               <input type="hidden" name="select_city" value="<!-- TMPL_VAR NAME="select_city" -->">
+               <input type="hidden" name="sort1"   value="<!-- TMPL_VAR NAME="sort1" -->">
+               <input type="hidden" name="sort2"   value="<!-- TMPL_VAR NAME="sort2" -->">
+               
+<!--           from form 3 -->
+               <input type="hidden" name="dateenrolled"  value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               <input type="hidden" name="dateexpiry"  value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               <textarea  style="display:none;" name="opacnotes" cols="70" rows="3"><!-- TMPL_VAR NAME="opacnotes"--></textarea>
+               <textarea style="display:none;" name="borrowernotes" cols="70" rows="3"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               <input type="hidden" name="login"   value="<!-- TMPL_VAR NAME="login" -->">
+               <input type="hidden" name="password"   value="<!-- TMPL_VAR NAME="password" -->">       
+               <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+               <input type="hidden" name="lost"  value="<!-- TMPL_VAR NAME="lost" -->" />
+               <input type="hidden" name="gonenoaddress"  value="<!-- TMPL_VAR NAME="gonenoaddress" -->" />
+               
+               <!-- TMPL_IF NAME="opadd" -->
+                       <input type="hidden" name="op" value="add">
+               <!-- TMPL_ELSE -->
+                       <input type="hidden" name="op" value="modify">
+               <!-- /TMPL_IF -->
+
+               <input type="hidden" name="debarred"  value="<!-- TMPL_VAR NAME="debarred" -->" />
+
+       <p>
+               <!-- TMPL_IF NAME="mandatorycardnumber" -->
+               <label class="borrowers_mandafield">
+               <!-- TMPL_ELSE -->
+               <label>
+               <!-- /TMPL_IF-->
+               Card number</label>
+               <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+       </p>
+       <fieldset is="memberentry_address">
+               <legend>Professional address</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorystreetnumber" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       Street number</label>
+                       <input type="text" name="streetnumber" size="5" value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               </p>
+                       <!-- TMPL_IF NAME="road_cgipopup" -->
+                               <p>
+                               <!-- TMPL_IF NAME="mandatorystreettype" -->
+                                       <label class="borrowers_mandafield">
+                               <!--TMPL_ELSE-->
+                                       <label>
+                               <!-- /TMPL_IF-->
+                               Road type</label>
+                               <!-- TMPL_VAR NAME="roadpopup" -->
+                               </p>
+                       <!--/TMPL_IF--> 
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryaddress" -->
+                       <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       Address</label>
+                       <input type="text" name="address" size="34" value="<!-- TMPL_VAR NAME="address" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryaddress2s" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Address 2</label>
+                       <input type="text" name="address2" size="33" value="<!-- TMPL_VAR NAME="address2" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryzipcode" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                               Zipcode</label>
+                       <input type="text" name="zipcode" size="10"  maxlength="10" value="<!-- TMPL_VAR NAME="zipcode" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycity" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                               City</label>
+                       <input style="text-transform:uppercase;" type="text" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorybranchcode" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                               Branch</label>
+               <!-- TMPL_VAR NAME="CGIbranch" -->
+               </p>
+       </fieldset>
+       <fieldset>
+               <legend>Professional contact</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryphone" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Phone (home)</label>
+                       <input type="text" name="phone" value="<!-- TMPL_VAR NAME="phone" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryphonepro" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Phone (prof)</label>
+                       <input type="text" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorymobile" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Phone (cell)</label>                            
+                       <input type="text" name="mobile" value="<!-- TMPL_VAR NAME="mobile" -->" >
+               </p>
+               <p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryemail" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       E-mail (home)</label>
+                       <input type="text" name="email" value="<!-- TMPL_VAR NAME="email" -->" >        
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryemailpro" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       E-mail (prof)</label>
+                       <input type="text" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryefax" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Fax</label>     
+                       <input type="text" name="fax" value="<!-- TMPL_VAR NAME="fax" -->">
+               </p>
+       </fieldset>
+       <fieldset>
+               <legend>Structure</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycontactname" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Name</label>
+                       <input style="text-transform:uppercase;" type="text" name="contactname" size="20" value="<!-- TMPL_VAR NAME="contactname" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryrelationship" -->
+                               <label class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Relation</label>
+                       <select name="relationship" size="1">
+                                               <!-- TMPL_LOOP NAME="relshiploop" -->
+                                                       <option <!-- TMPL_VAR NAME="selected" -->><!-- TMPL_VAR NAME="relationship" --></option>
+                                               <!-- /TMPL_LOOP -->
+                       </select>
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryb_address" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Adress </label>
+                       <input type="text" name="b_address" size="40" value="<!-- TMPL_VAR NAME="b_address" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryb_zipcode" -->
+                       <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                       <label>
+                       <!-- /TMPL_IF-->        
+                       Zipcode</label>
+                       <input type="text" maxlength="5" name="b_zipcode" size="5" value="<!-- TMPL_VAR NAME="b_zipcode" -->">
+               </p>
+                       <!-- TMPL_IF NAME="mandatoryb_city" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       City</label>
+                       <input style="text-transform:uppercase;" type="text" name="b_city" size="20" value="<!-- TMPL_VAR NAME="b_city" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryb_phone" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Phone (home)</label>
+                       <input type="text" name="b_phone" size="20" value="<!-- TMPL_VAR NAME="b_phone" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycontactnotes" -->
+                               <label class="borrowers_mandafield">
+                       <!-- TMPL_ELSE -->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Notes</label>
+                       <textarea  name="contactnotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="contactnotes" --></textarea>
+               </p>
+       </fieldset>
+               <div>
+               <input type="button" class="borrowers_button" name="etapeprec1" value="Etape precedente" onclick="check_form_borrowers(0);">
+               <input type="button" class="borrowers_button" name="etapesuiv3" onclick="check_form_borrowers('3')" value="Etape suivante"></div>
+       </p>
+</form>
+<!-- ############################END FORM PROFESSIONAL############################################"-->
+<!--/TMPL_IF-->
+
+<!-- TMPL_IF NAME="step_3"-->
+       <form name="form" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+               <!--            field always hidden in different form (1,2,3) -->
+               <input type="hidden" name="BorrowerMandatoryfield" value="<!--TMPL_VAR NAME="BorrowerMandatoryfield"-->">
+               <input type="hidden" name="FormFieldList" value="">
+               <input type="hidden" name="category_type" value="<!-- TMPL_VAR name="category_type" -->">
+               <input type="hidden" name="type" value="borrowers">
+               <input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->">
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
+               <input type="hidden" name="actionType" value="<!-- TMPL_VAR NAME="actionType" -->">
+               <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" />
+               <input type="hidden" name="flags" value="<!-- TMPL_VAR NAME="flags" -->" />
+               <input type="hidden" name="borrowerid" value="<!-- TMPL_VAR NAME="borrowerid" -->">
+               <input type="hidden" name="nodouble"  value="<!-- TMPL_VAR NAME="nodouble" -->" />
+               
+       <!--            from form 1 -->
+               <input type="hidden" name="title"  value="<!-- TMPL_VAR NAME="title" -->">
+               <input type="hidden" name="surname"  value="<!-- TMPL_VAR NAME="surname" -->" >
+               <input type="hidden" name="firstname"  value="<!-- TMPL_VAR NAME="firstname" -->">
+               <input type="hidden" name="dateofbirth"  value="<!-- TMPL_VAR NAME="dateofbirth" -->">
+               <input type="hidden" name="initials"  value="<!-- TMPL_VAR NAME="initials" -->">
+               <input type="hidden" name="othernames"  value="<!-- TMPL_VAR NAME="othernames" -->" >
+               <input type="hidden" name="sex" value="<!-- TMPL_VAR NAME="sex" -->" >
+               <input type="hidden" name="categorycode"  value="<!-- TMPL_VAR NAME="categorycode" -->">
+               <input type="hidden" name="select_city" value="<!-- TMPL_VAR NAME="select_city" -->">
+               <input type="hidden" name="sort1"   value="<!-- TMPL_VAR NAME="sort1" -->">
+               <input type="hidden" name="sort2"   value="<!-- TMPL_VAR NAME="sort2" -->">
+
+
+       <!--            from form 2 -->
+               <input type="hidden" name="streetnumber"  value="<!-- TMPL_VAR NAME="streetnumber" -->">
+               <input type="hidden" name="address"  value="<!-- TMPL_VAR NAME="address" -->">
+               <input type="hidden" name="address2"  value="<!-- TMPL_VAR NAME="address2" -->">
+               <input type="hidden" name="streettype"  value="<!-- TMPL_VAR NAME="streettype" -->">    
+               <input type="hidden" name="zipcode"  value="<!-- TMPL_VAR NAME="zipcode" -->">
+               <input type="hidden" name="city"  value="<!-- TMPL_VAR NAME="city" -->"> 
+               <input type="hidden" name="branchcode"  value="<!-- TMPL_VAR NAME="branchcode" -->">
+               <input type="hidden" name="phone"   value="<!-- TMPL_VAR NAME="phone" -->" >
+               <input type="hidden" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" >
+               <input type="hidden" name="mobile"  value="<!-- TMPL_VAR NAME="mobile" -->" >   
+               <input type="hidden" name="email" value="<!-- TMPL_VAR NAME="email" -->" >
+               <input type="hidden" name="emailpro" value="<!-- TMPL_VAR NAME="emailpro" -->" >
+               <input type="hidden" name="contactname"  value="<!-- TMPL_VAR NAME="contactname" -->">
+               <input type="hidden" name="relationship"  value="<!-- TMPL_VAR NAME="relationship" -->">
+               <input type="hidden" name="b_address" value="<!-- TMPL_VAR NAME="b_address" -->">
+               <input type="hidden" name="b_zipcode"  value="<!-- TMPL_VAR NAME="b_zipcode" -->">
+               <input type="hidden" name="b_city"  value="<!-- TMPL_VAR NAME="b_city" -->">
+               <input type="hidden" name="b_phone"  value="<!-- TMPL_VAR NAME="b_phone" -->"> 
+               <input type="hidden" name="fax"  value="<!-- TMPL_VAR NAME="fax" -->">  
+               <textarea style="display:none;" name="contactnotes" cols="70" rows="3"  ><!-- TMPL_VAR NAME="contactnotes" --></textarea>
+       
+               <!-- TMPL_IF NAME="opadd" -->
+                       <input type="hidden" name="op" value="add">
+               <!-- TMPL_ELSE -->
+                       <input type="hidden" name="op" value="modify">
+               <!-- /TMPL_IF -->
+               <p>
+                       <!-- TMPL_IF NAME="mandatorycardnumber" -->
+                       <label  class="borrowers_mandafield">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                        Card number</label>
+                       <input type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->">
+               </p>
+       <fieldset id="memberentry_subscription">
+       <legend>Library set-up</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateenrolled" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Arrival date</label>
+                       <input type="text" name="dateenrolled"  maxlength="10"    size="10" onblur="CheckDate(document.form.dateenrolled.value);" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorydateexpiry" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Expiry date</label>
+                       <input type="text" name="dateexpiry" maxlength="10"  size="10"
+                                                       onblur="CheckDate(document.form.dateexpiry.value);check_manip_date('verify');" value="<!-- TMPL_VAR NAME="dateexpiry" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryopacnotes" -->
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->        
+                       OPAC note</label>
+                       <textarea  name="opacnotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="opacnotes" --></textarea>
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatoryborrowernotes" -->  
+                               <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                               <label>
+                       <!-- /TMPL_IF-->
+                       Library note</label>
+                       <textarea name="borrowernotes" cols="70" rows="2"   ><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+               </p>
+       </fieldset>
+       <fieldset id="memberentry_login">
+               <legend>OPAC login</legend>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorylogin" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       OPAC Login</label>
+                       <input type="text" name="login" size="20"  value="<!-- TMPL_VAR NAME="login" -->">
+               </p>
+               <p>
+                       <!-- TMPL_IF NAME="mandatorypassword" -->
+                       <label style="font-weight:bold">
+                       <!--TMPL_ELSE-->
+                       <label>
+                       <!-- /TMPL_IF-->
+                       Password</label>
+                       <!--TMPL_IF NAME="opadd"-->
+                               <input type="text" name="password" size="20"  value="<!-- TMPL_VAR NAME="password" -->">
+                       <!--TMPL_ELSE-->
+                               <!--TMPL_IF NAME="password"-->
+                                       <input type="text" name="password" size="20"  value="****">
+                               <!--TMPL_ELSE-->
+                                       <input type="text" name="password" size="20"  value="">
+                               <!--/TMPL_IF-->
+                       <!--/TMPL_IF-->
+               </p>
+               <!--this zones are not necessary in modif mode -->
+               <!-- TMPL_UNLESS NAME="opadd" -->
+                       <h1>Warning</h1>
+                       <!-- TMPL_LOOP NAME="flagloop" -->
+                       <p>
+                               <label class="borrowers_labels_title"><!-- TMPL_VAR NAME="html" --></label>
+                               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="1" <!-- TMPL_VAR NAME="yes" -->>Yes
+                               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="0" <!-- TMPL_VAR NAME="no" -->>No
+                       </p>
+                       <!-- /TMPL_LOOP -->
+               <!-- /TMPL_UNLESS -->   
+               <p>
+               </fieldset>
+               <div>
+                       <input type="button" class="borrowers_button" name="etapeprec2" value="Etape precedente" onclick="check_form_borrowers(1);">    
+                       <!-- TMPL_IF NAME="opadd" -->
+                               <input type="button" name="step" onclick="unique();" value="Add member">
+                       <!-- TMPL_ELSE -->
+                               <input type="button" name="step4" onclick="check_form_borrowers();" value="Modify member">
+                       <!--/TMPL_IF -->
+               </div>
+       </form>
+<!-- /TMPL_IF -->
+<!--    TMPL_INCLUDE NAME="intranet-bottom.inc" -->
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/members/memberentry_old.tmpl b/koha-tmpl/intranet-tmpl/prog/en/members/memberentry_old.tmpl
new file mode 100644 (file)
index 0000000..604ca16
--- /dev/null
@@ -0,0 +1,254 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="modify" -->Edit Record<!-- TMPL_ELSE -->Add New <!-- TMPL_IF NAME="institution" -->Institutional <!-- /TMPL_IF -->Member<!-- /TMPL_IF --><!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-members.inc" -->
+
+       <!-- TMPL_IF NAME="addAction" -->
+       <h1>
+               Add New <!-- TMPL_IF NAME="institution" -->Institutional <!-- /TMPL_IF -->Member
+       </h1>
+       <!-- TMPL_ELSE -->
+       <h1>
+               Update <!-- TMPL_IF NAME="institution" -->Institutional <!-- /TMPL_IF -->Member Details
+</h1>
+<h2><!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR name="firstname" --></h2>
+       <!-- /TMPL_IF -->
+
+       <!-- TMPL_IF Name="NOK" -->
+               <h3>Missing Information</h3>
+                       <p>The following fields have a forbidden value. Correct them and press OK again :</p><ul>
+                       <!-- TMPL_IF NAME="ERROR_surname" -->
+                               <li><a href="#lastname">Last Name</a></li>
+                       <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_firstname" -->
+                               <li><a href="#firstname">First Name</a></li>
+                       <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_gender" -->
+                               <li><a href="sex">Sex</a></li>
+                       <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_address" -->
+                               <li><a href="#address">Mailing Address</a></li>
+                       <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_city" -->
+                               <li><a href="#city">Mailing Address City/State</a></li>
+                       <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_cardnumber" -->
+                               <li><a href="#cardnumber">Card Number</a></li>
+                       <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_invalid_cardnumber" -->
+                               <li><a href="#cardnumber">Invalid Card Number</a></li>
+                       <!-- /TMPL_IF -->
+                       </ul>
+       <!-- /TMPL_IF -->
+       <form action="/cgi-bin/koha/members/memberentry.pl" method="post">
+               <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" />
+               <input type="hidden" name="type" value="borrowers" />
+               <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
+               <input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->" />
+       <input type="hidden" name="actionType" value="<!-- TMPL_VAR NAME="actionType" -->" />
+               <!-- TMPL_IF NAME="addAction" -->
+                       <input type="hidden" name="op" value="add" />
+               <!-- TMPL_ELSE -->
+                       <input type="hidden" name="op" value="modify" />
+               <!-- /TMPL_IF -->
+       
+       <!-- TMPL_UNLESS name="institution" -->
+               <p>
+               <label for="title">Salutation:</label><!-- TMPL_VAR NAME="Mr" -->
+               <select name="title" id="title">
+                       <option <!-- TMPL_VAR NAME="title_selected_ " --> value="">No Title</option>
+                       <option value="Miss" <!-- TMPL_VAR NAME="title_Miss" -->>Miss</option>
+                       <option value="Mrs" <!-- TMPL_VAR NAME="title_Mrs" -->>Mrs</option>
+                       <option value="Ms" <!-- TMPL_VAR NAME="title_Ms" -->>Ms</option>
+                       <option <!-- TMPL_VAR NAME="title_Mr" --> value="Mr" >Mr</option>
+                       <option value="Dr" <!-- TMPL_VAR NAME="title_Dr" -->>Dr</option>
+                       <option value="Sir" <!-- TMPL_VAR NAME="title_Sir" -->>Sir</option>
+               </select>
+               </p>
+       <!-- /TMPL_UNLESS -->
+       <p>
+               <label for="surname">
+                       <!-- TMPL_IF NAME="institution" -->Institution name:<!-- TMPL_ELSE -->Last Name: <!-- /TMPL_IF -->
+               </label>
+               <input type="text" id="surname" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->" />
+       </p>
+
+       <!-- TMPL_UNLESS name="institution" -->
+       <p>
+               <label for="firstname">First Name:</label>
+               <input type="text" id="firstname" name="firstname" size="20" value="<!-- TMPL_VAR NAME="firstname" -->" />
+       </p>
+       <!-- /TMPL_UNLESS -->
+                               
+       <!-- TMPL_UNLESS name="institution" -->
+       <p>
+               <label for="initials">Initials:</label>
+               <input type="text" id="initials" name="initials" size="5" value="<!-- TMPL_VAR NAME="initials" -->" />
+       </p>
+       <!-- /TMPL_UNLESS -->
+                                       
+       <!-- TMPL_UNLESS name="institution" -->
+       <p>
+               <label for="othernames">Prefered Name:</label>
+               <input type="text" id="othernames" name="othernames" size="20" value="<!-- TMPL_VAR NAME="othernames" -->" />
+       </p>
+       <!-- /TMPL_UNLESS -->
+       <!-- TMPL_UNLESS name="institution" -->
+       <p>
+               <label for="sex">Sex:</label>
+               <input type="radio" id="sex" name="sex" value="F"<!-- TMPL_IF NAME="female" --> checked="checked"<!-- /TMPL_IF --> />F  <input type="radio" name="sex" value="M"<!-- TMPL_UNLESS name="female" --> checked="checked"<!-- /TMPL_UNLESS --> /> M
+       </p>
+       <!-- /TMPL_UNLESS -->
+
+<!-- TMPL_UNLESS name="institution" -->
+       <p><label for="dateofbirth">Date of Birth: </label><input type="text" id="dateofbirth" name="dateofbirth" size="10" value="<!-- TMPL_VAR NAME="dateofbirth" -->" /> (<!-- TMPL_VAR NAME="dateformat" -->)</p>
+<!-- /TMPL_UNLESS -->
+
+<p>Addresses:</p>
+<fieldset>
+       <legend>Mailing Address</legend>
+       <p>
+               <label for="streetaddress">Address:</label>
+               <input type="text" id="streetaddress" name="streetaddress" size="25" value="<!-- TMPL_VAR NAME="address" -->" />
+       </p>
+       <p>
+               <label for="city">City, State:</label>
+               <input type="text" id="city" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->" />
+       </p>
+       <p>
+               <label for="zipcode">Zip Code:</label>
+               <input type="text" id="zipcode" name="zipcode" size="20" maxlength="20" value="<!-- TMPL_VAR NAME="zipcode" -->" />
+       </p>
+</fieldset>
+
+<fieldset>
+       <legend>Street Address (if different)</legend>
+       <p>
+               <label for="physstreet">Address:</label>
+               <input type="text" id="physstreet" name="physstreet" size="25" value="<!-- TMPL_VAR NAME="physstreet" -->" />
+       </p>
+       <p>
+               <label for="streetcity">City, State: </label>
+               <input type="text" id="streetcity" name="streetcity" size="20" value="<!-- TMPL_VAR NAME="streetcity" -->" />
+       </p>
+       <p>
+               <label for="homezipcode">Zip Code:</label>
+               <input type="text" id="homezipcode" name="homezipcode" size="20" maxlength="20" value="<!-- TMPL_VAR NAME="homezipcode" -->" />
+       </p>
+</fieldset>
+<p>
+       <label for="phone">Phone (Home):</label>
+       <input type="text" id="phone" name="phone" size="20" value="<!-- TMPL_VAR NAME="phone" -->" />
+</p>
+<p>
+       <label for="phoneday">Phone (Daytime):</label>
+       <input type="text" id="phoneday" name="phoneday" size="20" value="<!-- TMPL_VAR NAME="phoneday" -->" />
+</p>
+<p>
+       <label for="faxnumber">Fax: </label>
+       <input type="text" id="faxnumber" name="faxnumber" size="20" value="<!-- TMPL_VAR NAME="faxnumber" -->" />
+</p>
+<p>
+       <label for="emailaddress">Email :</label>
+       <input type="text" id="emailaddress" name="emailaddress" size="40" value="<!-- TMPL_VAR NAME="emailaddress" -->" />
+</p>
+<p><label for="textmessaging">Member message: (appears in OPAC)</label></p>
+<p>
+       <textarea id="textmessaging" name="textmessaging" cols="30" rows="3">
+               <!-- TMPL_VAR NAME="textmessaging" -->
+       </textarea>
+</p>
+<p>
+       <label for="borrowernotes">Circulation note:(appears in Circulation)</label>
+       <textarea id="borrowernotes" name="borrowernotes" cols="30" rows="3">
+               <!-- TMPL_VAR NAME="borrowernotes" -->
+       </textarea>
+</p>
+<!-- TMPL_IF NAME="addAction" -->
+       <p>
+               <label>Joining date (leave blank for today): </label>
+               <input type="text" name="joining" size="12" maxlength="10" value="<!-- TMPL_VAR name="joining" -->" />
+       </p>
+<!-- TMPL_ELSE -->
+       <p>
+               <label>Joining date: </label>
+               <!-- TMPL_VAR name="joining" -->
+       </p>
+<!-- /TMPL_IF -->
+<p>
+       <label>Expiry date (leave blank for auto calc): </label>
+       <input type="text" name="expiry" size="12" maxlength="10" value="<!-- TMPL_VAR name="expiry" -->" />
+</p>
+
+<!-- TMPL_UNLESS name="institution" -->
+<h2>Alternate Contact</h2>
+<p>
+       <label for="contactname">Name: </label>
+       <input type="text" id="contactname"  name="contactname" size="40" value="<!-- TMPL_VAR NAME="contactname" -->" />
+</p>
+<p>
+       <label for="altphone">Phone:</label>
+       <input type="text" id="altphone" name="altphone" size="20" value="<!-- TMPL_VAR NAME="altphone" -->" />
+</p>
+<p>
+       <label for="altrelationship">Relationship:</label>
+       <select id="altrelationship" name="altrelationship" size="1">
+               <!-- TMPL_LOOP NAME="relshiploop" -->
+                       <option <!-- TMPL_VAR NAME="selected" -->><!-- TMPL_VAR NAME="relationship" --></option>
+               <!-- /TMPL_LOOP -->
+       </select>
+</p>
+<p>
+       <label for="altnotes">Notes: </label>
+       <textarea id="altnotes" name="altnotes" cols="30" rows="3"><!-- TMPL_VAR NAME="altnotes" --></textarea>
+</p>
+<!-- /TMPL_UNLESS -->
+
+<h2>Flags</h2>
+<!-- TMPL_LOOP NAME="flagloop" -->
+       <p>
+               <label for="<!-- TMPL_VAR NAME="name" -->"><!-- TMPL_VAR NAME="html" --></label>
+               <input type="radio" id="<!-- TMPL_VAR NAME="name" -->" name="<!-- TMPL_VAR NAME="name" -->" value="1" <!-- TMPL_VAR NAME="yes" --> />Yes 
+               <input type="radio" name="<!-- TMPL_VAR NAME="name" -->" value="0" <!-- TMPL_VAR NAME="no" --> />No
+       </p>
+<!-- /TMPL_LOOP -->
+
+<h2>Member Details</h2>
+       <!-- TMPL_UNLESS NAME="addAction" -->
+               <p>
+                       <label>Member Number:</label>
+                       <span class="ex"><!-- TMPL_VAR NAME="member" --></span>
+               </p>
+       <!-- /TMPL_UNLESS -->
+       <p>
+               <label for="categorycode">Category:</label>
+               <!-- TMPL_VAR NAME="catcodepopup" -->
+       </p>
+       <p>
+               <label for="branchcode">Branch:</label>
+               <!-- TMPL_VAR NAME="CGIbranch" -->
+       </p>
+       <p>
+               <label for="cardnumber">
+                       <a name="cardnumber">Card Number</a>
+               </label>
+               <input id="cardnumber" type="text" name="cardnumber" size="10" value="<!-- TMPL_VAR NAME="cardnumber" -->" />
+       </p>
+
+<h2>Additional Fields</h2>
+<p>These fields are available for your own usage. They can be useful for statistical purposes</p>
+<p>
+       <label for="sort1">Sorting field 1</label>
+       <input type="text" id="sort1" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" />
+</p>
+<p>
+       <label for="sort2">Sorting field 2</label>
+       <input type="text" id="sort2" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" />
+</p>
+
+<input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
+<input name="submit" type="submit" class="submit" value="<!-- TMPL_IF NAME="modify" -->Update<!-- TMPL_ELSE -->Add<!-- /TMPL_IF --> This Member" />
+</form>
+
+
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
index 7b7a182..0046af8 100644 (file)
@@ -6,64 +6,30 @@
 <h1><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)</h1>
 
 <ul>
-       <!-- TMPL_IF name="IS_ADULT" -->
-       <li>
-       <form action="/cgi-bin/koha/members/jmemberentry.pl" method="post">
-               <input type="submit" name="submit" value="Add Child" alt="Add Child" />
-               <input type="hidden" name="type" value="add" />
-               <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
-       </form>
-       </li>
-       <!-- /TMPL_IF -->
-       <li>
-       <!-- TMPL_IF name="I" -->
-       <form action="/cgi-bin/koha/members/imemberentry.pl" method="post">
-               <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="bornum" -->" />
-               <input type="submit" name="modify" value="Edit this Record" />
-       </form>
-       <!-- TMPL_ELSE -->
-               <form action="/cgi-bin/koha/members/memberentry.pl" method="post">
-                       <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="bornum" -->" />
-                       <input type="submit" name="modify" value="Edit this Record" />
-               </form>
-       <!-- /TMPL_IF -->
-       </li>
-       <li>
-               <form action="/cgi-bin/koha/members/member-password.pl" method="post">
-                       <input type="hidden" name="member" value="<!-- TMPL_VAR NAME=bornum -->" />
-                       <input type="submit" value="Change Member's Password" />
-               </form>
-       </li>
-       <li>
-               <form action="/cgi-bin/koha/members/member-flags.pl" method="post">
-                       <input type="hidden" name="member" value="<!-- TMPL_VAR NAME=bornum -->" />
-                       <input type="submit" value="Modify Member's Privileges" />
-               </form>
-       </li>
-       <li>
-               <form action="/cgi-bin/koha/members/deletemem.pl?member=<!-- TMPL_VAR NAME="bornum" -->">
-                       <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="bornum" -->" />
-                       <input type="submit" class="cancel" value="Delete this Member" />
-               </form>
-       </li>
-       <li>
-               <form action="/cgi-bin/koha/members/boraccount.pl" method="get">
-                       <input type="hidden" name="bornum" value="<!-- TMPL_VAR NAME="bornum" -->" />
-                       <input type="submit" value="View Account" />
-               </form>
-       </li>
-       <li>
-               <form action="/cgi-bin/koha/members/pay.pl" method="get">
-                       <input type="hidden" name="bornum" value="<!-- TMPL_VAR NAME="bornum" -->" />
-                       <input type="submit" value="Pay Fines" />
-               </form>
-       </li>
-       <li>
-               <form action="/cgi-bin/koha/members/readingrec.pl" method="get">
-                       <input type="hidden" name="bornum" value="<!-- TMPL_VAR NAME="bornum" -->" />
-                       <input type="submit" value="Member's Reading Record" />
-               </form>
-       </li>
+       <!-- TMPL_UNLESS name="guarantorborrowernumber" -->
+       <a href="/cgi-bin/koha/members/jmemberentry.pl?type=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Add child</a> 
+       <!-- /TMPL_UNLESS -->
+       <a href="/cgi-bin/koha/members/imemberentry.pl?borrowernumber=<!-- TMPL_VAR NAME="bornum" -->">
+               Edit this Record
+       </a> 
+       <a href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME=bornum -->">
+               Change Member's Password
+       </a> 
+       <a href="/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME=bornum -->">
+               Modify Member's Privileges
+       </a> 
+       <a href="/cgi-bin/koha/members/deletemem.pl?borrowernumber=<!-- TMPL_VAR NAME="bornum" -->">
+               Delete this Member
+       </a> 
+       <a href="/cgi-bin/koha/members/boraccount.pl?bornum=<!-- TMPL_VAR NAME="bornum" -->">
+               View Account
+       </a> 
+       <a href="/cgi-bin/koha/members/pay.pl?bornum=<!-- TMPL_VAR NAME="bornum" -->">
+               Pay Fines
+       </a> 
+       <a href="/cgi-bin/koha/members/readingrec.pl?bornum=<!-- TMPL_VAR NAME="bornum" -->">
+               Member's Reading Record
+       </a>
 </ul>
 
 <!-- TMPL_IF NAME="flagged" -->
 
 <!-- /TMPL_IF -->
 
-<h2>Borrower Information</h2>
-<p><label>Title (borrowers.title):</label><!-- TMPL_VAR NAME="title" --></p>
-<p><label>First Name (borrowers.firstname):</label><!-- TMPL_VAR NAME="firstname" --></p>
-<p><label>Last Name (borrowers.lastname): </label><!-- TMPL_VAR NAME="surname" --></p>
-<p><label>Othernames (borrowers.othernames): </label><!-- TMPL_VAR NAME="othernames" --></p>
-<p><label>Initials (borrowers.initials): </label><!-- TMPL_VAR NAME="initials" --></p>
-<p><label>Street Address (borrowers.streetaddress): </label><!-- TMPL_VAR NAME="streetaddress" --></p>
-<p><label>City (borrowers.city): </label><!-- TMPL_VAR NAME="city" --></p>
-<p><label>Zip Code (borrowers.zipcode): </label><!-- TMPL_VAR NAME="zipcode" --></p>
-
-<!-- TMPL_UNLESS NAME="I"-->
-<p><label>(borrowers.physstreet): </label><!-- TMPL_VAR NAME="physstreet" --></p>
-<p><label>(borrowers.streetcity): </label><!-- TMPL_VAR NAME="streetcity" --></p>
-<p><label>(borrowers.homezipcode): </label><!-- TMPL_VAR NAME="homezipcode" --></p>
-<!-- /TMPL_UNLESS -->
-
-<p><label>Home Phone (borrowers.phone): </label><!-- TMPL_VAR NAME="phone" --></p>
-<p><label>Daytime Phone (borrowers.phoneday): </label><!-- TMPL_VAR NAME="phoneday" --></p>
-<p><label>Fax (borrowers.faxnumber): </label><!-- TMPL_VAR NAME="faxnumber" --></p>
-<p><label>E-mail Address (borrowers.emailaddress):</label><!-- TMPL_VAR NAME="emailaddress" --></p>
-
-<!-- TMPL_UNLESS name="I" -->
-<p><label>Date of Birth (borrowers.dateofbirth):</label><!-- TMPL_VAR NAME="dateofbirth" --></p>
-<p><label>Sex (borrowers.sex):</label><!-- TMPL_VAR NAME="sex" --></p>
-<!-- /TMPL_UNLESS -->
-
-<p><label>Member Number (borrowers.borrowernumber):</label><!-- TMPL_VAR NAME="borrowernumber" --></p>
-<p><label>Category (borrowers.categorycode):</label><!-- TMPL_VAR NAME="categorycode" --></p>
-<p><label>Registration Date (borrowers.dateenrolled):</label><!-- TMPL_VAR NAME="dateenrolled" --></p>
-<p><label>Expiration Date (borrowers.expiry): </label><!-- TMPL_VAR NAME="expiry" --></p>
-<p><label>Registration Branch (borrowers.branchcode):</label><!-- TMPL_VAR NAME="branchname" --></p>
-
-<!-- TMPL_IF NAME="printethnicityline" -->
-<p><label>Ethnicity (borrowers.ethnicity):</label><!-- TMPL_VAR NAME="ethnicity" --></p>
-<p><label>Ethnicity Notes (borrowers.ethnotes): </label><!-- TMPL_VAR NAME="ethnotes" --></p>
-<!-- /TMPL_IF -->
-
-<p><label>Sort field 1 (borrowers.sort1): </label><!-- TMPL_VAR NAME="sort1" --></p>
-<p><label>Sort field 2 (borrowers.sort2):</label><!-- TMPL_VAR NAME="sort2" --></p>
-<p><label>OPAC login (borrowers.userid): </label><!-- TMPL_VAR name="userid" --></p>
-<p><label>OPAC Password (borrowers.password): </label><!-- TMPL_VAR NAME="password" --></p> 
-<p><label>Circulation Notes (borrowers.borrowernotes) :</label><!-- TMPL_VAR name="borrowernotes" --></p>
-<p><label>Patron Message (borrowers.textmessaging):</label><!-- TMPL_VAR NAME="textmessaging" --></p>
-
-<!-- TMPL_UNLESS name="I" -->
-<p><label>Alternate Contact Name (borrowers.contactname):</label><!-- TMPL_VAR NAME="contactname" --></p>
-<p><label>Alternate Contact Phone (borrowers.altphone): </label><!-- TMPL_VAR NAME="altphone" --></p>
-<p><label>Alternate Contact Relationship (borrowers.altrelationship):</label><!-- TMPL_VAR NAME="altrelationship" --></p>
-<p><label>Alternate Contact Notes (borrowers.altnotes): </label><!-- TMPL_VAR NAME="altnotes" --></p>
-<!-- /TMPL_UNLESS -->
+<fieldset>
+<legend>Borrower Information</legend>
+       <p><label>Title:</label><!-- TMPL_VAR NAME="title" --></p>
+       <p><label>First Name:</label><!-- TMPL_VAR NAME="firstname" --></p>
+       <p><label>Last Name: </label><!-- TMPL_VAR NAME="surname" --></p>
+       <p><label>Othernames: </label><!-- TMPL_VAR NAME="othernames" --></p>
+       <p><label>Initials: </label><!-- TMPL_VAR NAME="initials" --></p>
+       <p><label>Address: </label><!-- TMPL_VAR NAME="address" --></p>
+       <p><label>City: </label><!-- TMPL_VAR NAME="city" --></p>
+       <p><label>Zip Code: </label><!-- TMPL_VAR NAME="zipcode" --></p>
+       <!-- TMPL_UNLESS NAME="I"-->
+       <p><label>alt address: </label><!-- TMPL_VAR NAME="B_address" --></p>
+       <p><label>alt city: </label><!-- TMPL_VAR NAME="B_city" --></p>
+       <p><label>alt zipcode: </label><!-- TMPL_VAR NAME="B_zipcode" --></p>
+       <!-- /TMPL_UNLESS -->
+       <p><label>Home Phone: </label><!-- TMPL_VAR NAME="phone" --></p>
+       <p><label>Cell phone: </label><!-- TMPL_VAR NAME="mobile" --></p>
+       <p><label>Fax: </label><!-- TMPL_VAR NAME="fax" --></p>
+       <p><label>E-mail Address:</label><!-- TMPL_VAR NAME="email" --></p>
+       <!-- TMPL_UNLESS name="I" -->
+       <p><label>Date of Birth:</label><!-- TMPL_VAR NAME="dateofbirth" --></p>
+       <p><label>Sex:</label><!-- TMPL_VAR NAME="sex" --></p>
+       <!-- /TMPL_UNLESS -->
+</fieldset>
+<fieldset>
+       <legend>Library use</legend>
+       <p><label>Member Number:</label><!-- TMPL_VAR NAME="borrowernumber" --></p>
+       <p><label>Category:</label><!-- TMPL_VAR NAME="categorycode" --></p>
+       <p><label>Registration Date:</label><!-- TMPL_VAR NAME="dateenrolled" --></p>
+       <p><label>Expiration Date: </label><!-- TMPL_VAR NAME="dateexpiry" --></p>
+       <p><label>Registration Branch:</label><!-- TMPL_VAR NAME="branchname" --></p>
+
+       <!-- TMPL_IF NAME="printethnicityline" -->
+       <p><label>Ethnicity:</label><!-- TMPL_VAR NAME="ethnicity" --></p>
+       <p><label>Ethnicity Notes: </label><!-- TMPL_VAR NAME="ethnotes" --></p>
+       <!-- /TMPL_IF -->
 
-               <!-- TMPL_UNLESS name="I" -->
-                       <!-- TMPL_IF name="isguarantee" -->
-                               <!-- TMPL_IF NAME="guaranteeloop" -->
-                                       <p><label>Guarantees:</label><ul><!-- tmpl_loop name="guaranteeloop" --><li><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME=name --> - <!-- TMPL_VAR NAME="cardnumber" --></a></li><!-- /tmpl_loop --></ul></p>
-                               <!-- /TMPL_IF -->
-                       <!-- TMPL_ELSE -->
-                               <!-- TMPL_IF name="guarantorborrowernumber" -->
-                                       <p><label>Guarantor:</label><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="guarantorborrowernumber" -->"><!-- TMPL_VAR NAME="guarantorcardnumber" --></a></p>
-                               <!-- /TMPL_IF -->
+       <p><label>Sort field 1: </label><!-- TMPL_VAR NAME="sort1" --></p>
+       <p><label>Sort field 2:</label><!-- TMPL_VAR NAME="sort2" --></p>
+       <p><label>OPAC login: </label><!-- TMPL_VAR name="userid" --></p>
+       <p><label>OPAC Password: </label><!-- TMPL_VAR NAME="password" --></p> 
+       <p><label>Circulation Notes:</label><!-- TMPL_VAR name="borrowernotes" --></p>
+       <p><label>Patron Message:</label><!-- TMPL_VAR NAME="opacnote" --></p>
+</fieldset>
+<fieldset>
+       <legend>Alternate contact</legend>
+       <!-- TMPL_UNLESS name="I" -->
+       <p><label>Name:</label><!-- TMPL_VAR NAME="contactname" --></p>
+       <p><label>Phone: </label><!-- TMPL_VAR NAME="B_phone" --></p>
+       <p><label>Relationship:</label><!-- TMPL_VAR NAME="relationship" --></p>
+       <p><label>Notes: </label><!-- TMPL_VAR NAME="contactnote" --></p>
+       <!-- /TMPL_UNLESS -->
+       <!-- TMPL_UNLESS name="I" -->
+               <!-- TMPL_IF name="isguarantee" -->
+                       <!-- TMPL_IF NAME="guaranteeloop" -->
+                               <p><label>Guarantees:</label><ul><!-- tmpl_loop name="guaranteeloop" --><li><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME=name --> - <!-- TMPL_VAR NAME="cardnumber" --></a></li><!-- /tmpl_loop --></ul></p>
                        <!-- /TMPL_IF -->
-               <!-- /TMPL_UNLESS -->
-
-<h2>Fines &amp; Charges</h2>
+               <!-- TMPL_ELSE -->
+                       <!-- TMPL_IF name="guarantorborrowernumber" -->
+                               <p><label>Guarantor:</label><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="guarantorborrowernumber" -->"><!-- TMPL_VAR NAME="guarantorcardnumber" --></a></p>
+                       <!-- /TMPL_IF -->
+               <!-- /TMPL_IF -->
+       <!-- /TMPL_UNLESS -->
+</fieldset>
+<fieldset>
+       <legend>Fines &amp; Charges</legend>
        <!-- TMPL_IF name="totaldue" -->
                <p>Total Due: <!-- TMPL_VAR NAME="totaldue" --></p>
        <!-- TMPL_ELSE -->
                <p>No Outstanding Charges</p>
        <!-- /TMPL_IF -->
-
-<h2>Items On Loan</h2>
-<form action="/cgi-bin/koha/reserve/renewscript.pl" method="post">
-       <input type="hidden" name="bornum" value="<!-- TMPL_VAR NAME="bornum" -->" />
-<table>
-       <tr>
-               <th scope="col">Title</th>
-               <th scope="col">Due</th>
-               <th scope="col">Itemtype</th>
-               <th scope="col">Charge</th>
-               <th scope="col">Price</th>
-               <th scope="col">Renew</th>
-               <th scope="col">Return</th>
-       </tr>
-
-       <!-- tmpl_loop name="issueloop" -->
-       <tr>
-               <td>
-                       <!-- TMPL_IF name="red" --><span class="overdue"><!-- /TMPL_IF -->
-                       <!-- TMPL_VAR NAME="title" --><!-- TMPL_IF name="red" --></span><!-- /TMPL_IF -->
-                       <a href="/cgi-bin/koha/detail.pl?item=<!-- TMPL_VAR NAME="itemnumber" -->&amp;bib=<!-- TMPL_VAR NAME="biblionumber" -->&amp;bi=<!-- TMPL_VAR NAME="biblioitemnumber" -->">
-                               <!-- TMPL_VAR NAME="barcode" -->
-                       </a>
-               </td>
-               <td><!-- TMPL_VAR NAME="date_due" --></td>
-               <td>
-                  <!-- TMPL_VAR NAME="itemtype_description" -->
-                  <!-- TMPL_IF NAME="itemtype_image" -->
-                  <img src="<!-- TMPL_VAR NAME="itemtype_image" -->" />
-                  <!-- /TMPL_IF -->
-                </td>
-               <td><!-- TMPL_VAR NAME="charge" --></td>
-               <td><!-- TMPL_VAR NAME="replacementprice" --></td>
-               <td>
-               <!-- TMPL_IF name="norenew" -->
-                       <a href="/cgi-bin/koha/request.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->">Reserved</a>
-               <!-- TMPL_ELSE -->
-                 <input type="checkbox"
-                         name="items[]"
-                        value="<!-- TMPL_VAR NAME="itemnumber" -->"
-                  <!-- TMPL_IF NAME="red" -->
-                      checked="checked"
-                  <!-- /TMPL_IF -->
-                 />
-                 <input type="checkbox"
-                        name="all_items[]"
-                       value="<!-- TMPL_VAR NAME="itemnumber" -->"
-                     checked="checked"
-                       style="display: none;"
-                 />
-               <!-- /TMPL_IF -->
-               </td>
-               <td><a href="/cgi-bin/koha/circ/returns.pl?barcode=<!-- TMPL_VAR NAME="barcode" -->">Return</a></td>
-       </tr>
-       <!-- /tmpl_loop -->
-       <tr><td colspan="3">Total Replacement Cost:</td><td><!-- TMPL_VAR NAME="totalprice" --></td><td colspan="2">&nbsp;</td></tr>
-       </table>
-        <div id="action">
-          <input type="submit" name="renew_checked" value="Renew Checked Items" />
-          <input type="submit" name="renew_all" value="Renew All" />
-        </div>
-</form>
-
-<h2>Reserves</h2>
-<form action="/cgi-bin/koha/modrequest.pl" method="post">
-       <input type="hidden" name="from" value="borrower" />
+</fieldset>
+<fieldset>
+       <legend>Items On Loan</legend>
+       <form action="/cgi-bin/koha/reserve/renewscript.pl" method="post">
+               <input type="hidden" name="bornum" value="<!-- TMPL_VAR NAME="bornum" -->" />
        <table>
-       <tr>
-               <th scope="row">Title</th>
-               <th scope="row">Requested</th>
-               <th scope="row">Remove</th>
-       </tr>
-
-       <!-- TMPL_LOOP name="reserveloop" -->
-       <tr>
-               <td>
-                       <a href="/cgi-bin/koha/request.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="btitle" --></a>
-                       <!-- TMPL_IF name="volumeddesc" -->
-                               <!-- TMPL_VAR NAME="volumeddesc" -->
-                               <!-- TMPL_VAR NAME="itemtype" -->
+               <tr>
+                       <th scope="col">Title</th>
+                       <th scope="col">Due</th>
+                       <th scope="col">Itemtype</th>
+                       <th scope="col">Charge</th>
+                       <th scope="col">Price</th>
+                       <th scope="col">Renew</th>
+                       <th scope="col">Return</th>
+               </tr>
+       
+               <!-- tmpl_loop name="issueloop" -->
+               <tr>
+                       <td>
+                               <!-- TMPL_IF name="red" --><span class="overdue"><!-- /TMPL_IF -->
+                               <!-- TMPL_VAR NAME="title" --><!-- TMPL_IF name="red" --></span><!-- /TMPL_IF -->
+                               <a href="/cgi-bin/koha/detail.pl?item=<!-- TMPL_VAR NAME="itemnumber" -->&amp;bib=<!-- TMPL_VAR NAME="biblionumber" -->&amp;bi=<!-- TMPL_VAR NAME="biblioitemnumber" -->">
+                                       <!-- TMPL_VAR NAME="barcode" -->
+                               </a>
+                       </td>
+                       <td><!-- TMPL_VAR NAME="date_due" --></td>
+                       <td>
+                                       <!-- TMPL_VAR NAME="itemtype_description" -->
+                                       <!-- TMPL_IF NAME="itemtype_image" -->
+                                       <img src="<!-- TMPL_VAR NAME="itemtype_image" -->" />
+                                       <!-- /TMPL_IF -->
+                                       </td>
+                       <td><!-- TMPL_VAR NAME="charge" --></td>
+                       <td><!-- TMPL_VAR NAME="replacementprice" --></td>
+                       <td>
+                       <!-- TMPL_IF name="norenew" -->
+                               <a href="/cgi-bin/koha/request.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->">Reserved</a>
+                       <!-- TMPL_ELSE -->
+                       <input type="checkbox"
+                                                       name="items[]"
+                                                       value="<!-- TMPL_VAR NAME="itemnumber" -->"
+                                       <!-- TMPL_IF NAME="red" -->
+                                               checked="checked"
+                                       <!-- /TMPL_IF -->
+                       />
+                       <input type="checkbox"
+                                       name="all_items[]"
+                                       value="<!-- TMPL_VAR NAME="itemnumber" -->"
+                               checked="checked"
+                                       style="display: none;"
+                       />
                        <!-- /TMPL_IF -->
-               </td>
-               <td><!-- TMPL_VAR NAME="reservedate2" --></td>
-               <td>
-                       <select name="rank-request">
-                       <option value="n">No</option>
-                       <option value="del">Yes</option>
-                       </select>
-               </td>
-               <input type="hidden" name="biblio" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
-               <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="bornum" -->" />
-       </tr>
-       <!-- /tmpl_loop -->
-</table>
-<!-- TMPL_IF name="reserveloop" -->
-       <input type="submit" class="cancel" name="submit" value="Cancel Marked Requests" />
-<!-- /TMPL_IF -->
-</form>
-
+                       </td>
+                       <td><a href="/cgi-bin/koha/circ/returns.pl?barcode=<!-- TMPL_VAR NAME="barcode" -->">Return</a></td>
+               </tr>
+               <!-- /tmpl_loop -->
+               <tr><td colspan="3">Total Replacement Cost:</td><td><!-- TMPL_VAR NAME="totalprice" --></td><td colspan="2">&nbsp;</td></tr>
+               </table>
+                       <div id="action">
+                       <input type="submit" name="renew_checked" value="Renew Checked Items" />
+                       <input type="submit" name="renew_all" value="Renew All" />
+                       </div>
+       </form>
+</fieldset>
+<fieldset>
+       <legend>Reserves</legend>
+       <form action="/cgi-bin/koha/modrequest.pl" method="post">
+               <input type="hidden" name="from" value="borrower" />
+               <table>
+               <tr>
+                       <th scope="row">Title</th>
+                       <th scope="row">Requested</th>
+                       <th scope="row">Remove</th>
+               </tr>
+       
+               <!-- TMPL_LOOP name="reserveloop" -->
+               <tr>
+                       <td>
+                               <a href="/cgi-bin/koha/request.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="btitle" --></a>
+                               <!-- TMPL_IF name="volumeddesc" -->
+                                       <!-- TMPL_VAR NAME="volumeddesc" -->
+                                       <!-- TMPL_VAR NAME="itemtype" -->
+                               <!-- /TMPL_IF -->
+                       </td>
+                       <td><!-- TMPL_VAR NAME="reservedate2" --></td>
+                       <td>
+                               <select name="rank-request">
+                               <option value="n">No</option>
+                               <option value="del">Yes</option>
+                               </select>
+                       </td>
+                       <input type="hidden" name="biblio" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
+                       <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="bornum" -->" />
+               </tr>
+               <!-- /tmpl_loop -->
+       </table>
+       <!-- TMPL_IF name="reserveloop" -->
+               <input type="submit" class="cancel" name="submit" value="Cancel Marked Requests" />
+       <!-- /TMPL_IF -->
+       </form>
+</fieldset>
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
\ No newline at end of file
diff --git a/members/guarantor_search.pl b/members/guarantor_search.pl
new file mode 100755 (executable)
index 0000000..4d20b3f
--- /dev/null
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+
+# $Id$
+
+# script to find a guarantor
+
+# Copyright 2006 OUEST PROVENCE
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+use strict;
+use C4::Auth;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use CGI;
+use C4::Search;
+use HTML::Template;
+#op
+use C4::Date;
+use C4::Members;
+
+my $input = new CGI;
+my ($template, $loggedinuser, $cookie);
+
+       ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "members/guarantor_search.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {borrowers => 1},
+                            debug => 1,
+                            });
+# }
+my $theme = $input->param('theme') || "default";
+                       # only used if allowthemeoverride is set
+
+
+my $member=$input->param('member');
+my $orderby=$input->param('orderby');
+$orderby = "surname,firstname" unless $orderby;
+$member =~ s/,//g;   #remove any commas from search string
+$member =~ s/\*/%/g;
+if ($member eq ''){
+               $template->param(results=>0);
+}else{
+               $template->param(results=>1);
+}      
+my $env;
+
+my ($count,$results);
+my @resultsdata;
+my $background = 0;
+
+if ($member ne ''){
+       if(length($member) == 1)
+       {
+               ($count,$results)=GuarantornameSearch($env,$member,$orderby,"simple");
+       }
+       else
+       {
+               ($count,$results)=GuarantornameSearch($env,$member,$orderby,"advanced");
+       }
+       for (my $i=0; $i < $count; $i++){
+       #find out stats
+       my ($od,$issue,$fines)=borrdata2($env,$results->[$i]{'borrowerid'});
+       
+       my %row = (
+               background => $background,
+               count => $i+1,
+               borrowernumber => $results->[$i]{'borrowernumber'},
+               cardnumber => $results->[$i]{'cardnumber'},
+               surname => $results->[$i]{'surname'},
+               firstname => $results->[$i]{'firstname'},
+               categorycode => $results->[$i]{'categorycode'},
+               address => $results->[$i]{'address'},
+               city => $results->[$i]{'city'},
+               branchcode => $results->[$i]{'branchcode'},
+               
+               #op
+               dateofbirth =>format_date($results->[$i]{'dateofbirth'}),
+               #fi op  
+               
+               odissue => "$od/$issue",
+               fines => $fines,
+               borrowernotes => $results->[$i]{'borrowernotes'});
+       if ( $background ) { $background = 0; } else {$background = 1; }
+       push(@resultsdata, \%row);
+               }
+}
+$template->param( 
+                       member          => $member,
+                       numresults              => $count,
+                       
+                       resultsloop     => \@resultsdata );
+
+output_html_with_http_headers $input, $cookie, $template->output;
index 035e9aa..c4f2787 100755 (executable)
@@ -1,14 +1,7 @@
 #!/usr/bin/perl
-# NOTE: This file uses standard 8-space tabs
-#       DO NOT SET TAB SIZE TO 4
-
 # $Id$
 
-#script to set up screen for modification of borrower details
-#written 20/12/99 by chris@katipo.co.nz
-
-
-# Copyright 2000-2002 Katipo Communications
+# Copyright 2006 SAN OUEST PROVENCE et Paul POULAIN
 #
 # This file is part of Koha.
 #
@@ -38,13 +31,19 @@ use HTML::Template;
 use Date::Manip;
 use C4::Date;
 use C4::Input;
+use C4::Log;
+use Digest::MD5 qw(md5_base64);
 
 my $input = new CGI;
+my %data;
+
 
 my $dbh = C4::Context->dbh;
 
+my $category_type = $input->param('category_type') || die "NO CATEGORY_TYPE !"; # A, E, C, or P
+my $step=$input->param('step') || 0;
 my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "members/memberentry.tmpl",
+    = get_template_and_user({template_name => "members/memberentry$category_type.tmpl",
                             query => $input,
                             type => "intranet",
                             authnotrequired => 0,
@@ -52,62 +51,147 @@ my ($template, $loggedinuser, $cookie)
                             debug => 1,
                             });
 
-my $borrowernumber=$input->param('borrowernumber');
-my $actionType=$input->param('actionType') || '';
+my $borrowerid=$input->param('borrowerid');
+my $guarantorid=$input->param('guarantorid');
 my $modify=$input->param('modify');
 my $delete=$input->param('delete');
 my $op=$input->param('op');
 my $categorycode=$input->param('categorycode');
 my $destination=$input->param('destination');
+my $cardnumber=$input->param('cardnumber');
+my $check_member=$input->param('check_member');
+my $name_city=$input->param('name_city');
+my $nodouble=$input->param('nodouble');
+my $select_city=$input->param('select_city');
+my $nok=$input->param('nok');
+
+# $check_categorytype contains the value of duplicate borrowers category type to redirect in good template in step =2
+my $check_categorytype=$input->param('check_categorytype');
+# NOTE: Alert for ethnicity and ethnotes fields, they are unvalided in all borrowers form
+
+
+#function  to automatic setup the mandatory  fields (visual with css)
+my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
+my @field_check=split(/\|/,$check_BorrowerMandatoryField);
+foreach (@field_check) {
+$template->param( "mandatory$_" => 1);         
+}      
+
+$template->param( "checked" => 1) if ($nodouble eq 1);
 
-my $nok;
 # if a add or modify is requested => check validity of data.
 if ($op eq 'add' or $op eq 'modify') {
-       my %data;
        my @names=$input->param;
        foreach my $key (@names){
-               $data{$key}=$input->param($key);
+               $data{$key}=$input->param($key)||'';
                $data{$key}=~ s/\'/\\\'/g;
                $data{$key}=~ s/\"/\\\"/g;
        }
        my @errors;
-       if ($data{'cardnumber'} eq ''){
-               push @errors,"ERROR_cardnumber";
-               $nok=1;
-       } else {
-               #check cardnumber is valid
-               my $nounique;
-               if ( $op eq "add" )    {
-                       $nounique = 0;
-               } else {
-                       $nounique = 1;
-               }
-               my $valid=checkdigit('',$data{'cardnumber'}, $nounique);
-               if ($valid != 1){
-                       $nok=1;
-                       push @errors, "ERROR_invalid_cardnumber";
-               }
+       #############test for member being unique #############
+       if ($op eq 'add' && $step eq 2){
+               (my $category_type_send=$category_type ) if ($category_type eq 'I'); 
+               my $check_category; # recover the category code of the doublon suspect borrowers
+          ($check_member,$check_category)= checkuniquemember($category_type_send,$data{'surname'},$data{'firstname'},format_date_in_iso($data{'dateofbirth'}));
+#      recover the category type if the borrowers is a duplicate
+       ($check_categorytype,undef)=getcategorytype($check_category);
        }
 
-       if ($data{'sex'} eq '' && $categorycode ne "I"){
-               push @errors, "ERROR_gender";
-               $nok=1;
-       }
-       if ($data{'firstname'} eq '' && $categorycode ne "I"){
-               push @errors,"ERROR_firstname";
-               $nok=1;
-       }
-       if ($data{'surname'} eq ''){
-               push @errors,"ERROR_surname";
-               $nok=1;
+# CHECKS step by step
+# STEP 1
+       if ($step eq 1) {
+               ###############test to take the right zipcode and city name ##############
+               if ($category_type ne 'I' and $guarantorid){
+                       my ($borrower_city,$borrower_zipcode)=&getzipnamecity($select_city);
+                       $data{'city'}= $borrower_city;
+                       $data{'zipcode'}=$borrower_zipcode;
+               }
+               if ($category_type eq 'C' and $guarantorid){
+                       my $guarantordata=getguarantordata($guarantorid);
+                       if (($data{'contactname'} eq '' or $data{'contactname'} ne $guarantordata->{'surname'})) {
+                               $data{'contactfirstname'}=$guarantordata->{'firstname'};        
+                               $data{'contactname'}=$guarantordata->{'surname'};
+                               $data{'contacttitle'}=$guarantordata->{'title'};
+                               $data{'streetnumber'}=$guarantordata->{'streetnumber'};
+                               $data{'address'}=$guarantordata->{'address'};
+                               $data{'streettype'}=$guarantordata->{'streettype'};
+                               $data{'address2'}=$guarantordata->{'address2'};
+                               $data{'zipcode'}=$guarantordata->{'zipcode'};
+                               $data{'city'}=$guarantordata->{'city'};
+                               $data{'phone'}=$guarantordata->{'phone'};
+                               $data{'phonepro'}=$guarantordata->{'phonepro'};
+                               $data{'mobile'}=$guarantordata->{'mobile'};
+                               $data{'fax'}=$guarantordata->{'fax'};
+                               $data{'email'}=$guarantordata->{'email'};
+                               $data{'emailpro'}=$guarantordata->{'emailpro'};
+                       }
+               }
        }
-       if ($data{'streetaddress'} eq ''){
-               push @errors, "ERROR_address";
-               $nok=1;
+# STEP 2
+       if ($step eq 2) {
+                       if ( ($data{'login'} eq '')){
+                               my $onefirstnameletter=substr($data{'firstname'},0,1);
+                               my $fivesurnameletter=substr($data{'surname'},0,5);
+                               $data{'login'}=lc($onefirstnameletter.$fivesurnameletter);
+                       }
+                       if ($op eq 'add' and $data{'dateenrolled'} eq ''){
+                               my $today=today();
+                               #insert ,in field "dateenrolled" , the current date
+                               $data{'dateenrolled'}=$today;
+                               #if date expiry is null u must calculate the value only in this case
+                               $data{'dateexpiry'} = calcexpirydate($data{'categorycode'},$today);
+                       }
+                       if ($op eq 'modify' ){
+                       my $today=today();
+#                      if date expiry is null u must calculate the value only in this case
+                       if ($data{'dateexpiry'} eq ''){
+                       $data{'dateexpiry'} = calcexpirydate($data{'categorycode'},$today);
+                       }
+               }
        }
-       if ($data{'city'} eq ''){
-               push @errors, "ERROR_city";
-               $nok=1;
+# STEP 3
+       if ($step eq 3) {
+               # this value show if the login and password are been used
+               my $loginexist=checkuserpassword($borrowerid,$data{'login'},$data{'password'});
+               # test to know if u must save or create the borrowers
+               if ($op eq 'modify'){
+                       # test to know if another user have the same password and same login            
+                       if ($loginexist eq 0) {
+                               &modmember(%data);              
+                               logaction($loggedinuser,"MEMBERS","modify member", $borrowerid, "");
+                       }
+                       else {
+                               push @errors, "ERROR_login_exist";
+                               $nok=1;
+                       }
+               }else{
+                       # test to know if another user have the same password and same login     
+                       if ($loginexist) {
+                               push @errors, "ERROR_login_exist";
+                               $nok=1;
+                       } else {
+                               $borrowerid = &newmember(%data);
+                               logaction($loggedinuser,"MEMBERS","add member", $borrowerid, "");
+                       }
+               }
+               
+               if ($nok) {
+                       foreach my $error (@errors) {
+                               $template->param( $error => 1);
+                       }
+                       $template->param(nok => 1);
+                       $step--; # decrease step : go back to step 2, the step++ just before showing the template will go again to 3
+               }
+
+               unless ($nok) {
+                       if($destination eq "circ"){
+                               print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$data{'cardnumber'}");
+                       } else {
+                               if ($loginexist == 0) {
+                               print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$borrowerid");
+                               }
+                       }
+               }
        }
        if (C4::Context->preference("IndependantBranches")) {
                my $userenv = C4::Context->userenv;
@@ -118,62 +202,34 @@ if ($op eq 'add' or $op eq 'modify') {
                        }
                }
        }
-       if ($nok) {
-               foreach my $error (@errors) {
-                       $template->param( $error => 1);
-               }
-               $template->param(nok => 1);
-       } else {
-               my $query="Select * from borrowers where borrowernumber=?";
-               my $sth=$dbh->prepare($query);
-               $sth->execute($data{'borrowernumber'});
-               if (my $data2=$sth->fetchrow_hashref){
-                       &modmember(%data);
-               }else{
-                       $borrowernumber = &newmember(%data);
-               }
-               
-       if($destination eq "circ"){
-               print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$data{'cardnumber'}");
-       } else {
-               print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$borrowernumber");
-               }
-       }
 }
+
 if ($delete){
-       print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$borrowernumber");
+       print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$borrowerid");
 } else {  # this else goes down the whole script
-       if ($actionType eq 'Add'){
-               $template->param( addAction => 1);
-       } else {
-               $template->param( addAction =>0);
-       }
        # retrieve previous values : either in DB or in CGI, in case of errors in values
        my $data;
-       if ($nok) {
-               my @names=$input->param;
-               foreach my $key (@names){
-                       $data->{$key}=$input->param($key);
-               }
-       } else {
-               $data=borrdata('',$borrowernumber);
+# test to now if u add or modify a borrower (modify =>to take all carateristic of the borrowers)
+       if (!$op and !$data{'surname'}) {
+               $data=borrdata('',$borrowerid);
+               %data=%$data;
        }
        if (C4::Context->preference("IndependantBranches")) {
                my $userenv = C4::Context->userenv;
-               if ($userenv->{flags} != 1 && $data->{branchcode}){
-                       unless ($userenv->{branch} eq $data->{'branchcode'}){
+               if ($userenv->{flags} != 1 && $data{branchcode}){
+                       unless ($userenv->{branch} eq $data{'branchcode'}){
                                print $input->redirect("/cgi-bin/koha/members/members-home.pl");
                        }
                }
        }
-       if ($actionType eq 'Add'){
+       if ($op eq 'add'){
                $template->param( updtype => 'I');
        } else {
                $template->param( updtype => 'M');
        }
-       my $cardnumber=$data->{'cardnumber'};
-       $cardnumber=fixup_cardnumber($data->{'cardnumber'}) if $actionType eq 'Add';
-       if ($data->{'sex'} eq 'F'){
+       my $cardnumber=$data{'cardnumber'};
+       $cardnumber=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add';
+       if ($data{'sex'} eq 'F'){
                $template->param(female => 1);
        }
        my ($categories,$labels)=ethnicitycategories();
@@ -183,36 +239,66 @@ if ($delete){
                $ethcatpopup = CGI::popup_menu(-name=>'ethnicity',
                                        -id => 'ethnicity',
                                        -values=>$categories,
-                                       -default=>$data->{'ethnicity'},
+                                       -default=>$data{'ethnicity'},
                                        -labels=>$labels);
                $template->param(ethcatpopup => $ethcatpopup); # bad style, has to be fixed
        }
-
-       ($categories,$labels)=borrowercategories();
+       
+       
+       ($categories,$labels)=borrowercategories($category_type,$op);
+       
+       #if u modify the borrowers u must have the right value for is category code
+       
+       (my $default_category=$data{'categorycode'}) if ($op  eq '');
        my $catcodepopup = CGI::popup_menu(-name=>'categorycode',
-                                       -id => 'categorycode',
-                                       -values=>$categories,
-                                       -default=>$data->{'categorycode'},
-                                       -labels=>$labels);
+                                       -id => 'categorycode',
+                                       -values=>$categories,
+                                       -default=>$default_category,
+                                       -labels=>$labels);
+       #test in city
+       my $default_city;
+       if ($op eq ''){
+       (my $selectcity=&getidcity($data{'city'})) if ($select_city eq '');
+       $default_city=$selectcity;
+       }
+       my($cityid,$name_city)=getcities();
+       $template->param( city_cgipopup => 1) if ($cityid );
+       my $citypopup = CGI::popup_menu(-name=>'select_city',
+                                       -id => 'select_city',
+                                       -values=>$cityid,
+                                       -labels=>$name_city,
+#                                      -override => 1,
+                                       -default=>$default_city
+                                       );      
+       
+       my $default_roadtype;
+       $default_roadtype=$data{'streettype'} ;
+       my($roadtypeid,$road_type)=getroadtypes();
+       $template->param( road_cgipopup => 1) if ($roadtypeid );
+       my $roadpopup = CGI::popup_menu(-name=>'streettype',
+                                       -id => 'streettype',
+                                       -values=>$roadtypeid,
+                                       -labels=>$road_type,
+                                       -override => 1,
+                                       -default=>$default_roadtype
+                                       );      
 
-       my @relationships = ('','workplace', 'relative','friend', 'neighbour');
+       
+       my @relationships = split /,|\|/,C4::Context->preference('BorrowerRelationship');
        my @relshipdata;
        while (@relationships) {
-               my $relship = shift @relationships;
-               next unless $relship;
+               my $relship = shift @relationships || '';
                my %row = ('relationship' => $relship);
-               if ($data->{'altrelationship'} eq $relship) {
-                       $row{'selected'}=' selected = "selected"';
+               if ($data{'relationship'} eq $relship) {
+                       $row{'selected'}=' selected';
                } else {
                        $row{'selected'}='';
                }
                push(@relshipdata, \%row);
        }
-
-       # %flags: keys=$data-keys, datas=[formname, HTML-explanation]
-       my %flags = ('gonenoaddress' => ['gna', 'Gone no address'],
-                               'lost'          => ['lost', 'Lost'],
-                               'debarred'      => ['debarred', 'Debarred']);
+       my %flags = ( 'gonenoaddress' => ['gonenoaddress', 'Adresse Ã©rronée'],
+                     'lost'          => ['lost', 'Carte Perdue'],
+                     'debarred'      => ['debarred', 'Lecteur exclu']);
 
        my @flagdata;
        foreach (keys(%flags)) {
@@ -220,12 +306,12 @@ if ($delete){
        my %row =  ('key'   => $key,
                        'name'  => $flags{$key}[0],
                        'html'  => $flags{$key}[1]);
-       if ($data->{$key}) {
-               $row{'yes'}=' checked="checked"';
+       if ($data{$key}) {
+               $row{'yes'}=' checked';
                $row{'no'}='';
        } else {
                $row{'yes'}='';
-               $row{'no'}=' checked="checked"';
+               $row{'no'}=' checked';
        }
        push(@flagdata, \%row);
        }
@@ -235,102 +321,147 @@ if ($delete){
        }
 
        #Convert dateofbirth to correct format
-       $data->{'dateofbirth'} = format_date($data->{'dateofbirth'});
-
+       $data{'dateofbirth'} = format_date($data{'dateofbirth'});
        my @branches;
        my @select_branch;
        my %select_branches;
        my $branches=getbranches();
        my $default;
+       # -----------------------------------------------------
+       #  the value of ip from the branches hash table
+               my $select_ip;
+       # $ip is the ip of user when is connect to koha 
+               my $ip = $ENV{'REMOTE_ADDR'};
+       # -----------------------------------------------------
        foreach my $branch (keys %$branches) {
                if ((not C4::Context->preference("IndependantBranches")) || (C4::Context->userenv->{'flags'} == 1)) {
                        push @select_branch, $branch;
                        $select_branches{$branch} = $branches->{$branch}->{'branchname'};
-                       $default = $data->{'branchcode'};
-               } else {
+#               take the ip number from branches "op"
+                       $select_ip = $branches->{$branch}->{'branchip'} || '';
+                               
+#              test $select_ip equal $ip to attribute the default value for the scrolling list
+                       if ($select_ip eq $ip)  {
+                                               $default = $branches->{$branch}->{'branchcode'};
+                                               }
+                       } else {
                                push @select_branch, $branch if ($branch eq C4::Context->userenv->{'branch'});
                                $select_branches{$branch} = $branches->{$branch}->{'branchname'} if ($branch eq C4::Context->userenv->{'branch'});
-                               $default = C4::Context->userenv->{'branch'};
-               }
+                                       
+                               $default = C4::Context->userenv->{'branch'};
+                                       
+                               }
        }
+# --------------------------------------------------------------------------------------------------------
+       my $CGIbranch = CGI::scrolling_list(-id    => 'branchcode',
+                                          -name   => 'branchcode',
+                                          -values => \@select_branch,
+                                          -labels => \%select_branches,
+                                          -size   => 1,
+                                          -multiple =>0,
+                                          -override => 1,      
+                                          -default => $default,
+                                       );
+
+
+# --------------------------------------------------------------------------------------------------------
        
-       my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
-                               -id => 'branchcode',
-                               -values   => \@select_branch,
-                               -default  => $data->{'branchcode'},
-                               -labels   => \%select_branches,
-                               -size     => 1,
-                               -multiple => 0 );
-       
-       my $CGIsort1 = buildCGIsort("Bsort1","sort1",$data->{'sort1'});
+       my $CGIsort1 = buildCGIsort("Bsort1","sort1",$data{'sort1'});
        if ($CGIsort1) {
                $template->param(CGIsort1 => $CGIsort1);
+               $template->param( sort1 => $data{'sort1'});
        } else {
-               $template->param( sort1 => $data->{'sort1'});
+               $template->param( sort1 => $data{'sort1'});
        }
        
-       my $CGIsort2 = buildCGIsort("Bsort2","sort2",$data->{'sort2'});
+       my $CGIsort2 = buildCGIsort("Bsort2","sort2",$data{'sort2'});
        if ($CGIsort2) {
                $template->param(CGIsort2 =>$CGIsort2);
        } else {
-               $template->param( sort2 => $data->{'sort2'});
-       }
-
-       my $CGIsort1 = buildCGIsort("Bsort1","sort1",$data->{'sort1'});
-       if ($CGIsort1) {
-               $template->param(CGIsort1 => $CGIsort1);
-       } else {
-               $template->param( sort1 => $data->{'sort1'});
+               $template->param( sort2 => $data{'sort2'});
        }
 
-       my $CGIsort2 = buildCGIsort("Bsort2","sort2",$data->{'sort2'});
-       if ($CGIsort2) {
-               $template->param(CGIsort2 =>$CGIsort2);
-       } else {
-               $template->param( sort2 => $data->{'sort2'});
-       }
        
-       $template->param(       actionType              => $actionType,
-                               destination => $destination,
-                               borrowernumber          => $borrowernumber,
-                               address         => $data->{'streetaddress'},
-                               firstname       => $data->{'firstname'},
-                               surname         => $data->{'surname'},
-                               othernames      => $data->{'othernames'},
-                               initials        => $data->{'initials'},
-                               ethcatpopup     => $ethcatpopup,
-                               catcodepopup    => $catcodepopup,
-                               streetaddress   => $data->{'streetaddress'},
-                               physstreet   => $data->{'physstreet'},
-                               zipcode => $data->{'zipcode'},
-                               streetcity      => $data->{'streetcity'},
-                               homezipcode => $data->{'homezipcode'},
-                               city            => $data->{'city'},
-                               phone           => $data->{'phone'},
-                               phoneday        => $data->{'phoneday'},
-                               faxnumber       => $data->{'faxnumber'},
-                               emailaddress    => $data->{'emailaddress'},
-                               textmessaging   => $data->{'textmessaging'},
-                               contactname     => $data->{'contactname'},
-                               altphone        => $data->{'altphone'},
-                               altnotes        => $data->{'altnotes'},
-                               borrowernotes   => $data->{'borrowernotes'},
-                               flagloop        => \@flagdata,
-                               relshiploop     => \@relshipdata,
-                               "title_".$data->{'title'} => " SELECTED ",
-                               joining => format_date($data->{'dateenrolled'}),
-                               expiry          => format_date($data->{'expiry'}),
-                               cardnumber      => $cardnumber,
-                               dateofbirth     => $data->{'dateofbirth'},
-                               dateformat      => display_date_format(),
-                               modify          => $modify,
-                               CGIbranch => $CGIbranch);
-       $template->param(Institution => 1) if ($categorycode eq "I");
+       $data{'opacnotes'} =~ s/\\//g;
+       $data{'borrowernotes'} =~ s/\\//g;
+       # increase step to see next page
+       $step++;
+       warn "CITY".$data{city};
+       $template->param(
+               BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
+               category_type   => $category_type,#to know the category type of the borrower
+               select_city     => $select_city,
+               "step_$step"    => 1,# associate with step to know where u are
+               step            => $step,
+               destination     => $destination,#to know wher u come from and wher u must go in redirect
+               check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
+#                              flags           =>$data{'flags'},               
+               "op$op"         => 1,
+#              op                      => $op,
+               nodouble        => $nodouble,
+               borrowerid      => $borrowerid,#register number
+               cardnumber      => $data{'cardnumber'},
+               surname         => uc($data{'surname'}),
+               firstname       => ucfirst($data{'firstname'}),
+               "title_".$data{'title'}   => " SELECTED ",
+               title           => $data{'title'},
+               othernames      => $data{'othernames'},
+               initials        => $data{'initials'},
+               streetnumber    => $data{'streetnumber'},
+               streettype      =>$data{'streettype'},
+               address          => $data{'address'},
+               address2        => $data{'address2'},   
+               city            => $data{'city'},
+               zipcode         => $data{'zipcode'},
+               email           => $data{'email'},
+               phone           => $data{'phone'},
+               mobile          => $data{'mobile'},
+               fax             => $data{'fax'},
+               phonepro        => $data{'phonepro'},
+               emailpro        => $data{'emailpro'},
+               b_address       => $data{'b_address'},
+               b_city          => $data{'b_city'},
+               b_zipcode       => $data{'b_zipcode'},
+               b_email         => $data{'b_email'},
+               b_phone        => $data{'b_phone'},
+               dateofbirth     => $data{'dateofbirth'},
+               branchcode      => $data{'branchcode'},
+               catcodepopup    => $catcodepopup,
+               categorycode    => $data{'categorycode'},
+               dateenrolled    => format_date($data{'dateenrolled'}),
+               dateexpiry              => format_date($data{'dateexpiry'}),
+               debarred        => $data{'debarred'},
+               gonenoaddress   => $data{'gonenoaddress'}, 
+               lost    => $data{'lost'},
+               contactname     => uc($data{'contactname'}),
+               contactfirstname=> ucfirst($data{'contactfirstname'}),
+               "contacttitle_".$data{'contacttitle'} => "SELECTED" ,
+               contacttitle    => $data{'contacttitle'},
+               guarantorid     => $guarantorid,
+               ethcatpopup     => $ethcatpopup,
+               sex             => $data{'sex'},
+               login           => $data{'login'},      
+               password        => $data{'password'},   
+               opacnotes       => $data{'opacnotes'},  
+               contactnotes    => $data{'contactnotes'},
+               borrowernotes   => $data{'borrowernotes'},
+               relshiploop     => \@relshipdata,
+               relationship    => $data{'relationship'},
+               citypopup       => $citypopup,
+               roadpopup       => $roadpopup,  
+               contacttype     => $data{'contacttype'},
+               flagloop        => \@flagdata,
+#                              "contacttype_".$data{'contacttype'} =>" SELECTED ",
+               dateformat      => display_date_format(),
+               check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function
+                       modify          => $modify,
+#                              city_choice       => $city_choice ,#check if the city was selected
+               nok             => $nok,#flag to konw if an error 
+               CGIbranch => $CGIbranch,
+               );
+       #$template->param(Institution => 1) if ($categorycode eq "I");
        output_html_with_http_headers $input, $cookie, $template->output;
-
-
 }
-
 # Local Variables:
 # tab-width: 8
 # End:
index 0efdaec..92e63cc 100755 (executable)
@@ -78,7 +78,7 @@ my $data=borrdata('',$bornum);
 $template->param($data->{'categorycode'} => 1); # in template <TMPL_IF name="I"> => instutitional (A for Adult & C for children)
 
 $data->{'dateenrolled'} = format_date($data->{'dateenrolled'});
-$data->{'expiry'} = format_date($data->{'expiry'});
+$data->{'dateexpiry'} = format_date($data->{'dateexpiry'});
 $data->{'dateofbirth'} = format_date($data->{'dateofbirth'});
 $data->{'IS_ADULT'} = ($data->{'categorycode'} ne 'I');
 
@@ -91,13 +91,13 @@ $data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'});
 $data->{&expand_sex_into_predicate($data->{'sex'})} = 1;
 
 if ($data->{'categorycode'} eq 'C'){
-       my $data2=borrdata('',$data->{'guarantor'});
-       $data->{'streetaddress'}=$data2->{'streetaddress'};
+       my $data2=borrdata('',$data->{'guarantorid'});
+       $data->{'address'}=$data2->{'address'};
        $data->{'city'}=$data2->{'city'};
-       $data->{'physstreet'}=$data2->{'physstreet'};
-       $data->{'streetcity'}=$data2->{'streetcity'};
+       $data->{'B_address'}=$data2->{'B_address'};
+       $data->{'B_city'}=$data2->{'B_city'};
        $data->{'phone'}=$data2->{'phone'};
-       $data->{'phoneday'}=$data2->{'phoneday'};
+       $data->{'mobile'}=$data2->{'mobile'};
        $data->{'zipcode'} = $data2->{'zipcode'};
 }
 
@@ -106,7 +106,7 @@ if ($data->{'ethnicity'} || $data->{'ethnotes'}) {
        $template->param(printethnicityline => 1);
 }
 
-if ($data->{'categorycode'} ne 'C'){
+if ($data->{'category_type'} ne 'C'){
        $template->param(isguarantee => 1);
        # FIXME
        # It looks like the $i is only being returned to handle walking through
@@ -122,9 +122,9 @@ if ($data->{'categorycode'} ne 'C'){
        $template->param(guaranteeloop => \@guaranteedata);
 
 } else {
-       my ($guarantor)=findguarantor($data->{'borrowernumber'});
-       unless ($guarantor->{'borrowernumber'} == 0){
-               $template->param(guarantorborrowernumber => $guarantor->{'borrowernumber'}, guarantorcardnumber => $guarantor->{'cardnumber'});
+       my ($guarantorid)=findguarantor($data->{guarantorid});
+       if ($guarantorid->{'borrowernumber'}){
+               $template->param(guarantorborrowernumber => $guarantorid->{'borrowernumber'}, guarantorcardnumber => $guarantorid->{'cardnumber'});
        }
 }
 
index 5f6acef..99ac0af 100755 (executable)
@@ -135,6 +135,15 @@ my %requiretables = (
                                        `debarred3` int(1) default '0',
                                        PRIMARY KEY  (`branchcode`,`categorycode`)
                                        )",
+       cities                  => "(`cityid` int auto_increment,
+                                               `city_name` char(100) NOT NULL,
+                                               `city_zipcode` char(20),
+                                               PRIMARY KEY (`cityid`)
+                                       )",
+       roadtype                        => "(`roadtypeid` int auto_increment,
+                                               `road_type` char(100) NOT NULL,
+                                               PRIMARY KEY (`roadtypeid`)
+                                       )",
 );
 
 my %requirefields = (
@@ -157,6 +166,7 @@ my %dropable_table = (
 
 my %uselessfields = (
 # tablename => "field1,field2",
+       borrowers => "suburb,altstreetaddress,altsuburb,altcity,studentnumber,school,area,preferredcont,altcp",
        );
 # the other hash contains other actions that can't be done elsewhere. they are done
 # either BEFORE of AFTER everything else, depending on "when" entry (default => AFTER)
@@ -346,6 +356,24 @@ my %tabledata = (
                type            => 'Choice',
                options         => 'Calendar|Days'
         },
+        {
+            uniquefieldrequired => 'variable',
+            variable            => 'borrowerMandatoryField',
+            value               => 'zipcode|surname',
+            forceupdate         => { 'explanation' => 1,
+                                     'type' => 1},
+            explanation         => 'List all mandatory fields for borrowers',
+            type                => 'free',
+        },
+        {
+            uniquefieldrequired => 'variable',
+            variable            => 'borrowerRelationship',
+            value               => 'father|mother,grand-mother',
+            forceupdate         => { 'explanation' => 1,
+                                     'type' => 1},
+            explanation         => 'The relationships between a guarantor & a guarantee (separated by | or ,)',
+            type                => 'free',
+        },
     ],
 
 );
@@ -415,6 +443,78 @@ my %fielddefinitions = (
                        extra   => '',
                },
        ],
+       borrowers => [
+               {       field => 'B_email',
+                       type => 'text',
+                       null => 'NULL',
+                       after => 'B_zipcode',
+                },
+                {
+                       field => 'streetnumber', # street number (hidden if streettable table is empty)
+                       type => 'char(10)',
+                       null => 'NULL',
+                       after => 'initials',
+               },
+               {
+                       field => 'streettype', # street table, list builded from a system table
+                       type => 'char(50)',
+                       null => 'NULL',
+                       after => 'streetnumber',
+               },
+                {
+                       field => 'B_streetnumber', # street number (hidden if streettable table is empty)
+                       type => 'char(10)',
+                       null => 'NULL',
+                       after => 'fax',
+               },
+               {
+                       field => 'B_streettype', # street table, list builded from a system table
+                       type => 'char(50)',
+                       null => 'NULL',
+                       after => 'B_streetnumber',
+               },
+               {
+                       field => 'phonepro',
+                       type => 'text',
+                       null => 'NULL',
+                       after => 'fax',
+               },
+               {
+                       field => 'address2', # complement address
+                       type => 'text',
+                       null => 'NULL',
+                       after => 'address',
+               },
+               {
+                       field => 'emailpro',
+                       type => 'text',
+                       null => 'NULL',
+                       after => 'fax',
+               },
+               {
+                       field => 'contactfirstname', # contact's firstname
+                       type => 'text',
+                       null => 'NULL',
+                       after => 'contactname',
+               },
+               {
+                       field => 'contacttitle', # contact's title
+                       type => 'text',
+                       null => 'NULL',
+                       after => 'contactfirstname',
+               },
+       ],
+       categories =>  [
+               {
+                       field   => 'category_type',
+                       type    => 'char(1)',
+                       null    => 'NOT NULL',
+                       key             => '',
+                       default => 'A',
+                       extra   => '',
+               },
+       ],
+
 );
 
 my %indexes = (
@@ -715,6 +815,123 @@ my %foreign_keys = (
        # FIXME : don't constraint auth_*_table and auth_word, as they may be replaced by zebra
 );
 
+
+# column changes
+my %column_change = (
+       # table
+       borrowers => [
+                               {
+                                       from => 'emailaddress',
+                                       to => 'email',
+                                       after => 'city',
+                               },
+                               {
+                                       from => 'streetaddress',
+                                       to => 'address',
+                                       after => 'initials',
+                               },
+                               {
+                                       from => 'faxnumber',
+                                       to => 'fax',
+                                       after => 'phone',
+                               },
+                               {
+                                       from => 'textmessaging',
+                                       to => 'opacnote',
+                                       after => 'userid',
+                               },
+                               {
+                                       from => 'altnotes',
+                                       to => 'contactnote',
+                                       after => 'opacnote',
+                               },
+                               {
+                                       from => 'physstreet',
+                                       to => 'B_address',
+                                       after => 'fax',
+                               },
+                               {
+                                       from => 'streetcity',
+                                       to => 'B_city',
+                                       after => 'B_address',
+                               },
+                               {
+                                       from => 'phoneday',
+                                       to => 'mobile',
+                                       after => 'phone',
+                               },
+                               {
+                                       from => 'zipcode',
+                                       to => 'zipcode',
+                                       after => 'city',
+                               },
+                               {
+                                       from => 'homezipcode',
+                                       to => 'B_zipcode',
+                                       after => 'B_city',
+                               },
+                               {
+                                       from => 'altphone',
+                                       to => 'B_phone',
+                                       after => 'B_zipcode',
+                               },
+                               {
+                                       from => 'expiry',
+                                       to => 'dateexpiry',
+                                       after => 'dateenrolled',
+                               },
+                               {
+                                       from => 'guarantor',
+                                       to => 'guarantorid',
+                                       after => 'contactname',
+                               },
+                               {
+                                       from => 'textmessaging',
+                                       to => 'opacnotes',
+                                       after => 'flags',
+                               },
+                               {
+                                       from => 'altnotes',
+                                       to => 'contactnotes',
+                                       after => 'opacnotes',
+                               },
+                               {
+                                       from => 'altrelationship',
+                                       to => 'relationship',
+                                       after => 'borrowernotes',
+                               },
+                       ],
+               );
+               
+foreach my $table (keys %column_change) {
+       $sth = $dbh->prepare("show columns from $table");
+       $sth->execute();
+       undef %types;
+       while ( ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow )
+       {
+               $types{$column}->{type} ="$type";
+               $types{$column}->{null} = "$null";
+               $types{$column}->{key} = "$key";
+               $types{$column}->{default} = "$default";
+               $types{$column}->{extra} = "$extra";
+       }    # while
+       my $tablerows = $column_change{$table};
+       foreach my $row ( @$tablerows ) {
+               if ($types{$row->{from}}->{type}) {
+                       print "altering $table $row->{from} to $row->{to}\n";
+                       # ALTER TABLE `borrowers` CHANGE `faxnumber` `fax` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 
+#                      alter table `borrowers` change `faxnumber` `fax` type text  null after phone
+                       my $sql = 
+                               "alter table `$table` change `$row->{from}` `$row->{to}` $types{$row->{from}}->{type} ".
+                               ($types{$row->{from}}->{null} eq 'YES'?" NULL":" NOT NULL").
+                               ($types{$row->{from}}->{default}?" default ".$types{$row->{from}}->{default}:"").
+                               "$types{$row->{from}}->{extra} after $row->{after} ";
+#                      print "$sql";
+                       $dbh->do($sql);
+               }
+       }
+}
+
 #-------------------
 # Initialize
 
@@ -820,6 +1037,7 @@ foreach $table ( keys %fielddefinitions ) {
 #              $default="''" unless $default;
                my $extra   = $row->{extra};
                my $def     = $definitions->{$field};
+               my $after       = ($row->{after}?" after ".$row->{after}:"");
 
                unless ( $type eq $def->{type}
                        && $null eq $def->{null}
@@ -846,17 +1064,16 @@ foreach $table ( keys %fielddefinitions ) {
 # if it's a primary key, drop the previous pk, before altering the table
                        my $sth;
                        if ($key ne 'PRIMARY KEY') {
-                               $sth =$dbh->prepare("alter table $table $action $field $type $null $key $extra default ?");
+                               $sth =$dbh->prepare("alter table $table $action $field $type $null $key $extra default ? $after");
                        } else {
-                               $sth =$dbh->prepare("alter table $table drop primary key, $action $field $type $null $key $extra default ?");
+                               $sth =$dbh->prepare("alter table $table drop primary key, $action $field $type $null $key $extra default ? $after");
                        }
                        $sth->execute($default);
-                       print "  Alter $field in $table\n" unless $silent;
+                       print "  alter or create $field in $table\n" unless $silent;
                }
        }
 }
 
-
 # Populate tables with required data
 
 
@@ -1286,6 +1503,16 @@ sub MARCgetitem {
 exit;
 
 # $Log$
+# Revision 1.134  2006/04/14 09:37:29  tipaul
+# improvements from SAN Ouest Provence :
+# * introducing a category_type into categories. It can be A (adult), C (children), P (Professionnal), I (institution/organisation).
+# * each category_type has it's own forms to create members.
+# * the borrowers table has been heavily modified (many fields changed), to get something more logic & readable
+# * reintroducing guarantor/guanrantee system that is now independant from hardcoded C/A for categories
+# * updating templates to fit template rules
+#
+# (see mail feb, 17 on koha-devel "new features for borrowers" for more details)
+#
 # Revision 1.133  2006/04/13 08:36:42  plg
 # new: function C4::Date::get_date_format_string_for_DHTMLcalendar based on
 # the system preference prefered date format.