View | Details | Raw Unified | Return to bug 8455
Collapse All | Expand All

(-)a/reserve/renewscript.pl (-42 / +47 lines)
Lines 1-10 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
4
#written 18/1/2000 by chris@katipo.co.nz
3
#written 18/1/2000 by chris@katipo.co.nz
5
#script to renew items from the web
4
#script to renew items from the web
6
5
7
8
# Copyright 2000-2002 Katipo Communications
6
# Copyright 2000-2002 Katipo Communications
9
#
7
#
10
# This file is part of Koha.
8
# This file is part of Koha.
Lines 51-57 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
51
#
49
#
52
50
53
my @data;
51
my @data;
54
if ($input->param('renew_all')) {
52
if ( $input->param('renew_all') ) {
55
    @data = $input->param('all_items[]');
53
    @data = $input->param('all_items[]');
56
}
54
}
57
else {
55
else {
Lines 59-134 else { Link Here
59
}
57
}
60
58
61
my @barcodes;
59
my @barcodes;
62
if ($input->param('return_all')) {
60
if ( $input->param('return_all') ) {
63
    @barcodes = $input->param('all_barcodes[]');
61
    @barcodes = $input->param('all_barcodes[]');
64
} else {
62
}
63
else {
65
    @barcodes = $input->param('barcodes[]');
64
    @barcodes = $input->param('barcodes[]');
66
}
65
}
67
66
68
my $branch=$input->param('branch');
67
my $branch = $input->param('branch');
69
my $datedue;
68
my $datedue;
70
if ($input->param('newduedate')){
69
if ( $input->param('newduedate') ) {
71
    $datedue = dt_from_string($input->param('newduedate'));
70
    $datedue = dt_from_string( $input->param('newduedate') );
72
}
71
}
73
72
74
# warn "barcodes : @barcodes";
73
# warn "barcodes : @barcodes";
75
#
74
#
76
# renew items
75
# renew items
77
#
76
#
78
my $cardnumber = $input->param("cardnumber");
77
my $cardnumber     = $input->param("cardnumber");
79
my $borrowernumber = $input->param("borrowernumber");
78
my $borrowernumber = $input->param("borrowernumber");
80
my $exemptfine = $input->param("exemptfine") || 0;
79
my $exemptfine     = $input->param("exemptfine") || 0;
81
my $override_limit = $input->param("override_limit") || 0;
80
my $override_limit = $input->param("override_limit") || 0;
82
my $failedrenews = q{};
81
my $failedrenews   = q{};
83
foreach my $itemno (@data) {
82
foreach my $itemno (@data) {
83
84
    # check status before renewing issue
84
    # check status before renewing issue
85
	my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno,$override_limit);
85
    my ( $renewokay, $error ) =
86
    if ($renewokay){
86
      CanBookBeRenewed( $borrowernumber, $itemno, $override_limit );
87
        AddRenewal($borrowernumber,$itemno,$branch,$datedue);
87
    if ($renewokay) {
88
        AddRenewal( $borrowernumber, $itemno, $branch, $datedue );
89
    }
90
    else {
91
        $failedrenews .= "&failedrenew=$itemno";
88
    }
92
    }
89
	else {
90
		$failedrenews.="&failedrenew=$itemno";        
91
	}
92
}
93
}
93
my $failedreturn = q{};
94
my $failedreturn = q{};
94
foreach my $barcode (@barcodes) {
95
foreach my $barcode (@barcodes) {
96
95
    # check status before renewing issue
97
    # check status before renewing issue
96
98
97
    #System Preference Handling During Check-in In Patron Module
99
    #System Preference Handling During Check-in In Patron Module
98
	my $itemnumber;
100
    my $itemnumber;
99
	$itemnumber = GetItemnumberFromBarcode($barcode);
101
    $itemnumber = GetItemnumberFromBarcode($barcode);
100
    if ($itemnumber) {
102
    if ($itemnumber) {
101
		if ( C4::Context->preference("InProcessingToShelvingCart") ) {
103
        if ( C4::Context->preference("InProcessingToShelvingCart") ) {
102
			my $item = GetItem( $itemnumber );
104
            my $item = GetItem($itemnumber);
103
			if ( $item->{'location'} eq 'PROC' ) {
105
            if ( $item->{'location'} eq 'PROC' ) {
104
				$item->{'location'} = 'CART';
106
                $item->{'location'} = 'CART';
105
				ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
107
                ModItem( $item, $item->{'biblionumber'},
106
			}
108
                    $item->{'itemnumber'} );
107
		}
109
            }
110
        }
108
111
109
		if ( C4::Context->preference("ReturnToShelvingCart") ) {
112
        if ( C4::Context->preference("ReturnToShelvingCart") ) {
110
			my $item = GetItem( $itemnumber );
113
            my $item = GetItem($itemnumber);
111
			$item->{'location'} = 'CART';
114
            $item->{'location'} = 'CART';
112
			ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
115
            ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
113
		}
116
        }
114
	}
117
    }
115
118
116
   my ( $returned, $messages, $issueinformation, $borrower ) = 
119
    my ( $returned, $messages, $issueinformation, $borrower ) =
117
    AddReturn($barcode, $branch, $exemptfine);
120
      AddReturn( $barcode, $branch, $exemptfine );
118
   $failedreturn.="&failedreturn=$barcode" unless ($returned);
121
    $failedreturn .= "&failedreturn=$barcode" unless ($returned);
119
}
122
}
120
123
121
#
124
#
122
# redirection to the referrer page
125
# redirection to the referrer page
123
#
126
#
124
if ($input->param('destination') eq "circ"){
127
if ( $input->param('destination') eq "circ" ) {
125
    $cardnumber = uri_escape($cardnumber);
128
    $cardnumber = uri_escape($cardnumber);
126
    print $input->redirect(
129
    print $input->redirect( '/cgi-bin/koha/circ/circulation.pl?findborrower='
127
        '/cgi-bin/koha/circ/circulation.pl?findborrower='.$cardnumber.$failedrenews.$failedreturn
130
          . $cardnumber
128
    );
131
          . $failedrenews
132
          . $failedreturn );
129
}
133
}
130
else {
134
else {
131
    print $input->redirect(
135
    print $input->redirect(
132
        '/cgi-bin/koha/members/moremember.pl?borrowernumber='.$borrowernumber.$failedrenews.$failedreturn
136
            '/cgi-bin/koha/members/moremember.pl?borrowernumber='
133
    );
137
          . $borrowernumber
138
          . $failedrenews
139
          . $failedreturn );
134
}
140
}
135
- 

Return to bug 8455