3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Tools › Notices[% IF ( add_form or copy_form ) %][% IF ( modify ) %] › Modify notice[% ELSE %] › Add notice[% END %][% END %][% IF ( add_validate or copy_validate) %] › Notice added[% END %][% IF ( delete_confirm ) %] › Confirm deletion[% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
7 [% INCLUDE 'datatables.inc' %]
8 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.insertatcaret.js"></script>
9 <script type="text/javascript">
11 $(document).ready(function() {
12 $("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, {
15 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'nosort' ] }
20 $('#branch').change(function() {
22 $('#selectlibrary').submit();
24 $('#newnotice').click(function() {
25 $('#op').val("add_form");
30 $("#newmodule").on("change",function(){
31 if( $("#branch").val() == ""){
34 var branchcode = $("#branch").val();
36 window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
39 $("#submit_form").click( function(event) {
40 event.preventDefault();
41 var at_least_one_exists = 0;
43 $("fieldset.mtt").each( function(){
44 var title = $(this).find('input[name="title"]').val();
45 var content = $(this).find('textarea[name="content"]').val();
47 ( title.length == 0 && content.length > 0 )
48 || ( title.length > 0 && content.length == 0 )
50 var mtt = $(this).find('input[name="message_transport_type"]').val();
51 var msg = _("Please specify title and content for %s");
52 msg = msg.replace( "%s", mtt );
53 at_least_one_exists = 1;
55 return are_valid = false;
56 } else if ( title.length > 0 && content.length > 0 ) {
57 at_least_one_exists = 1;
60 if ( ! at_least_one_exists ) {
61 alert( _("Please fill at least one template.") );
68 // Test if code already exists in DB
69 var new_lettercode = $("#code").val();
70 var new_branchcode = $("#branch").val();
71 [% IF ( add_form and code ) # IF edit %]
72 if ( new_lettercode != '[% code %]' ) {
75 data: { code: new_lettercode, branchcode: new_branchcode },
77 url: '/cgi-bin/koha/svc/letters/',
78 success: function (data) {
79 if ( data.letters.length > 0 ) {
80 if( new_branchcode == '' ) {
81 alert( _("A default letter with the code '%s' already exists.").format(new_lettercode) );
83 alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) );
87 $("#add_notice").submit();
91 [% IF ( add_form and code ) %]
93 $("#add_notice").submit();
99 $("#content_sms").on("keyup", function(){
100 var length = $(this).val().length;
101 $("#sms_counter").html(length + "/" + sms_limit + _(" characters"));
102 if ( length > sms_limit ) {
103 $("#sms_counter").css("color", "red");
105 $("#sms_counter").css("color", "black");
108 $( ".transport-types" ).accordion({ collapsible: true, active:false, animate: 200 });
109 $(".insert").on("click",function(){
110 var containerid = $(this).data("containerid");
111 insertValueQuery( containerid );
116 [% IF add_form or copy_form %]
124 function isNotNull(f,noalert) {
125 if (f.value.length ==0) {
131 function isNum(v,maybenull) {
132 var n = new Number(v.value);
136 if (maybenull==0 && v.value=='') {
141 function insertValueQuery(containerid) {
142 var fieldset = $("#" + containerid);
143 var myQuery = $(fieldset).find('textarea[name="content"]');
144 var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
146 if($(myListBox).find('option').length > 0) {
147 $(myListBox).find('option').each( function (){
148 if ( $(this).attr('selected') && $(this).val().length > 0 ) {
149 $(myQuery).insertAtCaret("<<" + $(this).val() + ">>");
158 <body id="tools_letter" class="tools">
159 [% INCLUDE 'header.inc' %]
160 [% INCLUDE 'letters-search.inc' %]
162 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( add_form or copy_form) %][% IF ( modify ) %]<a href="/cgi-bin/koha/tools/letter.pl">Notices & Slips</a> › Modify notice[% ELSE %] <a href="/cgi-bin/koha/tools/letter.pl">Notices & Slips</a> › Add notice[% END %][% ELSE %][% IF ( add_validate or copy_validate) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices & Slips</a> › Notice added[% ELSE %][% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices & Slips</a> › Confirm deletion[% ELSE %]Notices & Slips[% END %][% END %][% END %]</div>
164 [% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
170 [% IF ( no_op_set ) %]
171 <h1>Notices and Slips</h1>
172 <form method="get" action="/cgi-bin/koha/tools/letter.pl" id="selectlibrary">
173 <input type="hidden" name="searchfield" value="[% searchfield %]" />
174 [% UNLESS independant_branch %]
177 <select name="branchcode" id="branch" style="width:20em;">
178 <option value="*">All libraries</option>
179 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
183 <div id="toolbar" class="btn-toolbar">
184 <button type="submit" class="btn btn-default btn-sm" id="newnotice"><i class="fa fa-plus"></i> New notice</button>
185 <input type="hidden" id="op" name="op" />
190 <p>You searched for <b>[% searchfield %]</b></p>
192 [% IF ( letter && !independant_branch) %]
193 [% select_for_copy = BLOCK %]
194 <select name="branchcode">
195 [% FOREACH l IN Branches.all() %]
196 <option value="[% l.branchcode %]">Copy to [% l.branchname %]</option>
209 <th class="nosort">Copy notice</th>
210 <th class="nosort">Actions</th>
214 [% FOREACH lette IN letter %]
215 [% can_edit = lette.branchcode || !independant_branch %]
217 <td>[% IF lette.branchname %][% lette.branchname %][% ELSE %](All libraries)[% END %]</td>
218 <td>[% lette.module %]</td>
219 <td>[% lette.code %]</td>
220 <td>[% lette.name %]</td>
222 [% IF !independant_branch || !lette.branchcode %]
223 <form method="post" action="/cgi-bin/koha/tools/letter.pl">
224 <input type="hidden" name="op" value="copy_form" />
225 <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
226 <input type="hidden" name="module" value="[% lette.module %]" />
227 <input type="hidden" name="code" value="[% lette.code %]" />
228 [% IF independant_branch %]
229 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
231 [% select_for_copy %]
233 <button class="btn btn-default btn-xs"><i class="fa fa-clone"></i> Copy</button>
239 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=[% lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]"><i class="fa fa-pencil"></i> Edit</a>
241 [% IF !lette.protected && can_edit %]
242 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&branchcode=[%lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]"><i class="fa fa-trash"></i> Delete</a>
250 <div class="dialog message">
251 [% IF ( branchcode ) %]
252 <p>There are no notices for this library.</p>
254 <p>There are no notices.</p>
261 [% IF add_form or copy_form %]
262 <h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1>
263 <form id="add_notice" name="Aform" method="post" enctype="multipart/form-data" class="validate">
265 <input type="hidden" name="op" id="op" value="add_validate" />
267 <input type="hidden" name="op" id="op" value="copy_validate" />
270 <input type="hidden" name="checked" value="0" />
272 <input type="hidden" name="add" value="0" />
274 <input type="hidden" name="add" value="1" />
276 <fieldset class="rows">
277 <input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" />
279 [% IF independant_branch %]
280 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
285 <label for="branch">Library:</label>
286 <select name="branchcode" id="branch" style="width:20em;">
287 <option value="">All libraries</option>
288 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
291 <span class="label">Library:</span>
292 <input type="hidden" id="branch" name="branchcode" value="[% branchcode %]" />
293 [% IF ( branchcode ) %]
294 [% Branches.GetName( branchcode ) %]
302 <label for="module">Koha module:</label>
303 <input type="hidden" name="oldmodule" value="[% module %]" />
305 <select name="module" id="newmodule">
307 <select name="module" id="module">
309 [% IF ( module == "acquisition" ) %]
310 <option value="acquisition" selected="selected">Acquisition</option>
312 <option value="acquisition" >Acquisition</option>
314 [% IF ( module == "catalogue" ) %]
315 <option value="catalogue" selected="selected">Catalog</option>
317 <option value="catalogue" >Catalog</option>
319 [% IF ( module == "circulation" ) %]
320 <option value="circulation" selected="selected">Circulation</option>
322 <option value="circulation">Circulation</option>
324 [% IF ( module == "orderacquisition" ) %]
325 <option value="orderacquisition" selected="selected">Order acquisition</option>
327 <option value="orderacquisition">Order acquisition</option>
329 [% IF ( module == "claimacquisition" ) %]
330 <option value="claimacquisition" selected="selected">Claim acquisition</option>
332 <option value="claimacquisition">Claim acquisition</option>
334 [% IF ( module == "claimissues" ) %]
335 <option value="claimissues" selected="selected">Claim serial issue</option>
337 <option value="claimissues">Claim serial issue</option>
339 [% IF ( module == "reserves" ) %]
340 <option value="reserves" selected="selected">Holds</option>
342 <option value="reserves">Holds</option>
344 [% IF ( module == "members" ) %]
345 <option value="members" selected="selected">Members</option>
347 <option value="members">Members</option>
349 [% IF ( module == "serial" ) %]
350 <option value="serial" selected="selected">Serials (routing list)</option>
352 <option value="serial">Serials (routing list)</option>
354 [% IF ( module == "suggestions" ) %]
355 <option value="suggestions" selected="selected">Suggestions</option>
357 <option value="suggestions">Suggestions</option>
363 <label for="code" class="required">Code:</label>
364 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
365 <span class="required">Required</span>
367 <span class="label">Code:</span>
368 <input type="hidden" id="code" name="code" value="[% code %]" />
373 <label for="name" class="required">Name:</label>
374 <input type="text" id="name" name="name" size="60" value="[% letter_name %]" required="required" />
375 <span class="required">Required</span>
379 [% IF Koha.Preference('TranslateNotices') %]
380 <div style="clear:both"></div>
383 <li><a href="#lang_default">Default</a></li>
384 [% FOR language IN languages %]
385 [% FOR sublanguage IN language.sublanguages_loop %]
386 [% IF language.plural %]
387 <li><a href="#lang_[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</a></li>
389 <li><a href="#lang_[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</a></li>
396 [% FOREACH lang IN letters.keys %]
397 <div id="lang_[% lang %]">
398 <div class="transport-types" style="clear:both">
399 [% FOR mtt IN letters.$lang.templates.keys.sort %]
400 [% SET letter = letters.$lang.templates.$mtt %]
402 [% SWITCH letter.message_transport_type %]
414 [% letter.message_transport_type %]
417 [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %]
418 <fieldset class="rows mtt" id="[% letter.message_transport_type %]_[% lang %]" disabled="disabled">
419 <div class="dialog message">You should enable the SMSSendDriver preference to use the SMS templates.</div>
420 [% ELSIF letter.message_transport_type == "phone" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
421 <fieldset class="rows mtt" id="[% letter.message_transport_type %]_[% lang %]" disabled="disabled">
422 <div class="dialog message">You should enable the TalkingTechItivaPhoneNotification preference to use the phone templates.</div>
424 <fieldset class="rows mtt" id="[% letter.message_transport_type %]_[% lang %]">
428 <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type %]" />
429 <input type="hidden" name="lang" value="[% lang %]" />
430 <label for="is_html_[% letter.message_transport_type %]">HTML message:</label>
431 [% IF letter.is_html %]
432 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" checked="checked" />
434 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" />
438 <label for="title_[% letter.message_transport_type %]">Message subject:</label><input type="text" id="title_[% letter.message_transport_type %]" name="title" size="60" value="[% letter.title %]" />
441 <label for="SQLfieldname_[% letter.message_transport_type %]">Message body:</label>
442 [% IF letter.message_transport_type == 'sms' %]
443 <span id="sms_counter">[% IF letter.content && letter.content.length > 0 %][% letter.content.length %][% ELSE %]0[% END %]/160 characters</span>
448 <select name="SQLfieldname" id="SQLfieldname_[% letter.message_transport_type %]" multiple="multiple" size="9">
449 [% FOREACH SQLfieldname IN SQLfieldnames %]
450 <option value="[% SQLfieldname.value %]">[% SQLfieldname.text %]</option>
455 <button type="button" data-containerid="[% letter.message_transport_type %]_[% lang %]" class="btn btn-default btn-sm insert">Insert <i class="fa fa-long-arrow-right"></i></button>
457 <td><textarea name="content" id="content_[% letter.message_transport_type %]" cols="80" rows="15">[% letter.content %]</textarea></td>
465 </div> <!-- / #transport-types -->
467 [% IF Koha.Preference('TranslateNotices') %]
471 [% IF code.search('DGST') %] <span class="overdue">Warning, this is a template for a Digest, as such, any references to branch data ( e.g. branches.branchname ) will refer to the borrower's home branch.</span> [% END %]
472 <fieldset class="action"><input type="submit" id="submit_form" value="Submit" class="button" /> <a class="cancel" href="/cgi-bin/koha/tools/letter.pl">Cancel</a></fieldset>
473 <input type="hidden" name="searchfield" value="[% searchfield %]" />
477 [% IF ( add_validate or copy_validate) %]
479 <form action="[% action %]" method="post">
480 <input type="submit" value="OK" />
484 [% IF ( delete_confirm ) %]
485 <div class="dialog alert">
486 <h3>Delete notice?</h3>
497 <td>[% IF letter.branchcode %][% Branches.GetName( letter.branchcode ) %][% ELSE %](All libraries)[% END %]</td>
498 <td>[% letter.module %]</td>
499 <td>[% letter.code %]</td>
500 <td>[% letter.name %]</td>
503 <form action="[% action %]" method="post">
504 <input type="hidden" name="op" value="delete_confirmed">
505 <input type="hidden" name="branchcode" value="[% letter.branchcode %]" />
506 <input type="hidden" name="code" value="[% letter.code %]" />
507 <input type="hidden" name="module" value="[% letter.module %]" />
508 <button type="submit" class="approve"><i class="fa fa-check"></i> Yes, delete</button>
511 <form action="[% action %]" method="get">
512 <button type="submit" class="deny"><i class="fa fa-times"></i> No, do not delete</button>
517 [% IF ( delete_confirmed ) %]
519 <form action="[% action %]" method="post">
520 <input type="submit" value="OK" />
526 [% UNLESS add_form or copy_form %]
527 <div class="yui-b noprint">
528 [% INCLUDE 'tools-menu.inc' %]
532 [% INCLUDE 'intranet-bottom.inc' %]