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
22 # with Koha; if not, write to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
36 # And assures user is loggedin and has correct accreditations.
38 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
40 template_name => "members/moremember.tmpl",
44 flagsrequired => { circulate => 'circulate_remaining_permissions' },
50 # find items to renew, all items or a selection of items
54 if ($input->param('renew_all')) {
55 @data = $input->param('all_items[]');
58 @data = $input->param('items[]');
62 if ($input->param('return_all')) {
63 @barcodes = $input->param('all_barcodes[]');
65 @barcodes = $input->param('barcodes[]');
68 my $branch=$input->param('branch');
70 if ( $input->param('newduedate') ) {
71 $datedue = dt_from_string( $input->param('newduedate') );
72 $datedue->set_hour(23);
73 $datedue->set_minute(59);
76 # warn "barcodes : @barcodes";
80 my $cardnumber = $input->param("cardnumber");
81 my $borrowernumber = $input->param("borrowernumber");
82 my $exemptfine = $input->param("exemptfine") || 0;
83 my $override_limit = $input->param("override_limit") || 0;
84 my $failedrenews = q{};
85 foreach my $itemno (@data) {
86 # check status before renewing issue
87 my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno,$override_limit);
89 AddRenewal($borrowernumber,$itemno,$branch,$datedue);
92 $failedrenews.="&failedrenew=$itemno";
95 my $failedreturn = q{};
96 foreach my $barcode (@barcodes) {
97 # check status before renewing issue
99 #System Preference Handling During Check-in In Patron Module
101 $itemnumber = GetItemnumberFromBarcode($barcode);
103 if ( C4::Context->preference("InProcessingToShelvingCart") ) {
104 my $item = GetItem( $itemnumber );
105 if ( $item->{'location'} eq 'PROC' ) {
106 $item->{'location'} = 'CART';
107 ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
111 if ( C4::Context->preference("ReturnToShelvingCart") ) {
112 my $item = GetItem( $itemnumber );
113 $item->{'location'} = 'CART';
114 ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
118 my ( $returned, $messages, $issueinformation, $borrower ) =
119 AddReturn($barcode, $branch, $exemptfine);
120 $failedreturn.="&failedreturn=$barcode" unless ($returned);
124 # redirection to the referrer page
126 if ($input->param('destination') eq "circ"){
127 $cardnumber = uri_escape($cardnumber);
128 print $input->redirect(
129 '/cgi-bin/koha/circ/circulation.pl?findborrower='.$cardnumber.$failedrenews.$failedreturn
133 print $input->redirect(
134 '/cgi-bin/koha/members/moremember.pl?borrowernumber='.$borrowernumber.$failedrenews.$failedreturn