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