|
Lines 134-162
sub show_accept {
Link Here
|
| 134 |
|
134 |
|
| 135 |
# We could have used ->find with the share id, but we don't want to change |
135 |
# We could have used ->find with the share id, but we don't want to change |
| 136 |
# the url sent to the patron |
136 |
# the url sent to the patron |
| 137 |
my $shared_shelf = Koha::Virtualshelfshares->search( |
137 |
my $shared_shelves = Koha::Virtualshelfshares->search( |
| 138 |
{ |
138 |
{ |
| 139 |
shelfnumber => $param->{shelfnumber}, |
139 |
shelfnumber => $param->{shelfnumber}, |
| 140 |
}, |
140 |
}, |
| 141 |
{ |
141 |
{ |
| 142 |
order_by => { -desc => 'sharedate' }, |
142 |
order_by => { -desc => 'sharedate' }, |
| 143 |
limit => 1, |
|
|
| 144 |
} |
143 |
} |
| 145 |
); |
144 |
); |
| 146 |
|
145 |
|
| 147 |
if ( $shared_shelf ) { |
146 |
if ( $shared_shelves ) { |
| 148 |
$shared_shelf = $shared_shelf->next; |
|
|
| 149 |
my $key = keytostring( stringtokey( $param->{key}, 0 ), 1 ); |
147 |
my $key = keytostring( stringtokey( $param->{key}, 0 ), 1 ); |
| 150 |
my $is_accepted = eval { $shared_shelf->accept( $key, $param->{loggedinuser} ) }; |
148 |
while ( my $shared_shelf = $shared_shelves->next ) { |
| 151 |
if ( $is_accepted ) { |
149 |
my $is_accepted = eval { $shared_shelf->accept( $key, $param->{loggedinuser} ) }; |
| 152 |
notify_owner($param); |
150 |
if ( $is_accepted ) { |
| 153 |
|
151 |
notify_owner($param); |
| 154 |
#redirect to view of this shared list |
152 |
|
| 155 |
print $param->{query}->redirect( |
153 |
#redirect to view of this shared list |
| 156 |
-uri => SHELVES_URL . $param->{shelfnumber}, |
154 |
print $param->{query}->redirect( |
| 157 |
-cookie => $param->{cookie} |
155 |
-uri => SHELVES_URL . $param->{shelfnumber}, |
| 158 |
); |
156 |
-cookie => $param->{cookie} |
| 159 |
exit; |
157 |
); |
|
|
158 |
exit; |
| 159 |
} |
| 160 |
} |
160 |
} |
| 161 |
$param->{errcode} = 7; #not accepted (key not found or expired) |
161 |
$param->{errcode} = 7; #not accepted (key not found or expired) |
| 162 |
} else { |
162 |
} else { |
| 163 |
- |
|
|