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