Bug 27936: Clarify AllowItemsOnHoldCheckoutSIP syspref help text
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / branches.tt
1 [% USE Koha %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% SET footerjs = 1 %]
5 [% USE TablesSettings %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Administration &rsaquo; Libraries
8 [% IF op == 'add_form' %]
9     &rsaquo;[% IF library %]Modify library[% ELSE %]New library [% library.branchcode | html %][% END %]
10 [% ELSIF op == 'delete_confirm' %]
11     &rsaquo; Confirm deletion of library '[% library.branchcode | html %]'
12 [% END %]
13 </title>
14 [% INCLUDE 'doc-head-close.inc' %]
15 </head>
16
17 <body id="admin_branches" class="admin">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'prefs-admin-search.inc' %]
20
21 <div id="breadcrumbs">
22     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
24 &rsaquo; <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
25 [% IF op == 'add_form'  %]
26 &rsaquo; [% IF library %]Modify library[% ELSE %]New library [% library.branchcode | html %][% END %]
27 [% ELSIF op == 'delete_confirm' %]
28 &rsaquo; Confirm deletion of library '[% library.branchcode | html %]'
29 [% END %]
30 </div>
31
32 <div class="main container-fluid">
33     <div class="row">
34         <div class="col-sm-10 col-sm-push-2">
35             <main>
36
37 [% FOREACH m IN messages %]
38     <div class="dialog [% m.type | html %]">
39         [% SWITCH m.code %]
40         [% CASE 'error_on_update' %]
41             An error occurred when updating this library. Perhaps it already exists.
42         [% CASE 'error_on_insert' %]
43             An error occurred when adding this library. The branchcode might already exist.
44         [% CASE 'error_on_delete' %]
45             An error occurred when deleting this library. Check the logs.
46         [% CASE 'success_on_update' %]
47             Library updated successfully.
48         [% CASE 'success_on_insert' %]
49             Library added successfully.
50         [% CASE 'success_on_delete' %]
51             Library deleted successfully.
52         [% CASE 'cannot_delete_library' %]
53             This library cannot be deleted. Patrons or items are still using it
54             [% IF m.data.patrons_count and m.data.items_count %]
55                 ([% m.data.patrons_count | html %] patrons and [% m.data.items_count | html %] items).
56             [% ELSIF m.data.patrons_count %]
57                 ([% m.data.patrons_count | html %] patrons).
58             [% ELSIF m.data.items_count %]
59                 ([% m.data.items_count | html %] items).
60             [% END %]
61         [% CASE 'error_on_update_category' %]
62             An error occurred when updating this library category. Perhaps it already exists.
63         [% CASE 'error_on_insert_category' %]
64             An error occurred when adding this library category. The categorycode might already exist.
65         [% CASE 'error_on_delete_category' %]
66             An error occurred when deleting this library category. Check the logs.
67         [% CASE 'success_on_update_category' %]
68             Library category updated successfully.
69         [% CASE 'success_on_insert_category' %]
70             Library category added successfully.
71         [% CASE 'success_on_delete_category' %]
72             Library category deleted successfully.
73         [% CASE 'cannot_delete_category' %]
74             This library category cannot be deleted. [% m.data.libraries_count | html %] libraries are still using it.
75         [% CASE %]
76             [% m.code | html %]
77         [% END %]
78     </div>
79 [% END %]
80
81 [% IF op == 'list' %]
82     <div id="toolbar" class="btn-toolbar">
83         <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>
84     </div>
85 [% END %]
86
87 [% IF op == 'add_form' %]
88     <h3>[% IF library %]Modify library[% ELSE %]New library[% END %]</h3>
89     <form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
90         <fieldset class="rows">
91             <input type="hidden" name="op" value="add_validate" />
92             [% IF library %]
93                 <input type="hidden" name="is_a_modif" value="1" />
94             [% END %]
95             <ol>
96                 <li>
97                     [% IF library %]
98                         <span class="label">Library code: </span>
99                         <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
100                         [% library.branchcode | html %]
101                     [% ELSE %]
102                         <label for="branchcode" class="required">Library code: </label>
103                         <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode | html %]" class="required" required="required" />
104                         <span class="required">Required</span>
105                     [% END %]
106                 </li>
107                 <li>
108                     <label for="branchname" class="required">Name: </label>
109                     <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required" required="required" />
110                     <span class="required">Required</span>
111                 </li>
112             </ol>
113         </fieldset>
114         [% IF categories %]
115             <fieldset class="rows"><legend>Group(s):</legend>
116                 <ol>
117                     [% FOREACH category IN categories %]
118                         <li>
119                             <label for="[% category.categorycode | html %]">[% category.categoryname | html %]: </label>
120                             [% IF category and selected_categorycodes.grep(category.categorycode).size %]
121                                 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" checked="checked" />
122                             [% ELSE %]
123                                 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" />
124                             [% END %]
125                             <div class="hint">[% category.codedescription | html %]</div>
126                         </li>
127                     [% END %]
128                 </ol>
129             </fieldset>
130         [% END %]
131         <fieldset class="rows">
132             <ol>
133                 <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% library.branchaddress1 | html %]" /></li>
134                 <li><label for="branchaddress2">Address line 2: </label><input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% library.branchaddress2 | html %]" /></li>
135                 <li><label for="branchaddress3">Address line 3: </label><input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% library.branchaddress3 | html %]" /></li>
136                 <li><label for="branchcity">City: </label><input type="text" name="branchcity" id="branchcity" size="60" value="[% library.branchcity | html %]" /></li>
137                 <li><label for="branchstate">State: </label><input type="text" name="branchstate" id="branchstate" size="60" value="[% library.branchstate | html %]" /></li>
138                 <li><label for="branchzip">ZIP/Postal code: </label><input type="text" name="branchzip" id="branchzip"  size="25" maxlength="25" value="[% library.branchzip | html %]" /></li>
139                 <li><label for="branchcountry">Country: </label><input type="text" name="branchcountry" id="branchcountry" size="60" value="[% library.branchcountry | html %]" /></li>
140                 <li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone | html %]" /></li>
141                 <li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax | html %]" /></li>
142                 <li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email"  size="80" value="[% library.branchemail | html %]" /></li>
143                 [% IF (Koha.Preference('ILLModule')) %]
144                 <li>
145                     <label for="branchillemail">ILL staff email: </label>
146                     <input type="text" name="branchillemail" id="branchillemail" class="email"  size="80" value="[% library.branchillemail | html %]" />
147                     <div class="hint">
148                         [% IF ( CAN_user_parameters_manage_sysprefs ) %]
149                             Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ILLDefaultStaffEmail">ILLDefaultStaffEmail</a> system preference
150                         [% ELSE %]
151                             Default: ILLDefaultStaffEmail system preference
152                         [% END %]
153                     </div>
154                 </li>
155                 [% END %]
156                 <li>
157                     <label for="branchreplyto">Reply-To: </label>
158                     <input type="text" name="branchreplyto" id="branchreplyto" class="email"  size="80" value="[% library.branchreplyto | html %]" />
159                     <div class="hint">
160                          [% IF ( CAN_user_parameters_manage_sysprefs ) %]
161                             Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ReplyToDefault">ReplyToDefault</a> system preference
162                         [% ELSE %]
163                             Default: ReplyToDefault system preference
164                         [% END %]
165                     </div>
166                 </li>
167                 <li>
168                     <label for="branchreturnpath">Return-Path: </label>
169                     <input type="text" name="branchreturnpath" id="branchreturnpath" class="email"  size="80" value="[% library.branchreturnpath | html %]" />
170                     <div class="hint">
171                          [% IF ( CAN_user_parameters_manage_sysprefs ) %]
172                             Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ReturnpathDefault">ReturnpathDefault</a> system preference
173                         [% ELSE %]
174                             Default: ReturnpathDefault system preference
175                         [% END %]
176                     </div>
177                 </li>
178                 <li><label for="smtp_server">SMTP server: </label>
179                     <select name="smtp_server" id="smtp_server">
180                     [% IF selected_smtp_server.is_system_default %]
181                         <option value="*" selected="selected">Default</option>
182                     [% ELSE %]
183                         <option value="*">Default</option>
184                     [% END %]
185                     [% FOREACH smtp_server IN smtp_servers %]
186                         [% IF smtp_server.id == selected_smtp_server.id %]
187                             <option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option>
188                         [% ELSE %]
189                             <option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option>
190                         [% END %]
191                     [% END %]
192                     </select>
193                 </li>
194                 <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl"  size="80" value="[% library.branchurl | html %]" class="url" /></li>
195                 <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% library.opac_info | $raw %]</textarea></li>
196                 <li>
197                     <label for="branchip">IP: </label>
198                     <input type="text" name="branchip" id="branchip"  size="15" maxlength="15" value="[% library.branchip | html %]" />
199                     <div class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</div>
200                 </li>
201                 <li>
202                     <label for="marcorgcode">MARC organization code</label>
203                     <input type="text" name="marcorgcode" id="marcorgcode" size="16" value="[% library.marcorgcode | html %]" />
204                     <div class="hint">
205                         [% IF ( CAN_user_parameters_manage_sysprefs ) %]
206                             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>.
207                         [% ELSE %]
208                             If not filled in defaults to system preference MARCOrgCode.
209                         [% END %]
210                         You can obtain your code from <a href="http://www.loc.gov/marc/organizations/orgshome.html" target="_blank">Library of Congress</a>.
211                     </div>
212                 </li>
213                 <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" size="80" value="[% library.branchnotes | html %]" /></li>
214                 <li><label for="pickup_location">Pickup location: </label>
215                     <select name="pickup_location" id="pickup_location">
216                         [% IF !library || library.pickup_location == 1 %]
217                         <option value="1" selected="selected">Yes</option>
218                         <option value="0">No</option>
219                         [% ELSE %]
220                         <option value="1">Yes</option>
221                         <option value="0" selected="selected">No</option>
222                         [% END %]
223                     </select>
224                 </li>
225             </ol>
226         </fieldset>
227         <fieldset class="action">
228             <input type="submit" value="Submit" />
229             <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
230         </fieldset>
231     </form>
232 [% END %]
233
234 [% IF op == 'delete_confirm' and not ( items_count or patrons_count )%]
235     <div class="dialog alert">
236         <form action="/cgi-bin/koha/admin/branches.pl" method="post">
237             <h3>Are you sure you want to delete [% library.branchname | html %] ([% library.branchcode | html %])?</h3>
238             <input type="hidden" name="op" value="delete_confirmed" />
239             <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
240             <input type="hidden" name="branchname" value="[% library.branchname | html %]">
241             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
242         </form>
243         <form action="/cgi-bin/koha/admin/branches.pl" method="get">
244             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
245         </form>
246     </div>
247 [% END %]
248
249 [% IF op == 'list' %]
250     <h3>Libraries</h3>
251     [% IF libraries_count > 0 %]
252         <table id="libraries">
253             <thead>
254                 <tr>
255                     <th>Name</th>
256                     <th>Code</th>
257                     <th>Address</th>
258                     <th>MARC organization code</th>
259                     <th>IP</th>
260                     <th>Pickup location</th>
261                     <th>SMTP server</th>
262                     <th data-class-name="actions noExport">Actions</th>
263                 </tr>
264             </thead>
265         </table>
266     [% ELSE %]
267         <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>
268     [% END %]
269 [% END %]
270
271             </main>
272         </div> <!-- /.col-sm-10.col-sm-push-2 -->
273
274         <div class="col-sm-2 col-sm-pull-10">
275             <aside>
276                 [% INCLUDE 'admin-menu.inc' %]
277             </aside>
278         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
279      </div> <!-- /.row -->
280
281 [% MACRO jsinclude BLOCK %]
282     [% Asset.js("js/admin-menu.js") | $raw %]
283     [% INCLUDE 'datatables.inc' %]
284     [% INCLUDE 'columns_settings.inc' %]
285     [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
286     [% INCLUDE 'str/tinymce_i18n.inc' %]
287     <script>
288         var columns_settings = [% TablesSettings.GetColumns( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
289         $(document).ready(function() {
290
291             var libraries_url = '/api/v1/libraries';
292             var libraries = $("#libraries").api({
293                 "ajax": {
294                     "url": libraries_url
295                 },
296                 'embed': [ 'smtp_server' ],
297                 '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>',
298                 "columnDefs": [ {
299                     "targets": [0,1,3,4,6,8,9,10,11,12,13,14,15],
300                     "render": function (data, type, row, meta) {
301                         if ( type == 'display' ) {
302                             if ( data != null ) {
303                                 return data.escapeHtml();
304                             }
305                             else {
306                                 return "";
307                             }
308                         }
309                         return data;
310                     }
311                 } ],
312                 "columns": [
313                     {
314                         "data": "name",
315                         "searchable": true,
316                         "orderable": true
317                     },
318                     {
319                         "data": "library_id",
320                         "searchable": true,
321                         "orderable": true
322                     },
323                     {
324                         "data": function( row, type, val, meta ) {
325                             const library_info = [];
326                             if ( row.address1 != null ) library_info.push(row.address1.escapeHtml());
327                             if ( row.address2 != null ) library_info.push(row.address2.escapeHtml());
328                             if ( row.address3 != null ) library_info.push(row.address3.escapeHtml());
329                             // geographical_location = city, state postal_code
330                             const locations = [];
331                             if ( row.city != null ) locations.push(row.city.escapeHtml());
332                             if ( row.state != null ) locations.push(row.state.escapeHtml());
333                             const geographical_location = locations.join(', ');
334                             if ( geographical_location != '' && row.postal_code != null) {
335                                 library_info.push(geographical_location+' '+row.postal_code.escapeHtml());
336                             }
337                             else {
338                                 library_info.push(geographical_location);
339                             }
340                             if ( row.country != null ) library_info.push(row.country.escapeHtml());
341                             if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml());
342                             if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml());
343                             if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>');
344                             if ( row.url != null ) library_info.push('<a href="'+encodeURIComponent(row.url)+'">'+row.url.escapeHtml()+'</a>');
345                             if ( row.opac_info != null ) library_info.push(_("OPAC Info") + ': <div>'+row.opac_info.escapeHtml()+'</div>');
346                             if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml());
347                             return library_info.join('<br/>');
348                         },
349                         "searchable": false,
350                         "orderable": false
351                     },
352                     {
353                         "data": "marc_org_code",
354                         "searchable": true,
355                         "orderable": true
356                     },
357                     {
358                         "data": "ip",
359                         "searchable": true,
360                         "orderable": true
361                     },
362                     {
363                         "data": "pickup_location",
364                         "searchable": true,
365                         "orderable": true,
366                         "render": function( data, type, row, meta ) {
367                             return (data) ? _("Yes") : _("No");
368                         }
369                     },
370                     {
371                         "data": "smtp_server",
372                         "render": function( data, type, row, meta ) {
373                             if ( data.smtp_server_id ) {
374                                 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>';
375                             }
376                             else {
377                                 return _("Default");
378                             }
379                         },
380                         "searchable": false,
381                         "visible": true,
382                         "orderable": false
383                     },
384                     {
385                         "data": function( row, type, val, meta ) {
386
387                             var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode='+encodeURIComponent(row.library_id)+'" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
388                             result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
389                             result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n";
390                             result += '<input type="hidden" name="op" value="delete_confirm" />';
391                             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>';
392
393                             return result;
394
395                         },
396                         "searchable": false,
397                         "orderable": false
398                     },
399                     {
400                         "data": "address1",
401                         "searchable": true,
402                         "visible": false,
403                         "orderable": false
404                     },
405                     {
406                         "data": "address2",
407                         "searchable": true,
408                         "visible": false,
409                         "orderable": false
410                     },
411                     {
412                         "data": "address3",
413                         "searchable": true,
414                         "visible": false,
415                         "orderable": false
416                     },
417                     {
418                         "data": "city",
419                         "searchable": true,
420                         "visible": false,
421                         "orderable": false
422                     },
423                     {
424                         "data": "state",
425                         "searchable": true,
426                         "visible": false,
427                         "orderable": false
428                     },
429                     {
430                         "data": "postal_code",
431                         "searchable": true,
432                         "visible": false,
433                         "orderable": false
434                     },
435                     {
436                         "data": "country",
437                         "searchable": true,
438                         "visible": false,
439                         "orderable": false
440                     },
441                     {
442                         "data": "opac_info",
443                         "searchable": true,
444                         "visible": false,
445                         "orderable": false
446                     },
447                     {
448                         "data": "notes",
449                         "searchable": true,
450                         "visible": false,
451                         "orderable": false
452                     }
453                 ]
454             }, columns_settings);
455
456             [% UNLESS library %]
457                 $("#Aform").on("submit", function( event ) {
458                     if ( $("#branchcode").val().match(/\s/) ) {
459                         event.preventDefault();
460                         alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
461                         return false;
462                     } else {
463                         return true;
464                     }
465                 });
466             [% END %]
467         });
468
469         tinyMCE.init({
470             branding : false,
471             relative_urls : false,
472             content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
473             menubar : "file edit view insert format tools table",
474             mode : "specific_textareas",
475             plugins : "autoresize table hr link image charmap lists code emoticons",
476             toolbar : [
477                 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
478                 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
479             ],
480         });
481     </script>
482 [% END %]
483
484 [% INCLUDE 'intranet-bottom.inc' %]