Bugzilla – Attachment 152235 Details for
Bug 13870
Add warnings about subscriptions and orders when deleting items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13870: Added a visual warning message on the item batch form
Bug-13870-Added-a-visual-warning-message-on-the-it.patch (text/plain), 5.53 KB, created by
Thibaud Guillot (thibaud_g)
on 2023-06-09 10:34:57 UTC
(
hide
)
Description:
Bug 13870: Added a visual warning message on the item batch form
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2023-06-09 10:34:57 UTC
Size:
5.53 KB
patch
obsolete
>From 4a89d79119024e3a7d9429a36d65eaa8321a7fb3 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Thu, 2 Mar 2023 16:08:55 +0100 >Subject: [PATCH] Bug 13870: Added a visual warning message on the item batch > form > >I add a visual warn on item linked to subscription or concern >by an order. I don't think that pop-up could be the solution so I put a >warn triangle aside the delete action to >I don't think another pop-up is the ideal solution so I chose to integrate a yellow triangle >right next to the action leading to the deletion of the 'item' with a hover message >if a subscription or order is linked. I'm looking forward to your feedback :) > >Test plan : > >1) Apply this patch >2) Be sure to have item with order or can concern by a subscription >3) Edit them to go on the batch form >4) See the yellow triangle next to the 'delete' action in 'actions' >dropdown menu >--- > cataloguing/additem.pl | 16 ++++++++++++++++ > .../prog/en/modules/cataloguing/additem.tt | 12 ++++++++++-- > 2 files changed, 26 insertions(+), 2 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 4630eec0a4..c9face24ae 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -32,6 +32,7 @@ use C4::Context; > use C4::Members; > use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers ); > use C4::Search qw( enabled_staff_search_views ); >+use C4::Acquisition qw( GetOrderFromItemnumber ); > use Koha::Biblios; > use Koha::Item::Templates; > use Koha::ItemTypes; >@@ -42,6 +43,8 @@ use Koha::Patrons; > use Koha::SearchEngine::Indexer; > use Koha::UI::Form::Builder::Item; > use Koha::Result::Boolean; >+use Koha::Serial::Items; >+use Koha::Subscriptions; > > use Encode qw( encode_utf8 ); > use List::MoreUtils qw( any uniq ); >@@ -642,9 +645,21 @@ if ($op) { > # now, build existiing item list > > my @items; >+my %warning_messages; > for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) { > my $i = $item->columns_to_str; > $i->{nomod} = 1 unless $patron->can_edit_items_from($item->homebranch); >+ my $i_order = GetOrderFromItemnumber($i->{itemnumber}); >+ my $i_serialid = Koha::Serial::Items->search( {itemnumber => $i->{itemnumber}} )->get_column('serialid'); >+ >+ if ($i_order) { >+ $warning_messages{$i->{itemnumber}} = sprintf('There is an order (ordernumber %s) on this item', $i_order->{ordernumber} ); >+ } >+ if ($i_serialid) { >+ $warning_messages{$i->{itemnumber}} = 'A subscription is linked to this item'; >+ } >+ >+ $i->{nomod} = 1 unless $patron->can_edit_items_from( $item->homebranch ); > push @items, $i; > } > >@@ -763,6 +778,7 @@ $template->param( > barcode => $current_item->{barcode}, > op => $nextop, > popup => scalar $input->param('popup') ? 1: 0, >+ warning_messages => \%warning_messages, > C4::Search::enabled_staff_search_views, > ); > $template->{'VARS'}->{'searchid'} = $searchid; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >index e3e8d2ebdb..180df057a8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -94,7 +94,9 @@ > <tbody> > [% FOREACH item IN items %] > [% SET can_be_edited = ! ( Koha.Preference('IndependentBranches') && ! logged_in_user.is_superlibrarian && item.homebranch != Branches.GetLoggedInBranchname() ) %] >- [% IF item.itemnumber == itemnumber%] >+ [% SET current_itemnumber = item.itemnumber %] >+ [% SET warn_message = warning_messages.$current_itemnumber %] >+ [% IF item.itemnumber == itemnumber %] > [% UNLESS can_be_edited %] > <tr id="row[% item.itemnumber | html %]" class="active"> > [% ELSE %] >@@ -126,7 +128,13 @@ > <li><a href="additem.pl?op=dupeitem&biblionumber=[% biblio.biblionumber | uri %]&itemnumber=[% item.itemnumber | uri %]&searchid=[% searchid | uri %]#additema">Duplicate</a></li> > <li class="print_label"><a href="/cgi-bin/koha/labels/label-edit-batch.pl?op=add&number_type=itemnumber&number_list=[% item.itemnumber | uri %]" target="_blank" >Print label</a></li> > [% UNLESS item.nomod %] >- <li><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]&searchid=[% searchid | html %]" onclick="return confirm_deletion();">Delete</a></li> >+ <li> >+ <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]&searchid=[% searchid | html %]" onclick="return confirm_deletion();">Delete >+ [% IF warn_message %] >+ <i class="fa fa-warning warn" Title="[% warn_message %]"></i> >+ [% END %] >+ </a> >+ </li> > [% END %] > [% END %] > [% IF ( OPACBaseURL ) %] >-- >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 13870
:
147641
|
152235
|
152236
|
155576
|
175440
|
176858
|
179579
|
179580
|
179581
|
179834
|
180952
|
183442
|
183556