From 9395334e6970a7cd91901f73de3a142e1b3c5199 Mon Sep 17 00:00:00 2001 From: btoumi Date: Wed, 25 Jul 2007 14:09:39 +0000 Subject: [PATCH] add control of 'return date' if it 's a special or repeatable holidays , and return a right return date (renewal) --- C4/Circulation.pm | 34 +++++++++++++++++-- .../prog/en/circ/circulation.tmpl | 1 + .../prog/en/members/moremember.tmpl | 1 + members/moremember.pl | 6 ++-- reserve/renewscript.pl | 4 +-- 5 files changed, 39 insertions(+), 7 deletions(-) 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 " /> " /> + " /> diff --git a/koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl index b34fa1ca95..739a448a52 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl @@ -210,6 +210,7 @@

Items on loan

" /> + " />
diff --git a/members/moremember.pl b/members/moremember.pl index 7dc6c2652d..9605a916ac 100755 --- a/members/moremember.pl +++ b/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, diff --git a/reserve/renewscript.pl b/reserve/renewscript.pl index c2c1af2088..d06101e231 100755 --- a/reserve/renewscript.pl +++ b/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"; -- 2.39.5
Title