From dd7c34f7cdf0784e865d8b0c6f0b3aa9e0d54fda Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 2 Apr 2024 22:27:45 +0000 Subject: [PATCH] Bug 36498: Add ability to set item group display order from additem.tt To test: 1. Apply patch, restart_all 2. System preferences -> EnableItemGroups, set to 'Enable'. 3. Find a record and create at least 1 item group. 4. Go to Add item 5. Scroll to the bottom and look for 'Options' underneath 'Add to item group' 6. In the dropdown select 'Create new item group' 7. There should be fields for 'Name' and 'Display order'. 8. Make sure you can add a new item group with and without a display order set. If no display order is set it should default to 0. 9. Try to add a non numerical display order, you should not be able to. --- cataloguing/additem.pl | 8 ++-- .../prog/en/modules/cataloguing/additem.tt | 48 +++++++++++-------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index b930565ce4..eb0d8d2b1c 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -54,7 +54,7 @@ use URI::Escape qw( uri_escape_utf8 ); our $dbh = C4::Context->dbh; sub add_item_to_item_group { - my ( $biblionumber, $itemnumber, $item_group, $item_group_description ) = @_; + my ( $biblionumber, $itemnumber, $item_group, $item_group_description, $display_order ) = @_; return unless $item_group; @@ -64,6 +64,7 @@ sub add_item_to_item_group { { biblio_id => $biblionumber, description => $item_group_description, + display_order => $display_order, } )->store(); @@ -136,6 +137,7 @@ my $fa_stickyduedate = $input->param('stickyduedate'); my $fa_duedatespec = $input->param('duedatespec'); my $item_group = $input->param('item_group'); my $item_group_description = $input->param('item_group_description'); +my $display_order = $input->param('item_group_display_order'); our $frameworkcode = &GetFrameworkCode($biblionumber); @@ -332,7 +334,7 @@ if ($op eq "cud-additem") { } unless ( @errors ) { $item->store->discard_changes; - add_item_to_item_group( $item->biblionumber, $item->itemnumber, $item_group, $item_group_description ); + add_item_to_item_group( $item->biblionumber, $item->itemnumber, $item_group, $item_group_description, $display_order ); # This is a bit tricky : if there is a cookie for the last created item and # we just added an item, the cookie value is not correct yet (it will be updated @@ -445,7 +447,7 @@ if ($op eq "cud-additem") { $current_item = $current_item->unblessed; add_item_to_item_group( $item->biblionumber, $item->itemnumber, $item_group, - $item_group_description + $item_group_description, $display_order ); # We count the item only if it was really added 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 87756e4819..9cc3367330 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -266,26 +266,34 @@ [% FOREACH ig IN item_groups %] [% END %] -

- - -

- -

- - - Required -

+
    +
  1. + + +
  2. +
    +
  3. + + + Required +
  4. +
  5. + + +
    Display order must be numerical
    +
  6. +
    +
[% END %] -- 2.30.2