Bugzilla – Attachment 158294 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.14 KB, created by
Lucas Gass (lukeg)
on 2023-11-02 22:25:44 UTC
(
hide
)
Description:
Bug 34234: Add sub for count and logic to additem page
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2023-11-02 22:25:44 UTC
Size:
4.14 KB
patch
obsolete
>From 4ff28b4b71a750f12e147c6b7a4e1fe0c7aef95e 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 >--- > 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 eda845d154d..47844478d6d 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 1e397a0de26..a9fc80646f9 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 6fe0ec6cdc3..8014325538d 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