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 under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 # And assures user is loggedin and has correct accreditations.
36 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
38 template_name
=> "members/moremember.tmpl",
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 renewing 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='