Main Koha release repository https://koha-community.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

562 lines
29 KiB

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE AuthorisedValues %]
[% USE Price %]
[% USE TablesSettings %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Item types [% IF op == 'add_form' %]&rsaquo;
[% IF ( itemtype ) %]
Modify item type '[% itemtype.itemtype | html %]'
[% ELSE %]
Add item type
[% END %]
[% END %]
[% IF op == 'delete_confirm' %]&rsaquo;
[% IF ( total ) %]
Cannot delete item type '[% itemtype.itemtype | html %]'
[% ELSE %]
Delete item type '[% itemtype.itemtype | html %]'?
[% END %]
[% END %]
[% IF op == 'delete_confirmed' %]&rsaquo;
Data deleted
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
<style>
fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
fieldset.rows .ui-tabs-nav { margin-left : 10px; }
</style>
</head>
<body id="admin_itemtypes" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF op == 'add_form' %]
[% IF itemtype %]
<a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Modify item type '[% itemtype.itemtype | html %]'
[% ELSE %]
<a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Add item type
[% END %]
[% END %]
[% IF op == 'delete_confirm' %]
[% IF total %]
<a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Cannot delete item type '[% itemtype.itemtype | html %]'
[% ELSE %]
<a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Delete item type '[% itemtype.itemtype | html %]'?
[% END %]
[% END %]
[% IF op == 'delete_confirmed' %]
<a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo;Data deleted
[% END %]
[% IF op == 'list' %]
Item types administration
[% END %]</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% IF op == 'list' %]<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="newitemtype" href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form"><i class="fa fa-plus"></i> New item type</a>
</div>[% END %]
[% FOREACH m IN messages %]
<div class="dialog [% m.type | html %]">
[% SWITCH m.code %]
[% CASE 'error_on_update' %]
An error occurred when updating this item type. Perhaps the value already exists.
[% CASE 'error_on_insert' %]
An error occurred when inserting this item type. Perhaps the value already exists.
[% CASE 'error_on_delete' %]
An error occurred when deleting this item type. Check the logs.
[% CASE 'success_on_update' %]
Item type updated successfully.
[% CASE 'success_on_insert' %]
Item type inserted successfully.
[% CASE 'success_on_delete' %]
Item type deleted successfully.
[% CASE 'already_exists' %]
This item type already exists.
[% CASE 'cannot_be_deleted' %]
Cannot delete this item type. <p><strong>This record is in use</strong>. Deletion is not possible.</p>
[% CASE %]
[% m.code | html %]
[% END %]
</div>
[% END %]
[% IF op == 'add_form' %]
[% IF itemtype %]
<h3>Modify item type</h3>
[% ELSE %]
<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" />
<fieldset class="rows">
<ol>
[% IF itemtype %]
<li>
<input type="hidden" name="is_a_modif" value="1" />
<span class="label">Item type: </span> <input type="hidden" name="itemtype" value="[% itemtype.itemtype | html %]" />
[% itemtype.itemtype | html %]
</li>
[% ELSE %]
<li>
<label for="itemtype" class="required">Item type: </label>
<input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" required="required" class="focus" /> <span class="required">Required</span>
</li>
[% END %]
<li>
<label for="parent_type">Parent item type: </label>
[% IF !is_a_parent && parent_types %]
<select name="parent_type" id="parent_type">
<option value="">None</option>
[% 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 %]
<span class="hint">Defining a parent type will apply checkout limits for all children as described on the circulation rules page.</span>
</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 %]
<a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype.itemtype | uri %]" title="Translate item type [% itemtype.itemtype | html %]" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
[% END %]
</li>
<li>
<span class="label">Search category</span>
<select id="searchcategory" name="searchcategory">
<option value="">None</option>
[% FOREACH cat IN searchcategory %]
[% IF cat.authorised_value == itemtype.searchcategory %]
<option value="[% cat.authorised_value | html %]" selected="selected">
[% cat.lib | html %]
</option>
[% ELSE %]
<option value="[% cat.authorised_value | html %]" >
[% cat.lib | html %]
</option>
[% END %]
[% END %]
</select>
<span class="hint">Options are defined as the authorized values for the ITEMTYPECAT category.</span>
</li>
[% IF ( Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') ) %]
<li>
<span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=noItemTypeImages">noItemTypeImages or OpacNoItemTypeImages system preferences</a>
</li>
[% END %]
</ol>
[% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
<div id="icons" class="toptabs" style="clear:both">
<h5 style="margin-left:10px;">Choose an icon:</h5>
<ul>
<li><a href="#none">None</a></li>
[% FOREACH imageset IN imagesets %]
[% IF ( imageset.imagesetactive ) %]
<li class="ui-tabs-active">
[% ELSE %]
<li>
[% END %]
<a href="#[% imageset.imagesetname | uri %]">[% imageset.imagesetname | html %]</a>
</li>
[% END %]
[% IF itemtype.image_location('intranet').match('^http') %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
</ul>
<div id="none">
<ul>
<li><label for="noimage">No image: </label><input type="radio" name="image" id="noimage" value="removeImage" /></li>
</ul>
<br class="clear" />
</div>
[% FOREACH imageset IN imagesets %]
<div id="[% imageset.imagesetname | html %]">
<ul>
[% FOREACH image IN imageset.images %]
<li style="float: none; display: inline-block; clear : none; width: auto;">
<label>
[% IF image.StaffImageUrl %]
<img src="[% image.StaffImageUrl | html %]" alt="[% image.StaffImageUrl | html %]" title="[% image.StaffImageUrl | html %]" />
[% END %]
[% IF image.checked %]
<input type="radio" name="image" value="[% image.KohaImage | html %]" checked="checked" />
[% ELSIF image.KohaImage %] <!-- to delete the radio button if there is no image after -->
<input type="radio" name="image" value="[% image.KohaImage | html %]" />
[% END %]
</label>
</li>
[% END %]
</ul>
<br class="clear" />
</div>
[% END %]
<div id="remote">
<ul>
<li>
<label for="remote_image_check"> Remote image:</label>
[% SET image_location = itemtype.image_location('intranet') %]
[% IF image_location.match('^http') %]
<input type="radio" id="remote_image_check" name="image" value="remoteImage" checked="checked" />
<input type="text" name="remoteImage" size="48" maxlength="200" value="[% image_location | html %]" onmousedown="document.getElementById('remote_image_check').checked = true;" />
[% IF itemtype.imageurl %]
<img src="[% image_location | html %]" alt="" />
[% END %]
[% ELSE %]
<input type="radio" id="remote_image_check" name="image" value="remoteImage" />
<input type="text" name="remoteImage" size="48" maxlength="200" value="" onmousedown="document.getElementById('remote_image_check').checked = true;" />
[% END %]
</li>
</ul>
<br class="clear" />
</div>
</div>
[% END %]
<ol class="oladditemtype">
<li>
<label for="hideinopac">Hide in OPAC: </label>
[% IF ( itemtype.hideinopac ) %]
<input type="checkbox" id="hideinopac" name="hideinopac" checked="checked" value="1" />
[% ELSE %]
<input type="checkbox" id="hideinopac" name="hideinopac" value="1" />
[% END %]
<span class="hint">If checked, items of this type will be hidden as filters in OPAC's advanced search.</span>
</li>
<li>
<label for="notforloan">Not for loan: </label>
[% IF itemtype.notforloan %]
<input type="checkbox" id="notforloan" name="notforloan" checked="checked" value="1" />
[% ELSE %]
<input type="checkbox" id="notforloan" name="notforloan" value="1" />
[% END %]
<span class="hint">If checked, no item of this type can be issued. If not checked, every item of this type can be issued unless notforloan is set for a specific item.</span>
</li>
<li>
<label for="rentalcharge">Rental charge: </label>
<input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% itemtype.rentalcharge | $Price on_editing => 1 %]" />
<span class="hint">This fee is charged once per checkout/renewal per item</span>
</li>
<li>
<label for="rentalcharge_daily">Daily rental charge: </label>
<input type="text" id="rentalcharge_daily" name="rentalcharge_daily" size="10" value="[% itemtype.rentalcharge_daily | $Price on_editing => 1 %]" />
<span class="hint">This fee is charged at checkout/renewal time for each day between the checkout/renewal date and due date for loans specified in days.</span>
</li>
<li>
<label for="rentalcharge_daily_calendar">Daily rentals use calendar: </label>
[% IF itemtype.rentalcharge_daily_calendar %]
<input type="checkbox" id="rentalcharge_daily_calendar" name="rentalcharge_daily_calendar" checked="checked" value="1" />
[% ELSE %]
<input type="checkbox" id="rentalcharge_daily_calendar" name="rentalcharge_daily_calendar" value="1" />
[% END %]
<span class="hint">If checked, daily charge will be calculated using the calendar to exclude holidays. If not checked, the fee will be calculated based on the number of days until due, directly.</span>
</li>
<li>
<label for="rentalcharge_hourly">Hourly rental charge: </label>
<input type="text" id="rentalcharge_hourly" name="rentalcharge_hourly" size="10" value="[% itemtype.rentalcharge_hourly | $Price on_editing => 1 %]" />
<span class="hint">This fee is charged at checkout/renewal time for each hour between the checkout/renewal date and due date for loans specified in hours.</span>
</li>
<li>
<label for="rentalcharge_hourly_calendar">Hourly rentals use calendar: </label>
[% IF itemtype.rentalcharge_hourly_calendar %]
<input type="checkbox" id="rentalcharge_hourly_calendar" name="rentalcharge_hourly_calendar" checked="checked" value="1" />
[% ELSE %]
<input type="checkbox" id="rentalcharge_hourly_calendar" name="rentalcharge_hourly_calendar" value="1" />
[% END %]
<span class="hint">If checked, hourly charge will be calculated using the calendar to exclude holidays. If not checked, the fee will be calculated based on the number of hours until due, directly.</span>
</li>
<li>
<label for="defaultreplacecost">Default replacement cost: </label>
<input type="text" id="defaultreplacecost" name="defaultreplacecost" size="10" value="[% itemtype.defaultreplacecost | html %]" />
</li>
<li>
<label for="processfee">Processing fee (when lost): </label>
<input type="text" id="processfee" name="processfee" size="10" value="[% itemtype.processfee | html %]" />
</li>
<li>
<label for="checkinmsg">Checkin message: </label>
<textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% itemtype.checkinmsg | html %]</textarea>
</li>
<li>
<label for="checkinmsgtype">Checkin message type: </label>
<select type="text" id="checkinmsgtype" name="checkinmsgtype">
[% IF itemtype.checkinmsgtype == 'message' %]
<option value="message" selected="selected">Message</option>
[% ELSE %]
<option value="message">Message</option>
[% END %]
[% IF itemtype.checkinmsgtype == 'alert' %]
<option value="alert" selected="selected">Alert</option>
[% ELSE %]
<option value="alert">Alert</option>
[% END %]
</select>
</li>
<li>
<label for="sip_media_type">SIP media type: </label>
<select id="sip_media_type" name="sip_media_type">
<option value=""></option>
[% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE') %]
[% IF a.authorised_value == itemtype.sip_media_type %]
<option value="[% a.authorised_value | html %]" selected="selected">[% a.lib | html %]</option>
[% ELSE %]
<option value="[% a.authorised_value | html %]">[% a.lib | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li><label for="branches">Library limitation: </label>
<select id="branches" name="branches" multiple size="10">
<option value="">All libraries</option>
[% FOREACH branch IN branches_loop %]
[% IF ( branch.selected ) %]
<option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
[% ELSE %]
<option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
[% END %]
[% END %]
</select>
<span class="hint">Select 'All libraries' if all libraries use this item type. Otherwise, select the specific libraries that use this item type.</span>
</li>
<li>
<label for="summary">Summary: </label>
<textarea id="summary" name="summary" cols="55" rows="5">[% itemtype.summary | html %]</textarea>
<p>Enter a summary that will overwrite the default one in search results lists. Example, for a website itemtype : </p>
<p><strong>&lt;a href="[856u]"&gt;open site&lt;/a&gt;</strong> will show the link just below the title</p>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Save changes" />
<a href="/cgi-bin/koha/admin/itemtypes.pl" class="cancel">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op == 'delete_confirm' %]
<div class="dialog alert">
<h3>Delete item type '[% itemtype.itemtype | html %]'?</h3>
<table>
<tr>
<th scope="row">Item type</th>
<td>[% itemtype.itemtype | html %]</td>
</tr>
<tr><th scope="row">Description</th><td>[% itemtype.translated_description | html %]</td></tr>
[% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
<tr>
<th scope="row">Image</th>
<td>
[% SET image_location = itemtype.image_location('intranet') %]
[% IF image_location %]<img src="[% image_location | html %]" alt="" />[% END %]
</td>
</tr>
[% END %]
<tr><th scope="row">Rental charge</th><td>[% itemtype.rentalcharge | $Price %]</td></tr>
</table>
<form action="/cgi-bin/koha/admin/itemtypes.pl" method="post">
<input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="itemtype" value="[% itemtype.itemtype | html %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this item type</button>
</form>
<form action="/cgi-bin/koha/admin/itemtypes.pl" method="post">
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% IF op == 'list' %]
<h2>Item types administration</h2>
[% IF itemtypes %]
<table id="table_item_type">
<thead>
[% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]<th class="noExport">Image</th>[% END %]
<th>Description</th>
<th>Code</th>
<th>Parent code</th>
<th>Search category</th>
<th>Not for loan</th>
<th>Hide in OPAC</th>
<th>Rental charge</th>
<th>Daily rental charge</th>
<th>Hourly rental charge</th>
<th>Default replacement cost</th>
<th>Processing fee (when lost)</th>
<th>Checkin message</th>
<th>Library limitations</th>
<th class="noExport NoSort">Actions</th>
</thead>
[% FOREACH itemtype IN itemtypes %]
<tr>
[% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
<td>
[% SET image_location = itemtype.image_location('intranet') %]
[% IF image_location %]<img src="[% image_location | html %]" alt="" />[% ELSE %]&nbsp;[% END %]
</td>
[% END %]
<td>
[% IF itemtype.parent_type %]
[% IF itemtype.parent.translated_descriptions.size %]
[% itemtype.parent.description | html %] (default)<br/>
[% ELSE %]
[% itemtype.parent.description | html %]
[% END %]
</br>
[% IF itemtype.translated_descriptions.size %]
[% itemtype.description | html %] (default)<br/>
[% FOR description IN itemtype.translated_descriptions %]
[% IF description.translation == itemtype.translated_description %]
-- <strong>[% description.translation | html %]</strong>
[% ELSE %]
-- [% description.translation | html %] ([% description.lang | html %])
[% END %]
<br/>
[% END %]
[% ELSE %]
-- [% itemtype.description | html %]
[% END %]
[% ELSE %]
[% IF itemtype.translated_descriptions.size %]
[% itemtype.description | html %] (default)<br/>
[% FOR description IN itemtype.translated_descriptions %]
[% IF description.translation == itemtype.translated_description %]
<strong>[% description.translation | html %]</strong>
[% ELSE %]
[% description.translation | html %] ([% description.lang | html %])
[% END %]
<br/>
[% END %]
[% ELSE %]
[% itemtype.description | html %]
[% END %]
[% END %]
</td>
<td>
<a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype | uri %]">
[% itemtype.itemtype | html %]
</a>
</td>
<td>
[% itemtype.parent_type | html %]
</td>
<td>[% AuthorisedValues.GetByCode( 'ITEMTYPECAT', itemtype.searchcategory ) | html %]</td>
<td>[% IF ( itemtype.notforloan ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
<td>[% IF ( itemtype.hideinopac ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
<td>
[% UNLESS ( itemtype.notforloan ) %]
[% itemtype.rentalcharge | $Price %]
[% END %]
</td>
<td>
[% UNLESS ( itemtype.notforloan ) %]
[% itemtype.rentalcharge_daily | $Price %]
[% END %]
</td>
<td>
[% UNLESS ( itemtype.notforloan ) %]
[% itemtype.rentalcharge_hourly | $Price %]
[% END %]
</td>
<td>[% itemtype.defaultreplacecost | $Price %]</td>
<td>[% itemtype.processfee | $Price %]</td>
<td>[% itemtype.checkinmsg | html_line_break | $raw %]</td>
<td>
[% IF itemtype.library_limits %]
[% libraries_str = "" %]
[% FOREACH library IN itemtype.library_limits %]
[%- IF loop.first -%]
[% libraries_str = library.branchname _ " (" _ library.branchcode _ ")" %]
[% ELSE %]
[% libraries_str = libraries_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
[% END %]
[% END %]
<span class="library_limitation" title="[% libraries_str | html %]">
[% IF itemtype.library_limits.count > 1 %]
[% itemtype.library_limits.count | html %] library limitations
[% ELSE %]
[% itemtype.library_limits.count | html %] library limitation
[% END %]
[% ELSE %]
No limitation
[% END %]
</td>
<td class="actions">
<a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype | uri %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
<a href="/cgi-bin/koha/admin/itemtypes.pl?op=delete_confirm&amp;itemtype=[% itemtype.itemtype | uri %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</table>
[% ELSE %]
<div class="dialog message">There are no itemtypes defined</div>
[% END %]
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'greybox.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function() {
$('#icons').tabs();
var columns_settings = [% TablesSettings.GetColumns( 'admin', 'itemtypes', 'table_item_type', 'json' ) | $raw %];
[% IF ( Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') ) %]
columns_settings.shift(); // Remove item type image column from configuration
[% END %]
$(document).ready(function() {
KohaTable("table_item_type", {
"aaSorting": [[ 1, "asc" ]],
"iDisplayLength": 10,
"sPaginationType": "full"
}, columns_settings);
});
$( "#itemtypeentry" ).validate({
rules: {
itemtype: { required: true },
description: { required: true },
rentalcharge: { number: true }
}
});
$("#itemtype").on("blur",function(){
toUC(this);
});
$(".library_limitation").tooltip();
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]