Bug 34478: Changes for patron_lists/list

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2024-02-02 09:57:52 +00:00 committed by Jonathan Druart
parent c3dce50a4f
commit ee17b3d417
Signed by: jonathan.druart
GPG key ID: A085E712BEF0E0F0
2 changed files with 6 additions and 3 deletions

View file

@ -146,6 +146,7 @@
<div id="patrons_to_add"></div>
<fieldset class="action">
<input type="hidden" name="op" value="cud-add" />
<input type="hidden" name="patron_list_id" value="[% list.patron_list_id | html %]" />
<input type="submit" class="btn btn-primary" value="Add patrons" />
<a href="lists.pl" class="cancel">Cancel</a>
@ -216,6 +217,7 @@
</div> <!-- /.page-section -->
<fieldset class="action">
<input type="hidden" name="op" value="cud-delete" />
<input type="hidden" name="patron_list_id" value="[% list.patron_list_id | html %]" />
<button type="submit" class="btn btn-default btn-sm list-remove"><i class="fa fa-trash-can" aria-hidden="true"></i> Remove selected patrons</button>
<button class="btn btn-default btn-sm merge-patrons" type="submit"><i class="fa fa-compress"></i> Merge selected patrons</button>

View file

@ -31,6 +31,7 @@ use Koha::List::Patron qw(
use List::MoreUtils qw( uniq );
my $cgi = CGI->new;
my $op = $cgi->param('op') // q{};
my ( $template, $logged_in_user, $cookie ) = get_template_and_user(
{
@ -49,7 +50,7 @@ my @existing = $list->patron_list_patrons;
my $patrons_by_id = $cgi->param('patrons_by_id');
my $id_column = $cgi->param('id_column');
if ( $patrons_by_id ){
if ( $op eq 'cud-add' && $patrons_by_id ) {
push my @patrons_list, uniq( split(/\s\n/, $patrons_by_id) );
my %add_params;
$add_params{list} = $list;
@ -71,12 +72,12 @@ if ( $patrons_by_id ){
}
my @patrons_to_add = $cgi->multi_param('patrons_to_add');
if (@patrons_to_add) {
if ( $op eq 'cud-add' && @patrons_to_add) {
AddPatronsToList( { list => $list, cardnumbers => \@patrons_to_add } );
}
my @patrons_to_remove = $cgi->multi_param('patrons_to_remove');
if (@patrons_to_remove) {
if ( $op eq 'cud-delete' && @patrons_to_remove) {
DelPatronsFromList( { list => $list, patron_list_patrons => \@patrons_to_remove } );
}