Remove unused or unnecessary variables in claims processing
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / claims.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
3     <title>Koha &rsaquo; Serials &rsaquo; Claims</title>
4     <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
5 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
6 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
7 <script type="text/JavaScript" language="JavaScript">
8 //<![CDATA[
9          $(document).ready(function() {
10                 <!-- TMPL_UNLESS NAME="preview" -->$("#claimst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
11                         dateFormat: 'uk',<!-- /TMPL_IF -->
12                         headers: { 0: { sorter: false },1:{sorter:false}}
13                 });<!-- /TMPL_UNLESS -->
14             $('#supplierid').change(function() {
15             $('#claims').submit();
16             });
17
18             // Case-insensitive version of jquery's contains function
19             jQuery.extend(
20                 jQuery.expr[':'], { 
21                     icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0" 
22                 }
23             );
24
25
26             // Checkboxes : Select All / None
27             $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All"));
28             $("span.exportSelected").html("<a id=\"ExportSelected\" href=\"/cgi-bin/koha/serials/claims.pl\">Export selected items data<\/a>");
29
30
31             $("#CheckAll").click(function(){ 
32                           $("#claimst :checkbox").attr('checked', $("#CheckAll").is(':checked')); 
33             });
34
35
36             // Generates a dynamic link for exporting the selection's data as CSV
37             $("#ExportSelected").click(function() {
38                 // We use input:checked because it's faster, but if there must new checkboxes  
39                 // used for other purpose on this page, please use [name=serialid]:checked instead
40                 var selected = $("input:checked");
41
42                 if (selected.length == 0) {
43                         alert(_('Please select at least one item to export.'));
44                         return false;
45                 }
46                 
47                 // Building the url from currently checked boxes
48                 var url = '/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=&amp;op=claims';
49                 for (var i = 0; i < selected.length; i++) {
50                     url += '&amp;serialid=' + selected[i].value;
51                 }
52                 // And redirecting to the CSV page
53                 location.href = url;
54                 return false;
55             }); 
56
57
58          });
59
60         // Checks if the form can be sent (at least one checkbox must be checked)
61         function checkForm() {
62             if ($("input:checked").length == 0) {
63                 alert(_('Please select at least one item.'));
64                 return false;
65             }
66         }
67
68         // Filter by status
69         function filterByStatus() {
70             selectedStatus = $("#statusfilter").val();
71             if (selectedStatus == "all") {
72                 clearFilters();
73             } else {
74                 $("table#claimst tbody tr").hide();
75                 $("table#claimst tbody tr:contains(" + selectedStatus + ")").show();                
76             }
77         }
78
79         // Filter by title
80         function filterByTitle() {
81                 var title = $("#titlefilter").val();
82                 $("table#claimst tbody tr").hide();
83                 $("table#claimst tbody tr:icontains("  + title + ")").show();                
84
85         }
86
87         // Filter by date
88         function filterByDate() {
89             var beginDate = Date_from_syspref($("#begindate").val()).getTime();
90             var endDate   = Date_from_syspref($("#enddate").val()).getTime();
91             
92             // Checks if the beginning date is valid
93             if (!parseInt(beginDate)) {
94                 alert(_('The beginning date is missing or invalid.'));
95                 return false;
96             }
97
98             // Checks if the ending date is valid
99             if (!parseInt(endDate)) {
100                 alert(_('The ending date is missing or invalid.'));
101                 return false;
102             }
103
104             // Checks if beginning date is before ending date
105             if (beginDate > endDate) {
106                 // If not, we swap them
107                 var tmpDate = endDate;
108                 endDate = beginDate;
109                 beginDate = tmpDate;
110             }
111            
112             // We hide everything
113             $("table#claimst tbody tr").hide();
114
115             // For each date in the table
116             $(".planneddate").each(function() {
117
118                 // We make a JS Date Object, according to the locale
119                 var pdate = Date_from_syspref($(this).text()).getTime();
120
121                 // And checks if the date is between the beginning and ending dates
122                 if (pdate > beginDate && 
123                     pdate < endDate) {
124                         // If so, we can show the row
125                         $(this).parent().show();
126                     }
127
128             });
129         }
130
131         // Clears filters : shows everything
132         function clearFilters() {
133             $("table#claimst tbody tr").show();
134         }
135
136         function popup(supplierid,serialid){
137                 window.open('claims.pl?supplierid='+ supplierid +'&amp;serialid='+ serialid +'&amp;op=preview' ,'popup', 'width=600,height=400,toolbar=no,scrollbars=yes');
138         }
139
140 //]]>
141 </script>
142 </head>
143 <body>
144     <!-- TMPL_INCLUDE NAME="header.inc" -->
145 <!-- TMPL_UNLESS NAME="preview" -->
146     <!--TMPL_INCLUDE NAME="serials-search.inc" -->
147 <!-- /TMPL_UNLESS -->
148
149 <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>
150
151 <!-- TMPL_UNLESS NAME="preview" -->
152
153 <div id="doc3" class="yui-t2">
154    
155    <div id="bd">
156         <div id="yui-main">
157         <div class="yui-b">
158
159     <h1>Claims</h1>
160
161 <!-- TMPL_IF NAME="letter" --><!-- TMPL_UNLESS NAME="missingissues" --><!-- TMPL_IF NAME="supplierid" --> <div class="dialog alert">No missing issues found.</div><!-- TMPL_ELSE --><div class="dialog message">Please choose a vendor.</div><!-- /TMPL_IF --><!-- /TMPL_UNLESS --><!-- /TMPL_IF -->
162         
163              <!-- TMPL_IF NAME="SHOWCONFIRMATION" -->
164      <div class="dialog alert">Your notification has been sent.</div>
165      <!-- /TMPL_IF -->
166 <!-- TMPL_UNLESS NAME="letter" --><div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div><!-- /TMPL_UNLESS -->
167     <form id="claims" name="claims" action="claims.pl" method="post">
168     <fieldset><label for="supplierid">View: </label>
169         <select id="supplierid" size="1" name="supplierid">
170         <!-- TMPL_LOOP NAME="supplier_loop" -->
171           <option value="<!-- TMPL_VAR NAME="id" -->"<!--  TMPL_IF NAME="selected" --> selected="yes" <!-- /TMPL_IF -->><!-- TMPL_VAR NAME="name" -->       
172           </option>
173         <!-- /TMPL_LOOP -->
174         </select>
175         <input type="submit" value="OK" />
176         <!-- TMPL_IF name="phone" -->Phone: <!-- TMPL_VAR name="phone" --><!-- /TMPL_IF -->
177         <!-- TMPL_IF name="booksellerfax" -->Fax: <!-- TMPL_VAR name="booksellerfax" --><!-- /TMPL_IF -->
178         <!-- TMPL_IF name="bookselleremail" --></p><p><a href="mailto:<!-- TMPL_VAR name="bookselleremail" -->"><!-- TMPL_VAR name="bookselleremail" --></a><!-- /TMPL_IF -->
179     </fieldset>
180 </form>
181
182    <!-- TMPL_IF NAME="missingissues" -->        
183     <h3>Missing Issues</h3>
184     <form action="claims.pl" onsubmit="filterByTitle(); return false;">
185         <fieldset class="rows">
186         <legend>Filters :</legend>
187         
188         <ol>
189         <li>
190             <label for="statusfilter">Status : </label>
191             <select id="statusfilter" onchange="filterByStatus();">
192                 <option value="all" selected="selected">(All)</option>
193                 <option>Expected</option>
194                 <option>Arrived</option>
195                 <option>Late</option>
196                 <option>Missing</option>
197                 <option>Claimed</option>
198             </select>
199         </li>
200         
201         <li>
202             <label for="titlefilter">Title : </label>
203             <input id="titlefilter" type="text" />
204             <input type="submit" value="OK" />
205         </li>
206         
207         <li>
208             <label for="begindate">From</label>
209             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="begindatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
210             <input type="text" name="begindate" id="begindate" value="<!-- TMPL_VAR name="begindate" -->" size="10" maxlength="10" />
211             <script type="text/javascript">
212                  //<![CDATA[ 
213                 Calendar.setup({
214                     inputField  : "begindate", 
215                     button              : "begindatebutton",
216                     ifFormat    : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->"
217                 });
218                 //]]>
219             </script>
220
221             <label for="enddate" style="float:none;">To</label>
222             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="enddatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
223             <input type="text" name="enddate" id="enddate" value="<!-- TMPL_VAR name="enddate" -->" size="10" maxlength="10" />
224             <script type="text/javascript">
225                  //<![CDATA[ 
226                  Calendar.setup({
227                     inputField      : "enddate", 
228                     button          : "enddatebutton",
229                     ifFormat        : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->"
230                 });
231                 //]]>
232             </script> <span class="hint"><!-- TMPL_INCLUDE NAME="date-format.inc" --></span>
233             <input type="button" value="OK" onclick="filterByDate();" />
234         </li>
235         
236         <li>
237             <input type="reset" value="Clear Filters" onclick="clearFilters();" />
238         </li>
239         </ol>
240         </fieldset>
241     </form>
242
243         <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()">
244         <input type="hidden" name="order" value="<!--TMPL_VAR Name="order"-->" />
245                     <p><span class="checkall"></span><span class="clearall"></span></p> 
246          <table id="claimst">
247                 <thead><tr>
248                     <!--TMPL_IF NAME="letter"-->
249                     <th>Claim</th>
250                     <!--/TMPL_IF-->
251                     <th>Vendor</th>
252                     <th>Title</th>
253                     <th>Issue number</th>
254                     <th>Status</th>
255                     <th>Since</th>
256                     <th>&nbsp;</th>
257                 <th>Begin Claim</th>
258                 </tr></thead>
259                 <tbody><!-- TMPL_LOOP name="missingissues" -->
260                     <tr>
261                         <!--TMPL_IF NAME="letter" -->
262                             <td>
263                     <input type="checkbox" name="serialid" value="<!-- TMPL_VAR NAME="serialid"-->" />
264                             </td>
265                         <!--/TMPL_IF-->
266                         <td>
267                         <!-- TMPL_VAR name="name" -->
268                         </td>
269                         <td>
270                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR NAME="subscriptionid" -->"><!-- TMPL_VAR name="title" escape="html" --></a>
271                         </td>
272                         <td>
273                         <!-- TMPL_VAR name="serialseq" -->
274                         </td>
275                         <td>
276                             <!-- TMPL_IF Name="status1" -->Expected<!-- /TMPL_IF -->
277                             <!-- TMPL_IF Name="status2" -->Arrived<!-- /TMPL_IF -->
278                             <!-- TMPL_IF Name="status3" -->Late<!-- /TMPL_IF -->
279                             <!-- TMPL_IF Name="status4" -->Missing<!-- /TMPL_IF -->
280                             <!-- TMPL_IF Name="status7" -->Claimed<!-- /TMPL_IF -->
281                         </td>
282                         <td class="planneddate">
283                         <!-- TMPL_VAR name="planneddate" -->
284                         </td>
285                         <td>
286                         <!-- TMPL_VAR name="claimdate" -->
287                         </td>
288                         <td>
289                             <a href="/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=<!-- TMPL_VAR name="supplieri" -->&amp;serialid=<!-- TMPL_VAR name="serialid" -->&amp;op=claims">Export item data</a>
290                         </td>
291                     </tr>
292                 <!-- /TMPL_LOOP --></tbody>
293             </table>
294              <p><span class="exportSelected"></span></p>
295         <!-- TMPL_IF Name="singlesupplier"-->
296             <input type="hidden" name="supplierid" value="<!--TMPL_VAR NAME="supplierid"-->" />
297             <!-- <a href="claims.pl?supplierid=<!-- TMPL_VAR name="supplierid" -->&amp;op=preview" onclick="popup(<!-- TMPL_VAR name="supplierid" -->,''); return false" class="button">Vendor Group Claim Notice</a></p> -->
298         <!-- /TMPL_IF -->
299
300 <!--TMPL_IF Name="letter" -->
301         <fieldset class="action"> <label for="letter_code">Select notice:</label>
302             <select name="letter_code" id="letter_code">
303                 <!-- TMPL_LOOP name="letters" -->
304                     <option value="<!--TMPL_VAR Name="code"-->"><!--TMPL_VAR Name="name"--></option>
305                 <!--/TMPL_LOOP-->
306                         </select>
307             <input type="hidden" name="op" value="send_alert" /><input type="submit" name="submit" class="button" value="Send notification" /></fieldset>
308             <!--/TMPL_IF-->
309         </form>
310 <!-- /TMPL_IF -->
311
312 <!-- TMPL_ELSE -->
313
314 <div id="doc" class="yui-t7">
315    <div id="bd">
316         
317 <!-- TMPL_IF Name="supplierloop"-->
318         <!-- TMPL_LOOP Name="supplierloop"-->
319         <!-- TMPL_IF NAME="name" -->
320         <p><b><!-- TMPL_VAR NAME="name" --></b><br />
321         <!-- /TMPL_IF -->
322         <!-- TMPL_IF NAME="postal" -->
323         <!-- TMPL_VAR NAME="postal" --><br />
324         <!-- /TMPL_IF -->
325         <!-- TMPL_IF NAME="contphone" -->
326         Ph: <!-- TMPL_VAR NAME="contphone" --><br />
327         <!-- /TMPL_IF -->
328         <!-- TMPL_IF NAME="contfax" -->
329         Fax: <!-- TMPL_VAR NAME="contfax" --><br />
330         <!-- /TMPL_IF -->
331         <!-- TMPL_IF NAME="contemail" -->
332         Email: <!-- TMPL_VAR NAME="contemail" --><br />
333         <!-- /TMPL_IF -->
334         <!-- TMPL_IF NAME="accountnumber" -->
335         A/C: <!-- TMPL_VAR NAME="accountnumber" --></p>
336         <!-- /TMPL_IF -->
337         <!-- TMPL_IF NAME="contact" -->
338         <p>Dear <!-- TMPL_VAR NAME="contact" --></p>
339         <!-- TMPL_ELSE -->
340         <p>To whom it may concern</p>
341         <!-- /TMPL_IF -->
342         <p>The following items have not been received from you and are now considered missing:</p>
343         <!-- /TMPL_LOOP -->
344 <!-- /TMPL_IF -->
345         <!-- TMPL_IF NAME="missingissues" -->
346         <h3>Missing Issues</h3>
347         <table>
348             <tr>
349                 <td><b>Vendor<b></td>
350                 <td><b>Title</b></td>
351                 <td><b>Issue number</b></td>
352                 <td><b>Missing since</b></td>
353             </tr>
354             <!-- TMPL_LOOP name="missingissues" -->
355                 <tr>
356                     <td>
357                     <!-- TMPL_VAR name="name" -->
358                     </td>
359                     <td>
360                     <!-- TMPL_VAR name="Title" escape="html" -->
361                     </td>
362                     <td>
363                     <!-- TMPL_VAR name="serialseq" -->
364                     </td>
365                     <td>
366                     <!-- TMPL_VAR name="planneddate" -->
367                     </td>
368                 </tr>
369             <!-- /TMPL_LOOP -->
370         </table>
371         <!-- /TMPL_IF -->
372
373 <p class="noprint"><a href="#" onclick="window.print(); return false;">Print</a> &nbsp; <a href="#" class="close">Close</a></p>
374 <!-- /TMPL_UNLESS -->
375
376 </div>
377 </div>
378
379 <!-- TMPL_UNLESS NAME="preview" -->
380 <div class="yui-b">
381 <!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
382 </div>
383 <!-- /TMPL_UNLESS -->
384 </div>
385 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->