Bugzilla – Attachment 158329 Details for
Bug 34234
Item groups dropdown in detail page modal does not respect display order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34234: Add sub for count and logic to additem page
Bug-34234-Add-sub-for-count-and-logic-to-additem-p.patch (text/plain), 4.19 KB, created by
Owen Leonard
on 2023-11-03 11:56:58 UTC
(
hide
)
Description:
Bug 34234: Add sub for count and logic to additem page
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2023-11-03 11:56:58 UTC
Size:
4.19 KB
patch
obsolete
>From 690560c42bae439334ea961cd26aaf047fa5f3d7 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 2 Nov 2023 22:24:03 +0000 >Subject: [PATCH] Bug 34234: Add sub for count and logic to additem page > >To Test: >1. EnableItemGroups >2. Find a record and add some new item groups with different display orders >3. Now edit an item on the record and scroll down to the dropdown underneath "+ Add to item group" >4. Notice that the values in the dropdown do not respect the display order. >5. Apply patch and restart_all >6. The display order should now be respected > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > Koha/Template/Plugin/ItemGroups.pm | 15 +++++++++++++++ > cataloguing/additem.pl | 3 --- > .../prog/en/modules/cataloguing/additem.tt | 10 +++++----- > 3 files changed, 20 insertions(+), 8 deletions(-) > >diff --git a/Koha/Template/Plugin/ItemGroups.pm b/Koha/Template/Plugin/ItemGroups.pm >index eda845d154..47844478d6 100644 >--- a/Koha/Template/Plugin/ItemGroups.pm >+++ b/Koha/Template/Plugin/ItemGroups.pm >@@ -50,4 +50,19 @@ sub listGroups { > ); > } > >+=head3 count >+ >+[% ItemGroups.count %] >+ >+returns count of item groups on a particular bibliographic record >+ >+=cut >+ >+sub count { >+ my ( $self, $biblionumber ) = @_; >+ return Koha::Biblio::ItemGroups->search( >+ { biblio_id => $biblionumber }, >+ )->count; >+} >+ > 1; >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 1e397a0de2..a9fc80646f 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -752,14 +752,11 @@ if( my $default_location = C4::Context->preference('NewItemsDefaultLocation') ) > $location_field->{marc_value}->{value} ||= $default_location; > } > >-my @ig = Koha::Biblio::ItemGroups->search({ biblio_id => $biblionumber })->as_list(); > #sort by display order >-my @sorted_ig = sort { $a->display_order <=> $b->display_order } @ig; > # what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. > $template->param( > biblio => $biblio, > items => \@items, >- item_groups => \@sorted_ig, > item_header_loop => \@header_value_loop, > subfields => $subfields, > itemnumber => $itemnumber, >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 6fe0ec6cdc..8014325538 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -4,6 +4,7 @@ > [% USE Branches %] > [% USE KohaDates %] > [% USE Price %] >+[% USE ItemGroups %] > [% USE TablesSettings %] > [% PROCESS 'i18n.inc' %] > [% INCLUDE 'doc-head-open.inc' %] >@@ -36,7 +37,7 @@ > [% INCLUDE 'str/cataloging_additem.inc' %] > [% Asset.js("js/cataloging_additem.js") | $raw %] > <script> >- var has_item_groups = "[% item_groups.size | html %]"; >+ var has_item_groups = "[% ItemGroups.count(biblio.biblionumber) | html %]"; > </script> > </head> > >@@ -249,18 +250,17 @@ > [% IF op != 'add_item' %] > <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" /> > [% END %] >- >-[% IF item_groups.size && op != 'saveitem' && CAN_user_editcatalogue_manage_item_groups %] >+[% IF ItemGroups.count(biblio.biblionumber) && op != 'saveitem' && CAN_user_editcatalogue_manage_item_groups %] > <fieldset class="rows"> > <legend><i class="fa fa-plus"></i> Add to item group</legend> >- [% FOREACH ig IN item_groups %] >+ [% FOREACH ig IN ItemGroups.listGroups(biblio.biblionumber) %] > <input type="hidden" id="item-group-[% ig.id | html %]" value="[% ig.description | html %]" /> > [% END %] > <p> > <label for="select_item_group">Options: </label> > <select name="item_group" id="item-group-add-or-create-form-select"> > <optgroup label="Use existing item group"> >- [% FOREACH ig IN item_groups %] >+ [% FOREACH ig IN ItemGroups.listGroups(biblio.biblionumber) %] > <option value="[% ig.id | html %]">[% ig.description | html %]</option> > [% END %] > </optgroup> >-- >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 34234
:
158148
|
158294
|
158328
|
158329
|
160442
|
160542
|
160543
|
160992
|
161019
|
161760