Bugzilla – Attachment 93088 Details for
Bug 21946
Group circulation by item type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21946: Update Administration->Item types to allow for defining parent types
Bug-21946-Update-Administration-Item-types-to-allo.patch (text/plain), 6.13 KB, created by
ByWater Sandboxes
on 2019-09-21 16:35:20 UTC
(
hide
)
Description:
Bug 21946: Update Administration->Item types to allow for defining parent types
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2019-09-21 16:35:20 UTC
Size:
6.13 KB
patch
obsolete
>From d1cc6917352b0dbc230009e089fe93b337a38e75 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 2 Apr 2019 14:47:16 +0000 >Subject: [PATCH] Bug 21946: Update Administration->Item types to allow for > defining parent types > >To test: >1 - Browse to Administration -> Item types >2 - Not a new colum for prent type >3 - Edit an existing type and not you can select any type (except the current) as a parent >4 - Select one >5 - Edit the type you selected as parent >6 - Note it cannot have a parent defined >7 - Edit a new type, note you can select a parent > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> >--- > admin/itemtypes.pl | 8 +++++++ > .../prog/en/modules/admin/itemtypes.tt | 26 +++++++++++++++++++++- > 2 files changed, 33 insertions(+), 1 deletion(-) > >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index 80b13c6888..c24430a719 100755 >--- a/admin/itemtypes.pl >+++ b/admin/itemtypes.pl >@@ -71,11 +71,16 @@ if ( $op eq 'add_form' ) { > }; > } > >+ my $parent_type = $itemtype ? $itemtype->parent_type : undef; >+ my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}}); > my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) ); > my $searchcategory = GetAuthorisedValues("ITEMTYPECAT"); > my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') ); > $template->param( > itemtype => $itemtype, >+ parent_type => $parent_type, >+ parent_types => $parent_types, >+ is_a_parent => $itemtype ? Koha::ItemTypes->search({parent_type=>$itemtype_code})->count : 0, > imagesets => $imagesets, > searchcategory => $searchcategory, > can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ), >@@ -84,6 +89,7 @@ if ( $op eq 'add_form' ) { > } elsif ( $op eq 'add_validate' ) { > my $is_a_modif = $input->param('is_a_modif'); > my $itemtype = Koha::ItemTypes->find($itemtype_code); >+ my $parent_type = $input->param('parent_type'); > my $description = $input->param('description'); > my $rentalcharge = $input->param('rentalcharge'); > my $rentalcharge_daily = $input->param('rentalcharge_daily'); >@@ -108,6 +114,7 @@ if ( $op eq 'add_form' ) { > > if ( $itemtype and $is_a_modif ) { # it's a modification > $itemtype->description($description); >+ $itemtype->parent_type($parent_type); > $itemtype->rentalcharge($rentalcharge); > $itemtype->rentalcharge_daily($rentalcharge_daily); > $itemtype->rentalcharge_hourly($rentalcharge_hourly); >@@ -137,6 +144,7 @@ if ( $op eq 'add_form' ) { > { > itemtype => $itemtype_code, > description => $description, >+ parent_type => $parent_type, > rentalcharge => $rentalcharge, > rentalcharge_daily => $rentalcharge_daily, > rentalcharge_hourly => $rentalcharge_hourly, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >index 6ac7988e60..eeffaf5d9c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -96,7 +96,7 @@ Item types administration > [% IF itemtype %] > <h3>Modify item type</h3> > [% ELSE %] >- <h3>Add item type</h3> >+ ]<h3>Add item type</h3> > [% END %] > <form action="/cgi-bin/koha/admin/itemtypes.pl" name="Aform" method="post" id="itemtypeentry"> > <input type="hidden" name="op" value="add_validate" /> >@@ -115,6 +115,26 @@ Item types administration > </li> > [% END %] > <li> >+ <label for="parent_type">Parent item type: </label> >+ [% IF !is_a_parent && parent_types %] >+ <select name="parent_type" id="parent_type"> >+ [% FOREACH pt IN parent_types %] >+ [% IF parent_type == pt.itemtype %] >+ <option value="[% pt.itemtype | html %]" selected="selected">[% pt.description | html %]</option> >+ [% ELSE %] >+ <option value="[% pt.itemtype | html %]">[% pt.description | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ [% ELSIF is_a_parent %] >+ <input type="text" id="parent_type" value="[% parent_type | html %]" name="parent_type" size="10" maxlength="10" disabled/> >+ <p>Is a parent to another type, cannot have a parent</p> >+ [% ELSE %] >+ <input type="text" id="parent_type" value="[% parent_type | html %]" name="parent_type" size="10" maxlength="10" disabled/> >+ <p>No available parent types</p> >+ [% END %] >+ </li> >+ <li> > <label for="description" class="required">Description: </label> > <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span> > [% IF can_be_translated %] >@@ -349,6 +369,7 @@ Item types administration > <thead> > [% UNLESS Koha.Preference('noItemTypeImages') %]<th>Image</th>[% END %] > <th>Code</th> >+ <th>Parent code</th> > <th>Description</th> > <th>Search category</th> > <th>Not for loan</th> >@@ -375,6 +396,9 @@ Item types administration > </a> > </td> > <td> >+ [% itemtype.parent_type | html %] >+ </td> >+ <td> > [% IF itemtype.translated_descriptions.size %] > [% itemtype.description | html %] (default)<br/> > [% FOR description IN itemtype.translated_descriptions %] >-- >2.11.0
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 21946
:
87713
|
87714
|
87715
|
87716
|
87717
|
87718
|
87719
|
88392
|
88574
|
88575
|
88576
|
88577
|
88578
|
88579
|
88580
|
88581
|
88926
|
88927
|
88928
|
88929
|
88930
|
88931
|
88932
|
88933
|
88934
|
89167
|
89168
|
89169
|
89170
|
89171
|
89172
|
89173
|
89174
|
89175
|
89176
|
93075
|
93076
|
93077
|
93078
|
93079
|
93080
|
93081
|
93082
|
93083
|
93084
|
93086
|
93087
|
93088
|
93089
|
93090
|
93091
|
93092
|
93093
|
93094
|
93095
|
93096
|
93097
|
93098
|
93099
|
93100
|
93101
|
93102
|
93103
|
93104
|
93105
|
96977
|
96978
|
96979
|
96980
|
96981
|
96982
|
96983
|
96984
|
96985
|
96986
|
96987
|
99419
|
99420
|
99421
|
99422
|
99423
|
99424
|
107035
|
107036
|
107037
|
107038
|
107039
|
107040
|
107041
|
107278
|
107279
|
107280
|
107281
|
107282
|
107283
|
107284
|
107467
|
107489
|
107686
|
107687
|
107688
|
107689
|
107690
|
107691
|
107692
|
107693
|
107694
|
107701
|
107733