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">Home</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 <div class="page-section">
333 <table id="libraries">
339 <th>MARC organization code</th>
341 <th>Pickup location</th>
344 <th data-class-name="actions noExport">Actions</th>
350 <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>
354 [% IF op == 'view' && library %]
355 <h1>[% library.branchname | html %]</h1>
356 <div class="row page-section">
357 <div class="col-sm-6">
361 <span class="label">Library code: </span>
362 [% library.branchcode | html %]
365 <span class="label">Name: </span>
366 [% library.branchname | html %]
369 <span class="label">Category:</span>
370 [% category.categoryname | html %]
373 <span class="label">Address line 1: </span>
374 [% library.branchaddress1 | html %]
377 <span class="label">Address line 2: </span>
378 [% library.branchaddress2 | html %]
381 <span class="label">Address line 3: </span>
382 [% library.branchaddress3 | html %]
385 <span class="label">City: </span>
386 [% library.branchcity | html %]
389 <span class="label">State: </span>
390 [% library.branchstate | html %]
393 <span class="label">ZIP/Postal code: </span>
394 [% library.branchzip | html %]
397 <span class="label">Country: </span>
398 [% library.branchcountry | html %]
401 <span class="label">Phone: </span>
402 [% library.branchphone | html %]
405 <span class="label">Fax: </span>
406 [% library.branchfax | html %]
411 <div class="col-sm-6">
415 <span class="label">Email: </span>
416 [% IF ( library.branchemail ) %]
417 <a href="mailto:[% library.branchemail | url %]">[% library.branchemail | html %]</a>
421 <span class="label">ILL staff email: </span>
422 [% IF ( library.branchillemail ) %]
423 <a href="mailto:[% library.branchillemail | url %]">[% library.branchillemail | html %]</a>
427 <span class="label">Reply-To: </span>
428 [% IF ( library.branchreplyto ) %]
429 <a href="mailto:[% library.branchreplyto | url %]">[% library.branchreplyto | html %]</a>
433 <span class="label">Return-Path: </span>
434 [% library.branchreturnpath | html %]
437 <span class="label">SMTP server: </span>
438 [% smtp_server.name | html %]
441 <span class="label">URL: </span>
442 [% IF ( library.branchurl ) %]
443 <a href="[% library.branchurl | url %]" target="_blank">[% library.branchurl | html %]</a>
447 <span class="label">IP: </span>
448 [% library.branchip | html %]
451 <span class="label">MARC organization code</span>
452 [% library.marcorgcode | html %]
455 <span class="label">Notes: </span>
456 [% library.branchnotes | html %]
459 <span class="label">Pickup location: </span>
460 [% IF ( library.pickup_location ) %]
467 <span class="label">Public: </span>
468 [% IF ( library.public ) %]
475 </div> <!-- /.rows -->
476 </div> <!-- /.col-sm-6 -->
477 </div> <!-- /.row -->
478 [% IF OpacLibraryInfo %]<!-- opac_info -->
479 <div class="row page-section">
480 <div class="col-sm-12">
481 <h2>OPAC information</h2>
482 <div>[% OpacLibraryInfo.content | $raw %]</div>
486 [% ELSIF op == 'view' %]
487 <div>This library does not exist.</div>
491 </div> <!-- /.col-sm-10.col-sm-push-2 -->
493 <div class="col-sm-2 col-sm-pull-10">
495 [% INCLUDE 'admin-menu.inc' %]
497 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
498 </div> <!-- /.row -->
500 [% MACRO jsinclude BLOCK %]
501 [% Asset.js("js/admin-menu.js") | $raw %]
502 [% INCLUDE 'datatables.inc' %]
503 [% INCLUDE 'columns_settings.inc' %]
504 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
505 [% INCLUDE 'str/tinymce_i18n.inc' %]
507 var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
508 var saved_table = localStorage.getItem("DataTables_libraries_/cgi-bin/koha/admin/branches.pl");
509 var updated_settings = get_columns_saved_state(saved_table, table_settings);
511 $(document).ready(function() {
513 var libraries_url = '/api/v1/libraries';
514 var libraries = $("#libraries").kohaTable({
518 'embed': [ 'smtp_server' ],
519 '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>',
522 "targets": [0,1,3,4,7,9,10,11,12,13,14,15,16],
523 "render": function (data, type, row, meta) {
524 if ( type == 'display' ) {
525 if ( data != null ) {
526 return data.escapeHtml();
540 "render": function( data, type, row, meta ) {
541 return "<a href=\"/cgi-bin/koha/admin/branches.pl?op=view&branchcode=" + encodeURIComponent( row.library_id ) + "\">" + row.name.escapeHtml() + "</a>";
545 "data": "library_id",
550 "data": function( row, type, val, meta ) {
551 const library_info = [];
552 if ( row.address1 != null ) library_info.push(row.address1.escapeHtml());
553 if ( row.address2 != null ) library_info.push(row.address2.escapeHtml());
554 if ( row.address3 != null ) library_info.push(row.address3.escapeHtml());
555 // geographical_location = city, state postal_code
556 const locations = [];
557 if ( row.city != null ) locations.push(row.city.escapeHtml());
558 if ( row.state != null ) locations.push(row.state.escapeHtml());
559 const geographical_location = locations.join(', ');
560 if ( geographical_location != '' && row.postal_code != null) {
561 library_info.push(geographical_location+' '+row.postal_code.escapeHtml());
564 library_info.push(geographical_location);
566 if ( row.country != null ) library_info.push(row.country.escapeHtml());
567 if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml());
568 if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml());
569 if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>');
570 if ( row.url != null ) library_info.push('<a href="'+encodeURIComponent(row.url)+'">'+row.url.escapeHtml()+'</a>');
571 if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml());
572 return library_info.join('<br/>');
578 "data": "marc_org_code",
588 "data": "pickup_location",
591 "render": function( data, type, row, meta ) {
592 return (data) ? _("Yes") : _("No");
599 "render": function( data, type, row, meta ) {
600 return (data) ? _("Yes") : _("No");
604 "data": "smtp_server",
605 "render": function( data, type, row, meta ) {
606 if ( data.smtp_server_id ) {
607 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>';
618 "data": function( row, type, val, meta ) {
620 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>';
621 result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
622 result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n";
623 result += '<input type="hidden" name="op" value="delete_confirm" />';
624 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>';
663 "data": "postal_code",
675 "data": function( row, type, val, meta ) {
676 return ''; // provisional placeholder for opac_info
689 }, updated_settings);
692 $("#Aform").on("submit", function( event ) {
693 if ( $("#branchcode").val().match(/\s/) ) {
694 event.preventDefault();
695 alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
706 relative_urls : false,
707 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
708 menubar : "file edit view insert format tools table",
709 mode : "specific_textareas",
710 plugins : "autoresize table hr link image charmap lists code emoticons",
712 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
713 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
719 [% INCLUDE 'intranet-bottom.inc' %]