add control of 'return date' if it 's a special or repeatable holidays , and return a right return date
(renewal)
This commit is contained in:
parent
ee5c4c303c
commit
9395334e69
5 changed files with 39 additions and 7 deletions
|
@ -1633,7 +1633,7 @@ C<$datedue> should be in the form YYYY-MM-DD.
|
||||||
|
|
||||||
sub AddRenewal {
|
sub AddRenewal {
|
||||||
|
|
||||||
my ( $borrowernumber, $itemnumber, $datedue ) = @_;
|
my ( $borrowernumber, $itemnumber, $branch ,$datedue ) = @_;
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
|
|
||||||
# If the due date wasn't specified, calculate it by adding the
|
# 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 ) =
|
my ( $due_year, $due_month, $due_day ) =
|
||||||
Add_Delta_DHMS( Today_and_Now(), $loanlength, 0, 0, 0 );
|
Add_Delta_DHMS( Today_and_Now(), $loanlength, 0, 0, 0 );
|
||||||
$datedue = "$due_year-$due_month-$due_day";
|
$datedue = "$due_year-$due_month-$due_day";
|
||||||
|
$datedue=CheckValidDatedue($datedue,$itemnumber,$branch);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find the issues record for this book
|
# Find the issues record for this book
|
||||||
|
@ -1942,7 +1942,8 @@ for (my $i=0;$i<2;$i++){
|
||||||
($dow=0) if ($dow>6);
|
($dow=0) if ($dow>6);
|
||||||
my $result=CheckRepeatableHolidays($itemnumber,$dow,$branchcode);
|
my $result=CheckRepeatableHolidays($itemnumber,$dow,$branchcode);
|
||||||
my $countspecial=CheckSpecialHolidays($years,$month,$day,$itemnumber,$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;
|
$i=0;
|
||||||
(($years,$month,$day) = Add_Delta_Days($years,$month,$day, 1))if ($i ne '1');
|
(($years,$month,$day) = Add_Delta_Days($years,$month,$day, 1))if ($i ne '1');
|
||||||
}
|
}
|
||||||
|
@ -2002,6 +2003,33 @@ $sth->finish;
|
||||||
return $countspecial;
|
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{
|
sub CheckValidBarcode{
|
||||||
my ($barcode) = @_;
|
my ($barcode) = @_;
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
|
|
|
@ -718,6 +718,7 @@ No patron matched <!-- TMPL_VAR name="message" -->
|
||||||
<input type="hidden" value="circ" name="destination" />
|
<input type="hidden" value="circ" name="destination" />
|
||||||
<input type="hidden" name="cardnumber" value="<!-- TMPL_VAR NAME="cardnumber" -->" />
|
<input type="hidden" name="cardnumber" value="<!-- TMPL_VAR NAME="cardnumber" -->" />
|
||||||
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
|
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
|
||||||
|
<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
|
||||||
|
|
||||||
<!-- TMPL_IF NAME="todayissues" -->
|
<!-- TMPL_IF NAME="todayissues" -->
|
||||||
<table>
|
<table>
|
||||||
|
|
|
@ -210,6 +210,7 @@
|
||||||
<h2>Items on loan</h2>
|
<h2>Items on loan</h2>
|
||||||
<form action="/cgi-bin/koha/reserve/renewscript.pl" method="post">
|
<form action="/cgi-bin/koha/reserve/renewscript.pl" method="post">
|
||||||
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
|
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
|
||||||
|
<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Title</th>
|
<th scope="col">Title</th>
|
||||||
|
|
|
@ -90,7 +90,8 @@ if ( not defined $data ) {
|
||||||
|
|
||||||
# re-reregistration function to automatic calcul of date expiry
|
# re-reregistration function to automatic calcul of date expiry
|
||||||
(
|
(
|
||||||
$data->{'dateexpiry'} = GetMembeReregistration(
|
# $data->{'dateexpiry'} = GetMembeReregistration(
|
||||||
|
$data->{'dateexpiry'} = ExtendMemberSubscriptionTo(
|
||||||
$data->{'categorycode'},
|
$data->{'categorycode'},
|
||||||
$borrowernumber, $data->{'dateenrolled'}
|
$borrowernumber, $data->{'dateenrolled'}
|
||||||
)
|
)
|
||||||
|
@ -330,7 +331,7 @@ $picture = "/borrowerimages/" . $borrowernumber . ".jpg";
|
||||||
if ( -e $htdocs . "$picture" ) {
|
if ( -e $htdocs . "$picture" ) {
|
||||||
$template->param( picture => $picture );
|
$template->param( picture => $picture );
|
||||||
}
|
}
|
||||||
|
my $branch=C4::Context->userenv->{'branch'};
|
||||||
|
|
||||||
$template->param($data);
|
$template->param($data);
|
||||||
|
|
||||||
|
@ -338,6 +339,7 @@ $template->param(
|
||||||
roaddetails => $roaddetails,
|
roaddetails => $roaddetails,
|
||||||
borrowernumber => $borrowernumber,
|
borrowernumber => $borrowernumber,
|
||||||
reregistration => $reregistration,
|
reregistration => $reregistration,
|
||||||
|
branch => $branch,
|
||||||
totalprice => sprintf( "%.2f", $totalprice ),
|
totalprice => sprintf( "%.2f", $totalprice ),
|
||||||
totaldue => sprintf( "%.2f", $total ),
|
totaldue => sprintf( "%.2f", $total ),
|
||||||
issueloop => \@issuedata,
|
issueloop => \@issuedata,
|
||||||
|
|
|
@ -39,7 +39,7 @@ if ($input->param('renew_all')) {
|
||||||
else {
|
else {
|
||||||
@data = $input->param('items[]');
|
@data = $input->param('items[]');
|
||||||
}
|
}
|
||||||
|
my $branch=$input->param('branch');
|
||||||
#
|
#
|
||||||
# renew items
|
# renew items
|
||||||
#
|
#
|
||||||
|
@ -51,7 +51,7 @@ foreach my $itemno (@data) {
|
||||||
# warn "CanBookbeRenewed";
|
# warn "CanBookbeRenewed";
|
||||||
if (CanBookBeRenewed($borrowernumber,$itemno)){
|
if (CanBookBeRenewed($borrowernumber,$itemno)){
|
||||||
# warn "$itemno can be renewed for $borrowernumber";
|
# warn "$itemno can be renewed for $borrowernumber";
|
||||||
AddRenewal($borrowernumber,$itemno);
|
AddRenewal($borrowernumber,$itemno,$branch);
|
||||||
# warn "renewal added";
|
# warn "renewal added";
|
||||||
# }else {
|
# }else {
|
||||||
# warn "cannot renew";
|
# warn "cannot renew";
|
||||||
|
|
Loading…
Reference in a new issue