Bug 41884: Add better reporting when item fails to modify via batch mod

To test:
1. Search for the system preference, PreventWithDrawingItemsStatus
2. Select both in transit and checked out, then save
3. Find an item and put it in transit.
4. Try to batch modify the item, making it withdrawen.
5. View the details of job, you should see 1 item could not be modified.
6. APPLY PATCH, restart_all
7. Try the steps again, this time when you get to the details of the job you should see more information on the item that failed:

    1 item could not be modified.
        39999000001457 : Item is in transit

8. Repeat this steps with a a checkout out item.
9. Also try with multiple items that will fail, ensure the display looks good.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2026-02-18 21:51:47 +00:00
parent 42b042b4a4
commit c42f58d196
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 17 additions and 1 deletions

View File

@ -584,7 +584,9 @@ sub batch_update {
)
} catch {
push @errors, {
error => eval { $_->{error} } || "$_",
itemnumber => $item->itemnumber,
barcode => $item->barcode,
error => eval { $_->message } || eval { $_->error } || "$_",
};
warn $_
};

View File

@ -23,6 +23,20 @@
<div class="alert alert-warning">
[% SET error_items_count = report.errors.size %]
<span>[% tnx('{count} item could not be modified.', '{count} items could not be modified.', error_items_count, { count = error_items_count }) | html %]</span>
<ul>
[% FOR error IN report.errors %]
<li>
[% error.barcode | html %]
[% IF error.error == 'intransit_cannot_withdraw' %]
: [% t('Item is in transit') | html %]
[% ELSIF error.error == 'onloan_cannot_withdraw' %]
: [% t('Item is checked out') | html %]
[% ELSE %]
: [% error.error | html %]
[% END %]
</li>
[% END %]
</ul>
</div>
[% END %]
</div>