- if ($data{'dateenrolled'} eq ''){
- my $today= sprintf('%04d-%02d-%02d', Today());
- #insert ,in field "dateenrolled" , the current date
- $data{'dateenrolled'}=$today;
- $data{'dateexpiry'} = GetExpiryDate($data{'categorycode'},$today);
- }
-
- $data{'surname'}=uc($data{'surname'});
- $data{'firstname'}=ucfirst(lc $data{'firstname'});
- $data{'dateenrolled'}=format_date($data{'dateenrolled'});
- $data{'dateexpiry'}=format_date($data{'dateexpiry'});
- $data{'contactname'}=uc($data{'contactname'});
- $data{'contactfirstname'}= ucfirst( lc $data{'contactfirstname'});
- $data{'dateofbirth'} = format_date($data{'dateofbirth'});
-
-# warn "$step";
- $template->param(%data);
- $template->param(
- BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
- category_type => $category_type,#to know the category type of the borrower
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
- select_city => $select_city,
- "step_$step" => 1,# associate with step to know where u are
- "$category_type" => 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,
- nodouble => $nodouble,
- borrowernumber => $borrowernumber,#register number
- "contacttitle_".$data{'contacttitle'} => "SELECTED" ,
- guarantorid => $guarantorid,
- ethcatpopup => $ethcatpopup,
- relshiploop => \@relshipdata,
- citypopup => $citypopup,
- roadpopup => $roadpopup,
- borrotitlepopup => $borrotitlepopup,
- guarantorinfo => $guarantorinfo,
- flagloop => \@flagdata,
- dateformat => display_date_format(),
- check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function
- modify => $modify,
- nok => $nok,#flag to konw if an error
- CGIbranch => $CGIbranch,
- memberofinstution => $member_of_institution,
- CGIorganisations => $CGIorganisations,
-
- );
+if ($data{'dateenrolled'} eq ''){
+ my $today= sprintf('%04d-%02d-%02d', Today());
+ $data{'dateenrolled'}=$today;
+}
+
+$data{'surname'}=uc($data{'surname'});
+$data{'firstname'}=ucfirst(lc $data{'firstname'});
+$data{'dateenrolled'}=format_date($data{'dateenrolled'});
+$data{'dateexpiry'}=format_date($data{'dateexpiry'});
+$data{'contactname'}=uc($data{'contactname'});
+$data{'contactfirstname'}= ucfirst( lc $data{'contactfirstname'});
+$data{'dateofbirth'} = format_date($data{'dateofbirth'});
+
+$template->param( "showguarantor" => 1) if ($category_type!~/A|I/);# associate with step to know where u are
+$template->param( "showguarantor" => 0) if ($category_type=~/A|I/);# associate with step to know where u are
+ warn "$step";
+$template->param(%data);
+$template->param( "step_$step" => 1) if $step;# associate with step to know where u are
+$template->param( "step" => $step) if $step;# associate with step to know where u are
+$template->param(
+ BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
+ category_type => $category_type,#to know the category type of the borrower
+ DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ select_city => $select_city,
+ "$category_type" => 1,# associate with step to know where u are
+ 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,
+ nodouble => $nodouble,
+ borrowernumber => $borrowernumber,#register number
+ "contacttitle_".$data{'contacttitle'} => "SELECTED" ,
+ guarantorid => $guarantorid,
+ ethcatpopup => $ethcatpopup,
+ relshiploop => \@relshipdata,
+ citypopup => $citypopup,
+ roadpopup => $roadpopup,
+ borrotitlepopup => $borrotitlepopup,
+ guarantorinfo => $guarantorinfo,
+ flagloop => \@flagdata,
+ dateformat => display_date_format(),
+ check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function
+ modify => $modify,
+ nok => $nok,#flag to konw if an error
+ CGIbranch => $CGIbranch,
+ memberofinstution => $member_of_institution,
+ CGIorganisations => $CGIorganisations,