From 6cfe88b7b2d30d5cd1b6a85c5334c6b0727a9b78 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Wed, 19 Dec 2007 16:26:01 -0600 Subject: [PATCH] Fix for bug 1427 Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 4 +-- circ/circulation.pl | 25 ++++++++++--------- .../prog/en/modules/circ/circulation.tmpl | 15 ++++++++--- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 8263c67b75..6c9da55f6e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -961,8 +961,8 @@ sub AddIssue { $dateduef=CheckValidDatedue($dateduef,$item->{'itemnumber'},C4::Context->userenv->{'branch'}); # if ReturnBeforeExpiry ON the datedue can't be after borrower expirydate - if ( C4::Context->preference('ReturnBeforeExpiry') && $dateduef gt $borrower->{dateexpiry} ) { - $dateduef = $borrower->{dateexpiry}; + if ( C4::Context->preference('ReturnBeforeExpiry') && $dateduef->output('iso') gt $borrower->{dateexpiry} ) { + $dateduef = C4::Dates->new($borrower->{dateexpiry},'iso'); } }; $sth->execute( diff --git a/circ/circulation.pl b/circ/circulation.pl index 28a43f1de5..2ab8f5f795 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -212,27 +212,28 @@ if ($borrowernumber) { my ( $renew_year, $renew_month, $renew_day ) = Add_Delta_YM( $enrol_year, $enrol_month, $enrol_day, 0 , $borrower->{'enrolmentperiod'}) if ($enrol_year*$enrol_month*$enrol_day>0); - # if the expiry date is before today + # if the expiry date is before today ie they have expired if ( $warning_year*$warning_month*$warning_day==0 || Date_to_Days( $today_year, $today_month, $today_day ) > Date_to_Days( $warning_year, $warning_month, $warning_day ) ) { - - #borrowercard expired or nearly expired, warn the librarian + #borrowercard expired, no issues $template->param( - flagged => "1", - warndeparture => format_date($borrower->{dateexpiry}), + flagged => "1", + noissues => "1", + expired => format_date($borrower->{dateexpiry}), renewaldate => format_date("$renew_year-$renew_month-$renew_day") ); } # check for NotifyBorrowerDeparture - if ($warning_year*$warning_month*$warning_day==0 - || (C4::Context->preference('NotifyBorrowerDeparture') && - Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) < - Date_to_Days( $today_year, $today_month, $today_day )) ) - { - $template->param("warndeparture" => format_date($borrower->{dateexpiry})); - } + elsif ( C4::Context->preference('NotifyBorrowerDeparture') && + Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) < + Date_to_Days( $today_year, $today_month, $today_day ) ) + { + # borrower card soon to expire warn librarian + $template->param("warndeparture" => format_date($borrower->{dateexpiry}), + flagged => "1",); + } $template->param( overduecount => $od, issuecount => $issue, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl index 86686540b7..d4ac1d5ac0 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl @@ -267,12 +267,19 @@ No patron matched

Cannot Check Out!Attention: