Bug 23010: Report on count of items not modified via batchMod

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ccf4bc0626)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Lucas Gass 2025-04-23 22:40:09 +00:00 committed by Paul Derscheid
parent af9615f3d9
commit 845171e4aa
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
3 changed files with 16 additions and 2 deletions

View File

@ -113,6 +113,7 @@ sub process {
callback => sub { $self->step; },
}
);
$report->{errors} = $results->{errors};
$report->{modified_itemnumbers} = $results->{modified_itemnumbers};
$report->{modified_fields} = $results->{modified_fields};
} catch {
@ -123,7 +124,6 @@ sub process {
my $data = $self->decoded_data;
$data->{report} = $report;
$self->finish($data);
}

View File

@ -459,6 +459,7 @@ sub batch_update {
my ( @modified_itemnumbers, $modified_fields );
my $i;
my @errors;
my $schema = Koha::Database->new->schema;
while ( my $item = $self->next ) {
@ -578,6 +579,9 @@ sub batch_update {
}
)
} catch {
push @errors, {
error => eval { $_->{error} } || "$_",
};
warn $_
};
@ -600,7 +604,10 @@ sub batch_update {
}
}
return ( { modified_itemnumbers => \@modified_itemnumbers, modified_fields => $modified_fields }, $self );
return (
{ modified_itemnumbers => \@modified_itemnumbers, modified_fields => $modified_fields, errors => \@errors },
$self
);
}
=head2 apply_regex

View File

@ -13,6 +13,13 @@
[% IF job.status == 'cancelled' %]<span>The job has been cancelled before it finished.</span>[% END %]
<a href="/cgi-bin/koha/tools/batchMod.pl" title="New batch item modification">New batch item modification</a>
</div>
<div>
[% IF report.errors.size %]
<div class="alert alert-warning">
<span>[% report.errors.size | html %] item(s) could not be modified.</span>
</div>
[% END %]
</div>
[% END %]
[% END %]