From 905fd7ba963468a23e3c8c7ccba39d74a410dca1 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 18 Feb 2026 21:51:47 +0000 Subject: [PATCH] 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 --- Koha/Items.pm | 4 +++- .../batch_item_record_modification.inc | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Koha/Items.pm b/Koha/Items.pm index 862631fbfb3..90525e2f33f 100644 --- a/Koha/Items.pm +++ b/Koha/Items.pm @@ -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 $_ }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc index ba400992a23..a889154774e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc @@ -23,6 +23,20 @@
[% SET error_items_count = report.errors.size %] [% tnx('{count} item could not be modified.', '{count} items could not be modified.', error_items_count, { count = error_items_count }) | html %] +
    + [% FOR error IN report.errors %] +
  • + [% 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 %] +
  • + [% END %] +
[% END %] -- 2.39.5