Bugzilla – Attachment 129018 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.24 KB, created by
Jonathan Druart
on 2022-01-05 09:35:03 UTC
(
hide
)
Description:
Bug 29788: Fix batch delete item
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-05 09:35:03 UTC
Size:
5.24 KB
patch
obsolete
>From 3777ba94467a2dc5561d60c8f5d8c9114ec72da7 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 > >--- > Koha/Acquisition/Order.pm | 2 +- > Koha/BackgroundJob/BatchDeleteBiblio.pm | 2 +- > Koha/BackgroundJob/BatchDeleteItem.pm | 2 +- > Koha/UI/Table/Builder/Items.pm | 9 ++++++++- > .../intranet-tmpl/prog/en/includes/html_helpers.inc | 6 +++--- > 5 files changed, 14 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..18fb2b14b4f 100644 >--- a/Koha/UI/Table/Builder/Items.pm >+++ b/Koha/UI/Table/Builder/Items.pm >@@ -106,9 +106,16 @@ Build the headers given the items' info. > sub _build_headers { > my ( $self, $items ) = @_; > >+ use Data::Printer colored => 1; warn p $items; > 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 0c3e9675fc9..ff603a717cd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -260,18 +260,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.25.1
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