- $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 (!defined($data{'dateenrolled'}) or $data{'dateenrolled'} eq ''){
+ $data{'dateenrolled'}=C4::Dates->today('iso');
+}
+if (C4::Context->preference('uppercasesurnames')) {
+ $data{'surname'} =uc($data{'surname'} );
+ $data{'contactname'}=uc($data{'contactname'});
+}
+foreach (qw(dateenrolled dateexpiry dateofbirth)) {
+ $data{$_} = format_date($data{$_}); # back to syspref for display
+ $template->param( $_ => $data{$_});
+}
+
+if (C4::Context->preference('ExtendedPatronAttributes')) {
+ $template->param(ExtendedPatronAttributes => 1);
+ patron_attributes_form($template, $borrowernumber);
+}
+
+$template->param( "showguarantor" => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
+$debug and warn "memberentry step: $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( debug => $debug ) if $debug;
+
+$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 => C4::Dates->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)
+ "op$op" => 1);
+
+$template->param(
+ nodouble => $nodouble,
+ borrowernumber => $borrowernumber, #register number
+ guarantorid => (defined($borrower_data->{'guarantorid'})) ? $borrower_data->{'guarantorid'} : $guarantorid,
+ ethcatpopup => $ethcatpopup,
+ relshiploop => \@relshipdata,
+ citypopup => $citypopup,
+ roadpopup => $roadpopup,
+ borrotitlepopup => $borrotitlepopup,
+ guarantorinfo => $guarantorinfo,
+ flagloop => \@flagdata,
+ dateformat => C4::Dates->new()->visual(),
+ C4::Context->preference('dateformat') => 1,
+ 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,
+ NoUpdateLogin => $NoUpdateLogin
+ );
+
+if(defined($data{'flags'})){
+ $template->param(flags=>$data{'flags'});
+}
+if(defined($data{'contacttitle'})){
+ $template->param("contacttitle_" . $data{'contacttitle'} => "SELECTED");
+}
+