* 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 ")
This commit is contained in:
tipaul 2005-05-19 21:52:45 +00:00
parent 64574b6f6a
commit 459e1ff76b
3 changed files with 23 additions and 6 deletions

View File

@ -99,13 +99,12 @@ sub modmember {
my (%data) = @_;
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'}',
cardnumber='$data{'cardnumber'}',sex='$data{'sex'}',ethnotes='$data{'ethnicnotes'}',
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'}',
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'}',
borrowernotes='$data{'borrowernotes'}',altphone='$data{'altphone'}',surname='$data{'surname'}',
@ -130,7 +129,16 @@ sub newmember {
my (%data) = @_;
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();
my $query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,

View File

@ -39,8 +39,6 @@
</div>
<!-- /TMPL_IF -->
<form action="/cgi-bin/koha/members/memberentry.pl" method="post">
<input type="hidden" name="joining" value="<!-- TMPL_VAR NAME="dateenrolled" -->">
<input type="hidden" name="expiry" value="<!-- TMPL_VAR NAME="expiry" -->">
<input type="hidden" name="type" value="borrowers">
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->">
<input type="hidden" name="updtype" value="<!-- TMPL_VAR NAME="updtype" -->">
@ -237,6 +235,17 @@
<tr>
<th colspan="5" >LIBRARY USE</th>
</tr>
<tr>
<!-- TMPL_IF NAME="addAction" -->
<td>Joining date (leave blank for today)</td>
<td><input type="text" name="joining" size="12" maxlength="10" value="<!-- TMPL_VAR name="joining" -->"></td>
<!-- TMPL_ELSE -->
<td>Joining date</td>
<td><!-- TMPL_VAR name="joining" --></td>
<!-- /TMPL_IF -->
<td>Expiry date (leave blank for auto calc)</td>
<td><input type="text" name="expiry" size="12" maxlength="10" value="<!-- TMPL_VAR name="expiry" -->"></td>
</tr>
<tr>
<td>Borrower message (appears in OPAC)</td>
<td colspan="4"><textarea name="textmessaging" cols="70" rows="3"><!-- TMPL_VAR NAME="textmessaging" --></textarea></td>

View File

@ -261,8 +261,8 @@ if ($delete){
flagloop => \@flagdata,
relshiploop => \@relshipdata,
"title_".$data->{'title'} => " SELECTED ",
dateenrolled => $data->{'dateenrolled'},
expiry => $data->{'expiry'},
joining => format_date($data->{'dateenrolled'}),
expiry => format_date($data->{'expiry'}),
cardnumber => $cardnumber,
dateofbirth => $data->{'dateofbirth'},
sort1 => $data->{'sort1'},