|
Lines 59-114
$template->param( backends_available => $backends_available );
Link Here
|
| 59 |
|
59 |
|
| 60 |
my $op = $params->{'method'} || 'list'; |
60 |
my $op = $params->{'method'} || 'list'; |
| 61 |
|
61 |
|
|
|
62 |
my ( $illrequest_id, $request ); |
| 63 |
if ( $illrequest_id = $params->{illrequest_id} ) { |
| 64 |
$request = Koha::Illrequests->find($illrequest_id); |
| 65 |
# Make sure the request belongs to the logged in user |
| 66 |
unless ( $request->borrowernumber == $loggedinuser ) { |
| 67 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
| 68 |
exit; |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 62 |
if ( $op eq 'list' ) { |
72 |
if ( $op eq 'list' ) { |
| 63 |
|
73 |
|
| 64 |
my $requests = Koha::Illrequests->search( |
74 |
my $requests = Koha::Illrequests->search( |
| 65 |
{ borrowernumber => $loggedinuser } |
75 |
{ borrowernumber => $loggedinuser } |
| 66 |
); |
76 |
); |
| 67 |
my $req = Koha::Illrequest->new; |
|
|
| 68 |
$template->param( |
77 |
$template->param( |
| 69 |
requests => $requests, |
78 |
requests => $requests, |
| 70 |
backends => $backends |
79 |
backends => $backends |
| 71 |
); |
80 |
); |
| 72 |
|
81 |
|
| 73 |
} elsif ( $op eq 'view') { |
82 |
} elsif ( $op eq 'view') { |
| 74 |
my $request = Koha::Illrequests->find({ |
|
|
| 75 |
borrowernumber => $loggedinuser, |
| 76 |
illrequest_id => $params->{illrequest_id} |
| 77 |
}); |
| 78 |
# Make sure the request belongs to the logged in user |
| 79 |
unless ( $request->borrowernumber == $loggedinuser ) { |
| 80 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
| 81 |
exit; |
| 82 |
} |
| 83 |
$template->param( |
83 |
$template->param( |
| 84 |
request => $request |
84 |
request => $request |
| 85 |
); |
85 |
); |
| 86 |
|
86 |
|
| 87 |
} elsif ( $op eq 'update') { |
87 |
} elsif ( $op eq 'update') { |
| 88 |
my $request = Koha::Illrequests->find({ |
|
|
| 89 |
borrowernumber => $loggedinuser, |
| 90 |
illrequest_id => $params->{illrequest_id} |
| 91 |
}); |
| 92 |
$request->notesopac($params->{notesopac})->store; |
88 |
$request->notesopac($params->{notesopac})->store; |
| 93 |
# Send a notice to staff alerting them of the update |
89 |
# Send a notice to staff alerting them of the update |
| 94 |
$request->send_staff_notice('ILL_REQUEST_MODIFIED'); |
90 |
$request->send_staff_notice('ILL_REQUEST_MODIFIED'); |
| 95 |
print $query->redirect( |
91 |
print $query->redirect( |
| 96 |
'/cgi-bin/koha/opac-illrequests.pl?method=view&illrequest_id=' . |
92 |
'/cgi-bin/koha/opac-illrequests.pl?method=view&illrequest_id=' |
| 97 |
$params->{illrequest_id} . |
93 |
. $illrequest_id |
| 98 |
'&message=1' |
94 |
. '&message=1' ); |
| 99 |
); |
|
|
| 100 |
exit; |
95 |
exit; |
| 101 |
} elsif ( $op eq 'cancreq') { |
96 |
} elsif ( $op eq 'cancreq') { |
| 102 |
my $request = Koha::Illrequests->find({ |
|
|
| 103 |
borrowernumber => $loggedinuser, |
| 104 |
illrequest_id => $params->{illrequest_id} |
| 105 |
}); |
| 106 |
$request->status('CANCREQ')->store; |
97 |
$request->status('CANCREQ')->store; |
| 107 |
print $query->redirect( |
98 |
print $query->redirect( |
| 108 |
'/cgi-bin/koha/opac-illrequests.pl?method=view&illrequest_id=' . |
99 |
'/cgi-bin/koha/opac-illrequests.pl?method=view&illrequest_id=' |
| 109 |
$params->{illrequest_id} . |
100 |
. $illrequest_id |
| 110 |
'&message=1' |
101 |
. '&message=1' ); |
| 111 |
); |
|
|
| 112 |
exit; |
102 |
exit; |
| 113 |
} elsif ( $op eq 'create' ) { |
103 |
} elsif ( $op eq 'create' ) { |
| 114 |
if (!$params->{backend}) { |
104 |
if (!$params->{backend}) { |
| 115 |
- |
|
|