1 [% USE AuthorisedValues %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Administration ›
6 [% CASE 'add_form' %][% IF field %]Modify additional field '[% field.name | html %]'[% ELSE %]Add additional field[% END %]
7 [% CASE %]Manage additional fields
10 [% INCLUDE 'doc-head-close.inc' %]
13 [% marcfield_tables = ['subscription'] %]
14 [% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
16 <body id="ser_add_fields" class="ser">
17 [% INCLUDE 'header.inc' %]
18 [% INCLUDE 'cat-search.inc' %]
20 <div id="breadcrumbs">
21 <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
23 [% CASE 'add_form' %]<a href="/cgi-bin/koha/admin/additional-fields.pl">Manage additional fields</a> › [% IF field %]Modify field '[% field.name | html %]'[% ELSE %]Add field[% END %]
24 [% CASE 'list' %]<a href="/cgi-bin/koha/admin/additional-fields.pl">Manage additional fields</a> › Modify fields for '[% tablename | html %]'
25 [% CASE %]Manage additional fields
29 <div class="main container-fluid">
31 <div class="col-sm-10 col-sm-push-2">
35 <div id="toolbar" class="btn-toolbar">
36 <a class="btn btn-default" id="newfields" href="?op=add_form&tablename=[% tablename | uri %]"><i class="fa fa-plus"></i> Create field</a>
41 [% FOR message IN messages %]
42 [% IF message.code == 'insert' %]
43 [% IF message.number > 0 %]
44 <div class="dialog message">The field has been inserted</div>
46 <div class="dialog alert">The field could not be inserted. Perhaps the name already exists?</div>
48 [% ELSIF message.code == 'update' %]
49 [% IF message.number > 0 %]
50 <div class="dialog message">The field has been updated</div>
52 <div class="dialog alert">The field could not be updated. Perhaps the name already exists?</div>
54 [% ELSIF message.code == 'delete' %]
55 [% IF message.number > 0 %]
56 <div class="dialog message">The field has been deleted</div>
58 <div class="dialog alert">The field could not be deleted. Check the log for errors.</div>
64 [% IF op == 'list_tables' %]
65 [% IF CAN_user_acquisitions_order_manage || CAN_user_serials_edit_subscription %]
66 <h3>Additional fields</h3>
67 <p>Select a table:</p>
68 [% BLOCK table_option %]
69 <li><a href="?tablename=[% value | uri %]">[% content | html %] (<span class="ex">[% value | html %]</span>)</a></li>
72 [% IF CAN_user_acquisition_order_manage %]
73 [% WRAPPER table_option value="aqbasket" %]Order baskets[% END %]
75 [% IF CAN_user_serials_edit_subscription %]
76 [% WRAPPER table_option value="subscription" %]Subscriptions[% END %]
80 Additional permissions in the acquisitions or serials modules are required for editing additional fields
82 [% ELSIF op == 'list' %]
83 <h3>Additional fields for '[% tablename | html %]'</h3>
89 <th>Authorised value category</th>
90 [% IF show_marcfield %]
98 [% FOR field IN fields %]
100 <td>[% field.name | html %]</td>
101 <td>[% field.authorised_value_category | html %]</td>
102 [% IF show_marcfield %]
103 <td>[% field.marcfield | html %]</td>
106 [% IF field.searchable %]Yes[% ELSE %]No[% END %]
109 <a class="btn btn-default btn-xs" href="?op=add_form&field_id=[% field.id | html %]"><i class="fa fa-pencil"></i> Edit</a>
110 <a class="confirmdelete btn btn-default btn-xs" href="?op=delete&field_id=[% field.id | uri %]&tablename=[% tablename | uri %]"><i class="fa fa-trash"></i> Delete</a>
117 [% IF tablename %]There are no additional fields defined for this table.[% END %]
119 [% ELSIF op == 'add_form' %]
121 <h3>Modify field</h3>
125 <form action="" name="add_form" id="add_field" method="post">
126 <fieldset class="rows">
129 <label for="name" class="required">Name: </label>
130 <input type="text" name="name" id="name" value="[% field.name | html %]" class="required" required="required" />
131 <span class="required">Required</span>
134 <label for="av">Authorised value category: </label>
135 <select name="authorised_value_category">
136 <option value="">None</option>
137 [% PROCESS options_for_authorised_value_categories authorised_value_categories = AuthorisedValues.GetCategories({selected => field.authorised_value_category}) %]
140 [% IF show_marcfield %]
142 <label for="marcfield">MARC field: </label>
143 <input type="text" name="marcfield" id="marcfield" value="[% field.marcfield | html %]" />
147 <label for="searchable">Searchable: </label>
148 [% IF field.searchable %]
149 <input type="checkbox" name="searchable" id="searchable" checked="checked" />
151 <input type="checkbox" name="searchable" id="searchable" />
156 <fieldset class="action">
158 <input type="hidden" name="field_id" value="[% field.id | html %]" />
160 <input type="hidden" name="tablename" value="[% tablename | html %]" />
161 <input type="hidden" name="op" value="add" />
162 <input type="submit" value="Save" />
163 <a href="?tablename=[% tablename | uri %]" class="cancel">Cancel</a>
169 </div> <!-- /.col-sm-10.col-sm-push-2 -->
171 <div class="col-sm-2 col-sm-pull-10">
173 [% INCLUDE 'admin-menu.inc' %]
175 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
176 </div> <!-- /.row -->
179 [% MACRO jsinclude BLOCK %]
180 [% INCLUDE "datatables.inc" %]
182 $(document).ready(function(){
183 $('#selecttable').find(":submit").hide();
184 $('#selecttable select').change(function() {
185 $('#selecttable').submit();
188 $("#fieldst").dataTable($.extend(true, {}, dataTablesDefaults, {
190 'sDom': 't<"bottom pager"ilpf>',
191 'sPaginationType': 'full',
192 'aLengthMenu': [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
193 'iDisplayLength': 20,
194 'aaSorting': [[ 0, "asc" ]],
197 $(".confirmdelete").click(function(){
198 return confirm(_("Are you sure you want to delete this field?"));
201 $("#add_field").on('submit', function() {
202 if ( $("#marcfield").length && $("select[name='authorised_value_category']").length ) {
203 if ( $("#marcfield").val().length > 0
204 && $("select[name='authorised_value_category']" ).val().length > 0 ) {
205 alert(_("You cannot select an authorised value category and a MARC field") );
215 [% INCLUDE 'intranet-bottom.inc' %]