5 [% USE TablesSettings %]
6 [% INCLUDE 'doc-head-open.inc' %]
8 [% IF op == 'add_form' %]
12 New library [% library.branchcode | html %]
13 [% END %] › [% ELSIF op == 'delete_confirm' %]
14 Confirm deletion of library '[% library.branchcode | html %]' › [% END %]
15 Libraries › Administration › Koha
17 [% INCLUDE 'doc-head-close.inc' %]
20 <body id="admin_branches" class="admin">
21 [% INCLUDE 'header.inc' %]
22 [% INCLUDE 'prefs-admin-search.inc' %]
24 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
27 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
30 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
33 [% IF op == 'add_form' %]
35 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
39 <a href="#" aria-current="page">
45 <a href="#" aria-current="page">
46 New library [% library.branchcode | html %]
51 [% ELSIF op == 'delete_confirm' %]
53 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
56 <a href="#" aria-current="page">
57 Confirm deletion of library '[% library.branchcode | html %]'
61 [% ELSIF op == 'view' %]
63 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
66 <a href="#" aria-current="page">
67 [% library.branchname | html %]
73 <a href="#" aria-current="page">
81 <div class="main container-fluid">
83 <div class="col-sm-10 col-sm-push-2">
86 [% FOREACH m IN messages %]
87 <div class="dialog [% m.type | html %]">
89 [% CASE 'error_on_update' %]
90 <span>An error occurred when updating this library. Perhaps it already exists.</span>
91 [% CASE 'error_on_insert' %]
92 <span>An error occurred when adding this library. The branchcode might already exist.</span>
93 [% CASE 'error_on_delete' %]
94 <span>An error occurred when deleting this library. Check the logs.</span>
95 [% CASE 'success_on_update' %]
96 <span>Library updated successfully.</span>
97 [% CASE 'success_on_insert' %]
98 <span>Library added successfully.</span>
99 [% CASE 'success_on_delete' %]
100 <span>Library deleted successfully.</span>
101 [% CASE 'cannot_delete_library' %]
102 <span>This library cannot be deleted. Patrons or items are still using it</span>
103 [% IF m.data.patrons_count and m.data.items_count %]
104 <span>([% m.data.patrons_count | html %] patrons and [% m.data.items_count | html %] items).</span>
105 [% ELSIF m.data.patrons_count %]
106 <span>([% m.data.patrons_count | html %] patrons).</span>
107 [% ELSIF m.data.items_count %]
108 <span>([% m.data.items_count | html %] items).</span>
110 [% CASE 'error_on_update_category' %]
111 <span>An error occurred when updating this library category. Perhaps it already exists.</span>
112 [% CASE 'error_on_insert_category' %]
113 <span>An error occurred when adding this library category. The categorycode might already exist.</span>
114 [% CASE 'error_on_delete_category' %]
115 <span>An error occurred when deleting this library category. Check the logs.</span>
116 [% CASE 'success_on_update_category' %]
117 <span>Library category updated successfully.</span>
118 [% CASE 'success_on_insert_category' %]
119 <span>Library category added successfully.</span>
120 [% CASE 'success_on_delete_category' %]
121 <span>Library category deleted successfully.</span>
122 [% CASE 'cannot_delete_category' %]
123 <span>This library category cannot be deleted. [% m.data.libraries_count | html %] libraries are still using it.</span>
125 <span>[% m.code | html %]</span>
130 [% IF op == 'list' || op == 'view' %]
131 <div id="toolbar" class="btn-toolbar">
132 <a class="btn btn-default" id="newbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form"><i class="fa fa-plus"></i> New library</a>
133 [% IF op == 'view' && library %]
134 <a class="btn btn-default" id="editbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode=[% library.branchcode | uri %]"><i class="fa fa-pencil"></i> Edit library</a>
139 [% IF op == 'add_form' %]
140 <h1>[% IF library %]Modify library[% ELSE %]New library[% END %]</h1>
141 <form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
142 <fieldset class="rows">
143 <input type="hidden" name="op" value="add_validate" />
145 <input type="hidden" name="is_a_modif" value="1" />
150 <span class="label">Library code: </span>
151 <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
152 [% library.branchcode | html %]
154 <label for="branchcode" class="required">Library code: </label>
155 <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode | html %]" class="required focus" required="required" />
156 <span class="required">Required</span>
160 <label for="branchname" class="required">Name: </label>
162 <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required focus" required="required" />
164 <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required" required="required" />
166 <span class="required">Required</span>
171 <fieldset class="rows"><legend>Group(s):</legend>
173 [% FOREACH category IN categories %]
175 <label for="[% category.categorycode | html %]">[% category.categoryname | html %]: </label>
176 [% IF category and selected_categorycodes.grep(category.categorycode).size %]
177 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" checked="checked" />
179 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" />
181 <div class="hint">[% category.codedescription | html %]</div>
187 <fieldset class="rows">
189 <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% library.branchaddress1 | html %]" /></li>
190 <li><label for="branchaddress2">Address line 2: </label><input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% library.branchaddress2 | html %]" /></li>
191 <li><label for="branchaddress3">Address line 3: </label><input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% library.branchaddress3 | html %]" /></li>
192 <li><label for="branchcity">City: </label><input type="text" name="branchcity" id="branchcity" size="60" value="[% library.branchcity | html %]" /></li>
193 <li><label for="branchstate">State: </label><input type="text" name="branchstate" id="branchstate" size="60" value="[% library.branchstate | html %]" /></li>
194 <li><label for="branchzip">ZIP/Postal code: </label><input type="text" name="branchzip" id="branchzip" size="25" maxlength="25" value="[% library.branchzip | html %]" /></li>
195 <li><label for="branchcountry">Country: </label><input type="text" name="branchcountry" id="branchcountry" size="60" value="[% library.branchcountry | html %]" /></li>
196 <li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone | html %]" /></li>
197 <li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax | html %]" /></li>
198 <li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email" size="80" value="[% library.branchemail | html %]" /></li>
199 [% IF (Koha.Preference('ILLModule')) %]
201 <label for="branchillemail">ILL staff email: </label>
202 <input type="text" name="branchillemail" id="branchillemail" class="email" size="80" value="[% library.branchillemail | html %]" />
204 [% IF ( CAN_user_parameters_manage_sysprefs ) %]
205 Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ILLDefaultStaffEmail">ILLDefaultStaffEmail</a> system preference
207 Default: ILLDefaultStaffEmail system preference
213 <label for="branchreplyto">Reply-To: </label>
214 <input type="text" name="branchreplyto" id="branchreplyto" class="email" size="80" value="[% library.branchreplyto | html %]" />
216 [% IF ( CAN_user_parameters_manage_sysprefs ) %]
217 Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ReplyToDefault">ReplyToDefault</a> system preference
219 Default: ReplyToDefault system preference
224 <label for="branchreturnpath">Return-Path: </label>
225 <input type="text" name="branchreturnpath" id="branchreturnpath" class="email" size="80" value="[% library.branchreturnpath | html %]" />
227 [% IF ( CAN_user_parameters_manage_sysprefs ) %]
228 Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ReturnpathDefault">ReturnpathDefault</a> system preference
230 Default: ReturnpathDefault system preference
234 <li><label for="smtp_server">SMTP server: </label>
235 <select name="smtp_server" id="smtp_server">
236 [% IF library AND library.smtp_server.is_system_default %]
237 <option value="*" selected="selected">Default</option>
239 <option value="*">Default</option>
241 [% FOREACH smtp_server IN smtp_servers %]
242 [% IF library AND smtp_server.id == library.smtp_server.id %]
243 <option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option>
245 <option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option>
250 <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl" size="80" value="[% library.branchurl | html %]" class="url" /></li>
251 <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% library.opac_info | $raw %]</textarea></li>
253 <label for="branchip">IP: </label>
254 <input type="text" name="branchip" id="branchip" size="15" maxlength="15" value="[% library.branchip | html %]" />
255 <div class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</div>
258 <label for="marcorgcode">MARC organization code</label>
259 <input type="text" name="marcorgcode" id="marcorgcode" size="16" maxlength="16" value="[% library.marcorgcode | html %]" />
261 [% IF ( CAN_user_parameters_manage_sysprefs ) %]
262 If not filled in defaults to system preference <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=MARCOrgCode">MARCOrgCode</a>.
264 If not filled in defaults to system preference MARCOrgCode.
266 You can obtain your code from <a href="http://www.loc.gov/marc/organizations/orgshome.html" target="_blank">Library of Congress</a>.
269 <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" size="80" value="[% library.branchnotes | html %]" /></li>
270 <li><label for="pickup_location">Pickup location: </label>
271 <select name="pickup_location" id="pickup_location">
272 [% IF !library || library.pickup_location == 1 %]
273 <option value="1" selected="selected">Yes</option>
274 <option value="0">No</option>
276 <option value="1">Yes</option>
277 <option value="0" selected="selected">No</option>
281 <li><label for="public">Public: </label>
282 <select name="public" id="public">
283 [% IF !library || library.public == 1 %]
284 <option value="1" selected="selected">Yes</option>
285 <option value="0">No</option>
287 <option value="1">Yes</option>
288 <option value="0" selected="selected">No</option>
291 <div class="hint">Set to 'yes' to show this library on the Libraries page in the OPAC.</div>
295 <fieldset class="action">
296 <input type="submit" value="Submit" />
297 <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
302 [% IF op == 'delete_confirm' and not ( items_count or patrons_count )%]
303 <div class="dialog alert">
304 <form action="/cgi-bin/koha/admin/branches.pl" method="post">
305 <h1>Are you sure you want to delete [% library.branchname | html %] ([% library.branchcode | html %])?</h1>
306 <input type="hidden" name="op" value="delete_confirmed" />
307 <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
308 <input type="hidden" name="branchname" value="[% library.branchname | html %]">
309 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
311 <form action="/cgi-bin/koha/admin/branches.pl" method="get">
312 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
317 [% IF op == 'list' %]
319 [% IF libraries_count > 0 %]
320 <table id="libraries">
326 <th>MARC organization code</th>
328 <th>Pickup location</th>
331 <th data-class-name="actions noExport">Actions</th>
336 <div class="dialog message">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">Start defining libraries</a>.</div>
340 [% IF op == 'view' && library %]
341 <h1>[% library.branchname | html %]</h1>
343 <div class="col-sm-6">
347 <span class="label">Library code: </span>
348 [% library.branchcode | html %]
351 <span class="label">Name: </span>
352 [% library.branchname | html %]
355 <span class="label">Category:</span>
356 [% category.categoryname | html %]
359 <span class="label">Address line 1: </span>
360 [% library.branchaddress1 | html %]
363 <span class="label">Address line 2: </span>
364 [% library.branchaddress2 | html %]
367 <span class="label">Address line 3: </span>
368 [% library.branchaddress3 | html %]
371 <span class="label">City: </span>
372 [% library.branchcity | html %]
375 <span class="label">State: </span>
376 [% library.branchstate | html %]
379 <span class="label">ZIP/Postal code: </span>
380 [% library.branchzip | html %]
383 <span class="label">Country: </span>
384 [% library.branchcountry | html %]
387 <span class="label">Phone: </span>
388 [% library.branchphone | html %]
391 <span class="label">Fax: </span>
392 [% library.branchfax | html %]
397 <div class="col-sm-6">
401 <span class="label">Email: </span>
402 [% IF ( library.branchemail ) %]
403 <a href="mailto:[% library.branchemail | url %]">[% library.branchemail | html %]</a>
407 <span class="label">ILL staff email: </span>
408 [% IF ( library.branchillemail ) %]
409 <a href="mailto:[% library.branchillemail | url %]">[% library.branchillemail | html %]</a>
413 <span class="label">Reply-To: </span>
414 [% IF ( library.branchreplyto ) %]
415 <a href="mailto:[% library.branchreplyto | url %]">[% library.branchreplyto | html %]</a>
419 <span class="label">Return-Path: </span>
420 [% library.branchreturnpath | html %]
423 <span class="label">SMTP server: </span>
424 [% smtp_server.name | html %]
427 <span class="label">URL: </span>
428 [% IF ( library.branchurl ) %]
429 <a href="[% library.branchurl | url %]" target="_blank">[% library.branchurl | html %]</a>
433 <span class="label">IP: </span>
434 [% library.branchip | html %]
437 <span class="label">MARC organization code</span>
438 [% library.marcorgcode | html %]
441 <span class="label">Notes: </span>
442 [% library.branchnotes | html %]
445 <span class="label">Pickup location: </span>
446 [% IF ( library.pickup_location ) %]
453 <span class="label">Public: </span>
454 [% IF ( library.public ) %]
461 </div> <!-- /.rows -->
462 </div> <!-- /.col-sm-6 -->
463 </div> <!-- /.row -->
464 [% IF ( library.opac_info ) %]
467 <div class="col-sm-12">
468 <h2>OPAC information</h2>
469 [% library.opac_info | $raw %]
473 [% ELSIF op == 'view' %]
474 <div>This library does not exist.</div>
478 </div> <!-- /.col-sm-10.col-sm-push-2 -->
480 <div class="col-sm-2 col-sm-pull-10">
482 [% INCLUDE 'admin-menu.inc' %]
484 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
485 </div> <!-- /.row -->
487 [% MACRO jsinclude BLOCK %]
488 [% Asset.js("js/admin-menu.js") | $raw %]
489 [% INCLUDE 'datatables.inc' %]
490 [% INCLUDE 'columns_settings.inc' %]
491 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
492 [% INCLUDE 'str/tinymce_i18n.inc' %]
494 var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
495 $(document).ready(function() {
497 var libraries_url = '/api/v1/libraries';
498 var libraries = $("#libraries").kohaTable({
502 'embed': [ 'smtp_server' ],
503 'emptyTable': '<div class="dialog message">'+_("There are no libraries defined.")+' <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">'+_("Start defining libraries")+'</a>.</div>',
505 "targets": [0,1,3,4,7,9,10,11,12,13,14,15,16],
506 "render": function (data, type, row, meta) {
507 if ( type == 'display' ) {
508 if ( data != null ) {
509 return data.escapeHtml();
523 "render": function( data, type, row, meta ) {
524 return "<a href=\"/cgi-bin/koha/admin/branches.pl?op=view&branchcode=" + encodeURIComponent( row.library_id ) + "\">" + row.name.escapeHtml() + "</a>";
528 "data": "library_id",
533 "data": function( row, type, val, meta ) {
534 const library_info = [];
535 if ( row.address1 != null ) library_info.push(row.address1.escapeHtml());
536 if ( row.address2 != null ) library_info.push(row.address2.escapeHtml());
537 if ( row.address3 != null ) library_info.push(row.address3.escapeHtml());
538 // geographical_location = city, state postal_code
539 const locations = [];
540 if ( row.city != null ) locations.push(row.city.escapeHtml());
541 if ( row.state != null ) locations.push(row.state.escapeHtml());
542 const geographical_location = locations.join(', ');
543 if ( geographical_location != '' && row.postal_code != null) {
544 library_info.push(geographical_location+' '+row.postal_code.escapeHtml());
547 library_info.push(geographical_location);
549 if ( row.country != null ) library_info.push(row.country.escapeHtml());
550 if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml());
551 if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml());
552 if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>');
553 if ( row.url != null ) library_info.push('<a href="'+encodeURIComponent(row.url)+'">'+row.url.escapeHtml()+'</a>');
554 if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml());
555 return library_info.join('<br/>');
561 "data": "marc_org_code",
571 "data": "pickup_location",
574 "render": function( data, type, row, meta ) {
575 return (data) ? _("Yes") : _("No");
582 "render": function( data, type, row, meta ) {
583 return (data) ? _("Yes") : _("No");
587 "data": "smtp_server",
588 "render": function( data, type, row, meta ) {
589 if ( data.smtp_server_id ) {
590 return '<a href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id='+encodeURIComponent(data.smtp_server_id)+'">'+data.name.escapeHtml()+'</a>';
601 "data": function( row, type, val, meta ) {
603 var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode='+encodeURIComponent(row.library_id)+'" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
604 result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
605 result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n";
606 result += '<input type="hidden" name="op" value="delete_confirm" />';
607 result += '<button type="submit" id="delete_library_'+row.library_id.escapeHtml()+'" class="btn btn-default btn-xs" role="button"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</button></form>';
646 "data": "postal_code",
673 $("#Aform").on("submit", function( event ) {
674 if ( $("#branchcode").val().match(/\s/) ) {
675 event.preventDefault();
676 alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
687 relative_urls : false,
688 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
689 menubar : "file edit view insert format tools table",
690 mode : "specific_textareas",
691 plugins : "autoresize table hr link image charmap lists code emoticons",
693 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
694 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
700 [% INCLUDE 'intranet-bottom.inc' %]