Bugzilla – Attachment 162328 Details for
Bug 35067
Allow authorised value parent category so categories can be linked and shown together
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35067: Save a parent category for authorised value category
Bug-35067-Save-a-parent-category-for-authorised-va.patch (text/plain), 7.77 KB, created by
Aleisha Amohia
on 2024-02-22 03:02:03 UTC
(
hide
)
Description:
Bug 35067: Save a parent category for authorised value category
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2024-02-22 03:02:03 UTC
Size:
7.77 KB
patch
obsolete
>From 8dbc0c2a5e1fa971f943deaf6a23fefd128e5b87 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 21 Feb 2024 22:49:28 +0000 >Subject: [PATCH] Bug 35067: Save a parent category for authorised value > category > >--- > admin/authorised_values.pl | 34 ++++++++++++------- > .../en/modules/admin/authorised_values.tt | 32 +++++++++++++---- > 2 files changed, 48 insertions(+), 18 deletions(-) > >diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl >index 2130e86819d..c41e87bdf9b 100755 >--- a/admin/authorised_values.pl >+++ b/admin/authorised_values.pl >@@ -67,6 +67,11 @@ if ($op eq 'add_form') { > }; > } > >+ my @category_names = Koha::AuthorisedValueCategories->search( >+ { category_name => { -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] } }, >+ { order_by => ['category_name'] } >+ )->as_list; >+ > if ($id) { > $template->param(action_modify => 1); > } elsif ( ! $category ) { >@@ -88,7 +93,8 @@ if ($op eq 'add_form') { > ); > } > $template->param( >- branches_loop => \@branches_loop, >+ branches_loop => \@branches_loop, >+ category_names => \@category_names, > ); > > } elsif ($op eq 'add') { >@@ -151,6 +157,7 @@ if ($op eq 'add_form') { > $searchfield = $new_category; > } elsif ($op eq 'add_category' ) { > my $new_category = $input->param('category'); >+ my $parent = $input->param('parent') || undef; > > my $already_exists = Koha::AuthorisedValueCategories->find( > { >@@ -166,9 +173,12 @@ if ($op eq 'add_form') { > } > } > else { # Insert >- my $av = Koha::AuthorisedValueCategory->new( { >- category_name => $new_category, >- } ); >+ my $av = Koha::AuthorisedValueCategory->new( >+ { >+ category_name => $new_category, >+ parent => $parent, >+ } >+ ); > > eval { > $av->store; >@@ -206,21 +216,21 @@ if ($op eq 'add_form') { > $op = 'list'; > } > >+my $avc = Koha::AuthorisedValueCategories->find( $searchfield ); >+ > $template->param( >- op => $op, >+ op => $op, > searchfield => $searchfield, >- messages => \@messages, >+ messages => \@messages, >+ avc => $avc, > ); > > if ( $op eq 'list' ) { > # build categories list > my @category_names = Koha::AuthorisedValueCategories->search( >- { >- category_name => >- { -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] } >- }, >- { order_by => ['category_name'] } >- )->get_column('category_name'); >+ { category_name => { -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] } }, >+ { order_by => ['category_name'] } >+ )->as_list; > > $searchfield ||= ""; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >index 8ae422c444f..98a0d756bda 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >@@ -133,6 +133,14 @@ > <span class="required">Required</span> > <input type="hidden" name="op" value="add_category" /> > </li> >+ <li> >+ <label for="parent">Parent category:</label> >+ <select name="parent" id="parent_auth_value_categories"> >+ [% FOR c IN category_names %] >+ <option value="[% c.category_name | html %]">[% c.category_name | html %]</option> >+ [% END %] >+ </select> >+ </li> > </ol> > [% ELSE %] > <ol> >@@ -246,16 +254,20 @@ > <label for="category_search">Show category: </label> > <select name="searchfield" id="category_search"> > [% FOR c IN category_names %] >- [% IF c == searchfield %] >- <option value="[% c | html %]" selected="selected">[% c | html %]</option> >+ [% IF c.category_name == searchfield %] >+ <option value="[% c.category_name | html %]" selected="selected">[% c.category_name | html %]</option> > [% ELSE %] >- <option value="[% c | html %]">[% c | html %]</option> >+ <option value="[% c.category_name | html %]">[% c.category_name | html %]</option> > [% END %] > [% END %] > </select> > </p> > </form> <!-- /#category --> > >+ [% IF avc.parent %] >+ Show parent category: <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% avc.parent | uri %]">[% avc.parent | html %]</a> >+ [% END %] >+ > [% IF loop %] > <table id="categoriest" class="authorized_values_table"> > <thead> >@@ -326,18 +338,26 @@ > <tr> > <th>Category</th> > <th>Description</th> >+ <th>Parent category</th> > <th class="noExport"> </th> > </tr> > </thead> > <tbody> > [% FOR c IN category_names %] > <tr> >- <td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c | uri %]">[% c | html %]</a></td> >+ <td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c.category_name | uri %]">[% c.category_name | html %]</a></td> >+ <td> >+ [% PROCESS category_descriptions code_category = c.category_name %] >+ </td> > <td> >- [% PROCESS category_descriptions code_category = c %] >+ [% IF c.parent %] >+ <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c.parent | uri %]">[% c.parent | html %]</a> >+ [% ELSE %] >+ >+ [% END %] > </td> > <td> >- <a id="addauth" class="btn btn-default btn-xs" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=[% c | uri %]"><i class="fa fa-plus"> </i> Add</a> >+ <a id="addauth" class="btn btn-default btn-xs" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=[% c.category_name | uri %]"><i class="fa fa-plus"> </i> Add</a> > </td> > </tr> > [% END # /FOR c %] >-- >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 35067
:
162312
|
162326
|
162327
|
162328
|
162329
|
162355
|
162356
|
162357
|
162358
|
162702
|
162703
|
162704
|
162705
|
162706
|
162708