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 );
114 [% IF add_form or copy_form %]
122 function isNotNull(f,noalert) {
123 if (f.value.length ==0) {
129 function isNum(v,maybenull) {
130 var n = new Number(v.value);
134 if (maybenull==0 && v.value=='') {
139 function insertValueQuery(mtt_id) {
140 var fieldset = $("#" + mtt_id);
141 var myQuery = $(fieldset).find('textarea[name="content"]');
142 var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
144 if($(myListBox).find('option').length > 0) {
145 $(myListBox).find('option').each( function (){
146 if ( $(this).attr('selected') && $(this).val().length > 0 ) {
147 $(myQuery).insertAtCaret("<<" + $(this).val() + ">>");
156 <body id="tools_letter" class="tools">
157 [% INCLUDE 'header.inc' %]
158 [% INCLUDE 'letters-search.inc' %]
160 <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>
162 [% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
168 [% IF ( no_op_set ) %]
169 <h1>Notices and Slips</h1>
170 <form method="get" action="/cgi-bin/koha/tools/letter.pl" id="selectlibrary">
171 <input type="hidden" name="searchfield" value="[% searchfield %]" />
172 [% UNLESS independant_branch %]
175 <select name="branchcode" id="branch" style="width:20em;">
176 <option value="*">All libraries</option>
177 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
181 <div id="toolbar" class="btn-toolbar">
182 <button type="submit" class="btn btn-default btn-sm" id="newnotice"><i class="fa fa-plus"></i> New notice</button>
183 <input type="hidden" id="op" name="op" />
188 <p>You searched for <b>[% searchfield %]</b></p>
190 [% IF ( letter && !independant_branch) %]
191 [% select_for_copy = BLOCK %]
192 <select name="branchcode">
193 [% FOREACH l IN Branches.all() %]
194 <option value="[% l.branchcode %]">Copy to [% l.branchname %]</option>
207 <th class="nosort">Copy notice</th>
208 <th class="nosort">Actions</th>
212 [% FOREACH lette IN letter %]
213 [% can_edit = lette.branchcode || !independant_branch %]
215 <td>[% IF lette.branchname %][% lette.branchname %][% ELSE %](All libraries)[% END %]</td>
216 <td>[% lette.module %]</td>
217 <td>[% lette.code %]</td>
218 <td>[% lette.name %]</td>
220 [% IF !independant_branch || !lette.branchcode %]
221 <form method="post" action="/cgi-bin/koha/tools/letter.pl">
222 <input type="hidden" name="op" value="copy_form" />
223 <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
224 <input type="hidden" name="module" value="[% lette.module %]" />
225 <input type="hidden" name="code" value="[% lette.code %]" />
226 [% IF independant_branch %]
227 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
229 [% select_for_copy %]
231 <button class="btn btn-default btn-xs"><i class="fa fa-clone"></i> Copy</button>
237 <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>
239 [% IF !lette.protected && can_edit %]
240 <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>
248 <div class="dialog message">
249 [% IF ( branchcode ) %]
250 <p>There are no notices for this library.</p>
252 <p>There are no notices.</p>
259 [% IF add_form or copy_form %]
260 <h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1>
261 <form id="add_notice" name="Aform" method="post" enctype="multipart/form-data" class="validate">
263 <input type="hidden" name="op" id="op" value="add_validate" />
265 <input type="hidden" name="op" id="op" value="copy_validate" />
268 <input type="hidden" name="checked" value="0" />
270 <input type="hidden" name="add" value="0" />
272 <input type="hidden" name="add" value="1" />
274 <fieldset class="rows">
275 <input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" />
277 [% IF independant_branch %]
278 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
283 <label for="branch">Library:</label>
284 <select name="branchcode" id="branch" style="width:20em;">
285 <option value="">All libraries</option>
286 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
289 <span class="label">Library:</span>
290 <input type="hidden" id="branch" name="branchcode" value="[% branchcode %]" />
291 [% IF ( branchcode ) %]
292 [% Branches.GetName( branchcode ) %]
300 <label for="module">Koha module:</label>
301 <input type="hidden" name="oldmodule" value="[% module %]" />
303 <select name="module" id="newmodule">
305 <select name="module" id="module">
307 [% IF ( module == "acquisition" ) %]
308 <option value="acquisition" selected="selected">Acquisition</option>
310 <option value="acquisition" >Acquisition</option>
312 [% IF ( module == "catalogue" ) %]
313 <option value="catalogue" selected="selected">Catalog</option>
315 <option value="catalogue" >Catalog</option>
317 [% IF ( module == "circulation" ) %]
318 <option value="circulation" selected="selected">Circulation</option>
320 <option value="circulation">Circulation</option>
322 [% IF ( module == "orderacquisition" ) %]
323 <option value="orderacquisition" selected="selected">Order acquisition</option>
325 <option value="orderacquisition">Order acquisition</option>
327 [% IF ( module == "claimacquisition" ) %]
328 <option value="claimacquisition" selected="selected">Claim acquisition</option>
330 <option value="claimacquisition">Claim acquisition</option>
332 [% IF ( module == "claimissues" ) %]
333 <option value="claimissues" selected="selected">Claim serial issue</option>
335 <option value="claimissues">Claim serial issue</option>
337 [% IF ( module == "reserves" ) %]
338 <option value="reserves" selected="selected">Holds</option>
340 <option value="reserves">Holds</option>
342 [% IF ( module == "members" ) %]
343 <option value="members" selected="selected">Members</option>
345 <option value="members">Members</option>
347 [% IF ( module == "serial" ) %]
348 <option value="serial" selected="selected">Serials (routing list)</option>
350 <option value="serial">Serials (routing list)</option>
352 [% IF ( module == "suggestions" ) %]
353 <option value="suggestions" selected="selected">Suggestions</option>
355 <option value="suggestions">Suggestions</option>
361 <label for="code" class="required">Code:</label>
362 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
363 <span class="required">Required</span>
365 <span class="label">Code:</span>
366 <input type="hidden" id="code" name="code" value="[% code %]" />
371 <label for="name" class="required">Name:</label>
372 <input type="text" id="name" name="name" size="60" value="[% letter_name %]" required="required" />
373 <span class="required">Required</span>
377 <div id="transport-types" style="clear:both">
378 [% FOREACH letter IN letters %]
380 [% SWITCH letter.message_transport_type %]
392 [% letter.message_transport_type %]
395 [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %]
396 <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
397 <div class="dialog message">You should enable the SMSSendDriver preference to use the SMS templates.</div>
398 [% ELSIF letter.message_transport_type == "phone" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
399 <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
400 <div class="dialog message">You should enable the TalkingTechItivaPhoneNotification preference to use the phone templates.</div>
402 <fieldset class="rows mtt" id="[% letter.message_transport_type %]">
406 <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type %]" />
407 <label for="is_html_[% letter.message_transport_type %]">HTML message:</label>
408 [% IF letter.is_html %]
409 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" checked="checked" />
411 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" />
415 <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 %]" />
418 <label for="SQLfieldname_[% letter.message_transport_type %]">Message body:</label>
419 [% IF letter.message_transport_type == 'sms' %]
420 <span id="sms_counter">[% IF letter.content && letter.content.length > 0 %][% letter.content.length %][% ELSE %]0[% END %]/160 characters</span>
425 <select name="SQLfieldname" id="SQLfieldname_[% letter.message_transport_type %]" multiple="multiple" size="9">
426 [% FOREACH SQLfieldname IN SQLfieldnames %]
427 <option value="[% SQLfieldname.value %]">[% SQLfieldname.text %]</option>
432 <button type="button" data-containerid="[% letter.message_transport_type %]" class="btn btn-default btn-sm insert">Insert <i class="fa fa-long-arrow-right"></i></button>
434 <td><textarea name="content" id="content_[% letter.message_transport_type %]" cols="80" rows="15">[% letter.content %]</textarea></td>
441 </div> <!-- / #transport-types -->
443 [% 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 %]
444 <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>
445 <input type="hidden" name="searchfield" value="[% searchfield %]" />
449 [% IF ( add_validate or copy_validate) %]
451 <form action="[% action %]" method="post">
452 <input type="submit" value="OK" />
456 [% IF ( delete_confirm ) %]
457 <div class="dialog alert">
458 <h3>Delete notice?</h3>
469 <td>[% IF letter.branchcode %][% Branches.GetName( letter.branchcode ) %][% ELSE %](All libraries)[% END %]</td>
470 <td>[% letter.module %]</td>
471 <td>[% letter.code %]</td>
472 <td>[% letter.name %]</td>
475 <form action="[% action %]" method="post">
476 <input type="hidden" name="op" value="delete_confirmed">
477 <input type="hidden" name="branchcode" value="[% letter.branchcode %]" />
478 <input type="hidden" name="code" value="[% letter.code %]" />
479 <input type="hidden" name="module" value="[% letter.module %]" />
480 <button type="submit" class="approve"><i class="fa fa-check"></i> Yes, delete</button>
483 <form action="[% action %]" method="get">
484 <button type="submit" class="deny"><i class="fa fa-times"></i> No, do not delete</button>
489 [% IF ( delete_confirmed ) %]
491 <form action="[% action %]" method="post">
492 <input type="submit" value="OK" />
498 [% UNLESS add_form or copy_form %]
499 <div class="yui-b noprint">
500 [% INCLUDE 'tools-menu.inc' %]
504 [% INCLUDE 'intranet-bottom.inc' %]