Bug 11588: fix untranslatable subscription frequency units
[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="[% interface %]/[% theme %]/en/css/datatables.css" />
8 <script type="text/javascript" src="[% interface %]/[% theme %]/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
9 [% INCLUDE 'datatables-strings.inc' %]
10 <script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
11 <script type="text/javascript">
12 //<![CDATA[
13     [% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
14          $(document).ready(function() {
15         [% UNLESS ( preview ) %]
16          var sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
17             "sDom": 't',
18             "aoColumnDefs": [
19                 { "aTargets": [ 0,1 ], "bSortable": false, "bSearchable": false }
20             ],
21             "bPaginate": false
22         }));
23         [% END %]
24             $('#supplierid').change(function() {
25             $('#claims').submit();
26             });
27
28             // Checkboxes : Select All / None
29             $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>");
30
31         $("#CheckAll").click(function() {
32             $("#claimst tr:visible :checkbox").attr('checked', $("#CheckAll").is(':checked'));
33         });
34
35             // Generates a dynamic link for exporting the selection's data as CSV
36             $("#ExportSelected").click(function() {
37                // 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.
38              var selected = $("input[name=serialid]:checked");
39
40         if (selected.length == 0) {
41             alert(_("Please select at least one item to export."));
42             return false;
43         }
44
45         // Building the url from currently checked boxes
46         var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
47         for (var i = 0; i < selected.length; i++) {
48             url += '&amp;serialid=' + selected[i].value;
49         }
50         url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
51         // And redirecting to the CSV page
52         location.href = url;
53         return false;
54         });
55
56         $("#titlefilter").keyup( function () {
57             sTable.fnFilter( this.value, 3 ); // 3 is position of title column
58         } );
59
60         $("#branchfilter").keyup(function() {
61             sTable.fnFilter( this.value, 2 ); // 2 is the position of the author column
62             });
63          });
64
65         // Checks if the form can be sent (at least one checkbox must be checked)
66         function checkForm() {
67             if ($("input:checked").length == 0) {
68                 alert(_("Please select at least one item."));
69                 return false;
70             }
71         }
72
73     // Filter by status
74     function filterByStatus() {
75         selectedStatus = $("#statusfilter").val();
76         if (selectedStatus == "all") {
77             clearFilters();
78         } else {
79             $("table#claimst tbody tr").hide();
80             $("table#claimst tbody tr").each( function() {
81                 if ( $(this).find("span.status-" + selectedStatus).size() > 0 ) {
82                     $(this).show();
83                 }
84             });
85         }
86     }
87
88     // Filter by branch
89     function filterByBranch() {
90         selectedBranch = $("#branchfilter").val();
91         if (selectedBranch == "all") {
92             clearFilters();
93         } else {
94             $("table#claimst tbody tr").hide();
95             $("table#claimst tbody tr").each( function() {
96                 if ( $(this).find("span.branch-" + selectedBranch).size() > 0 ) {
97                     $(this).show();
98                 }
99             });
100         }
101     }
102
103         // Filter by date
104         function filterByDate() {
105         var beginDate = Date_from_syspref($("#from").val()).getTime();
106         var endDate   = Date_from_syspref($("#to").val()).getTime();
107             
108             // Checks if the beginning date is valid
109             if (!parseInt(beginDate)) {
110                 alert(_("The beginning date is missing or invalid."));
111                 return false;
112             }
113
114             // Checks if the ending date is valid
115             if (!parseInt(endDate)) {
116                 alert(_("The ending date is missing or invalid."));
117                 return false;
118             }
119
120             // Checks if beginning date is before ending date
121             if (beginDate > endDate) {
122                 // If not, we swap them
123                 var tmpDate = endDate;
124                 endDate = beginDate;
125                 beginDate = tmpDate;
126             }
127            
128             // We hide everything
129             $("table#claimst tbody tr").hide();
130
131             // For each date in the table
132             $(".planneddate").each(function() {
133
134                 // We make a JS Date Object, according to the locale
135                 var pdate = Date_from_syspref($(this).text()).getTime();
136
137                 // And checks if the date is between the beginning and ending dates
138                 if (pdate > beginDate && 
139                     pdate < endDate) {
140                         // If so, we can show the row
141                         $(this).parent().show();
142                     }
143
144             });
145         }
146
147         // Clears filters : shows everything
148         function clearFilters() {
149             $("table#claimst tbody tr").show();
150         }
151
152         function popup(supplierid,serialid){
153                 window.open('claims.pl?supplierid='+ supplierid +'&amp;serialid='+ serialid +'&amp;op=preview' ,'popup', 'width=600,height=400,toolbar=no,scrollbars=yes');
154         }
155
156 //]]>
157 </script>
158 </head>
159 <body id="ser_claims" class="ser">
160     [% INCLUDE 'header.inc' %]
161 [% UNLESS ( preview ) %]
162     [% INCLUDE 'serials-search.inc' %]
163 [% END %]
164
165 <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>
166
167 [% UNLESS ( preview ) %]
168
169 <div id="doc3" class="yui-t2">
170    
171    <div id="bd">
172         <div id="yui-main">
173         <div class="yui-b">
174
175     <h1>Claims</h1>
176
177 [% IF ( letter ) %][% 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 %]
178         
179              [% IF ( SHOWCONFIRMATION ) %]
180      <div class="dialog alert">Your notification has been sent.</div>
181      [% END %]
182 [% UNLESS ( letter ) %]<div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div>[% END %]
183     <form id="claims" name="claims" action="claims.pl" method="post">
184     <fieldset>
185             <label for="supplierid">Vendor: </label>
186             <select id="supplierid" name="supplierid">
187                 [% FOREACH suploo IN suploop %]
188                     [% IF ( suploo.selected ) %]
189                     <option value="[% suploo.id %]" selected="selected" >
190                     [% ELSE %]
191                     <option value="[% suploo.id %]">
192                     [% END %]
193                         [% suploo.name %]
194                         ([% suploo.count %])
195                     </option>
196                 [% END %]
197             </select>
198         <input type="submit" value="OK" />
199         [% IF ( phone ) %]Phone: [% phone %][% END %]
200         [% IF ( booksellerfax ) %]Fax: [% booksellerfax %][% END %]
201         [% IF ( bookselleremail ) %]</p><p><a href="mailto:[% bookselleremail %]">[% bookselleremail %]</a>[% END %]
202     </fieldset>
203 </form>
204
205    [% IF ( missingissues ) %]   
206     <h3>Missing issues</h3>
207     <form action="claims.pl" onsubmit="return false;">
208         <fieldset class="rows">
209         <legend>Filters :</legend>
210         
211         <ol>
212         <li>
213             <label for="statusfilter">Status : </label>
214             <select id="statusfilter" onchange="filterByStatus();">
215             <option value="all" selected="selected">(All)</option>
216             <option value="expected">Expected</option>
217             <option value="late">Late</option>
218             <option value="missing">Missing</option>
219             <option value="missing_never_received">Missing (never received)</option>
220             <option value="missing_sold_out">Missing (sold out)</option>
221             <option value="missing_damaged">Missing (damaged)</option>
222             <option value="missing_lost">Missing (lost)</option>
223             <option value="claimed">Claimed</option>
224             </select>
225         </li>
226         
227         <li>
228             <label for="titlefilter">Title : </label>
229         <input id="titlefilter" type="text" />
230     </li>
231     <li>
232             <label for="branchfilter">Library: </label>
233             <select id="branchfilter" onchange="filterByBranch();">
234             <option value="all" selected="selected">(All)</option>
235             [% FOREACH branchloo IN branchloop %]
236                 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
237             [% END %]
238         </select>
239         </li>
240         
241         <li>
242         <label for="from">From:</label>
243         <input type="text" name="begindate" id="from" value="[% begindate %]" size="10" maxlength="10" class="datepickerfrom" />
244         <label for="to" style="float:none;">To:</label>
245         <input type="text" name="enddate" id="to" value="[% enddate %]" size="10" maxlength="10" class="datepickerto" />
246         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
247             <input type="button" value="OK" onclick="filterByDate();" />
248         </li>
249         
250         <li>
251         <input type="reset" value="Clear filters" onclick="clearFilters();" />
252         </li>
253         </ol>
254         </fieldset>
255     </form>
256
257     <fieldset>
258         <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()">
259         <input type="hidden" name="order" value="[% order %]" />
260          <table id="claimst">
261                 <thead><tr>
262                     <th><input type="checkbox" id="CheckAll"></th>
263                     <th>Vendor</th>
264                     <th>Library</th>
265                     <th>Title</th>
266                     <th>ISSN</th>
267                     <th>Issue number</th>
268                     <th>Status</th>
269                     <th>Since</th>
270                     <th>Claim date</th>
271                 </tr></thead>
272                 <tbody>[% FOREACH missingissue IN missingissues %]
273                     <tr>
274                         <td>
275                             <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
276                         </td>
277                         <td>
278                         [% missingissue.name %]
279                         </td>
280                         <td>
281                             <span class="branch-[% missingissue.branchcode %]">[% Branches.GetName( missingissue.branchcode ) %]</span>
282                         </td>
283                         <td>
284                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a>
285                         </td>
286                         <td>
287                           [% missingissue.issn %]
288                         </td>
289                         <td>
290                         [% missingissue.serialseq %]
291                         </td>
292                         <td>
293                             [% IF ( missingissue.status1 ) %]<span class="status-expected">Expected</span>[% END %]
294                             [% IF ( missingissue.status3 ) %]<span class="status-late">Late</span>[% END %]
295                             [% IF ( missingissue.status4 ) %]<span class="status-missing">Missing</span>[% END %]
296                             [% IF ( missingissue.status41 ) %]<span class="status-missing_never_received">Missing (never received)</span>[% END %]
297                             [% IF ( missingissue.status42 ) %]<span class="status-missing_sold_out">Missing (sold out)</span>[% END %]
298                             [% IF ( missingissue.status43 ) %]<span class="status-missing_damaged">Missing (damaged)</span>[% END %]
299                             [% IF ( missingissue.status44 ) %]<span class="status-missing_lost">Missing (lost)</span>[% END %]
300                             [% IF ( missingissue.status7 ) %]<span class="status-claimed">Claimed</span>[% END %]
301                         </td>
302                         <td class="planneddate">
303                         [% missingissue.planneddate %]
304                         </td>
305                         <td>
306                         [% missingissue.claimdate %]
307                         </td>
308                     </tr>
309                 [% END %]</tbody>
310             </table>
311
312         [% IF csv_profiles %]
313           <fieldset class="action">
314             <label for="csv_code">Select CSV profile:</label>
315             <select id="csv_profile_for_export">
316               [% FOR csv IN csv_profiles %]
317                 <option value="[% csv.export_format_id %]">[% csv.profile %]</option>
318                [% END %]
319             </select>
320             <span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Download selected claims</a></span>
321         [% END %]
322
323 [% IF ( letter ) %]
324         <fieldset class="action"> <label for="letter_code">Select notice:</label>
325             <select name="letter_code" id="letter_code">
326                 [% FOREACH letter IN letters %]
327                     <option value="[% letter.code %]">[% letter.name %]</option>
328                 [% END %]
329                         </select>
330             <input type="hidden" name="op" value="send_alert" /><input type="submit" name="submit" class="button" value="Send notification" /></fieldset>
331             [% END %]
332         </form>
333     </fieldset>
334 [% END %]
335
336 [% ELSE %]
337
338 <div id="doc" class="yui-t7">
339    <div id="bd">
340         
341 [% IF ( supplierloop ) %]
342         [% FOREACH supplierloo IN supplierloop %]
343         [% IF ( supplierloo.name ) %]
344         <p><b>[% supplierloo.name %]</b><br />
345         [% END %]
346         [% IF ( supplierloo.postal ) %]
347         [% supplierloo.postal %]<br />
348         [% END %]
349         [% IF ( supplierloo.contphone ) %]
350         Ph: [% supplierloo.contphone %]<br />
351         [% END %]
352         [% IF ( supplierloo.contfax ) %]
353         Fax: [% supplierloo.contfax %]<br />
354         [% END %]
355         [% IF ( supplierloo.contemail ) %]
356         Email: [% supplierloo.contemail %]<br />
357         [% END %]
358         [% IF ( supplierloo.accountnumber ) %]
359         A/C: [% supplierloo.accountnumber %]</p>
360         [% END %]
361         [% IF ( supplierloo.contact ) %]
362         <p>Dear [% supplierloo.contact %]</p>
363         [% ELSE %]
364         <p>To whom it may concern</p>
365         [% END %]
366         <p>The following items have not been received from you and are now considered missing:</p>
367         [% END %]
368 [% END %]
369         [% IF ( missingissues ) %]
370         <h3>Missing issues</h3>
371         <table>
372             <tr>
373                 <td><b>Vendor<b></td>
374                 <td><b>Title</b></td>
375                 <td><b>Issue number</b></td>
376                 <td><b>Missing since</b></td>
377             </tr>
378             [% FOREACH missingissue IN missingissues %]
379                 <tr>
380                     <td>
381                     [% missingissue.name %]
382                     </td>
383                     <td>
384                     [% missingissue.Title |html %]
385                     </td>
386                     <td>
387                     [% missingissue.serialseq %]
388                     </td>
389                     <td>
390                     [% missingissue.planneddate %]
391                     </td>
392                 </tr>
393             [% END %]
394         </table>
395         [% END %]
396
397 <p class="noprint"><a href="#" onclick="window.print(); return false;">Print</a> &nbsp; <a href="#" class="close">Close</a></p>
398 [% END %]
399
400 </div>
401 </div>
402
403 [% UNLESS ( preview ) %]
404 <div class="yui-b">
405 [% INCLUDE 'serials-menu.inc' %]
406 </div>
407 [% END %]
408 </div>
409 [% INCLUDE 'intranet-bottom.inc' %]