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:
Aleisha Amohia 2026-07-07 22:18:22 +00:00 committed by Pedro Amorim
parent 65b8a6129d
commit ca977dcd78
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
3 changed files with 16 additions and 25 deletions

View File

@ -83,7 +83,7 @@
<legend>Recall next available item</legend> <legend>Recall next available item</legend>
<ol> <ol>
[% UNLESS ( single_branch_mode ) %] [% UNLESS ( singleBranchMode ) %]
<li> <li>
<label for="pickup">Pick up at:</label> <label for="pickup">Pick up at:</label>
<select name="pickup" id="pickup"> <select name="pickup" id="pickup">
@ -122,7 +122,7 @@
<th>&nbsp;</th> <th>&nbsp;</th>
<th>Item type</th> <th>Item type</th>
<th>Barcode</th> <th>Barcode</th>
[% UNLESS ( single_branch_mode ) %] [% UNLESS ( singleBranchMode ) %]
<th>Home library</th> <th>Home library</th>
<th>Holding library</th> <th>Holding library</th>
[% END %] [% END %]
@ -134,7 +134,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
[% FOREACH item IN items %] [% FOREACH item IN biblio.items %]
<tr> <tr>
<td> <td>
[% IF item.can_be_recalled( patron => patron ) %] [% IF item.can_be_recalled( patron => patron ) %]
@ -147,7 +147,7 @@
</td> </td>
<td>[% ItemTypes.GetDescription( item.effective_itemtype ) | html %]</td> <td>[% ItemTypes.GetDescription( item.effective_itemtype ) | html %]</td>
<td>[% item.barcode | html %]</td> <td>[% item.barcode | html %]</td>
[% UNLESS ( single_branch_mode ) %] [% UNLESS ( singleBranchMode ) %]
<td>[% Branches.GetName( item.homebranch ) | html %]</td> <td>[% Branches.GetName( item.homebranch ) | html %]</td>
<td>[% Branches.GetName( item.holdingbranch) | html %]</td> <td>[% Branches.GetName( item.holdingbranch) | html %]</td>
[% END %] [% END %]
@ -186,7 +186,7 @@
[% END # / IF ( item.recall or hold ) %] [% END # / IF ( item.recall or hold ) %]
</td> </td>
</tr> </tr>
[% END # FOREACH item IN items %] [% END # FOREACH item IN biblio.items %]
</tbody> </tbody>
</table> </table>

View File

@ -36,12 +36,6 @@ my $op = $query->param('op') || '';
my $biblionumber = $query->param('biblionumber'); my $biblionumber = $query->param('biblionumber');
my $biblio = Koha::Biblios->find($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/ ) { if ( C4::Context->preference('UseRecalls') =~ m/opac/ ) {
my $patron = Koha::Patrons->find($borrowernumber); 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 # submitting recall request
if ( $op eq 'cud-request' ) { elsif ( $op eq 'cud-request' ) {
if ( defined $error and $error eq 'unavailable' ) { if ( defined $error and $error eq 'unavailable' ) {

View File

@ -150,8 +150,6 @@ if ($borrowernumber) {
my $recalls = Koha::Recalls->search( { biblio_id => $biblionumber, completed => 0 } ); my $recalls = Koha::Recalls->search( { biblio_id => $biblionumber, completed => 0 } );
my $branches = Koha::Libraries->search; my $branches = Koha::Libraries->search;
my $single_branch_mode = $branches->count == 1;
my $items = Koha::Items->search( { biblionumber => $biblionumber } );
$template->param( $template->param(
recalls => $recalls, recalls => $recalls,
@ -160,14 +158,7 @@ $template->param(
checkboxes => 1, checkboxes => 1,
C4::Search::enabled_staff_search_views, C4::Search::enabled_staff_search_views,
branches => $branches, branches => $branches,
items => $items,
error => $error, 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; output_html_with_http_headers $input, $cookie, $template->output;