3 #written 18/1/2000 by chris@katipo.co.nz
4 #script to renew items from the web
6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
15 # Koha is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with Koha; if not, see <http://www.gnu.org/licenses>.
34 # And assures user is loggedin and has correct accreditations.
36 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
38 template_name
=> "members/moremember.tt",
42 flagsrequired
=> { circulate
=> 'circulate_remaining_permissions' },
48 # find items to renew, all items or a selection of items
52 if ( $input->param('renew_all') ) {
53 @data = $input->param('all_items[]');
56 @data = $input->param('items[]');
60 if ( $input->param('return_all') ) {
61 @barcodes = $input->param('all_barcodes[]');
64 @barcodes = $input->param('barcodes[]');
67 my $branch = $input->param('branch');
69 if ( $input->param('newduedate') ) {
70 $datedue = dt_from_string
( $input->param('newduedate') );
71 $datedue->set_hour(23);
72 $datedue->set_minute(59);
75 # warn "barcodes : @barcodes";
79 my $cardnumber = $input->param("cardnumber");
80 my $borrowernumber = $input->param("borrowernumber");
81 my $exemptfine = $input->param("exemptfine") || 0;
82 my $override_limit = $input->param("override_limit") || 0;
83 my $failedrenews = q{};
84 foreach my $itemno (@data) {
86 # check status before renewing issue
87 my ( $renewokay, $error ) =
88 CanBookBeRenewed
( $borrowernumber, $itemno, $override_limit );
90 AddRenewal
( $borrowernumber, $itemno, $branch, $datedue );
93 $failedrenews .= "&failedrenew=$itemno";
96 my $failedreturn = q{};
97 foreach my $barcode (@barcodes) {
99 # check status before returning issue
101 #System Preference Handling During Check-in In Patron Module
103 $itemnumber = GetItemnumberFromBarcode
($barcode);
105 if ( C4
::Context
->preference("InProcessingToShelvingCart") ) {
106 my $item = GetItem
($itemnumber);
107 if ( $item->{'location'} eq 'PROC' ) {
108 $item->{'location'} = 'CART';
109 ModItem
( $item, $item->{'biblionumber'},
110 $item->{'itemnumber'} );
114 if ( C4
::Context
->preference("ReturnToShelvingCart") ) {
115 my $item = GetItem
($itemnumber);
116 $item->{'location'} = 'CART';
117 ModItem
( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
121 my ( $returned, $messages, $issueinformation, $borrower ) =
122 AddReturn
( $barcode, $branch, $exemptfine );
123 $failedreturn .= "&failedreturn=$barcode" unless ($returned);
127 # redirection to the referrer page
129 if ( $input->param('destination') eq "circ" ) {
130 $cardnumber = uri_escape
($cardnumber);
131 print $input->redirect( '/cgi-bin/koha/circ/circulation.pl?findborrower='
137 print $input->redirect(
138 '/cgi-bin/koha/members/moremember.pl?borrowernumber='