Browse Source

add control of 'return date' if it 's a special or repeatable holidays , and return a right return date

(renewal)
3.0.x
btoumi 17 years ago
parent
commit
9395334e69
  1. 34
      C4/Circulation.pm
  2. 1
      koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl
  3. 1
      koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl
  4. 6
      members/moremember.pl
  5. 4
      reserve/renewscript.pl

34
C4/Circulation.pm

@ -1633,7 +1633,7 @@ C<$datedue> should be in the form YYYY-MM-DD.
sub AddRenewal {
my ( $borrowernumber, $itemnumber, $datedue ) = @_;
my ( $borrowernumber, $itemnumber, $branch ,$datedue ) = @_;
my $dbh = C4::Context->dbh;
# If the due date wasn't specified, calculate it by adding the
@ -1650,7 +1650,7 @@ sub AddRenewal {
my ( $due_year, $due_month, $due_day ) =
Add_Delta_DHMS( Today_and_Now(), $loanlength, 0, 0, 0 );
$datedue = "$due_year-$due_month-$due_day";
$datedue=CheckValidDatedue($datedue,$itemnumber,$branch);
}
# Find the issues record for this book
@ -1942,7 +1942,8 @@ for (my $i=0;$i<2;$i++){
($dow=0) if ($dow>6);
my $result=CheckRepeatableHolidays($itemnumber,$dow,$branchcode);
my $countspecial=CheckSpecialHolidays($years,$month,$day,$itemnumber,$branchcode);
if (($result ne '0') or ($countspecial ne '0') ){
my $countspecialrepeatable=CheckRepeatableSpecialHolidays($month,$day,$itemnumber,$branchcode);
if (($result ne '0') or ($countspecial ne '0') or ($countspecialrepeatable ne '0') ){
$i=0;
(($years,$month,$day) = Add_Delta_Days($years,$month,$day, 1))if ($i ne '1');
}
@ -2002,6 +2003,33 @@ $sth->finish;
return $countspecial;
}
=head2 CheckRepeatableSpecialHolidays
$countspecial = CheckRepeatableSpecialHolidays($month,$day,$itemnumber,$branchcode);
this function check if the date is a repeatble special holidays
C<$month> = the month of datedue
C<$day> = the day of datedue
C<$itemnumber> = itemnumber
C<$branchcode> = localisation of issue
=cut
sub CheckRepeatableSpecialHolidays{
my ($month,$day,$itemnumber,$branchcode) = @_;
my $dbh = C4::Context->dbh;
my $query=qq|SELECT count(*)
FROM `repeatable_holidays`
WHERE month=?
AND day=?
AND branchcode=?
|;
my $sth = $dbh->prepare($query);
$sth->execute($month,$day,$branchcode);
my $countspecial=$sth->fetchrow ;
$sth->finish;
return $countspecial;
}
sub CheckValidBarcode{
my ($barcode) = @_;
my $dbh = C4::Context->dbh;

1
koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl

@ -718,6 +718,7 @@ No patron matched <!-- TMPL_VAR name="message" -->
<input type="hidden" value="circ" name="destination" />
<input type="hidden" name="cardnumber" value="<!-- TMPL_VAR NAME="cardnumber" -->" />
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
<!-- TMPL_IF NAME="todayissues" -->
<table>

1
koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl

@ -210,6 +210,7 @@
<h2>Items on loan</h2>
<form action="/cgi-bin/koha/reserve/renewscript.pl" method="post">
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
<table>
<tr>
<th scope="col">Title</th>

6
members/moremember.pl

@ -90,7 +90,8 @@ if ( not defined $data ) {
# re-reregistration function to automatic calcul of date expiry
(
$data->{'dateexpiry'} = GetMembeReregistration(
# $data->{'dateexpiry'} = GetMembeReregistration(
$data->{'dateexpiry'} = ExtendMemberSubscriptionTo(
$data->{'categorycode'},
$borrowernumber, $data->{'dateenrolled'}
)
@ -330,7 +331,7 @@ $picture = "/borrowerimages/" . $borrowernumber . ".jpg";
if ( -e $htdocs . "$picture" ) {
$template->param( picture => $picture );
}
my $branch=C4::Context->userenv->{'branch'};
$template->param($data);
@ -338,6 +339,7 @@ $template->param(
roaddetails => $roaddetails,
borrowernumber => $borrowernumber,
reregistration => $reregistration,
branch => $branch,
totalprice => sprintf( "%.2f", $totalprice ),
totaldue => sprintf( "%.2f", $total ),
issueloop => \@issuedata,

4
reserve/renewscript.pl

@ -39,7 +39,7 @@ if ($input->param('renew_all')) {
else {
@data = $input->param('items[]');
}
my $branch=$input->param('branch');
#
# renew items
#
@ -51,7 +51,7 @@ foreach my $itemno (@data) {
# warn "CanBookbeRenewed";
if (CanBookBeRenewed($borrowernumber,$itemno)){
# warn "$itemno can be renewed for $borrowernumber";
AddRenewal($borrowernumber,$itemno);
AddRenewal($borrowernumber,$itemno,$branch);
# warn "renewal added";
# }else {
# warn "cannot renew";

Loading…
Cancel
Save