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'));
74 # warn "barcodes : @barcodes";
78 my $cardnumber = $input->param("cardnumber");
79 my $borrowernumber = $input->param("borrowernumber");
80 my $exemptfine = $input->param("exemptfine") || 0;
81 my $override_limit = $input->param("override_limit") || 0;
82 my $failedrenews = q{};
83 foreach my $itemno (@data) {
84 # check status before renewing issue
85 my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno,$override_limit);
87 AddRenewal($borrowernumber,$itemno,$branch,$datedue);
90 $failedrenews.="&failedrenew=$itemno";
93 my $failedreturn = q{};
94 foreach my $barcode (@barcodes) {
95 # check status before renewing issue
97 #System Preference Handling During Check-in In Patron Module
99 $itemnumber = GetItemnumberFromBarcode($barcode);
101 if ( C4::Context->preference("InProcessingToShelvingCart") ) {
102 my $item = GetItem( $itemnumber );
103 if ( $item->{'location'} eq 'PROC' ) {
104 $item->{'location'} = 'CART';
105 ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
109 if ( C4::Context->preference("ReturnToShelvingCart") ) {
110 my $item = GetItem( $itemnumber );
111 $item->{'location'} = 'CART';
112 ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
116 my ( $returned, $messages, $issueinformation, $borrower ) =
117 AddReturn($barcode, $branch, $exemptfine);
118 $failedreturn.="&failedreturn=$barcode" unless ($returned);
122 # redirection to the referrer page
124 if ($input->param('destination') eq "circ"){
125 $cardnumber = uri_escape($cardnumber);
126 print $input->redirect(
127 '/cgi-bin/koha/circ/circulation.pl?findborrower='.$cardnumber.$failedrenews.$failedreturn
131 print $input->redirect(
132 '/cgi-bin/koha/members/moremember.pl?borrowernumber='.$borrowernumber.$failedrenews.$failedreturn