Bug 31391: Allow cancel recall if UseRecalls enabled, remove unnecessary vars
This follow-up includes the following changes: - only allow a recall cancellation via the OPAC if UseRecalls is enabled for the OPAC. - uses singleBranchMode var passed by C4::Auth in staff interface biblio recalls - drops unused attribute_type_codes var - drops unnecessary items var and uses biblio.items in template Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
65b8a6129d
commit
ca977dcd78
|
|
@ -83,7 +83,7 @@
|
|||
<legend>Recall next available item</legend>
|
||||
|
||||
<ol>
|
||||
[% UNLESS ( single_branch_mode ) %]
|
||||
[% UNLESS ( singleBranchMode ) %]
|
||||
<li>
|
||||
<label for="pickup">Pick up at:</label>
|
||||
<select name="pickup" id="pickup">
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
<th> </th>
|
||||
<th>Item type</th>
|
||||
<th>Barcode</th>
|
||||
[% UNLESS ( single_branch_mode ) %]
|
||||
[% UNLESS ( singleBranchMode ) %]
|
||||
<th>Home library</th>
|
||||
<th>Holding library</th>
|
||||
[% END %]
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH item IN items %]
|
||||
[% FOREACH item IN biblio.items %]
|
||||
<tr>
|
||||
<td>
|
||||
[% IF item.can_be_recalled( patron => patron ) %]
|
||||
|
|
@ -147,7 +147,7 @@
|
|||
</td>
|
||||
<td>[% ItemTypes.GetDescription( item.effective_itemtype ) | html %]</td>
|
||||
<td>[% item.barcode | html %]</td>
|
||||
[% UNLESS ( single_branch_mode ) %]
|
||||
[% UNLESS ( singleBranchMode ) %]
|
||||
<td>[% Branches.GetName( item.homebranch ) | html %]</td>
|
||||
<td>[% Branches.GetName( item.holdingbranch) | html %]</td>
|
||||
[% END %]
|
||||
|
|
@ -186,7 +186,7 @@
|
|||
[% END # / IF ( item.recall or hold ) %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END # FOREACH item IN items %]
|
||||
[% END # FOREACH item IN biblio.items %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
|||
|
|
@ -36,12 +36,6 @@ my $op = $query->param('op') || '';
|
|||
my $biblionumber = $query->param('biblionumber');
|
||||
my $biblio = Koha::Biblios->find($biblionumber);
|
||||
|
||||
if ( $op eq 'cud-cancel' ) {
|
||||
my $recall_id = $query->param('recall_id');
|
||||
Koha::Recalls->find($recall_id)->set_cancelled;
|
||||
print $query->redirect('/cgi-bin/koha/opac-user.pl');
|
||||
}
|
||||
|
||||
if ( C4::Context->preference('UseRecalls') =~ m/opac/ ) {
|
||||
|
||||
my $patron = Koha::Patrons->find($borrowernumber);
|
||||
|
|
@ -70,8 +64,14 @@ if ( C4::Context->preference('UseRecalls') =~ m/opac/ ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $op eq 'cud-cancel' ) {
|
||||
my $recall_id = $query->param('recall_id');
|
||||
Koha::Recalls->find($recall_id)->set_cancelled;
|
||||
print $query->redirect('/cgi-bin/koha/opac-user.pl');
|
||||
}
|
||||
|
||||
# submitting recall request
|
||||
if ( $op eq 'cud-request' ) {
|
||||
elsif ( $op eq 'cud-request' ) {
|
||||
|
||||
if ( defined $error and $error eq 'unavailable' ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -150,8 +150,6 @@ if ($borrowernumber) {
|
|||
|
||||
my $recalls = Koha::Recalls->search( { biblio_id => $biblionumber, completed => 0 } );
|
||||
my $branches = Koha::Libraries->search;
|
||||
my $single_branch_mode = $branches->count == 1;
|
||||
my $items = Koha::Items->search( { biblionumber => $biblionumber } );
|
||||
|
||||
$template->param(
|
||||
recalls => $recalls,
|
||||
|
|
@ -160,14 +158,7 @@ $template->param(
|
|||
checkboxes => 1,
|
||||
C4::Search::enabled_staff_search_views,
|
||||
branches => $branches,
|
||||
items => $items,
|
||||
error => $error,
|
||||
single_branch_mode => $single_branch_mode,
|
||||
attribute_type_codes => (
|
||||
C4::Context->preference('ExtendedPatronAttributes')
|
||||
? [ Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code') ]
|
||||
: []
|
||||
),
|
||||
);
|
||||
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
|
|
|||
Loading…
Reference in New Issue