Bug 3669: Remove parameters passed to action of form
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / members-toolbar.inc
1 [% USE Koha %]
2 [% USE Borrowers %]
3 [% USE Branches %]
4 [% USE AuthorisedValues %]
5 [% SET NorwegianPatronDBEnable = Koha.Preference( 'NorwegianPatronDBEnable' ) %]
6 <script type="text/javascript">
7 //<![CDATA[
8 $(document).ready(function(){
9     [% IF ( CAN_user_borrowers ) %]
10         [% IF ( NorwegianPatronDBEnable == 1 ) %]
11             $("#deletepatronlocal").click(function(){
12                 confirm_local_deletion();
13                 $(".btn-group").removeClass("open");
14                 return false;
15             });
16             $("#deletepatronremote").click(function(){
17                 confirm_remote_deletion();
18                 $(".btn-group").removeClass("open");
19                 return false;
20             });
21             $("#deletepatronboth").click(function(){
22                 confirm_both_deletion();
23                 $(".btn-group").removeClass("open");
24                 return false;
25             });
26         [% ELSE %]
27             $("#deletepatron").click(function(){
28                 confirm_deletion();
29                 $(".btn-group").removeClass("open");
30                 return false;
31             });
32         [% END %]
33         $("#renewpatron").click(function(){
34             confirm_reregistration();
35             $(".btn-group").removeClass("open");
36             return false;
37         });
38         [% IF ( is_child ) %]$("#updatechild").click(function(){
39             update_child();
40             $(".btn-group").removeClass("open");
41         });[% END %]
42     [% END %]
43     $("#updatechild, #patronflags, #renewpatron, #deletepatron, #exportbarcodes").tooltip();
44     $("#exportcheckins").click(function(){
45         export_barcodes();
46         $(".btn-group").removeClass("open");
47         return false;
48     });
49     $("#printsummary").click(function(){
50         printx_window("page");
51         $(".btn-group").removeClass("open");
52         return false;
53     });
54     $("#printslip").click(function(){
55         printx_window("slip");
56         $(".btn-group").removeClass("open");
57         return false;
58     });
59     $("#printquickslip").click(function(){
60         printx_window("qslip");
61         $(".btn-group").removeClass("open");
62         return false;
63     });
64     $("#print_overdues").click(function(){
65         window.open("/cgi-bin/koha/members/print_overdues.pl?borrowernumber=[% borrowernumber %]", "printwindow");
66         $(".btn-group").removeClass("open");
67         return false;
68     });
69     $("#searchtohold").click(function(){
70         searchToHold();
71         return false;
72     })
73 });
74 function confirm_deletion() {
75     var is_confirmed = window.confirm(_("Are you sure you want to delete this patron? This cannot be undone."));
76     if (is_confirmed) {
77         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]';
78     }
79 }
80 function confirm_local_deletion() {
81     var is_confirmed = window.confirm(_("Are you sure you want to delete this patron from the local database? This cannot be undone."));
82     if (is_confirmed) {
83         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]&deletelocal=true&deleteremote=false';
84     }
85 }
86 function confirm_remote_deletion() {
87     var is_confirmed = window.confirm(_("Are you sure you want to delete this patron from the Norwegian national patron database? This cannot be undone."));
88     if (is_confirmed) {
89         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]&deletelocal=false&deleteremote=true';
90     }
91 }
92 function confirm_both_deletion() {
93     var is_confirmed = window.confirm(_("Are you sure you want to delete this patron both from the local database and from the Norwegian national patron database? This cannot be undone."));
94     if (is_confirmed) {
95         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]&deletelocal=true&deleteremote=true';
96     }
97 }
98
99 [% IF ( is_child ) %]function confirm_updatechild() {
100     var is_confirmed = window.confirm(_("Are you sure you want to update this child to an Adult category?  This cannot be undone."));
101     if (is_confirmed) {
102         window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=[% borrowernumber %]&catcode=[% catcode %]&catcode_multi=[% CATCODE_MULTI %]';
103     }
104 }
105
106 function update_child() {
107     [% IF ( CATCODE_MULTI ) %]
108         window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=[% borrowernumber %]','UpdateChild','width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes');
109     [% ELSE %]
110         confirm_updatechild();
111     [% END %]
112 }
113 [% END %]
114
115 function confirm_reregistration() {
116     var is_confirmed = window.confirm(_("Are you sure you want to renew this patron's registration?"));
117     if (is_confirmed) {
118     window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;destination=[% destination %]&amp;reregistration=y';
119     }
120 }
121 function export_barcodes() {
122     window.open('/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrowernumber %]&amp;op=export_barcodes');
123 }
124 var slip_re = /slip/;
125 function printx_window(print_type) {
126     var handler = print_type.match(slip_re) ? "printslip" : "summary-print";
127     window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&amp;print=" + print_type, "printwindow");
128     return false;
129 }
130 function searchToHold(){
131     var date = new Date();
132     date.setTime(date.getTime() + (10 * 60 * 1000));
133     $.cookie("holdfor", "[% borrowernumber %]", { path: "/", expires: date });
134     location.href="/cgi-bin/koha/catalogue/search.pl";
135 }
136 //]]>
137 </script>
138
139 <div id="toolbar" class="btn-toolbar">
140     [% IF ( CAN_user_borrowers ) %]
141         [% IF ( guarantor ) %]
142             <a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;guarantorid=[% guarantorborrowernumber %]&amp;categorycode=[% categorycode %]">
143         [% ELSE %]
144             <a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">
145         [% END %]
146         <i class="fa fa-pencil"></i> Edit</a>
147     [% END %]
148
149     [% IF ( CAN_user_borrowers ) %]
150         [% IF ( adultborrower AND activeBorrowerRelationship ) %]
151             <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]"><i class="fa fa-plus"></i> Add child</a>
152         [% END %]
153         [% IF ( CAN_user_borrowers ) %]
154             <a id="changepassword" class="btn btn-small" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]"><i class="fa fa-lock"></i> Change password</a>
155         [% END %]
156         <a id="duplicate" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]"><i class="fa fa-copy"></i> Duplicate</a>
157     [% END %]
158
159     <div class="btn-group">
160         <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="fa fa-print"></i> Print <span class="caret"></span></button>
161             <ul class="dropdown-menu">
162                 [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %]
163                 <li><a id="printslip" href="#">Print slip</a></li>
164                 <li><a id="printquickslip" href="#">Print quick slip</a></li>
165                 [% IF Borrowers.HasOverdues( borrowernumber ) %]
166                     <li><a id="print_overdues" href="#">Print overdues</a></li>
167                 [% END %]
168             </ul>
169     </div>
170
171     [% IF ( CAN_user_reserveforothers ) %]
172         <a id="searchtohold" class="btn btn-small" href="#"><i class="fa fa-search"></i> Search to hold</a>
173     [% END %]
174
175     <a id="addnewmessageLabel" href="#add_message_form" data-toggle="modal" class="btn btn-small"><i class="fa fa-comment-o"></i> Add message</a>
176
177          <div class="btn-group">
178         <button class="btn btn-small dropdown-toggle" data-toggle="dropdown">More <span class="caret"></span></button>
179             <ul class="dropdown-menu">
180                 [% IF ( CAN_user_borrowers ) %]
181                     <li><a id="renewpatron" href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;destination=[% destination %]&amp;reregistration=y">Renew patron</a></li>
182                 [% ELSE %]
183                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to renew patrons" id="renewpatron" href="#">Renew patron</a></li>
184                 [% END %]
185                 [% IF ( CAN_user_permissions ) %]
186                     <li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=[% borrowernumber %]">Set permissions</a></li>
187                 [% ELSE %]
188                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to set permissions" id="patronflags" href="#">Set permissions</a></li>
189                 [% END %]
190                 [% IF CAN_user_borrowers && useDischarge %]
191                     <li><a href="/cgi-bin/koha/members/discharge.pl?borrowernumber=[% borrowernumber %]">Discharge</a></li>
192                 [% END %]
193                 [% IF ( CAN_user_borrowers ) %]
194                     [% IF ( NorwegianPatronDBEnable == 1 ) %]
195                         <li><a id="deletepatronlocal" href="#">Delete local</a></li>
196                         <li><a id="deletepatronremote" href="#">Delete remote</a></li>
197                         <li><a id="deletepatronboth" href="#">Delete local and remote</a></li>
198                     [% ELSE %]
199                         <li><a id="deletepatron" href="#">Delete</a></li>
200                     [% END %]
201                 [% ELSE %]
202                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to delete patrons" id="deletepatron" href="#">Delete</a></li>
203                 [% END %]
204                 [% IF ( is_child ) %]
205                     <li><a id="updatechild" href="#">Update child to adult patron</a></li>
206                 [% ELSE %]
207                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="Patron is an adult" id="updatechild" href="#">Update child to adult patron</a></li></li>
208                 [% END %]
209                 [% IF Koha.Preference('intranetreadinghistory') %]
210                     [%IF ( privacy == 2 ) %]
211                         <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="Not allowed by patron's privacy settings" id="exportbarcodes" href="#">Export today's checked in barcodes</a></li>
212                     [% ELSE %]
213                         <li><a id="exportcheckins" href="#">Export today's checked in barcodes</a></li>
214                     [% END %]
215                 [% END %]
216             </ul>
217     </div>
218 </div>
219
220 <!-- Modal -->
221 <div id="add_message_form" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="addnewmessageLabel" aria-hidden="true">
222     <div class="modal-body">
223         <form method="post" action="/cgi-bin/koha/circ/add_message.pl" id="message_form" name="message_f">
224         <fieldset id="borrower_messages" class="brief">
225             <legend>Leave a message</legend>
226             <ol>
227                 <li>
228                     <label for="message_type">Add a message for:</label>
229                     <select name="message_type" id="message_type">
230                         <option value="L">Staff - Internal note</option>
231                         <option value="B">OPAC - [% firstname %] [% surname %]</option>
232                     </select>
233                 </li>
234                 [% bor_notes = AuthorisedValues.Get( 'BOR_NOTES' ) %]
235                 [% IF bor_notes %]
236                     <li>
237                         <label for="type">Predefined notes: </label>
238                         <select name="type" id="type" onchange="this.form.borrower_message.value=this.options[this.selectedIndex].value;">
239                             <option value="">Select note</option>
240                             [% FOREACH bor_note IN bor_notes %]
241                                 <option value="[% bor_note.lib %]">[% bor_note.lib %]</option>
242                             [% END %]
243                         </select>
244                     </li>
245                 [% END %]
246                 <li>
247                     <textarea rows="3" cols="60" name="borrower_message" id="borrower_message" ></textarea>
248                 </li>
249             </ol>
250             <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
251             <input type="hidden" name="batch" value="[% batch %]" />
252             <input type="hidden" name="branchcode" value="[% LoginBranchcode %]" />
253         </fieldset>
254     </div>
255     <div class="modal-footer">
256         <fieldset class="action">
257             <input type="submit" value="Save" /> </form><a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
258         </fieldset>
259     </div>
260 </div>