4 #written 18/1/2000 by chris@katipo.co.nz
5 #script to renew items from the web
8 # Copyright 2000-2002 Katipo Communications
10 # This file is part of Koha.
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License along with
22 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 # Suite 330, Boston, MA 02111-1307 USA
28 use C4::Dates qw/format_date_in_iso/;
33 # And assures user is loggedin and has correct accreditations.
35 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37 template_name => "members/moremember.tmpl",
41 flagsrequired => { borrowers => 1 },
47 # find items to renew, all items or a selection of items
50 my @data = $input->param('items[]');
52 my @barcodes = $input->param('barcodes[]');
53 my $branch=$input->param('branch');
55 if ($input->param('newduedate')){
56 $datedue=C4::Dates->new($input->param('newduedate'));
59 # warn "barcodes : @barcodes";
63 my $cardnumber = $input->param("cardnumber");
64 my $borrowernumber = $input->param("borrowernumber");
66 foreach my $itemno (@data) {
67 # check status before renewing issue
68 my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno);
70 AddRenewal($borrowernumber,$itemno,$branch,$datedue);
73 $failedrenews.="&failedrenew=$itemno";
77 foreach my $barcode (@barcodes) {
78 # check status before renewing issue
79 my ( $returned, $messages, $issueinformation, $borrower ) =
80 AddReturn($barcode,$branch,1);
81 $failedreturn.="&failedreturn=$barcode" unless ($returned);
85 # redirection to the referrer page
87 if ($input->param('destination') eq "circ"){
88 print $input->redirect(
89 '/cgi-bin/koha/circ/circulation.pl?findborrower='.$cardnumber.$failedrenews.$failedreturn
93 print $input->redirect(
94 '/cgi-bin/koha/members/moremember.pl?borrowernumber='.$borrowernumber.$failedrenews.$failedreturn