Bug 37152: Aquisitions basket and OPAC suggestion deletion should use the op cud-delete

Both deleting a basket in Aquisitions and deleting a suggestion in the OPAC
take care of the confirmation in a javascript modal, rather than having a
whole separate page for confirmation, so they should be using the op
cud-delete rather than either cud-delete_confirm (which shouldn't ever be
used) or delete_confirm (which they aren't doing, they already confirmed).

Test plan:
1. There's no wrong behavior to see, so apply patch and restart_all
2. Aquisitions - Vendor search for My Vendor - Click My Basket
3. Click Delete basket, in the popup again Delete basket
4. Click Show baskets for vendor My Vendor and verify the basket is gone
5. OPAC - Your account - Purchase suggestions
6. Create a suggestion, then click the checkbox for it, Delete selected,
   confirm
7. Verify the suggestion was deleted

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Phil Ringnalda 2024-06-21 12:20:05 -07:00 committed by Katrin Fischer
parent d913d5ab79
commit fb9edbcf5c
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
4 changed files with 6 additions and 6 deletions

View file

@ -134,7 +134,7 @@ if ( $op eq 'cud-delete-order' ) {
$order->delete if $order; $order->delete if $order;
$op = 'list'; $op = 'list';
} elsif ( $op eq 'cud-delete_confirm' ) { } elsif ( $op eq 'cud-delete' ) {
output_and_exit( $query, $cookie, $template, 'insufficient_permission' ) output_and_exit( $query, $cookie, $template, 'insufficient_permission' )
unless $logged_in_patron->has_permission( { acquisition => 'delete_baskets' } ); unless $logged_in_patron->has_permission( { acquisition => 'delete_baskets' } );

View file

@ -146,7 +146,7 @@
<button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
<form action="/cgi-bin/koha/acqui/basket.pl" method="post"> <form action="/cgi-bin/koha/acqui/basket.pl" method="post">
[% INCLUDE 'csrf-token.inc' %] [% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-delete_confirm" /> <input type="hidden" name="op" value="cud-delete" />
<input type="hidden" name="basketno" value="[% basketno | html %]" /> <input type="hidden" name="basketno" value="[% basketno | html %]" />
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" /> <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
<input type="hidden" name="delbiblio" value="0" /> <input type="hidden" name="delbiblio" value="0" />
@ -165,7 +165,7 @@
<button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
<form action="/cgi-bin/koha/acqui/basket.pl" method="post"> <form action="/cgi-bin/koha/acqui/basket.pl" method="post">
[% INCLUDE 'csrf-token.inc' %] [% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-delete_confirm" /> <input type="hidden" name="op" value="cud-delete" />
<input type="hidden" name="basketno" value="[% basketno | html %]" /> <input type="hidden" name="basketno" value="[% basketno | html %]" />
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" /> <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
<input type="hidden" name="delbiblio" value="0" /> <input type="hidden" name="delbiblio" value="0" />
@ -174,7 +174,7 @@
<form action="/cgi-bin/koha/acqui/basket.pl" method="post"> <form action="/cgi-bin/koha/acqui/basket.pl" method="post">
[% INCLUDE 'csrf-token.inc' %] [% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-delete_confirm" /> <input type="hidden" name="op" value="cud-delete" />
<input type="hidden" name="basketno" value="[% basketno | html %]" /> <input type="hidden" name="basketno" value="[% basketno | html %]" />
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" /> <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
<input type="hidden" name="delbiblio" value="1" /> <input type="hidden" name="delbiblio" value="1" />

View file

@ -374,7 +374,7 @@
[% SET can_delete_suggestion = 0 %] [% SET can_delete_suggestion = 0 %]
<form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions"> <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions">
[% INCLUDE 'csrf-token.inc' %] [% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-delete_confirm" /> <input type="hidden" name="op" value="cud-delete" />
[% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %] [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
<div id="toolbar" class="toolbar clearfix"> <div id="toolbar" class="toolbar clearfix">
[% IF ( Koha.Preference('MaxTotalSuggestions') != '' && patrons_total_suggestions_count >= Koha.Preference('MaxTotalSuggestions') ) %] [% IF ( Koha.Preference('MaxTotalSuggestions') != '' && patrons_total_suggestions_count >= Koha.Preference('MaxTotalSuggestions') ) %]

View file

@ -232,7 +232,7 @@ my $suggestions = [ Koha::Suggestions->search_limited(
} }
)->as_list ]; )->as_list ];
if ( $op eq "cud-delete_confirm" ) { if ( $op eq "cud-delete" ) {
my @delete_field = $input->multi_param("delete_field"); my @delete_field = $input->multi_param("delete_field");
foreach my $delete_field (@delete_field) { foreach my $delete_field (@delete_field) {
&DelSuggestion( $borrowernumber, $delete_field ); &DelSuggestion( $borrowernumber, $delete_field );