From f4339f536f4e7c3008eac1e7b096398117d0c8a9 Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Wed, 3 Oct 2007 19:00:55 +0200 Subject: [PATCH] #1445 checking that there is an expiry date if there is none, automatically warn the librarian Signed-off-by: Chris Cormack --- reserve/request.pl | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/reserve/request.pl b/reserve/request.pl index 90ca398c56..afed443720 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -103,12 +103,17 @@ if ($cardnumber) { $maxreserves = 1; } - # we check the date expiricy of the borrower - my $warning = (Date_to_Days(split /-/,$date) > Date_to_Days( split /-/,$borrowerinfo->{'dateexpiry'})); - - if ( $warning > 0 ) { + # we check the date expiricy of the borrower (only if there is an expiry date, otherwise, set to 1 (warn) + warn "BOR : ".$borrowerinfo->{'dateexpiry'}; + if ($borrowerinfo->{'dateexpiry'}) { + my $warning = (Date_to_Days(split /-/,$date) > Date_to_Days( split /-/,$borrowerinfo->{'dateexpiry'})); + if ( $warning > 0 ) { + $expiry = 1; + } + } else { $expiry = 1; } + # check if the borrower make the reserv in a different branch if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) { @@ -116,19 +121,19 @@ if ($cardnumber) { } $template->param( - borrowernumber => $borrowerinfo->{'borrowernumber'}, - borrowersurname => $borrowerinfo->{'surname'}, - borrowerfirstname => $borrowerinfo->{'firstname'}, - borrowerstreetaddress => $borrowerinfo->{'address'}, - borrowercity => $borrowerinfo->{'city'}, - borrowerphone => $borrowerinfo->{'phone'}, - borroweremail => $borrowerinfo->{'email'}, - borroweremailpro => $borrowerinfo->{'emailpro'}, - borrowercategory => $borrowerinfo->{'category'}, - borrowerreservs => $count_reserv, - maxreserves => $maxreserves, - expiry => $expiry, - diffbranch => $diffbranch + borrowernumber => $borrowerinfo->{'borrowernumber'}, + borrowersurname => $borrowerinfo->{'surname'}, + borrowerfirstname => $borrowerinfo->{'firstname'}, + borrowerstreetaddress => $borrowerinfo->{'address'}, + borrowercity => $borrowerinfo->{'city'}, + borrowerphone => $borrowerinfo->{'phone'}, + borroweremail => $borrowerinfo->{'email'}, + borroweremailpro => $borrowerinfo->{'emailpro'}, + borrowercategory => $borrowerinfo->{'category'}, + borrowerreservs => $count_reserv, + maxreserves => $maxreserves, + expiry => $expiry, + diffbranch => $diffbranch ); } -- 2.20.1