[Koha-cvs] CVS: koha/C4 Members.pm,1.6.2.1,1.6.2.2

Paul POULAIN tipaul at users.sourceforge.net
Thu May 19 23:52:48 CEST 2005


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28891/C4

Modified Files:
      Tag: rel_2_2
	Members.pm 
Log Message:
* better management of joining & expiry dates :
	- dates can be manually typed when adding a borrower.
	- Empty fields are automatically calculated (joining = today & expiry date calculated from borrower category)
	- Expiry date can be modified
* checking expiry date when trying to issue a book & forbidding issuing when expiry date reached. ** IMPORTANT ** This check was not done before. Thus, you may be unable to issue books where you could before. You can update your database borrower by borrower or with the following SQL command on the server : "update borrowers set expiry='2005-31-12'". You can limit the update to a borrower category with "update borrowers set expiry='2005-31-12' where categorycode='A'" (all SQL commands must be typed without any ")


Index: Members.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Members.pm,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -r1.6.2.1 -r1.6.2.2
*** Members.pm	25 Mar 2005 16:30:32 -0000	1.6.2.1
--- Members.pm	19 May 2005 21:52:45 -0000	1.6.2.2
***************
*** 100,104 ****
  	my $dbh = C4::Context->dbh;
  	$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
- 	$data{'joining'}=format_date_in_iso($data{'joining'});
  	$data{'expiry'}=format_date_in_iso($data{'expiry'});
  	my $query="update borrowers set title='$data{'title'}',expiry='$data{'expiry'}',
--- 100,103 ----
***************
*** 106,110 ****
  	streetaddress='$data{'streetaddress'}',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'}',
  	categorycode='$data{'categorycode'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}',
--- 105,109 ----
  	streetaddress='$data{'streetaddress'}',faxnumber='$data{'faxnumber'}',firstname='$data{'firstname'}',
  	altnotes='$data{'altnotes'}',dateofbirth='$data{'dateofbirth'}',contactname='$data{'contactname'}',
! 	emailaddress='$data{'emailaddress'}',streetcity='$data{'streetcity'}',
  	altrelationship='$data{'altrelationship'}',othernames='$data{'othernames'}',phoneday='$data{'phoneday'}',
  	categorycode='$data{'categorycode'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}',
***************
*** 131,135 ****
--- 130,143 ----
  	my $dbh = C4::Context->dbh;
  	$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();





More information about the Koha-cvs mailing list