diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d46884cdce..1a1641cc80 100755 --- a/C4/Circulation.pm +++ b/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; diff --git a/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl index 14ef22ac48..911f2ccb9f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl @@ -718,6 +718,7 @@ No patron matched " /> " /> + " />