3 # Copyright 2006 SAN OUEST PROVENCE et Paul POULAIN
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
24 use Date::Calc qw/Today/;
26 use Digest::MD5 qw(md5_base64);
37 use C4::Branch; # GetBranches
42 my $dbh = C4::Context->dbh;
44 <<<<<<< HEAD:members/memberentry.pl
48 my $step=$input->param('step') || 0;
49 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
50 my ($template, $loggedinuser, $cookie)
51 = get_template_and_user({template_name => "members/memberentrygen.tmpl",
55 flagsrequired => {borrowers => 1},
58 my $guarantorid=$input->param('guarantorid');
59 my $borrowernumber=$input->param('borrowernumber');
60 my $actionType=$input->param('actionType') || '';
61 my $modify=$input->param('modify');
62 my $delete=$input->param('delete');
63 my $op=$input->param('op');
64 my $destination=$input->param('destination');
65 my $cardnumber=$input->param('cardnumber');
66 my $check_member=$input->param('check_member');
67 my $name_city=$input->param('name_city');
68 my $nodouble=$input->param('nodouble');
69 my $select_city=$input->param('select_city');
70 my $nok=$input->param('nok');
71 my $guarantorinfo=$input->param('guarantorinfo');
72 my $step=$input->param('step') || 0;
75 # $check_categorytype contains the value of duplicate borrowers category type to redirect in good template in step =2
76 my $check_categorytype=$input->param('check_categorytype');
77 # NOTE: Alert for ethnicity and ethnotes fields, they are unvalided in all borrowers form
80 $template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
82 #function to automatic setup the mandatory fields (visual with css)
83 my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
84 my @field_check=split(/\|/,$check_BorrowerMandatoryField);
85 foreach (@field_check) {
86 $template->param( "mandatory$_" => 1);
88 $template->param( "add" => 1) if ( $op eq 'add');
89 $template->param("checked" => 1) if ($nodouble eq 1);
90 my $categorycode=$input->param('categorycode');
91 ($borrower_data=GetMember($borrowernumber,'borrowernumber')) if ($op eq 'modify' or $op eq 'save');
92 $categorycode=$borrower_data->{'categorycode'} unless $categorycode;
93 my $category_type = $input->param('category_type');
94 unless ($category_type or !($categorycode)){
95 my $borrowercategory= GetBorrowercategory($categorycode);
96 $category_type = $borrowercategory->{'category_type'};
98 $category_type="A" unless $category_type; # FIXME we should display a error message instead of a 500 error !
100 # if a add or modify is requested => check validity of data.
101 %data= %$borrower_data if ($borrower_data);
104 if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') {
105 my @names= ($borrower_data && $op ne 'save') ? keys %$borrower_data : $input->param();
106 foreach my $key (@names) {
107 $newdata{$key} = $input->param($key) if ($input->param($key));
108 $newdata{$key} =~ s/\"/"/gg unless ($key eq 'borrowernotes' or $key eq 'opacnote');
110 $newdata{'dateenrolled'}=format_date_in_iso($newdata{'dateenrolled'}) if ($newdata{dateenrolled});
111 $newdata{'dateexpiry'}=format_date_in_iso($newdata{'dateexpiry'}) if ($newdata{dateexpiry});
112 $newdata{'dateofbirth'}=format_date_in_iso($newdata{'dateofbirth'}) if ($newdata{dateofbirth});
115 <<<<<<< HEAD:members/memberentry.pl
116 #############test for member being unique #############
117 if ($op eq 'insert'){
118 my $category_type_send=$category_type if ($category_type eq 'I');
119 my $check_category; # recover the category code of the doublon suspect borrowers
120 ($check_member,$check_category)= checkuniquemember($category_type_send,($newdata{'surname'}?$newdata{'surname'}:$data{'surname'}),($newdata{'firstname'}?$newdata{'firstname'}:$data{'firstname'}),($newdata{'dateofbirth'}?$newdata{'dateofbirth'}:$data{'dateofbirth'}));
123 # WARN : some tests must be done whatever the step, because the librarian can click on any tab.
124 #############test for member being unique #############
125 if ($op eq 'insert'){
126 my $category_type_send=$category_type if ($category_type eq 'I');
127 my $check_category; # recover the category code of the doublon suspect borrowers
128 ($check_member,$check_category) = checkuniquemember(
130 ($newdata{'surname' } ? $newdata{'surname' } : $data{'surname' }),
131 ($newdata{'firstname'} ? $newdata{'firstname'} : $data{'firstname'}),
132 ($newdata{'dateofbirth'} ? C4::Dates->new($newdata{'dateofbirth'})->output('iso') : $data{'dateofbirth'})
134 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
136 # recover the category type if the borrowers is a doublon
137 my $tmpborrowercategory=GetBorrowercategory($check_category);
138 $check_categorytype=$tmpborrowercategory->{'category_type'};
141 #recover all data from guarantor address phone ,fax...
142 <<<<<<< HEAD:members/memberentry.pl
143 if (($category_type eq 'C' || $category_type eq 'P') and $guarantorid ne '' ){
144 my $guarantordata=GetMember($guarantorid);
145 $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
146 if (($data{'contactname'} eq '' or $data{'contactname'} ne $guarantordata->{'surname'})) {
147 $data{'contactfirstname'}=$guarantordata->{'firstname'};
148 $data{'contactname'}=$guarantordata->{'surname'};
149 $data{'contacttitle'}=$guarantordata->{'title'};
150 map {$data{$_}=$guarantordata->{$_}}('streetnumber','address','streettype','address2','zipcode','city','phone','phonepro','mobile','fax','email','emailpro');
152 if ($category_type eq 'C' and $guarantorid ne '' ){
153 my $guarantordata=GetMember($guarantorid);
154 $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
155 if (($data{'contactname'} eq '' or $data{'contactname'} ne $guarantordata->{'surname'})) {
156 $newdata{'contactfirstname'} = $guarantordata->{'firstname'};
157 $newdata{'contactname' } = $guarantordata->{'surname'};
158 $newdata{'contacttitle' } = $guarantordata->{'title'};
159 map {$newdata{$_}=$guarantordata->{$_}}('streetnumber','address','streettype','address2','zipcode','city','phone','phonepro','mobile','fax','email','emailpro');
160 # This use of map is improper (void context). Should be foreach, probably.
162 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
166 <<<<<<< HEAD:members/memberentry.pl
167 ###############test to take the right zipcode and city name ##############
168 if ( $guarantorid eq ''){
170 my ($borrower_city,$borrower_zipcode)=&getzipnamecity($select_city);
171 $newdata{'city'}= $borrower_city;
172 $newdata{'zipcode'}=$borrower_zipcode;
174 # CHECKS step by step
176 if ($op eq 'insert' && checkcardnumber($cardnumber)){
177 push @errors, 'ERROR_cardnumber';
180 ###############test to take the right zipcode and city name ##############
181 if ( $guarantorid eq ''){
183 my ($borrower_city,$borrower_zipcode)=&getzipnamecity($select_city);
184 $newdata{'city' } = $borrower_city;
185 $newdata{'zipcode'} = $borrower_zipcode;
188 my $dateofbirthmandatory=0;
189 map {$dateofbirthmandatory=1 if $_ eq "dateofbirth"} @field_check; # improper use of map (void context). Probably "foreach" or even "grep" should be used.
190 if ($category_type ne 'I' && $newdata{dateofbirth} && $dateofbirthmandatory) {
191 my $age = GetAge(C4::Dates->new($data{dateofbirth})->output('iso'));
192 my $borrowercategory=GetBorrowercategory($data{'categorycode'});
193 if (($age > $borrowercategory->{'upperagelimit'}) or ($age < $borrowercategory->{'dateofbirthrequired'})) {
194 push @errors, 'ERROR_age_limitations';
200 if ( ($newdata{'userid'} eq '')){
201 my $onefirstnameletter=substr($data{'firstname'},0,1);
202 my $fivesurnameletter =substr($data{'surname'},0,5);
203 $newdata{'userid'}=lc($onefirstnameletter.$fivesurnameletter);
207 if ($op eq 'insert'){
209 # Check if the userid is unique
210 if ( !Check_Userid($data{'userid'},$borrowernumber)) {
211 push @errors, "ERROR_login_exist";
212 $nok = $loginexist = 1;
214 $borrowernumber = &AddMember(%newdata);
215 if ($data{'organisations'}){
216 # need to add the members organisations
217 my @orgs=split(/\|/,$data{'organisations'});
218 add_member_orgs($borrowernumber,\@orgs);
220 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
223 #builds default userid
224 if ( (defined $newdata{'userid'}) && ($newdata{'userid'} eq '')){
225 my $onefirstnameletter=substr($data{'firstname'},0,1);
226 my $fivesurnameletter=substr($data{'surname'},0,9);
227 $newdata{'userid'}=lc($onefirstnameletter.$fivesurnameletter);
231 if ($op eq 'save' || $op eq 'insert'){
232 if (checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){
233 push @errors, 'ERROR_cardnumber';
236 my $dateofbirthmandatory=0;
237 map {$dateofbirthmandatory=1 if $_ eq "dateofbirth"} @field_check;
238 if ($newdata{dateofbirth} && $dateofbirthmandatory) {
239 my $age = GetAge($newdata{dateofbirth});
240 my $borrowercategory=GetBorrowercategory($newdata{'categorycode'});
241 if (($age > $borrowercategory->{'upperagelimit'}) or ($age < $borrowercategory->{'dateofbirthrequired'})) {
242 push @errors, 'ERROR_age_limitations';
247 if (C4::Context->preference("IndependantBranches")) {
248 my $userenv = C4::Context->userenv;
249 if ($userenv && $userenv->{flags} != 1){
250 warn " $newdata{'branchcode'} : ".$userenv->{flags}.":".$userenv->{branch};
251 unless (!$newdata{'branchcode'} || $userenv->{branch} eq $newdata{'branchcode'}){
252 push @errors, "ERROR_branch";
257 # Check if the userid is unique
258 if (($op eq 'insert' || $op eq 'save') && !Check_Userid($newdata{'userid'},$borrowernumber)) {
259 push @errors, "ERROR_login_exist";
265 if ($op eq 'modify' || $op eq 'insert'){
266 unless ($newdata{'dateexpiry'}){
267 if ($newdata{'dateenrolled'}){
268 $newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$newdata{'dateenrolled'});
270 my $today= sprintf('%04d-%02d-%02d', Today());
271 $newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$today) ;
278 if ($op eq 'insert'){
279 # Check if the userid is unique
281 $borrowernumber = &AddMember(%newdata);
282 if ($data{'organisations'}){
283 # need to add the members organisations
284 my @orgs=split(/\|/,$data{'organisations'});
285 add_member_orgs($borrowernumber,\@orgs);
287 if($destination eq "circ"){
288 print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$data{'cardnumber'}");
290 if ($loginexist == 0) {
291 print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber");
297 # test to know if another user have the same password and same login
299 &ModMember(%newdata);
300 print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber");
304 <<<<<<< HEAD:members/memberentry.pl
306 print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$borrowernumber");
310 ($delete) and print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$borrowernumber");
311 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
313 <<<<<<< HEAD:members/memberentry.pl
314 $op="add" if ($op eq "insert");
315 $op="modify" if ($op eq "save");
317 $template->param( updtype => ($op eq "insert"?'I':'M'));
319 $template->param( step_1 => 1,step_2 => 1,step_3 => 1);
322 $op = "add" if ($op eq "insert");
323 $op = "modify" if ($op eq "save" );
325 $template->param( updtype => ($op eq "insert"?'I':'M'),step_1=>1,step_2=>1,step_3=>1,allsteps=>1);
326 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
328 if (C4::Context->preference("IndependantBranches")) {
329 my $userenv = C4::Context->userenv;
330 if ($userenv->{flags} != 1 && $data{branchcode}){
331 unless ($userenv->{branch} eq $data{'branchcode'}){
332 print $input->redirect("/cgi-bin/koha/members/members-home.pl");
337 $template->param( updtype => 'I',step_1=>1,step_2=>1,step_3=>1);
339 if ($op eq "modify") {
340 $template->param( updtype => 'M',modify => 1 );
341 $template->param( step_1=>1,step_2=>1,step_3=>1) unless $step;
343 # my $cardnumber=$data{'cardnumber'};
344 $data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add';
345 if ($data{'sex'} eq 'F'){
346 $template->param(female => 1);
347 } elsif ($data{'sex'} eq 'M'){
348 $template->param(male => 1);
350 $template->param(none => 1);
353 ##Now all the data to modify a member.
354 my ($categories,$labels)=ethnicitycategories();
356 my $ethnicitycategoriescount=$#{$categories};
358 if ($ethnicitycategoriescount>=0) {
359 $ethcatpopup = CGI::popup_menu(-name=>'ethnicity',
362 -values=>$categories,
363 -default=>$data{'ethnicity'},
365 $template->param(ethcatpopup => $ethcatpopup); # bad style, has to be fixed
368 <<<<<<< HEAD:members/memberentry.pl
370 my $action="WHERE category_type=?";
371 ($categories,$labels)=GetborCatFromCatType($category_type,$action);
373 my $action="WHERE category_type=?";
374 ($categories,$labels)=GetborCatFromCatType($category_type,$action);
375 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
377 if(scalar(@$categories)){
378 #if you modify the borrowers you must have the right value for his category code
379 my $default_category=$newdata{'categorycode'} if ($op eq 'modify');
380 my $catcodepopup = CGI::popup_menu(
381 -name=>'categorycode',
382 -id => 'categorycode',
383 -values=>$categories,
385 -default=>$default_category
387 $template->param(catcodepopup=>$catcodepopup);
390 <<<<<<< HEAD:members/memberentry.pl
391 $select_city=getidcity($data{'city'}) if ($guarantorid ne '0');
392 ($default_city=$select_city) if ($step eq 0);
393 if ($select_city eq '' ){
394 my $selectcity=&getidcity($data{'city'});
395 $default_city=$selectcity;
397 my($cityid,$name_city)=GetCities();
398 $template->param( city_cgipopup => 1) if ($cityid );
399 my $citypopup = CGI::popup_menu(-name=>'select_city',
400 -id => 'select_city',
403 -default=>$default_city
406 $select_city=getidcity($data{'city'}) if ($guarantorid ne '0');
407 ($default_city=$select_city) if ($step eq 0);
408 if ($select_city eq '' ){
409 $default_city=getidcity($data{'city'});
411 my($cityid,$name_city)=GetCities();
412 $template->param( city_cgipopup => 1) if ($cityid );
413 my $citypopup = CGI::popup_menu(-name=>'select_city',
414 -id => 'select_city',
418 -default=>$default_city
420 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
422 <<<<<<< HEAD:members/memberentry.pl
423 my $default_roadtype;
424 $default_roadtype=$data{'streettype'} ;
425 my($roadtypeid,$road_type)=GetRoadTypes();
426 $template->param( road_cgipopup => 1) if ($roadtypeid );
427 my $roadpopup = CGI::popup_menu(-name=>'streettype',
429 -values=>$roadtypeid,
432 -default=>$default_roadtype
435 my $default_roadtype;
436 $default_roadtype=$data{'streettype'} ;
437 my($roadtypeid,$road_type)=GetRoadTypes();
438 $template->param( road_cgipopup => 1) if ($roadtypeid );
439 my $roadpopup = CGI::popup_menu(-name=>'streettype',
441 -values=>$roadtypeid,
444 -default=>$default_roadtype
446 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
448 <<<<<<< HEAD:members/memberentry.pl
449 my $default_borrowertitle;
450 $default_borrowertitle=$data{'title'} ;
451 my($borrowertitle)=GetTitles();
452 my $borrotitlepopup = CGI::popup_menu(-name=>'title',
454 -values=>$borrowertitle,
456 -default=>$default_borrowertitle
459 my $default_borrowertitle;
460 $default_borrowertitle=$data{'title'} ;
461 my($borrowertitle)=GetTitles();
462 my $borrotitlepopup = CGI::popup_menu(-name=>'title',
464 -values=>$borrowertitle,
466 -default=>$default_borrowertitle
468 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
470 <<<<<<< HEAD:members/memberentry.pl
473 foreach (map {$_ || ''} split /,|\|/, C4::Context->preference('BorrowerRelationship')) {
474 my %row = ('relationship' => $_);
475 if ($data{'relationship'} eq $_) {
476 $row{'selected'}=' selected';
480 push(@relshipdata, \%row);
482 my %flags = ( 'gonenoaddress' => ['gonenoaddress', 'Gone no address '],
483 'lost' => ['lost', 'Lost'],
484 'debarred' => ['debarred', 'Debarred']);
485 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
487 <<<<<<< HEAD:members/memberentry.pl
488 my @relationships = split /,|\|/,C4::Context->preference('BorrowerRelationship');
490 while (@relationships) {
491 my $relship = shift @relationships || '';
492 my %row = ('relationship' => $relship);
493 if ($data{'relationship'} eq $relship) {
494 $row{'selected'}=' selected';
499 foreach my $key (keys(%flags)) {
500 my %row = ('key' => $key,
501 'name' => $flags{$key}[0],
502 'html' => $flags{$key}[1]);
504 $row{'yes'}=' checked';
508 $row{'no'}=' checked';
510 push(@flagdata, \%row);
511 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
513 push(@relshipdata, \%row);
515 my %flags = ( 'gonenoaddress' => ['gonenoaddress', 'Gone no address '],
516 'lost' => ['lost', 'Lost'],
517 'debarred' => ['debarred', 'Debarred']);
520 foreach (keys(%flags)) {
522 my %row = ('key' => $key,
523 'name' => $flags{$key}[0],
524 'html' => $flags{$key}[1]);
526 $row{'yes'}=' checked';
530 $row{'no'}=' checked';
532 push(@flagdata, \%row);
535 <<<<<<< HEAD:members/memberentry.pl
537 ($modify) and $template->param( modify => 1 );
538 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
540 <<<<<<< HEAD:members/memberentry.pl
546 my $onlymine=(C4::Context->preference('IndependantBranches') &&
547 C4::Context->userenv &&
548 C4::Context->userenv->{flags} !=1 &&
549 C4::Context->userenv->{branch}?1:0);
551 my $branches=GetBranches($onlymine);
554 foreach my $branch (sort keys %$branches) {
555 push @select_branch,$branch;
556 $select_branches{$branch} = $branches->{$branch}->{'branchname'};
557 $default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'});
560 #Convert dateofbirth to correct format
564 my $branches=GetBranches();
566 # -----------------------------------------------------
567 # the value of ip from the branches hash table
569 # $ip is the ip of user when is connect to koha
570 # my $ip = $ENV{'REMOTE_ADDR'};
572 # -----------------------------------------------------
573 foreach my $branch (keys %$branches) {
574 if ((not C4::Context->preference("IndependantBranches")) || (C4::Context->userenv->{'flags'} == 1)) {
575 push @select_branch, $branch;
576 $select_branches{$branch} = $branches->{$branch}->{'branchname'};
578 push @select_branch,$branch if ($branch eq C4::Context->userenv->{'branch'});
579 $select_branches{$branch} = $branches->{$branch}->{'branchname'} if ($branch eq C4::Context->userenv->{'branch'});
581 $default = C4::Context->userenv->{'branch'};
583 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
584 # --------------------------------------------------------------------------------------------------------
585 #in modify mod :default value from $CGIbranch comes from borrowers table
586 #in add mod: default value come from branches table (ip correspendence)
587 <<<<<<< HEAD:members/memberentry.pl
588 $default=$data{'branchcode'} if ($op eq 'modify');
589 my $CGIbranch = CGI::scrolling_list(-id => 'branchcode',
590 -name => 'branchcode',
591 -values => \@select_branch,
592 -labels => \%select_branches,
596 -default => $default,
598 my $CGIorganisations;
599 my $member_of_institution;
600 if (C4::Context->preference("memberofinstitution")){
601 my $organisations=get_institutions();
604 foreach my $organisation (keys %$organisations) {
605 push @orgs,$organisation;
606 $org_labels{$organisation}=$organisations->{$organisation}->{'surname'};
608 $member_of_institution=1;
610 $CGIorganisations = CGI::scrolling_list( -id => 'organisations',
611 -name => 'organisations',
612 -labels => \%org_labels,
621 $default=$data{'branchcode'} if ($op eq 'modify');
622 my $CGIbranch = CGI::scrolling_list(-id => 'branchcode',
623 -name => 'branchcode',
624 -values => \@select_branch,
625 -labels => \%select_branches,
629 -default => $default,
631 my $CGIorganisations;
632 my $member_of_institution;
633 if (C4::Context->preference("memberofinstitution")){
634 my $organisations=get_institutions();
637 foreach my $organisation (keys %$organisations) {
638 push @orgs,$organisation;
639 $org_labels{$organisation}=$organisations->{$organisation}->{'surname'};
641 $member_of_institution=1;
643 $CGIorganisations = CGI::scrolling_list( -id => 'organisations',
644 -name => 'organisations',
645 -labels => \%org_labels,
651 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
653 # --------------------------------------------------------------------------------------------------------
655 <<<<<<< HEAD:members/memberentry.pl
656 my $CGIsort1 = buildCGIsort("Bsort1","sort1",$data{'sort1'});
658 $template->param(CGIsort1 => $CGIsort1);
660 my $CGIsort1 = buildCGIsort("Bsort1","sort1",$data{'sort1'});
662 $template->param(CGIsort1 => $CGIsort1);
664 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
665 $template->param( sort1 => $data{'sort1'});
666 <<<<<<< HEAD:members/memberentry.pl
668 $template->param( sort1 => $data{'sort1'});
671 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
673 <<<<<<< HEAD:members/memberentry.pl
674 my $CGIsort2 = buildCGIsort("Bsort2","sort2",$data{'sort2'});
676 $template->param(CGIsort2 =>$CGIsort2);
678 $template->param( sort2 => $data{'sort2'});
681 foreach my $error (@errors) {
682 $template->param( $error => 1);
684 $template->param(nok => 1);
688 my $CGIsort2 = buildCGIsort("Bsort2","sort2",$data{'sort2'});
690 $template->param(CGIsort2 => $CGIsort2);
692 $template->param( sort2 => $data{'sort2'});
694 # increase step to see next page
696 foreach (@errors, 'nok') {
697 $template->param( $_ => 1);
701 # $step++ if $op eq 'add';
703 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
704 #Formatting data for display
706 <<<<<<< HEAD:members/memberentry.pl
707 if ($data{'dateenrolled'} eq ''){
708 my $today= sprintf('%04d-%02d-%02d', Today());
709 $data{'dateenrolled'}=$today;
712 if ($data{'dateenrolled'} eq ''){
713 my $today= sprintf('%04d-%02d-%02d', Today());
714 #insert ,in field "dateenrolled" , the current date
715 $data{'dateenrolled'}=$today;
716 $data{'dateexpiry'} = GetExpiryDate($data{'categorycode'},$today);
719 $data{'surname' } = uc($data{'surname'});
720 $data{'contactname' } = uc($data{'contactname'});
721 $data{'firstname' } = ucfirst(lc $data{'firstname'});
722 $data{'contactfirstname'}= ucfirst(lc $data{'contactfirstname'});
723 $data{'dateenrolled'} = C4::Dates->new($data{'dateenrolled'})->output;
724 $data{'dateexpiry' } = C4::Dates->new($data{'dateexpiry' })->output;
725 $data{'dateofbirth' } = C4::Dates->new($data{'dateofbirth' })->output;
726 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
728 <<<<<<< HEAD:members/memberentry.pl
729 $data{'surname'}=uc($data{'surname'});
730 $data{'firstname'}=ucfirst(lc $data{'firstname'});
731 $data{'dateenrolled'}=format_date($data{'dateenrolled'});
732 $data{'dateexpiry'}=format_date($data{'dateexpiry'});
733 $data{'contactname'}=uc($data{'contactname'});
734 $data{'contactfirstname'}= ucfirst( lc $data{'contactfirstname'});
735 $data{'dateofbirth'} = format_date($data{'dateofbirth'});
737 $template->param( "showguarantor" => 1) if ($category_type!~/A|I/);# associate with step to know where u are
738 $template->param( "showguarantor" => 0) if ($category_type=~/A|I/);# associate with step to know where u are
740 $template->param(%data);
741 $template->param( "step_$step" => 1) if $step;# associate with step to know where u are
742 $template->param( "step" => $step) if $step;# associate with step to know where u are
744 BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
745 category_type => $category_type,#to know the category type of the borrower
746 DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
747 select_city => $select_city,
748 "$category_type" => 1,# associate with step to know where u are
749 destination => $destination,#to know wher u come from and wher u must go in redirect
750 check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0)
751 flags =>$data{'flags'},
753 nodouble => $nodouble,
754 borrowernumber => $borrowernumber,#register number
755 "contacttitle_".$data{'contacttitle'} => "SELECTED" ,
756 guarantorid => $guarantorid,
757 ethcatpopup => $ethcatpopup,
758 relshiploop => \@relshipdata,
759 citypopup => $citypopup,
760 roadpopup => $roadpopup,
761 borrotitlepopup => $borrotitlepopup,
762 guarantorinfo => $guarantorinfo,
763 flagloop => \@flagdata,
764 dateformat => display_date_format(),
765 check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function
767 nok => $nok,#flag to konw if an error
768 CGIbranch => $CGIbranch,
769 memberofinstution => $member_of_institution,
770 CGIorganisations => $CGIorganisations,
773 $template->param(%data);
775 BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
776 category_type => $category_type,#to know the category type of the borrower
777 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
778 select_city => $select_city,
779 "step_$step" => 1, # associate with step to know where you are
780 "$category_type" => 1, # associate with step to know where you are
782 destination => $destination, # for redirect
783 check_member => $check_member, # to know if the borrower already exist(=>1) or not (=>0)
784 flags => $data{'flags'},
786 nodouble => $nodouble,
787 borrowernumber => $borrowernumber, # register number
788 "contacttitle_".$data{'contacttitle'} => "SELECTED",
789 guarantorid => $guarantorid,
790 ethcatpopup => $ethcatpopup,
791 relshiploop => \@relshipdata,
792 citypopup => $citypopup,
793 roadpopup => $roadpopup,
794 borrotitlepopup => $borrotitlepopup,
795 guarantorinfo => $guarantorinfo,
796 flagloop => \@flagdata,
797 dateformat => C4::Dates->visual(),
798 check_categorytype =>$check_categorytype, # to recover the category type with checkcategorytype function
800 nok => $nok, # flag to know if an error
801 CGIbranch => $CGIbranch,
802 memberofinstution => $member_of_institution,
803 CGIorganisations => $CGIorganisations,
805 >>>>>>> Removing CVS tags $Id$ and $Log$. Lots of files, not much change.:members/memberentry.pl
808 output_html_with_http_headers $input, $cookie, $template->output;