From b31ff7ec232edb59d231ca889af73936c65accce Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 15 May 2003 12:25:04 +0000 Subject: [PATCH] fixes for bug 246 (zipcode), 207 (display of institutional member) and some improvment and other bugfixes --- imemberentry.pl | 30 +++- insertdata.pl | 10 +- insertidata.pl | 52 ++++-- insertjdata.pl | 2 - .../default/en/members/imemberentry.tmpl | 26 +-- .../default/en/members/memberentry.tmpl | 13 +- .../default/en/members/moremember.tmpl | 58 ++++--- memberentry.pl | 21 +-- moremember.pl | 153 +++++++++--------- newmember.pl | 4 +- 10 files changed, 224 insertions(+), 145 deletions(-) diff --git a/imemberentry.pl b/imemberentry.pl index 1a43ac36c3..3827c7df92 100755 --- a/imemberentry.pl +++ b/imemberentry.pl @@ -31,6 +31,7 @@ use C4::Interface::CGI::Output; use C4::Koha; use HTML::Template; use C4::Members; +use C4::Date; my $input = new CGI; @@ -62,7 +63,7 @@ foreach my $branch (keys %$branches) { push @select_branch, $branch; $select_branches{$branch} = $branches->{$branch}->{'branchname'}; } -my $CGIbranch=CGI::scrolling_list( -name => 'branch', +my $CGIbranch=CGI::scrolling_list( -name => 'branchcode', -values => \@select_branch, -default => $data->{'branchcode'}, -labels => \%select_branches, @@ -70,7 +71,32 @@ my $CGIbranch=CGI::scrolling_list( -name => 'branch', -multiple => 0 ); $template->param(member => $member, - cardnumber_institution => $cardnumber, + member => $member, + address => $data->{'streetaddress'}, + firstname => $data->{'firstname'}, + surname => $data->{'surname'}, + othernames => $data->{'othernames'}, + streetaddress => $data->{'streetaddress'}, + streetcity => $data->{'streetcity'}, + zipcode => $data->{'zipcode'}, + 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'}, + "title_".$data->{'title'} => " SELECTED ", + dateenrolled => $data->{'dateenrolled'}, + expiry => $data->{'expiry'}, + cardnumber => $cardnumber, + dateofbirth => $data->{'dateofbirth'}, + dateformat => display_date_format(), + cardnumber_institution => $cardnumber, CGIbranch => $CGIbranch); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/insertdata.pl b/insertdata.pl index 8fe72d0f33..9f9ef4a7ac 100755 --- a/insertdata.pl +++ b/insertdata.pl @@ -48,7 +48,7 @@ my $dbh = C4::Context->dbh; my $query="Select * from borrowers where borrowernumber=$data{'borrowernumber'}"; my $sth=$dbh->prepare($query); $sth->execute; -if (my $data=$sth->fetchrow_hashref){ +if (my $data2=$sth->fetchrow_hashref){ $data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'}); $data{'joining'}=format_date_in_iso($data{'joining'}); $data{'expiry'}=format_date_in_iso($data{'expiry'}); @@ -61,7 +61,9 @@ if (my $data=$sth->fetchrow_hashref){ categorycode='$data{'categorycode'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}', borrowernotes='$data{'borrowernotes'}',altphone='$data{'altphone'}',surname='$data{'surname'}', initials='$data{'initials'}',physstreet='$data{'streetaddress'}',ethnicity='$data{'ethnicity'}', - gonenoaddress='$data{'gna'}',lost='$data{'lost'}',debarred='$data{'debarred'}',textmessaging='$data{'textmessaging'}', branchcode = '$data{'branchcode'}' + gonenoaddress='$data{'gna'}',lost='$data{'lost'}',debarred='$data{'debarred'}', + textmessaging='$data{'textmessaging'}', branchcode = '$data{'branchcode'}', + zipcode = '$data{'zipcode'}',homezipcode='$data{'homezipcode'}' where borrowernumber=$data{'borrowernumber'}"; # print $query; @@ -72,13 +74,13 @@ if (my $data=$sth->fetchrow_hashref){ $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,borrowernumber,physstreet,branchcode) values ('$data{'title'}','$data{'expiry'}','$data{'cardnumber'}', + initials,ethnicity,borrowernumber,physstreet,branchcode,zipcode,homezipcode) values ('$data{'title'}','$data{'expiry'}','$data{'cardnumber'}', '$data{'sex'}','$data{'ethnotes'}','$data{'address'}','$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{'borrowernumber'}','$data{'streetaddress'}','$data{'branchcode'}')"; + '$data{'ethnicity'}','$data{'borrowernumber'}','$data{'streetaddress'}','$data{'branchcode'}',$data{'zipcode'},$data{'homezipcode'})"; } # ok if its an adult (type) it may have borrowers that depend on it as a guarantor # so when we update information for an adult we should check for guarantees and update the relevant part diff --git a/insertidata.pl b/insertidata.pl index 9291a6c8d0..a193f2c0bb 100755 --- a/insertidata.pl +++ b/insertidata.pl @@ -43,25 +43,43 @@ foreach my $key (@names){ $data{$key}=$input->param($key); } my $dbh = C4::Context->dbh; -my $surname=$data{'institution_name'}; -my $query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber, -firstname,altnotes,dateofbirth,contactname,emailaddress,dateenrolled,streetcity, -altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname, -initials,ethnicity,borrowernumber,guarantor,school) -values ('','$data{'expiry'}','$data{'cardnumber_institution'}', -'','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}', -'$data{'firstname'}','$data{'altnotes'}','','$data{'contactname'}', -'$data{'emailaddress'}', -now(),'$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}', -'$data{'phoneday'}','I','$data{'city'}','$data{'area'}','$data{'phone'}', -'$data{'borrowernotes'}','$data{'altphone'}','$surname','$data{'initials'}', -'$data{'ethnicity'}','$data{'borrowernumber'}','','')"; - +my $query="Select * from borrowers where borrowernumber=$data{'borrowernumber'}"; +my $sth=$dbh->prepare($query); +$sth->execute; +if (my $data2=$sth->fetchrow_hashref){ + $query="update borrowers set title='$data{'title'}',expiry='$data{'expiry'}', + cardnumber='$data{'cardnumber_institution'}',sex='$data{'sex'}',ethnotes='$data{'ethnicnotes'}', + streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',firstname='$data{'firstname'}', + altnotes='$data{'altnotes'}',dateofbirth='$data{'dateofbirth'}',contactname='$data{'contactname'}', + emailaddress='$data{'emailaddress'}',dateenrolled='$data{'joining'}',streetcity='$data{'streetcity'}', + altrelationship='$data{'altrelationship'}',othernames='$data{'othernames'}',phoneday='$data{'phoneday'}', + city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}', + borrowernotes='$data{'borrowernotes'}',altphone='$data{'altphone'}',surname='$data{'institution_name'}', + initials='$data{'initials'}',physstreet='$data{'streetaddress'}',ethnicity='$data{'ethnicity'}', + gonenoaddress='$data{'gna'}',lost='$data{'lost'}',debarred='$data{'debarred'}', + textmessaging='$data{'textmessaging'}', branchcode = '$data{'branchcode'}', + zipcode = '$data{'zipcode'}',homezipcode='$data{'homezipcode'}' + where borrowernumber=$data{'borrowernumber'}"; +} else { + my $surname=$data{'institution_name'}; + $query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber, + firstname,altnotes,dateofbirth,contactname,emailaddress,dateenrolled,streetcity, + altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname, + initials,ethnicity,borrowernumber,guarantor,school,branchcode,zipcode,homezipcode) + values ('','$data{'expiry'}','$data{'cardnumber_institution'}', + '','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}', + '$data{'firstname'}','$data{'altnotes'}','','$data{'contactname'}', + '$data{'emailaddress'}', + now(),'$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}', + '$data{'phoneday'}','I','$data{'city'}','$data{'area'}','$data{'phone'}', + '$data{'borrowernotes'}','$data{'altphone'}','$surname','$data{'initials'}', + '$data{'ethnicity'}','$data{'borrowernumber'}','','',$data{'branchcode'},$data{'zipcode'},$data{'homezipcode'})"; +} #print $query; - my $sth2=$dbh->prepare($query); - $sth2->execute; - $sth2->finish; +my $sth2=$dbh->prepare($query); +$sth2->execute; +$sth2->finish; #$sth->finish; print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$data{'borrowernumber'}"); diff --git a/insertjdata.pl b/insertjdata.pl index d66930b36e..7ea4a6cca5 100755 --- a/insertjdata.pl +++ b/insertjdata.pl @@ -61,7 +61,6 @@ for (my $i=0;$i<3;$i++){ where borrowernumber=$data{'borrowernumber'}"; # print $query; }elsif ($data{"cardnumber_child_$i"} ne ''){ - warn "INSERT"; my $dob=$data{"dateofbirth_child_$i"}; $dob=ParseDate($dob); $dob=UnixDate($dob,'%Y-%m-%d'); @@ -94,7 +93,6 @@ for (my $i=0;$i<3;$i++){ } #print $query; my $sth2=$dbh->prepare($query); - warn "QQQ = $query"; $sth2->execute; $sth2->finish; $sth->finish; diff --git a/koha-tmpl/intranet-tmpl/default/en/members/imemberentry.tmpl b/koha-tmpl/intranet-tmpl/default/en/members/imemberentry.tmpl index 531c910e0d..9eb6700d06 100644 --- a/koha-tmpl/intranet-tmpl/default/en/members/imemberentry.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/members/imemberentry.tmpl @@ -1,7 +1,11 @@
-

Add New Institution


+ +

Edit Institution


+ +

Add new Institution


+
@@ -36,7 +40,7 @@ Institution Name - + ">   @@ -48,12 +52,12 @@ Postal Address* - Town* + Zipcode / Town* Area - - + "> + ">
"> @@ -70,7 +74,7 @@ Contact Name* - + "> @@ -80,9 +84,9 @@ Email - - - + "> + "> + ">   @@ -91,7 +95,7 @@ Notes - +   @@ -104,7 +108,7 @@ Notes - +   diff --git a/koha-tmpl/intranet-tmpl/default/en/members/memberentry.tmpl b/koha-tmpl/intranet-tmpl/default/en/members/memberentry.tmpl index 0ebe414865..48d57b91e6 100644 --- a/koha-tmpl/intranet-tmpl/default/en/members/memberentry.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/members/memberentry.tmpl @@ -88,12 +88,15 @@ Postal Address* - Town* + Zipcode / Town* Joining Branch - + + ">
+ + @@ -102,11 +105,13 @@ Street Address if different - Town + Zipcode / Town - + + ">
+ diff --git a/koha-tmpl/intranet-tmpl/default/en/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/default/en/members/moremember.tmpl index ad660288e7..4158b59392 100644 --- a/koha-tmpl/intranet-tmpl/default/en/members/moremember.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/members/moremember.tmpl @@ -2,6 +2,7 @@ +

@@ -24,9 +25,9 @@
(, )

Card Number:
- Postal Address: ,
- Home Address: ,
- Phone (Home):
+ Postal Address: ,
+ Home Address: ,
+ Phone (Home):
Phone (Daytime):
Fax:
E-mail: ">
@@ -39,31 +40,50 @@ Ethnicity: ,
- DoB:
- Sex:

- Alternative Contact:
+ + DoB:
+ Sex:

+ Alternative Contact:
Phone:
- Relationship:
+ + Relationship:
+
Notes:

- - Guarantees:
"> -
- - Guarantor: - - ">
+ + + Guarantees:
"> -
- no guarantor
+ Guarantor: + + ">
+ + no guarantor
+
-
+

General Notes:

- - "> - -

+ +
+ "> + +
+
+ +
+ "> + +
+
+ +
+ "> + +
+
"> diff --git a/memberentry.pl b/memberentry.pl index 54a80d9b09..383be6c820 100755 --- a/memberentry.pl +++ b/memberentry.pl @@ -156,16 +156,18 @@ if ($delete){ -multiple => 0 ); $template->param( - member => $member, + member => $member, address => $data->{'streetaddress'}, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - othernames => $data->{'othernames'}, - initials => $data->{'initials'}, - ethcatpopup => $ethcatpopup, - catcodepopup => $catcodepopup, - streetaddress => $data->{'physstreet'}, - streetcity => $data->{'streetcity'}, + firstname => $data->{'firstname'}, + surname => $data->{'surname'}, + othernames => $data->{'othernames'}, + initials => $data->{'initials'}, + ethcatpopup => $ethcatpopup, + catcodepopup => $catcodepopup, + streetaddress => $data->{'physstreet'}, + zipcode => $data->{'zipcode'}, + streetcity => $data->{'streetcity'}, + homezipcode => $data->{'homezipcode'}, city => $data->{'city'}, phone => $data->{'phone'}, phoneday => $data->{'phoneday'}, @@ -185,7 +187,6 @@ if ($delete){ dateofbirth => $data->{'dateofbirth'}, dateformat => display_date_format(), CGIbranch => $CGIbranch); -warn "title ==>".$data->{'title'}."<=="; output_html_with_http_headers $input, $cookie, $template->output; diff --git a/moremember.pl b/moremember.pl index 2451be475c..d7686eabc1 100755 --- a/moremember.pl +++ b/moremember.pl @@ -65,6 +65,8 @@ my $bornum=$input->param('bornum'); my $data=borrdata('',$bornum); +$template->param($data->{'categorycode'} => 1); # in template => instutitional (A for Adult & C for children) + $data->{'dateenrolled'} = format_date($data->{'dateenrolled'}); $data->{'expiry'} = format_date($data->{'expiry'}); $data->{'dateofbirth'} = format_date($data->{'dateofbirth'}); @@ -75,13 +77,14 @@ $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'}; - $data->{'city'}=$data2->{'city'}; - $data->{'physstreet'}=$data2->{'physstreet'}; - $data->{'streetcity'}=$data2->{'streetcity'}; - $data->{'phone'}=$data2->{'phone'}; - $data->{'phoneday'}=$data2->{'phoneday'}; + my $data2=borrdata('',$data->{'guarantor'}); + $data->{'streetaddress'}=$data2->{'streetaddress'}; + $data->{'city'}=$data2->{'city'}; + $data->{'physstreet'}=$data2->{'physstreet'}; + $data->{'streetcity'}=$data2->{'streetcity'}; + $data->{'phone'}=$data2->{'phone'}; + $data->{'phoneday'}=$data2->{'phoneday'}; + $data->{'zipcode'} = $data2->{'zipcode'}; } @@ -90,25 +93,25 @@ if ($data->{'ethnicity'} || $data->{'ethnotes'}) { } if ($data->{'categorycode'} ne 'C'){ - $template->param(isguarantee => 1); - # FIXME - # It looks like the $i is only being returned to handle walking through - # the array, which is probably better done as a foreach loop. - # - my ($count,$guarantees)=findguarantees($data->{'borrowernumber'}); - my @guaranteedata; - for (my $i=0;$i<$count;$i++){ - push (@guaranteedata, {borrowernumber => $guarantees->[$i]->{'borrowernumber'}, - cardnumber => $guarantees->[$i]->{'cardnumber'}, - name => $guarantees->[$i]->{'firstname'} . " " . $guarantees->[$i]->{'surname'}}); - } - $template->param(guaranteeloop => \@guaranteedata); + $template->param(isguarantee => 1); + # FIXME + # It looks like the $i is only being returned to handle walking through + # the array, which is probably better done as a foreach loop. + # + my ($count,$guarantees)=findguarantees($data->{'borrowernumber'}); + my @guaranteedata; + for (my $i=0;$i<$count;$i++){ + push (@guaranteedata, {borrowernumber => $guarantees->[$i]->{'borrowernumber'}, + cardnumber => $guarantees->[$i]->{'cardnumber'}, + name => $guarantees->[$i]->{'firstname'} . " " . $guarantees->[$i]->{'surname'}}); + } + $template->param(guaranteeloop => \@guaranteedata); } else { - my ($guarantor)=findguarantor($data->{'borrowernumber'}); - unless ($guarantor->{'borrowernumber'} == 0){ - $template->param(guarantorborrowernumber => $guarantor->{'borrowernumber'}, guarantorcardnumber => $guarantor->{'cardnumber'}); - } + my ($guarantor)=findguarantor($data->{'borrowernumber'}); + unless ($guarantor->{'borrowernumber'} == 0){ + $template->param(guarantorborrowernumber => $guarantor->{'borrowernumber'}, guarantorcardnumber => $guarantor->{'cardnumber'}); + } } my %bor; @@ -125,63 +128,63 @@ my ($numaccts,$accts,$total)=getboracctrecord('',\%bor); #} my @accountdata; for (my$i=0;$i<$numaccts;$i++){ - my $amount= $accts->[$i]{'amount'} + 0.00; - my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00; - my %row = %$accts->[$i]; - if ($amount2 != 0){ - my $item="   "; - $row{'date'} = format_date($accts->[$i]{'date'}); - - if ($accts->[$i]{'accounttype'} ne 'Res'){ - #get item data - #$item= - } - - # FIXME - # why set this variable if it's not going to be used? - # - my $env; - if ($accts->[$i]{'accounttype'} ne 'Res'){ - my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},''); - # FIXME, seems to me $iteminfo gets not defined - %row = (%row , %$iteminfo) if $iteminfo; - } - } - push (@accountdata, \%row); + my $amount= $accts->[$i]{'amount'} + 0.00; + my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00; + my %row = %$accts->[$i]; + if ($amount2 != 0){ + my $item="   "; + $row{'date'} = format_date($accts->[$i]{'date'}); + + if ($accts->[$i]{'accounttype'} ne 'Res'){ + #get item data + #$item= + } + + # FIXME + # why set this variable if it's not going to be used? + # + my $env; + if ($accts->[$i]{'accounttype'} ne 'Res'){ + my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},''); + # FIXME, seems to me $iteminfo gets not defined + %row = (%row , %$iteminfo) if $iteminfo; + } + } + push (@accountdata, \%row); } my ($count,$issue)=borrissues($bornum); my $today=ParseDate('today'); my @issuedata; for (my $i=0;$i<$count;$i++){ - my $datedue=ParseDate($issue->[$i]{'date_due'}); - $issue->[$i]{'date_due'} = format_date($issue->[$i]{'date_due'}); - my %row = %{$issue->[$i]}; - if ($datedue < $today){ - $row{'red'}=1; #print ""; - } - #find the charge for an item - # FIXME - This is expecting - # &C4::Circulation::Renewals2::calc_charges, but it's getting - # &C4::Circulation::Circ2::calc_charges, which only returns one - # element, so itemtype isn't being set. - # But &C4::Circulation::Renewals2::calc_charges doesn't appear to - # return the correct item type either (or a properly-formatted - # charge, for that matter). - my ($charge,$itemtype)=calc_charges(undef,$dbh,$issue->[$i]{'itemnumber'},$bornum); - $row{'itemtype'}=$itemtype; - $row{'charge'}=$charge; - - #check item is not reserved - my ($restype,$reserves)=CheckReserves($issue->[$i]{'itemnumber'}); - if ($restype){ - print "[$i]{'biblionumber'}>On Request - no renewals"; -# } elsif ($issue->[$i]->{'renewals'} > 0) { -# print "Previously Renewed - no renewals"; - } else { - $row{'norenew'}=0; - } - push (@issuedata, \%row); + my $datedue=ParseDate($issue->[$i]{'date_due'}); + $issue->[$i]{'date_due'} = format_date($issue->[$i]{'date_due'}); + my %row = %{$issue->[$i]}; + if ($datedue < $today){ + $row{'red'}=1; #print ""; + } + #find the charge for an item + # FIXME - This is expecting + # &C4::Circulation::Renewals2::calc_charges, but it's getting + # &C4::Circulation::Circ2::calc_charges, which only returns one + # element, so itemtype isn't being set. + # But &C4::Circulation::Renewals2::calc_charges doesn't appear to + # return the correct item type either (or a properly-formatted + # charge, for that matter). + my ($charge,$itemtype)=calc_charges(undef,$dbh,$issue->[$i]{'itemnumber'},$bornum); + $row{'itemtype'}=$itemtype; + $row{'charge'}=$charge; + + #check item is not reserved + my ($restype,$reserves)=CheckReserves($issue->[$i]{'itemnumber'}); + if ($restype){ + print "[$i]{'biblionumber'}>On Request - no renewals"; + # } elsif ($issue->[$i]->{'renewals'} > 0) { + # print "Previously Renewed - no renewals"; + } else { + $row{'norenew'}=0; + } + push (@issuedata, \%row); } my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2 diff --git a/newmember.pl b/newmember.pl index cc0d4e264b..d600f32583 100755 --- a/newmember.pl +++ b/newmember.pl @@ -169,11 +169,13 @@ if ($ok == 0) { sex => $sex, postal => $postal, home => $home, + zipcode => $data{'zipcode'}, + homezipcode => $data{'homezipcode'}, phone => $data{'phone'}, phoneday => $data{'phoneday'}, faxnumber => $data{'faxnumber'}, emailaddress => $data{'emailaddress'}, - textmessaging => $data{'textmessaging'}, + textmessaging => $data{'textmessaging'}, contactname => $data{'contactname'}, altphone => $data{'altphone'}, altrelationship => $data{'altrelationship'}, -- 2.39.5