Bug 11944: Fix encoding issue on adding a subscription
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / claims.tt
1 [% USE Branches %]
2
3 [% INCLUDE 'doc-head-open.inc' %]
4     <title>Koha &rsaquo; Serials &rsaquo; Claims</title>
5     [% INCLUDE 'doc-head-close.inc' %]
6 [% INCLUDE 'calendar.inc' %]
7 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
8 [% INCLUDE 'datatables.inc' %]
9 <script type="text/javascript">
10 //<![CDATA[
11          $(document).ready(function() {
12          var sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
13             "sDom": 't',
14                 "aoColumnDefs": [
15                     { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
16                     { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] },
17                     { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
18                 ],
19             "bPaginate": false
20         }));
21             $('#supplierid').change(function() {
22             $('#claims').submit();
23             });
24
25             // Checkboxes : Select All / None
26             $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>");
27
28         $("#CheckAll").click(function() {
29             $("#claimst tr:visible :checkbox").attr('checked', $("#CheckAll").is(':checked'));
30         });
31
32         // Generates a dynamic link for exporting the selections data as CSV
33             $("#ExportSelected").click(function() {
34                // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error.
35              var selected = $("input[name=serialid]:checked");
36
37         if (selected.length == 0) {
38             alert(_("Please select at least one item to export."));
39             return false;
40         }
41
42         // Building the url from currently checked boxes
43         var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
44         for (var i = 0; i < selected.length; i++) {
45             url += '&amp;serialid=' + selected[i].value;
46         }
47         url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
48         // And redirecting to the CSV page
49         location.href = url;
50         return false;
51         });
52
53         $("#titlefilter").keyup( function () {
54             sTable.fnFilter( this.value, 3 ); // 3 is position of title column
55         } );
56
57         $("#branchfilter").keyup(function() {
58             sTable.fnFilter( this.value, 2 ); // 2 is the position of the author column
59             });
60          });
61
62         // Checks if the form can be sent (at least one checkbox must be checked)
63         function checkForm() {
64             if ($("input:checked").length == 0) {
65         alert(_("Please select at least one issue."));
66                 return false;
67             }
68         }
69
70     // Filter by status
71     function filterByStatus() {
72         selectedStatus = $("#statusfilter").val();
73         if (selectedStatus == "all") {
74             clearFilters();
75         } else {
76             $("table#claimst tbody tr").hide();
77             $("table#claimst tbody tr").each( function() {
78                 if ( $(this).find("span.status-" + selectedStatus).size() > 0 ) {
79                     $(this).show();
80                 }
81             });
82         }
83     }
84
85     // Filter by branch
86     function filterByBranch() {
87         selectedBranch = $("#branchfilter").val();
88         if (selectedBranch == "all") {
89             clearFilters();
90         } else {
91             $("table#claimst tbody tr").hide();
92             $("table#claimst tbody tr").each( function() {
93                 if ( $(this).find("span.branch-" + selectedBranch).size() > 0 ) {
94                     $(this).show();
95                 }
96             });
97         }
98     }
99
100         // Filter by date
101         function filterByDate() {
102         var beginDate = Date_from_syspref($("#from").val()).getTime();
103         var endDate   = Date_from_syspref($("#to").val()).getTime();
104             
105             // Checks if the beginning date is valid
106             if (!parseInt(beginDate)) {
107                 alert(_("The beginning date is missing or invalid."));
108                 return false;
109             }
110
111             // Checks if the ending date is valid
112             if (!parseInt(endDate)) {
113                 alert(_("The ending date is missing or invalid."));
114                 return false;
115             }
116
117             // Checks if beginning date is before ending date
118             if (beginDate > endDate) {
119                 // If not, we swap them
120                 var tmpDate = endDate;
121                 endDate = beginDate;
122                 beginDate = tmpDate;
123             }
124            
125             // We hide everything
126             $("table#claimst tbody tr").hide();
127
128             // For each date in the table
129             $(".planneddate").each(function() {
130
131                 // We make a JS Date Object, according to the locale
132                 var pdate = Date_from_syspref($(this).text()).getTime();
133
134                 // And checks if the date is between the beginning and ending dates
135                 if (pdate > beginDate && 
136                     pdate < endDate) {
137                         // If so, we can show the row
138                         $(this).parent().show();
139                     }
140
141             });
142         }
143
144         // Clears filters : shows everything
145         function clearFilters() {
146             $("table#claimst tbody tr").show();
147         }
148
149 //]]>
150 </script>
151 </head>
152 <body id="ser_claims" class="ser">
153     [% INCLUDE 'header.inc' %]
154     [% INCLUDE 'serials-search.inc' %]
155
156 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Claims</div>
157
158 <div id="doc3" class="yui-t2">
159    
160    <div id="bd">
161         <div id="yui-main">
162         <div class="yui-b">
163
164     <h1>Claims</h1>
165
166     [% IF error_claim %]
167         [% IF error_claim == 'no_vendor_email' %]
168             <div class="error">This vendor has no email defined for late issues.</div>
169         [% ELSIF error_claim == 'no_loggedin_user_email' %]
170             <div class="error">No email is configured for your user.</div>
171         [% ELSE %]
172             <div class="error">[% error_claim %]</div>
173         [% END %]
174     [% END %]
175     [% IF info_claim %]
176         <div class="dialog message">Email has been sent.</div>
177     [% END %]
178
179 [% IF letters %][% UNLESS ( missingissues ) %][% IF ( supplierid ) %] <div class="dialog alert">No missing issues found.</div>[% ELSE %]<div class="dialog message">Please choose a vendor.</div>[% END %][% END %][% END %]
180         
181              [% IF ( SHOWCONFIRMATION ) %]
182      <div class="dialog alert">Your notification has been sent.</div>
183      [% END %]
184 [% UNLESS letters %]<div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div>[% END %]
185     <form id="claims" name="claims" action="claims.pl" method="post">
186     <fieldset>
187             <label for="supplierid">Vendor: </label>
188             <select id="supplierid" name="supplierid">
189                 [% FOREACH suploo IN suploop %]
190                     [% IF ( suploo.selected ) %]
191                     <option value="[% suploo.id %]" selected="selected" >
192                     [% ELSE %]
193                     <option value="[% suploo.id %]">
194                     [% END %]
195                         [% suploo.name %]
196                         ([% suploo.count %])
197                     </option>
198                 [% END %]
199             </select>
200         <input type="submit" value="OK" />
201     </fieldset>
202 </form>
203
204    [% IF ( missingissues ) %]   
205     <h3>Missing issues</h3>
206     <form action="claims.pl" onsubmit="return false;">
207         <fieldset class="rows">
208         <legend>Filters :</legend>
209         
210         <ol>
211         <li>
212             <label for="statusfilter">Status : </label>
213             <select id="statusfilter" onchange="filterByStatus();">
214             <option value="all" selected="selected">(All)</option>
215             <option value="expected">Expected</option>
216             <option value="late">Late</option>
217             <option value="missing">Missing</option>
218             <option value="missing_never_received">Missing (never received)</option>
219             <option value="missing_sold_out">Missing (sold out)</option>
220             <option value="missing_damaged">Missing (damaged)</option>
221             <option value="missing_lost">Missing (lost)</option>
222             <option value="claimed">Claimed</option>
223             </select>
224         </li>
225         
226         <li>
227             <label for="titlefilter">Title : </label>
228         <input id="titlefilter" type="text" />
229     </li>
230     <li>
231             <label for="branchfilter">Library: </label>
232             <select id="branchfilter" onchange="filterByBranch();">
233             <option value="all" selected="selected">(All)</option>
234             [% FOREACH branchloo IN branchloop %]
235                 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
236             [% END %]
237         </select>
238         </li>
239         
240         <li>
241         <label for="from">From:</label>
242         <input type="text" name="begindate" id="from" value="[% begindate %]" size="10" maxlength="10" class="datepickerfrom" />
243         <label for="to" style="float:none;">To:</label>
244         <input type="text" name="enddate" id="to" value="[% enddate %]" size="10" maxlength="10" class="datepickerto" />
245         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
246             <input type="button" value="OK" onclick="filterByDate();" />
247         </li>
248         
249         <li>
250         <input type="reset" value="Clear filters" onclick="clearFilters();" />
251         </li>
252         </ol>
253         </fieldset>
254     </form>
255
256     <fieldset>
257         <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()">
258             <table id="claimst">
259                 <thead>
260                     <tr>
261                         <th><input type="checkbox" id="CheckAll"></th>
262                         <th>Vendor</th>
263                         <th>Library</th>
264                         <th class="anti-the">Title</th>
265                         <th>ISSN</th>
266                         <th>Issue number</th>
267                         <th>Status</th>
268                         <th class="title-string">Since</th>
269                         <th>Claims count</th>
270                         <th class="title-string">Claim date</th>
271                     </tr>
272                 </thead>
273                 <tbody>[% FOREACH missingissue IN missingissues %]
274                     <tr>
275                         <td>
276                             <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
277                         </td>
278                         <td>[% missingissue.name %]</td>
279                         <td>
280                             <span class="branch-[% missingissue.branchcode %]">[% Branches.GetName( missingissue.branchcode ) %]</span>
281                         </td>
282                         <td>
283                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a>
284                         </td>
285                         <td>[% missingissue.issn %]</td>
286                         <td>[% missingissue.serialseq %]</td>
287                         <td>
288                             [% IF ( missingissue.status1 ) %]<span class="status-expected">Expected</span>[% END %]
289                             [% IF ( missingissue.status3 ) %]<span class="status-late">Late</span>[% END %]
290                             [% IF ( missingissue.status4 ) %]<span class="status-missing">Missing</span>[% END %]
291                             [% IF ( missingissue.status41 ) %]<span class="status-missing_never_received">Missing (never received)</span>[% END %]
292                             [% IF ( missingissue.status42 ) %]<span class="status-missing_sold_out">Missing (sold out)</span>[% END %]
293                             [% IF ( missingissue.status43 ) %]<span class="status-missing_damaged">Missing (damaged)</span>[% END %]
294                             [% IF ( missingissue.status44 ) %]<span class="status-missing_lost">Missing (lost)</span>[% END %]
295                             [% IF ( missingissue.status7 ) %]<span class="status-claimed">Claimed</span>[% END %]
296                         </td>
297                         <td class="planneddate">
298                             [% IF ( missingissue.planneddate ) %]
299                                 <span title="[% missingissue.planneddateISO %]">[% missingissue.planneddate %]</span>
300                             [% ELSE %]
301                                 <span title="0000-00-00"></span>
302                             [% END %]
303                         </td>
304                         <td>[% missingissue.claims_count %]</td>
305                         <td>
306                             [% IF ( missingissue.claimdate ) %]
307                                 <span title="[% missingissue.claimdateISO %]">[% missingissue.claimdate %]</span>
308                             [% ELSE %]
309                                 <span title="0000-00-00"></span>
310                             [% END %]
311                         </td>
312                     </tr>
313                 [% END %]</tbody>
314             </table>
315
316             [% IF csv_profiles %]
317               <fieldset class="action">
318                 <label for="csv_code">Select CSV profile:</label>
319                 <select id="csv_profile_for_export">
320                   [% FOR csv IN csv_profiles %]
321                     <option value="[% csv.export_format_id %]">[% csv.profile %]</option>
322                    [% END %]
323                 </select>
324                 <span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Download selected claims</a></span>
325             [% END %]
326
327             [% IF letters %]
328                 <fieldset class="action">
329                     <label for="letter_code">Select notice:</label>
330                     <select name="letter_code" id="letter_code">
331                         [% FOREACH letter IN letters %]
332                             <option value="[% letter.code %]">[% letter.name %]</option>
333                         [% END %]
334                     </select>
335                     <input type="hidden" name="op" value="send_alert" />
336                     <input type="hidden" name="supplierid" value="[% supplierid %]" />
337                     <input type="submit" name="submit" class="button" value="Send notification" />
338                 </fieldset>
339             [% END %]
340         </form>
341     </fieldset>
342 [% END %]
343
344 </div>
345 </div>
346
347 <div class="yui-b">
348 [% INCLUDE 'serials-menu.inc' %]
349 </div>
350 </div>
351 [% INCLUDE 'intranet-bottom.inc' %]