]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/place_hold.tt2
LP#1406387 Fix for Holds Placement Advanced Options
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / place_hold.tt2
1 [%  PROCESS "opac/parts/misc_util.tt2";
2     PROCESS "opac/parts/hold_error_messages.tt2";
3     PROCESS "opac/parts/metarecord_hold_filters.tt2";
4 %]
5
6 <div id='holds_box' class='canvas' style='margin-top: 6px;'>
7     <h1>[% l('Place Hold') %]</h1>
8
9     [% some_holds_allowed = -1 %]
10       
11     <form method="post">
12         <input type="hidden" name="hold_type" value="[% CGI.param('hold_type') | html %]" />
13         [%  
14             redirect = CGI.param('hold_source_page') || CGI.param('redirect_to') || CGI.referer;
15             # since we have to be logged in to get this far, return to a secure page
16             redirect = redirect.replace('^http:', 'https:') 
17         %]
18         <input type="hidden" name="redirect_to" value="[% redirect | html %]" />
19         [%
20             usr_barcode = CGI.param('usr_barcode') | html;
21             is_requestor = CGI.param('is_requestor');
22
23            IF is_requestor == '';
24                is_requestor = '0';
25            END;
26
27            IF is_requestor == '0' && usr_barcode == ctx.staff_recipient.card.barcode;
28                usr_barcode = '';
29            END;
30         %]
31
32         [% IF ctx.is_staff %]
33         <p class="staff-hold">
34             <input type="radio" id="hold_usr_is_requestor_not"
35                 onchange="staff_hold_usr_input_disabler(this);"
36                 name="hold_usr_is_requestor" value="0"
37                 />
38             <label for="hold_usr_is_requestor_not">
39                 [% l("Place hold for patron by barcode:") %]
40             </label>
41             <input type="text" name="hold_usr" id="hold_usr_input" 
42               value="[% usr_barcode | html %]" 
43               onchange="staff_hold_usr_barcode_changed();" 
44               onpaste="setTimeout(staff_hold_usr_barcode_changed,1);" 
45               onkeypress="return no_hold_submit(event)" autofocus /> 
46             <span id="patron_name"></span>
47             <span id="patron_usr_barcode_not_found" style="display: none">
48               [% l('Patron barcode was not found') %]
49             </span><br />
50             <input type="hidden" id="staff_barcode" 
51               value="[% ctx.staff_recipient.card.barcode | html %]"/>
52             <span>
53                 <input type="radio" id="hold_usr_is_requestor"
54                     onchange="staff_hold_usr_input_disabler(this);"
55                     name="hold_usr_is_requestor" value="1" />
56                 <label for="hold_usr_is_requestor">
57                     [% l("Place this hold for me ([_1] [_2])", ctx.user.first_given_name, ctx.user.family_name) | html %]
58                 </label>
59             </span>
60         </p>
61         [% END %]
62
63         <!-- loop through the holds and display status of request where appropriate -->
64         <table id='hold-items-list'>
65         [% FOR hdata IN ctx.hold_data;
66             attrs = {marc_xml => hdata.marc_xml};
67             PROCESS get_marc_attrs args=attrs;
68             this_hold_disallowed = 0;
69
70             IF CGI.param('hold_type') == 'M';
71               IF hdata.metarecord_filters.formats.size == 0;
72                 this_hold_disallowed = 1;
73                 # if this is the first hold and it's disallowed, 
74                 # assume all holds are, until we proven otherwise
75                 SET some_holds_allowed = 0 IF some_holds_allowed == -1;
76               ELSE; some_holds_allowed = 1; END;
77             END %]
78
79             <tr>
80                 <td>
81                     [% IF !this_hold_disallowed %]
82                     <input type="hidden" name="hold_target" value="[% hdata.target.id | html %]" />
83                     [% END %]
84                     <div class='hold-items-list-title'>[% attrs.title_extended | html %]</div>
85                     [% IF hdata.parts AND !this_hold_disallowed %]
86                         [% IF hdata.parts.size > 0 %]
87                         <div style='padding-left: 10px'>
88                             <span><label for='select_hold_part'>[%
89                                 hdata.part_required ? l('Select a Part:') : l('Select a Part (optional):')
90                             %]</label></span>
91                             <select id='select_hold_part' name='part'>
92                                 [% IF !hdata.part_required %]
93                                 <option selected='selected' value=''>[% l('- All Parts -') %]</option>
94                                 [% END %]
95                                 [% FOR part IN hdata.parts %]
96                                 <option value='[% part.id %]'>[% part.label | html %]</option>
97                                 [% END %]
98                             </select>
99                         </div>
100                         [% ELSE %]
101                         <input type='hidden' name='part' value=''/>
102                         [% END %]
103                     [% END %]
104                     [% IF NOT metarecords.disabled %]
105                         [% IF CGI.param('hold_type') == 'T' AND hdata.record.metarecord %]
106                         <!-- Grab the bre_id so that we can restore it if user accidentally clicks advanced options -->
107                            [% bre_id = hdata.target.id %]
108                             <a  id='advanced_hold_link'
109                                 href="[% mkurl('', {hold_type => 'M', hold_target => hdata.record.metarecord.id, bre_id => bre_id}) %]">
110                                 [% l('Advanced Hold Options') %]</a>
111                         [% END %]
112                         [% IF CGI.param('hold_type') == 'M' AND CGI.param('bre_id') %]
113                             <input type="hidden" name="bre_id" value="[% CGI.param('bre_id') %]" />
114                             <a id='basic_hold_link'
115                                href="[% mkurl('', {hold_target => CGI.param('bre_id'), hold_type => 'T'}) %]">
116                                 [% l('Basic Hold Options') %]</a>
117                         [% END %]
118                         [% IF hdata.metarecord_filters.formats.size OR # should this be size > 1
119                             (hdata.metarecord_filters.langs.size && hdata.metarecord_filters.langs.size > 1);
120                             PROCESS metarecord_hold_filters_selector hold_data=hdata;
121                         END;
122                     END %]
123                 </td>
124             </tr>
125
126             [% IF this_hold_disallowed %]
127               <tr><td>
128                 <div class="mr_holds_no_formats">
129                 [% l('This item does not have any formats available for holds placement') %]
130                 </div>
131               </td></tr>
132             [% END %]
133
134             [%  IF !loop.last AND ctx.hold_data.size > 1 %]
135             <tr class="holds_item_row_separator"><td> </td></tr>
136             [% END %]
137
138         [% END %]
139         </table>
140
141         [% IF some_holds_allowed %]
142
143         <p>
144             [%- org_select_id = 'pickup_lib'; -%]
145             <label for="[% org_select_id %]">[%l('Pickup location:') %]</label>
146             [% PROCESS "opac/parts/org_selector.tt2";
147                 INCLUDE build_org_selector name='pickup_lib' 
148                     value=ctx.default_pickup_lib id=org_select_id 
149                     can_have_vols_only=1 hold_pickup_lib=1 %]
150         </p>
151         <p>
152             [% l('Notify when hold is ready for pickup?') %]
153             <blockquote>
154                 <input type="checkbox" id="email_notify" name="email_notify" value="t"
155                     [% IF !ctx.user.email %]disabled="true"[% ELSIF ctx.default_email_notify %]checked="checked"[% END %]/>
156                     <label for="email_notify">[% l('Yes, by Email') %]</label><br/>
157                 <blockquote>
158                     [% IF !ctx.user.email and !ctx.is_staff; l('No configured Email address. See "My Account" for setting your Email address.');
159                      ELSE; l('Email Address:') %] <span name="email_address">[% ctx.user.email %]</span>[% END %]
160                 </blockquote>
161                 [%- IF allow_phone_notifications == 'true' %]
162                 <input type="checkbox" id="phone_notify_checkbox" name="phone_notify_checkbox"
163                     [% IF ctx.default_phone_notify %]checked="checked"[% END %]/>
164                     <label for="phone_notify_checkbox">[% l('Yes, by Phone') %]</label><br/>
165                 <blockquote>
166                     <label>[% l('Phone Number:') %]<input type="text" name="phone_notify" [% setting = 'opac.default_phone';
167                     IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]'
168                     [%- ELSIF ctx.user.day_phone; %] value='[% ctx.user.day_phone | html %]' [% END %]/></label>
169                 </blockquote>
170                 [%- END -%]
171                 [% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1 %]
172                 <input type="checkbox" id="sms_notify_checkbox" name="sms_notify_checkbox"
173                     [% IF ctx.default_sms_notify %]checked="checked"[% END %]/>
174                     <label for="sms_notify_checkbox">[% l('Yes, by Text Messaging') %]</label><br/>
175                 <blockquote>
176                     [% INCLUDE "opac/parts/sms_carrier_selector.tt2" %]<br/>
177                     [% INCLUDE "opac/parts/sms_number_textbox.tt2" %]<br/>
178                 </blockquote>
179                 [% END %]
180             </blockquote>
181         </p>
182         <input id="place_hold_submit" type="submit" name="submit" 
183             value="[% l('Submit') %]" title="[% l('Submit') %]"
184             alt="[% l('Submit') %]" class="opac-button" />
185         [% END # some_holds_allowed %]
186         <input type="reset" name="cancel" onclick="window.location='[% redirect | html %]'" value="[% l('Cancel') %]" id="holds_cancel" class="opac-button" />
187     </form>
188 </div>
189