Bug 23376: Clean up order receipt page code
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / orderreceive.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE ItemTypes %]
7 [% USE Price %]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Koha &rsaquo; Acquisitions &rsaquo; Receipt summary for : [% name | html %] [% IF ( invoice ) %]invoice, [% invoice | html %][% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 </head>
13
14 <body id="acq_orderreceive" class="acq">
15 [% INCLUDE 'header.inc' %]
16 [% INCLUDE 'acquisitions-search.inc' %]
17
18 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.basket.booksellerid | html %]">[% name | html %]</a> &rsaquo; Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]][% END %] (order #[% order.ordernumber | html %])</div>
19
20 <div class="main container-fluid">
21     <div class="row">
22         <div class="col-sm-10 col-sm-push-2">
23             <main>
24
25 <h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% order.ordernumber | html %])</h1>
26
27 [% IF ( count ) %]
28     <form action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);">
29 <div class="row">
30 <div class="col-sm-6">
31     <div class="dialog alert order_error" style="display:none"></div>
32
33     <fieldset class="rows">
34     <legend>Catalog details</legend>
35     <ol><li><span class="label">Title: </span><span class="title">[% order.biblio.title | html %]</span></li>
36     <li> <span class="label">Author: </span>
37         [% order.biblio.author | html %]</li>
38     <li><span class="label">Copyright: </span>
39         [% order.biblio.copyrightdate | html %]</li>
40     <li> <span class="label">ISBN: </span>
41         [% order.biblio.biblioitem.isbn | html %]</li>
42     <li> <span class="label">Series: </span>
43         [% order.biblio.seriestitle | html %]</li>
44     </ol>
45         </fieldset>
46
47     [% IF suggestion %]
48         <fieldset class="rows">
49         <legend>Suggestion</legend>
50         <ol>
51           <li>
52             <span class="label">Suggested by: </span>
53             [% suggestion.surnamesuggestedby | html %][% IF suggestion.firstnamesuggestedby %], [% suggestion.firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&amp;op=show">suggestion #[% suggestion.suggestionid | html %]</a>)
54             [% IF suggestion.reason %]
55                 <li>
56                     <span class="label">Reason:</span>
57                     [% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %]
58                     [% SET other_reason = 1 %]
59                     <select class="select-reason" id="reason" name="reason">
60                         <option value=""> -- Choose a reason -- </option>
61                         [% FOREACH reason IN suggestion_reasons %]
62                             [% IF reason.lib == suggestion.reason %]
63                                 <option value="[% reason.lib | html %]" selected="selected">[% reason.lib | html %]</option>
64                                 [% SET other_reason = 0 %]
65                             [% ELSE %]
66                                 <option value="[% reason.lib | html %]">[% reason.lib | html %]</option>
67                             [% END %]
68                         [% END %]
69                         <option value="other">Others...</option>
70                     </select>
71
72                     <span id="other_reason" name="other_reason">
73                         [% IF other_reason %]
74                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/>
75                         [% ELSE %]
76                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
77                         [% END %]
78                         <a href="#back">Cancel</a>
79                     </span>
80
81                     <input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" />
82                 </li>
83             [% END %]
84           </li>
85         </ol>
86         </fieldset>
87     [% END %]
88
89     [% IF order.subscriptionid and orders.count %]
90         <fieldset class="rows">
91             <legend>Receipt history for this subscription</legend>
92             <table id="orders">
93                 <thead>
94                     <tr>
95                         <th>Invoice</th>
96                         <th>Order number</th>
97                         <th class="title-string">Creation date</th>
98                         <th class="title-string">Receive date</th>
99                         <th>Quantity received</th>
100                         <th class="title-string">Status</th>
101                         <th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th>
102                         <th>Internal note</th>
103                     </tr>
104                 </thead>
105                 <tbody>
106                 [% FOR order IN orders %]
107                     <tr>
108                         <td>
109                         [% IF order.invoice %]
110                             [% IF CAN_user_acquisition %]
111                                 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | uri %]" title="Invoice detail page">
112                                    [% order.invoice.invoicenumber | html %]</a>
113                             [% ELSE %]
114                                 [% order.invoice.invoicenumber | html %]
115                             [% END %]
116                         [% END %]
117                         </td>
118                         <td>[% order.ordernumber | html %]</td>
119                         <td><span title="[% order.basket.creationdate | uri %]">[% order.basket.creationdate | $KohaDates%]</span></td>
120                         <td>[% IF order.datereceived %]<span title="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates %]</span>[% END %]</td>
121                         <td>[% order.quantityreceived | html %]</td>
122                         <td>
123                           [% SWITCH order.orderstatus %]
124                           [%# FIXME We should only see/display Complete here, right? %]
125                             [% CASE 'new' %]<span title="status_1">New</span>
126                             [% CASE 'ordered' %]<span title="status_2">Ordered</span>
127                             [% CASE 'partial' %]<span title="status_3">Partial</span>
128                             [% CASE 'complete' %]<span title="status_4">Complete</span>
129                             [% CASE 'cancelled' %]<span title="status_5">Cancelled</span>
130                           [% END %]
131                         </td>
132                         <td>
133                             [% IF order.datereceived %][%# FIXME Should only be true, right? %]
134                                 [%# FIXME What if unitprice has not been filled? %]
135                                 [% order.unitprice_tax_excluded * order.quantity | $Price %] / [% order.unitprice_tax_included * order.quantity | $Price %]
136                             [% END %]
137                         </td>
138                         <td>[% order.order_internalnote | html %]</td>
139                     </tr>
140                 [% END %]
141                 </tbody>
142             </table>
143         </fieldset>
144     [% ELSIF (AcqCreateItemReceiving) %]
145         <div id="items_list" style="display:none">
146             <p><strong>Items list</strong></p>
147             <div style="width:100%;overflow:auto;">
148                 <table>
149                     <thead>
150                         <tr>
151                             <th>Actions</th>
152                             <th>Barcode</th>
153                             <th>Home library</th>
154                             <th>Holding library</th>
155                             <th>Not for loan</th>
156                             <th>Restricted</th>
157                             <th>Location</th>
158                             <th>Call number</th>
159                             <th>Copy number</th>
160                             <th>Inventory number</th>
161                             <th>Collection</th>
162                             <th>Item type</th>
163                             <th>Materials</th>
164                             <th>Notes</th>
165                         </tr>
166                     </thead>
167                     <tbody>
168                     </tbody>
169                 </table>
170             </div>
171         </div>
172
173         [% UNLESS order.subscriptionid %]
174           <fieldset class="rows" id="itemfieldset">
175               <legend>Item</legend>
176               [% IF ( NoACQframework ) %]
177                   <p class="required">
178                       No ACQ framework, using default. You should create a
179                       framework with code ACQ, the items framework would be
180                       used
181                   </p>
182               [% END %]
183               <div id="outeritemblock"></div>
184           </fieldset>
185         [% END %]
186     [% ELSIF (AcqCreateItem == 'ordering') %]
187         [% IF (items.count) %]
188             <h5>Items</h5>
189             <div style="width:100%;overflow:auto">
190                 <table>
191                     <thead>
192                         <tr>
193                             <th>Receive?</th>
194                             <th>&nbsp;</th>
195                             <th>Barcode</th>
196                             <th>Home library</th>
197                             <th>Current library</th>
198                             <th>Not for loan</th>
199                             <th>Restricted</th>
200                             <th>Location</th>
201                             <th>Call number</th>
202                             <th>Copy number</th>
203                             <th>Inventory number</th>
204                             <th>Collection</th>
205                             <th>Item type</th>
206                             <th>Materials</th>
207                             <th>Notes</th>
208                         </tr>
209                     </thead>
210                     <tbody>
211                         [% FOREACH item IN items %]
212                             <tr id="item_[% item.itemnumber | html %]">
213                                 <td style="text-align:center"><input type="checkbox" name="items_to_receive" value="[% item.itemnumber | html %]" /></td>
214                                 <td><a style="cursor:pointer" onclick="PopupEditPage([% item.biblionumber | html %],[% item.itemnumber | html %]);">Edit</a></td>
215                                 <td>[% item.barcode | html %]</td>
216                                 <td>[% Branches.GetName( item.homebranch ) | html %]</td>
217                                 <td>[% Branches.GetName( item.holdingbranch ) | html %]</td>
218                                 <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) | html %]</td>
219                                 <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %]</td>
220                                 <td><span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]</span></td>
221                                 <td>[% item.itemcallnumber | html %]</td>
222                                 <td>[% item.copynumber | html %]</td>
223                                 <td>[% item.stocknumber | html %]</td>
224                                 <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td>
225                                 <td>[% ItemTypes.GetDescription( item.itype ) | html %]</td>
226                                 <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.materials', authorised_value => item.materials ) | html %]</td>
227                                 <td>[% item.itemnotes | html %]</td>
228                             </tr>
229                         [% END %]
230                     </tbody>
231                 </table>
232             </div>
233         [% END %]
234     [% END %]
235     <input type="hidden" name="biblionumber" value="[% order.biblionumber | html %]" />
236     <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
237     <input type="hidden" name="ordernumber" value="[% order.ordernumber | html %]" />
238     <input type="hidden" name="booksellerid" value="[% order.basket.booksellerid | html %]" />
239         </div>
240     <div class="col-sm-6">
241     <fieldset class="rows">
242     <legend>Accounting details</legend>
243         <ol>
244             <li>
245                 <label for="datereceived">Date received: </label>
246                 <input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | $KohaDates %]" class="datepicker" />
247             </li>
248        <li><label for="bookfund">Fund: </label><select id="bookfund" name="bookfund">
249             <option value="">Keep current ([% budget_period_description | html %] - [% order.fund.budget_name | html %])</option>
250             [% FOREACH period IN budget_loop %]
251                 <optgroup label="[% period.description | html %]">
252                 [% FOREACH fund IN period.funds %]
253                     [% IF ( fund.b_sel ) %]
254                         <option value="[% fund.b_id | html %]" selected="selected">[% fund.b_txt | html %]</option>
255                     [% ELSE %]
256                         <option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option>
257                     [% END %]
258                 [% END %]
259                 </optgroup>
260             [% END %]
261        </select></li>
262        <li><label>&nbsp;</label><span>(Current: [% budget_period_description | html %] - [% bookfund | html %])</span></li>
263        <li>
264         <label for="creator">Ordered by: </label>
265         <span>
266             [% INCLUDE 'patron-title.inc' patron = creator %]
267         </span>
268        </li>
269        <li><label for="quantity_to_receive">Quantity ordered: </label><span class="label">
270            [% IF edit or order.subscriptionid %]
271                <input type="text" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" />
272            [% ELSE%]
273                <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" />
274            [% END %]
275            </span></li>
276         <li><label for="quantity">Quantity received: </label>
277           [% IF order.subscriptionid %]
278               <input type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantity | html %]" />
279               <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
280           [% ELSIF AcqCreateItemReceiving %]
281               <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
282           [% ELSE %]
283             [% IF ( order.quantityreceived ) %]
284                 [% IF ( edit ) %]
285                     <input type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived | html %]" />
286                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
287                 [% ELSE %]
288                     [% IF ( items ) %]
289                         <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" />
290                     [% ELSE %]
291                         <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived + 1 | html %]" />
292                     [% END %]
293                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
294                 [% END %]
295             [% ELSE %]
296                 <input type="text" id="quantity" size="20" name="quantityrec" value="1" />
297                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" />
298             [% END %]
299             <div id="qtyrecerror" style="display:none">
300                 <p class="error">Warning, you have entered more items than expected.
301                 Items will not be created.</p>
302             </div>
303           [% END %][%# IF (order.subscriptionid) ELSIF (AcqCreateItemReceiving) %]
304                 </li>
305
306         [% IF ( gst_values ) %]
307             <li>
308                 <label for="tax_rate">Tax rate: </label>
309                 <select name="tax_rate" id="tax_rate">
310                 [% tax_rate = order.tax_rate_on_receiving || order.tax_rate_on_ordering %]
311                 [% FOREACH gst IN gst_values %]
312                     [% IF gst.option == tax_rate %]
313                         <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
314                     [% ELSE %]
315                         <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
316                     [% END %]
317                 [% END %]
318                 </select>
319             </li>
320         [% ELSE %]
321             <input type="hidden" name="tax_rate" value="0" />
322         [% END %]
323
324         <li><label for="rrp">Retail price: </label>
325             [% IF (invoiceincgst == 1) %]
326                 [% order.rrp_tax_included | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax inclusive)</span></li>
327             [% ELSE %]
328                 [% order.rrp_tax_excluded | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax exclusive)</span></li>
329             [% END %]
330         <li>
331             <label for="replacementprice">Replacement price:</label>
332             <input type="text" size="20" name="replacementprice" id="replacementprice" value="[% order.replacementprice | $Price on_editing => 1 %]" />
333         </li>
334         <li>
335             [% IF (invoiceincgst) %]
336                 <label for="ecost">Budgeted cost: </label>[% order.ecost_tax_included | $Price %] <span class="hint">(tax inclusive)</span>
337             [% ELSE %]
338                 <label for="ecost">Budgeted cost: </label>[% order.ecost_tax_excluded | $Price %] <span class="hint">(tax exclusive)</span>
339             [% END %]
340             </li>
341         <li>
342             <label for="unitprice">Actual cost:</label>
343             [% IF (invoiceincgst) %]
344                 <input type="text" size="20" name="unitprice" id="unitprice" value="[% order.unitprice_tax_included | $Price on_editing => 1 %]" /> <span class="hint">(tax inclusive)</span>
345             [% ELSE %]
346                 <input type="text" size="20" name="unitprice" id="unitprice" value="[% order.unitprice_tax_excluded | $Price on_editing => 1 %]" /> <span class="hint">(tax exclusive)</span>
347             [% END %]
348             <label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label>
349         </li>
350         <li id="select_currency">
351             <label for="unitprice_currency"></label>
352             <input type="text" size="20" name="unitprice" id="unitprice_currency" value="" />
353             [% IF currencies.count %]
354                 <select name="currency">
355                     <option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
356                     [% FOR currency IN currencies %]
357                         <option value="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option>
358                     [% END %]
359                 </select>
360             [% END %]
361         </li>
362         <li><label for="order_internalnote">Internal note: </label><textarea name="order_internalnote" width="40" rows="8" >[% order_internalnote | html %]</textarea></li>
363         [% IF order_vendornote %]
364             <li><label for="order_vendornote">Vendor note: </label><span>[% order_vendornote | html %]</span></li>
365         [% END %]
366         </ol>
367     </fieldset>
368
369 </div>
370 </div><div class="row"><fieldset class="action">
371         <input type="submit"  value="Save" class="button" accesskey="w" />
372         <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Cancel</a>
373 </fieldset></div>    </form>
374 [% ELSE %]
375     This ordernumber does not exist.
376 [% END %]
377
378 </main>
379 </div> <!-- /.col-sm-10.col-sm-push-2 -->
380
381 <div class="col-sm-2 col-sm-pull-10">
382     <aside>
383         [% INCLUDE 'acquisitions-menu.inc' %]
384     </aside>
385 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
386 </div> <!-- /.row -->
387 [% MACRO jsinclude BLOCK %]
388     [% Asset.js("js/acquisitions-menu.js") | $raw %]
389 [% INCLUDE 'calendar.inc' %]
390     [% Asset.js("js/additem.js") | $raw %]
391     [% Asset.js("js/cataloging.js") | $raw %]
392     <script>
393         function Check(form) {
394             [% IF (AcqCreateItemReceiving) %]
395                 var total_errors = CheckMandatorySubfields(form);
396                 if (total_errors != 0) {
397                     var alertString = _("Form not submitted because of the following problem(s)");
398                     alertString += "\n------------------------------------------------------------------------------------\n";
399                     alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
400                     alert(alertString);
401                     return false;
402                 }
403
404                 if(check_additem('[% UniqueItemFields | html %]') == false){
405                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
406                     return false;
407                 };
408
409                 // Remove last itemblock if it is not in items_list
410                 var lastitemblock = $("#outeritemblock > div:last");
411                 var tobedeleted = true;
412                 var listitems = $("#items_list tr");
413                 $(listitems).each(function(){
414                     if($(this).attr('idblock') == $(lastitemblock).attr('id')){
415                         tobedeleted = false;
416                     }
417                 });
418                 if(tobedeleted){
419                     $(lastitemblock).remove();
420                 }
421
422                 if(check_additem('[% UniqueItemFields | html %]') == false){
423                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
424                     if(tobedeleted) {
425                         $(lastitemblock).appendTo("#outeritemblock");
426                     }
427                     return false;
428                 };
429             [% END %]
430
431             return true;
432         }
433
434         [% IF (AcqCreateItem == 'ordering') %]
435             var items_columns = [null, null, 'barcode', 'homebranchname',
436                 'holdingbranchname', 'notforloan', 'restricted', 'location',
437                 'itemcallnumber', 'copynumber', 'stocknumber', 'collection',
438                 'itemtype', 'materials', 'itemnotes'];
439
440             function PopupEditPage(biblionumber, itemnumber) {
441                 var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber="
442                     + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem";
443                 var w = window.open(url);
444                 var watchClose = setInterval(function() {
445                     if (w.closed) {
446                         clearTimeout(watchClose);
447                         $.getJSON('/cgi-bin/koha/catalogue/getitem-ajax.pl',
448                             {
449                                 'itemnumber': itemnumber
450                             },
451                             function(item) {
452                                 var tds = $("#item_"+itemnumber+" td");
453                                 for(var i=2; i<tds.length; i++) {
454                                     var column = items_columns[i];
455                                     var text = item[column];
456                                     if ( text == null ) text = '';
457                                     $(tds[i]).text(text);
458                                 }
459                             }
460                         );
461                     }
462                 }, 500);
463             }
464
465             function CalcQtyToReceive() {
466                 var qty = $("input[name='items_to_receive']:checked").length;
467                 $("#quantity").val(qty);
468             }
469
470             function CheckNItems(n) {
471                 $("input[name='items_to_receive']").each(function() {
472                     $(this).prop('checked', false);
473                 });
474                 $("input[name='items_to_receive']:lt("+n+")").each(function () {
475                     $(this).prop('checked', true);
476                 });
477             }
478         [% END %]
479
480         $(document).ready(function() {
481             [% IF (AcqCreateItemReceiving) %]
482                 cloneItemBlock(0, '[% UniqueItemFields | html %]');
483             [% ELSIF (AcqCreateItem == 'ordering') && not order.subscriptionid %]
484                 $("input[name='items_to_receive']").change(function() {
485                     CalcQtyToReceive();
486                 });
487                 CalcQtyToReceive();
488                 $("#quantity").keyup(function() {
489                     var qty = parseInt($("#quantity").val());
490                     var qtyto = parseInt($("#quantity_to_receive").val());
491                     if(qty > qtyto) {
492                         $("#qtyrecerror").show();
493                     } else {
494                         $("#qtyrecerror").hide();
495                     }
496                     CheckNItems($(this).val());
497                 });
498             [% END %]
499
500             $("input[name='change_currency']").on("change", function(){
501                 if ( $(this).is(":checked") ) {
502                     $("#select_currency").show();
503                     $("#unitprice").prop("readonly", "true");
504                 } else {
505                     $("#select_currency").hide();
506                     $("#unitprice").prop("readonly", "");
507                 }
508             }).change();
509
510             function update_unitprice() {
511                 var rate = Number($("select[name='currency'] option:selected").val());
512                 var unitprice = $("#unitprice_currency").val();
513                 var new_unitprice = Number( unitprice * rate ).toFixed(2);
514                 $("#unitprice").val(new_unitprice);
515             }
516             $("select[name='currency']").on("change", function(){update_unitprice()} );
517             $("#unitprice_currency").on("change", function(){update_unitprice()} );
518
519             [% IF other_reason %]
520                 $(".select-reason").hide();
521                 $(".select-reason").find("option[value='other']").attr("selected","selected");
522                 $("#other_reason").show();
523             [% ELSE %]
524                 $("#other_reason").hide();
525             [% END %]
526             $(".select-reason").change(function(){
527                 if($(this).val() == "other"){
528                     $(this).hide();
529                     $("#other_reason").show();
530                 }
531             });
532             $("a[href*=back]").click(function(){
533                 $(".select-reason").show().find("option[value='']").attr("selected","selected");
534                 $("#other_reason").hide();
535             });
536
537         });
538     </script>
539 [% END %]
540
541 [% INCLUDE 'intranet-bottom.inc' %]