5 [% USE TablesSettings %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 [% IF library %][% SET OpacLibraryInfo = library.opac_info( lang => lang ) %][% END %]
10 [% IF op == 'add_form' %]
14 New library [% library.branchcode | html %]
15 [% END %] › [% ELSIF op == 'delete_confirm' %]
16 Confirm deletion of library '[% library.branchcode | html %]' › [% END %]
17 Libraries › Administration › Koha
19 [% INCLUDE 'doc-head-close.inc' %]
22 <body id="admin_branches" class="admin">
23 [% WRAPPER 'header.inc' %]
24 [% INCLUDE 'prefs-admin-search.inc' %]
27 [% WRAPPER 'sub-header.inc' %]
28 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
31 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
34 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
37 [% IF op == 'add_form' %]
39 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
43 <a href="#" aria-current="page">
49 <a href="#" aria-current="page">
50 New library [% library.branchcode | html %]
55 [% ELSIF op == 'delete_confirm' %]
57 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
60 <a href="#" aria-current="page">
61 Confirm deletion of library '[% library.branchcode | html %]'
65 [% ELSIF op == 'view' %]
67 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
70 <a href="#" aria-current="page">
71 [% library.branchname | html %]
77 <a href="#" aria-current="page">
86 <div class="main container-fluid">
88 <div class="col-sm-10 col-sm-push-2">
91 [% FOREACH m IN messages %]
92 <div class="dialog [% m.type | html %]">
94 [% CASE 'error_on_update' %]
95 <span>An error occurred when updating this library. Perhaps it already exists.</span>
96 [% CASE 'error_on_insert' %]
97 <span>An error occurred when adding this library. The branchcode might already exist.</span>
98 [% CASE 'error_on_delete' %]
99 <span>An error occurred when deleting this library. Check the logs.</span>
100 [% CASE 'success_on_update' %]
101 <span>Library updated successfully.</span>
102 [% CASE 'success_on_insert' %]
103 <span>Library added successfully.</span>
104 [% CASE 'success_on_delete' %]
105 <span>Library deleted successfully.</span>
106 [% CASE 'cannot_delete_library' %]
107 <span>This library cannot be deleted. Patrons or items are still using it</span>
108 [% IF m.data.patrons_count and m.data.items_count %]
109 <span>([% m.data.patrons_count | html %] patrons and [% m.data.items_count | html %] items).</span>
110 [% ELSIF m.data.patrons_count %]
111 <span>([% m.data.patrons_count | html %] patrons).</span>
112 [% ELSIF m.data.items_count %]
113 <span>([% m.data.items_count | html %] items).</span>
115 [% CASE 'error_on_update_category' %]
116 <span>An error occurred when updating this library category. Perhaps it already exists.</span>
117 [% CASE 'error_on_insert_category' %]
118 <span>An error occurred when adding this library category. The categorycode might already exist.</span>
119 [% CASE 'error_on_delete_category' %]
120 <span>An error occurred when deleting this library category. Check the logs.</span>
121 [% CASE 'success_on_update_category' %]
122 <span>Library category updated successfully.</span>
123 [% CASE 'success_on_insert_category' %]
124 <span>Library category added successfully.</span>
125 [% CASE 'success_on_delete_category' %]
126 <span>Library category deleted successfully.</span>
127 [% CASE 'cannot_delete_category' %]
128 <span>This library category cannot be deleted. [% m.data.libraries_count | html %] libraries are still using it.</span>
130 <span>[% m.code | html %]</span>
135 [% IF op == 'list' || op == 'view' %]
136 <div id="toolbar" class="btn-toolbar">
137 <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>
138 [% IF op == 'view' && library %]
139 <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>
144 [% IF op == 'add_form' %]
145 <h1>[% IF library %]Modify library[% ELSE %]New library[% END %]</h1>
146 <form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
147 <fieldset class="rows">
148 <input type="hidden" name="op" value="add_validate" />
150 <input type="hidden" name="is_a_modif" value="1" />
155 <span class="label">Library code: </span>
156 <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
157 [% library.branchcode | html %]
159 <label for="branchcode" class="required">Library code: </label>
160 <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode | html %]" class="required focus" required="required" />
161 <span class="required">Required</span>
165 <label for="branchname" class="required">Name: </label>
167 <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required focus" required="required" />
169 <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required" required="required" />
171 <span class="required">Required</span>
176 <fieldset class="rows"><legend>Group(s):</legend>
178 [% FOREACH category IN categories %]
180 <label for="[% category.categorycode | html %]">[% category.categoryname | html %]: </label>
181 [% IF category and selected_categorycodes.grep(category.categorycode).size %]
182 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" checked="checked" />
184 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" />
186 <div class="hint">[% category.codedescription | html %]</div>
192 <fieldset class="rows">
194 <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% library.branchaddress1 | html %]" /></li>
195 <li><label for="branchaddress2">Address line 2: </label><input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% library.branchaddress2 | html %]" /></li>
196 <li><label for="branchaddress3">Address line 3: </label><input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% library.branchaddress3 | html %]" /></li>
197 <li><label for="branchcity">City: </label><input type="text" name="branchcity" id="branchcity" size="60" value="[% library.branchcity | html %]" /></li>
198 <li><label for="branchstate">State: </label><input type="text" name="branchstate" id="branchstate" size="60" value="[% library.branchstate | html %]" /></li>
199 <li><label for="branchzip">ZIP/Postal code: </label><input type="text" name="branchzip" id="branchzip" size="25" maxlength="25" value="[% library.branchzip | html %]" /></li>
200 <li><label for="branchcountry">Country: </label><input type="text" name="branchcountry" id="branchcountry" size="60" value="[% library.branchcountry | html %]" /></li>
201 <li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone | html %]" /></li>
202 <li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax | html %]" /></li>
203 <li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email" size="80" value="[% library.branchemail | html %]" /></li>
204 [% IF (Koha.Preference('ILLModule')) %]
206 <label for="branchillemail">ILL staff email: </label>
207 <input type="text" name="branchillemail" id="branchillemail" class="email" size="80" value="[% library.branchillemail | html %]" />
209 [% IF ( CAN_user_parameters_manage_sysprefs ) %]
210 Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ILLDefaultStaffEmail">ILLDefaultStaffEmail</a> system preference
212 Default: ILLDefaultStaffEmail system preference
218 <label for="branchreplyto">Reply-To: </label>
219 <input type="text" name="branchreplyto" id="branchreplyto" class="email" size="80" value="[% library.branchreplyto | html %]" />
221 [% IF ( CAN_user_parameters_manage_sysprefs ) %]
222 Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ReplyToDefault">ReplyToDefault</a> system preference
224 Default: ReplyToDefault system preference
229 <label for="branchreturnpath">Return-Path: </label>
230 <input type="text" name="branchreturnpath" id="branchreturnpath" class="email" size="80" value="[% library.branchreturnpath | html %]" />
232 [% IF ( CAN_user_parameters_manage_sysprefs ) %]
233 Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ReturnpathDefault">ReturnpathDefault</a> system preference
235 Default: ReturnpathDefault system preference
239 <li><label for="smtp_server">SMTP server: </label>
240 <select name="smtp_server" id="smtp_server">
241 [% IF library AND library.smtp_server.is_system_default %]
242 <option value="*" selected="selected">Default</option>
244 <option value="*">Default</option>
246 [% FOREACH smtp_server IN smtp_servers %]
247 [% IF library AND smtp_server.id == library.smtp_server.id %]
248 <option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option>
250 <option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option>
255 <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl" size="80" value="[% library.branchurl | html %]" class="url" /></li>
256 <li><label for="opac_info">OPAC info: </label>
257 [% IF OpacLibraryInfo %]<!-- opac_info -->
258 <div>[% OpacLibraryInfo.content | $raw %]</div>
259 <div class="hint"><a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&id=[% OpacLibraryInfo.id | $raw %]&editmode=wysiwyg" target="_blank">Edit html content</a></div>
261 <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&editmode=wysiwyg" target="_blank">Add html content</a>
265 <label for="branchip">IP: </label>
266 <input type="text" name="branchip" id="branchip" size="15" maxlength="15" value="[% library.branchip | html %]" />
267 <div class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</div>
270 <label for="marcorgcode">MARC organization code</label>
271 <input type="text" name="marcorgcode" id="marcorgcode" size="16" maxlength="16" value="[% library.marcorgcode | html %]" />
273 [% IF ( CAN_user_parameters_manage_sysprefs ) %]
274 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>.
276 If not filled in defaults to system preference MARCOrgCode.
278 You can obtain your code from <a href="http://www.loc.gov/marc/organizations/orgshome.html" target="_blank">Library of Congress</a>.
281 <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" size="80" value="[% library.branchnotes | html %]" /></li>
282 <li><label for="pickup_location">Pickup location: </label>
283 <select name="pickup_location" id="pickup_location">
284 [% IF !library || library.pickup_location == 1 %]
285 <option value="1" selected="selected">Yes</option>
286 <option value="0">No</option>
288 <option value="1">Yes</option>
289 <option value="0" selected="selected">No</option>
293 <li><label for="public">Public: </label>
294 <select name="public" id="public">
295 [% IF !library || library.public == 1 %]
296 <option value="1" selected="selected">Yes</option>
297 <option value="0">No</option>
299 <option value="1">Yes</option>
300 <option value="0" selected="selected">No</option>
303 <div class="hint">Set to 'yes' to show this library on the Libraries page in the OPAC.</div>
307 <fieldset class="action">
308 <input type="submit" value="Submit" />
309 <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
314 [% IF op == 'delete_confirm' and not ( items_count or patrons_count )%]
315 <div class="dialog alert">
316 <form action="/cgi-bin/koha/admin/branches.pl" method="post">
317 <h1>Are you sure you want to delete [% library.branchname | html %] ([% library.branchcode | html %])?</h1>
318 <input type="hidden" name="op" value="delete_confirmed" />
319 <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
320 <input type="hidden" name="branchname" value="[% library.branchname | html %]">
321 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
323 <form action="/cgi-bin/koha/admin/branches.pl" method="get">
324 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
329 [% IF op == 'list' %]
331 [% IF libraries_count > 0 %]
332 <table id="libraries">
338 <th>MARC organization code</th>
340 <th>Pickup location</th>
343 <th data-class-name="actions noExport">Actions</th>
348 <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>
352 [% IF op == 'view' && library %]
353 <h1>[% library.branchname | html %]</h1>
355 <div class="col-sm-6">
359 <span class="label">Library code: </span>
360 [% library.branchcode | html %]
363 <span class="label">Name: </span>
364 [% library.branchname | html %]
367 <span class="label">Category:</span>
368 [% category.categoryname | html %]
371 <span class="label">Address line 1: </span>
372 [% library.branchaddress1 | html %]
375 <span class="label">Address line 2: </span>
376 [% library.branchaddress2 | html %]
379 <span class="label">Address line 3: </span>
380 [% library.branchaddress3 | html %]
383 <span class="label">City: </span>
384 [% library.branchcity | html %]
387 <span class="label">State: </span>
388 [% library.branchstate | html %]
391 <span class="label">ZIP/Postal code: </span>
392 [% library.branchzip | html %]
395 <span class="label">Country: </span>
396 [% library.branchcountry | html %]
399 <span class="label">Phone: </span>
400 [% library.branchphone | html %]
403 <span class="label">Fax: </span>
404 [% library.branchfax | html %]
409 <div class="col-sm-6">
413 <span class="label">Email: </span>
414 [% IF ( library.branchemail ) %]
415 <a href="mailto:[% library.branchemail | url %]">[% library.branchemail | html %]</a>
419 <span class="label">ILL staff email: </span>
420 [% IF ( library.branchillemail ) %]
421 <a href="mailto:[% library.branchillemail | url %]">[% library.branchillemail | html %]</a>
425 <span class="label">Reply-To: </span>
426 [% IF ( library.branchreplyto ) %]
427 <a href="mailto:[% library.branchreplyto | url %]">[% library.branchreplyto | html %]</a>
431 <span class="label">Return-Path: </span>
432 [% library.branchreturnpath | html %]
435 <span class="label">SMTP server: </span>
436 [% smtp_server.name | html %]
439 <span class="label">URL: </span>
440 [% IF ( library.branchurl ) %]
441 <a href="[% library.branchurl | url %]" target="_blank">[% library.branchurl | html %]</a>
445 <span class="label">IP: </span>
446 [% library.branchip | html %]
449 <span class="label">MARC organization code</span>
450 [% library.marcorgcode | html %]
453 <span class="label">Notes: </span>
454 [% library.branchnotes | html %]
457 <span class="label">Pickup location: </span>
458 [% IF ( library.pickup_location ) %]
465 <span class="label">Public: </span>
466 [% IF ( library.public ) %]
473 </div> <!-- /.rows -->
474 </div> <!-- /.col-sm-6 -->
475 </div> <!-- /.row -->
476 [% IF OpacLibraryInfo %]<!-- opac_info -->
479 <div class="col-sm-12">
480 <h2>OPAC information</h2>
481 <div>[% OpacLibraryInfo.content | $raw %]</div>
485 [% ELSIF op == 'view' %]
486 <div>This library does not exist.</div>
490 </div> <!-- /.col-sm-10.col-sm-push-2 -->
492 <div class="col-sm-2 col-sm-pull-10">
494 [% INCLUDE 'admin-menu.inc' %]
496 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
497 </div> <!-- /.row -->
499 [% MACRO jsinclude BLOCK %]
500 [% Asset.js("js/admin-menu.js") | $raw %]
501 [% INCLUDE 'datatables.inc' %]
502 [% INCLUDE 'columns_settings.inc' %]
503 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
504 [% INCLUDE 'str/tinymce_i18n.inc' %]
506 var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
507 var saved_table = localStorage.getItem("DataTables_libraries_/cgi-bin/koha/admin/branches.pl");
508 var updated_settings = get_columns_saved_state(saved_table, table_settings);
510 $(document).ready(function() {
512 var libraries_url = '/api/v1/libraries';
513 var libraries = $("#libraries").kohaTable({
517 'embed': [ 'smtp_server' ],
518 '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>',
521 "targets": [0,1,3,4,7,9,10,11,12,13,14,15,16],
522 "render": function (data, type, row, meta) {
523 if ( type == 'display' ) {
524 if ( data != null ) {
525 return data.escapeHtml();
539 "render": function( data, type, row, meta ) {
540 return "<a href=\"/cgi-bin/koha/admin/branches.pl?op=view&branchcode=" + encodeURIComponent( row.library_id ) + "\">" + row.name.escapeHtml() + "</a>";
544 "data": "library_id",
549 "data": function( row, type, val, meta ) {
550 const library_info = [];
551 if ( row.address1 != null ) library_info.push(row.address1.escapeHtml());
552 if ( row.address2 != null ) library_info.push(row.address2.escapeHtml());
553 if ( row.address3 != null ) library_info.push(row.address3.escapeHtml());
554 // geographical_location = city, state postal_code
555 const locations = [];
556 if ( row.city != null ) locations.push(row.city.escapeHtml());
557 if ( row.state != null ) locations.push(row.state.escapeHtml());
558 const geographical_location = locations.join(', ');
559 if ( geographical_location != '' && row.postal_code != null) {
560 library_info.push(geographical_location+' '+row.postal_code.escapeHtml());
563 library_info.push(geographical_location);
565 if ( row.country != null ) library_info.push(row.country.escapeHtml());
566 if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml());
567 if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml());
568 if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>');
569 if ( row.url != null ) library_info.push('<a href="'+encodeURIComponent(row.url)+'">'+row.url.escapeHtml()+'</a>');
570 if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml());
571 return library_info.join('<br/>');
577 "data": "marc_org_code",
587 "data": "pickup_location",
590 "render": function( data, type, row, meta ) {
591 return (data) ? _("Yes") : _("No");
598 "render": function( data, type, row, meta ) {
599 return (data) ? _("Yes") : _("No");
603 "data": "smtp_server",
604 "render": function( data, type, row, meta ) {
605 if ( data.smtp_server_id ) {
606 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>';
617 "data": function( row, type, val, meta ) {
619 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>';
620 result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
621 result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n";
622 result += '<input type="hidden" name="op" value="delete_confirm" />';
623 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>';
662 "data": "postal_code",
674 "data": function( row, type, val, meta ) {
675 return ''; // provisional placeholder for opac_info
688 }, updated_settings);
691 $("#Aform").on("submit", function( event ) {
692 if ( $("#branchcode").val().match(/\s/) ) {
693 event.preventDefault();
694 alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
705 relative_urls : false,
706 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
707 menubar : "file edit view insert format tools table",
708 mode : "specific_textareas",
709 plugins : "autoresize table hr link image charmap lists code emoticons",
711 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
712 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
718 [% INCLUDE 'intranet-bottom.inc' %]