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