Bugzilla – Attachment 129170 Details for
Bug 29788
Make Koha::Item->safe_to_delete return a Koha::Result::Boolean object
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29788: Fix batch delete item
Bug-29788-Fix-batch-delete-item.patch (text/plain), 5.23 KB, created by
Kyle M Hall (khall)
on 2022-01-07 14:12:45 UTC
(
hide
)
Description:
Bug 29788: Fix batch delete item
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-01-07 14:12:45 UTC
Size:
5.23 KB
patch
obsolete
>From 46678dc3a50464631d555199605d4c9d979fd09e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 5 Jan 2022 10:27:30 +0100 >Subject: [PATCH] Bug 29788: Fix batch delete item > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Acquisition/Order.pm | 2 +- > Koha/BackgroundJob/BatchDeleteBiblio.pm | 2 +- > Koha/BackgroundJob/BatchDeleteItem.pm | 2 +- > Koha/UI/Table/Builder/Items.pm | 8 +++++++- > koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc | 6 +++--- > 5 files changed, 13 insertions(+), 7 deletions(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index 517c88af186..214d7fe69c8 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -131,7 +131,7 @@ sub cancel { > $self->add_message( > { > message => 'error_delitem', >- payload => { item => $item, reason => @{$deleted->messages}[0]->messages } >+ payload => { item => $item, reason => @{$deleted->messages}[0]->message } > } > ); > } >diff --git a/Koha/BackgroundJob/BatchDeleteBiblio.pm b/Koha/BackgroundJob/BatchDeleteBiblio.pm >index 63e12935af0..8c94720ac19 100644 >--- a/Koha/BackgroundJob/BatchDeleteBiblio.pm >+++ b/Koha/BackgroundJob/BatchDeleteBiblio.pm >@@ -119,7 +119,7 @@ sub process { > code => 'item_not_deleted', > biblionumber => $biblionumber, > itemnumber => $item->itemnumber, >- error => @{$deleted->messages}[0]->messages, >+ error => @{$deleted->messages}[0]->message, > }; > $schema->storage->txn_rollback; > $job->progress( ++$job_progress )->store; >diff --git a/Koha/BackgroundJob/BatchDeleteItem.pm b/Koha/BackgroundJob/BatchDeleteItem.pm >index 66f0044624d..b5147e78292 100644 >--- a/Koha/BackgroundJob/BatchDeleteItem.pm >+++ b/Koha/BackgroundJob/BatchDeleteItem.pm >@@ -126,7 +126,7 @@ sub process { > biblionumber => $item->biblionumber, > barcode => $item->barcode, > title => $item->biblio->title, >- reason => $return, >+ reason => @{$return->messages}[0]->message, > }; > > next; >diff --git a/Koha/UI/Table/Builder/Items.pm b/Koha/UI/Table/Builder/Items.pm >index 516414d2648..b573f2a3b3f 100644 >--- a/Koha/UI/Table/Builder/Items.pm >+++ b/Koha/UI/Table/Builder/Items.pm >@@ -108,7 +108,13 @@ sub _build_headers { > > my @witness_attributes = uniq map { > my $item = $_; >- map { defined $item->{$_} && $item->{$_} ne "" ? $_ : () } keys %$item >+ map { >+ defined $item->{$_} >+ && !ref( $item->{$_} ) # biblio and safe_to_delete are objects >+ && $item->{$_} ne "" >+ ? $_ >+ : () >+ } keys %$item > } @$items; > > my ( $itemtag, $itemsubfield ) = >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >index 56707256be0..802e6621ce5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -261,18 +261,18 @@ > [% UNLESS can_be_edited %] > <td class="error">Cannot delete</td> > [% ELSE %] >- [% IF item.safe_to_delete == 1 %] >+ [% IF item.safe_to_delete %] > <td><input type="checkbox" name="itemnumber" value="[% item.itemnumber | html %]" id="row[% item.itemnumber | html %]" checked="checked" /></td> > [% ELSE %] > [% SET messages = item.safe_to_delete.messages %] > [% FOR m IN messages %] >- [% SWITCH m %] >+ [% SWITCH m.message %] > [% CASE "book_on_loan" %][% SET cannot_delete_reason = t("Item is checked out") %] > [% CASE "not_same_branch" %][% SET cannot_delete_reason = t("Item does not belong to your library") %] > [% CASE "book_reserved" %][% SET cannot_delete_reason = t("Item has a waiting hold") %] > [% CASE "linked_analytics" %][% SET cannot_delete_reason = t("Item has linked analytics") %] > [% CASE "last_item_for_hold" %][% SET cannot_delete_reason = t("Last item for bibliographic record with biblio-level hold on it") %] >- [% CASE %][% SET cannot_delete_reason = t("Unknown reason") _ '(' _ item.safe_to_delete _ ')' %] >+ [% CASE %][% SET cannot_delete_reason = t("Unknown reason") _ '(' _ m.message _ ')' %] > [% END %] > [% END %] > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29788
:
128993
|
129010
|
129013
|
129018
|
129075
|
129076
|
129077
|
129097
|
129098
|
129169
| 129170 |
129326
|
132052