From c9fdd72708c0aea8284f02a11ced61f170570f69 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Tue, 5 Nov 2002 23:26:25 +0000 Subject: [PATCH] Added support for setting a required_date and an expiry_date on reserves. Note that reserves system doesn't pay any attention to these dates, and the librarian interface doesn't support setting these dates yet. --- C4/Reserves2.pm | 24 +++++++++++------ .../opac-tmpl/default/en/opac-reserve.tmpl | 26 +++++++++++++++++++ opac/opac-reserve.pl | 12 ++++++++- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/C4/Reserves2.pm b/C4/Reserves2.pm index ed6eca500d..77fbabfd1f 100755 --- a/C4/Reserves2.pm +++ b/C4/Reserves2.pm @@ -302,13 +302,13 @@ sub Findgroupreserve { return($i,@results); } -sub CreateReserve { +sub CreateReserve { my -($env,$branch,$borrnum,$biblionumber,$constraint,$bibitems,$priority,$notes,$title)= @_; +($env,$branch,$borrnum,$biblionumber,$constraint,$bibitems,$priority,$notes,$title,$required_date, $expires_date)= @_; my $fee=CalcReserveFee($env,$borrnum,$biblionumber,$constraint,$bibitems); - my $dbh = &C4Connect; - my $const = lc substr($constraint,0,1); - my @datearr = localtime(time); + my $dbh = &C4Connect; + my $const = lc substr($constraint,0,1); + my @datearr = localtime(time); my $resdate =(1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3]; #eval { # updates take place here @@ -325,11 +325,19 @@ sub CreateReserve { } #if ($const eq 'a'){ my $query="insert into reserves - (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,priority,reservenotes) + (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,priority,reservenotes,required_date,expires_date) values -('$borrnum','$biblionumber','$resdate','$branch','$const','$priority','$notes')"; +(?, ?, ?, ?, ?, ?, ?, ?, ?)"; my $sth = $dbh->prepare($query); - $sth->execute(); + $sth->execute($borrnum, + $biblionumber, + $resdate, + $branch, + $const, + $priority, + $notes, + $required_date, + $expires_date); $sth->finish; #} if (($const eq "o") || ($const eq "e")) { diff --git a/koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl index 39c4e1091d..115bb4a08a 100644 --- a/koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl +++ b/koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl @@ -53,9 +53,33 @@ Please select which item types are ok for you. The first of these item that matc +

Please select the branch from which you want to collect the item:
+

+ + + +
Reserve on this date: + + + + + + + +
End reserve on this date: + + + + + + + +
+ +

@@ -73,6 +97,8 @@ Please confirm that you wish to request an item of these types:

+ + diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 2b9f9dfaf9..81e58482a3 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -125,6 +125,14 @@ if ($query->param('item_types_selected')) { $template->param(message => 1); $template->param(no_items_selected => 1); } + my $required_date=join '-', $query->param('required-year'), $query->param('required-month'), $query->param('required-day'); + my $expires_date=join '-', $query->param('expires-year'), $query->param('expires-month'), $query->param('expires-day'); + ($query->param('required-year')) || ($required_date=''); + ($query->param('expires-year')) || ($expires_date=''); + warn "REQ: $required_date\n"; + $template->param(required_date=> $required_date, + expires_date => $expires_date); + } elsif ($query->param('place_reserve')) { # here we actually do the reserveration. Stage 3. @@ -139,7 +147,9 @@ if ($query->param('item_types_selected')) { } } my @reqbibs = keys %reqbibs; - CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title); + my $required_date=$query->param('required_date'); + my $expires_date=$query->param('expires_date'); + CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title, $required_date, $expires_date); print $query->redirect("/cgi-bin/koha/opac-user.pl"); } else { # Here we check that the borrower can actually make reserves Stage 1. -- 2.39.5
Item Type