Fix for Bug 3659, Add place hold option from patron checkout tab
[wip/koha-chris_n.git] / koha-tmpl / intranet-tmpl / prog / en / includes / circ-toolbar.inc
1 <div id="toolbar">
2         <script type="text/javascript">
3         //<![CDATA[
4
5 function confirm_deletion() {
6     var is_confirmed = window.confirm(_('Are you sure you want to delete this patron? This cannot be undone.'));
7     if (is_confirmed) {
8         window.location='/cgi-bin/koha/members/deletemem.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->';
9     }
10 }
11
12 function confirm_updatechild() {
13     var is_confirmed = window.confirm(_('Are you sure you want to update this child to an Adult category?  This cannot be undone.'));
14     if (is_confirmed) {
15         window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&catcode=<!-- TMPL_VAR NAME="catcode" -->&catcode_multi=<!-- TMPL_VAR NAME="CATCODE_MULTI" -->';
16     }
17 }
18
19 function confirm_reregistration() {
20     var is_confirmed = window.confirm(_('Are you sure you want to renew this patron\'s registration?'));
21     // var borrowernumbervalue1 = $("#borrowernumber").attr("value");
22     if (is_confirmed) {
23         window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&amp;destination=circ&amp;reregistration=y';
24     }
25 }
26
27 function update_child() {
28     // var borrowernumbervalue= $("#borrowernumber").attr("value"); 
29 <!-- TMPL_IF NAME="CATCODE_MULTI" -->
30  window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes');
31 <!-- TMPL_ELSE -->
32  confirm_updatechild();
33 <!-- /TMPL_IF -->
34 }
35
36         // prepare DOM for YUI Toolbar
37
38          $(document).ready(function() {
39             $("#printslip,#patronflags,#deletepatron").parent().remove();
40                 $("#moremenuc,#printmenuc,#searchtoholdc").empty();
41             yuiToolbar();
42          });
43
44         // YUI Toolbar Functions
45         function printx_window(print_type) {
46                 window.open("/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=" + print_type, "printwindow");
47                 return false;
48         }
49         function searchToHold(){
50                 var date = new Date();
51                 date.setTime(date.getTime() + (10 * 60 * 1000));
52             $.cookie("holdfor", "<!-- TMPL_VAR NAME="borrowernumber" -->", { path: "/", expires: date });
53             location.href="/cgi-bin/koha/catalogue/search.pl";
54         }
55         function yuiToolbar() {
56             var printmenu = [
57             <!-- TMPL_IF NAME="CAN_user_borrowers" -->
58                 { text: _("Print Page"), onclick: {fn: function(){printx_window("page")}} },
59             <!-- /TMPL_IF -->
60                 { text: _("Print Slip"), onclick: {fn: function(){printx_window("slip")}} },
61                 { text: _("Quick Slip"), onclick: {fn: function(){printx_window("qslip")}} }
62             ];
63         
64                 var moremenu = [
65                         { text: _("Renew Patron"),  onclick: { fn: confirm_reregistration } },
66             { text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->"
67                 <!-- TMPL_IF NAME="CAN_user_permissions" --><!-- TMPL_IF NAME="StaffMember" -->
68                     <!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->, disabled: true<!-- /TMPL_UNLESS-->
69                     <!-- TMPL_ELSE --><!-- /TMPL_IF -->
70                 <!-- TMPL_ELSE -->, disabled: true<!-- /TMPL_IF-->},
71             { text: _("Delete"), <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->disabled: true, <!-- /TMPL_UNLESS --><!-- TMPL_ELSE --><!-- TMPL_UNLESS NAME="CAN_user_borrowers" -->disabled: true, <!-- /TMPL_UNLESS --><!-- /TMPL_IF --> onclick: { fn: confirm_deletion } },
72                         { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }<!-- TMPL_UNLESS NAME="is_child" -->, disabled: true<!-- /TMPL_UNLESS -->}
73                 ];
74
75             new YAHOO.widget.Button({
76                 type: "menu",
77                 label: _("Print"),
78                 name: "printmenubutton",
79                 menu: printmenu,
80                 container: "printmenuc"
81             });
82             new YAHOO.widget.Button({
83                 id: "searchtohold",
84                 type: "button",
85                 label: _("Search to hold"),
86                 container: "searchtoholdc",
87                         onclick: {fn: searchToHold }
88                 });
89             new YAHOO.widget.Button({
90                 type: "menu",
91                 label: _("More"),
92                 name: "moremenubutton",
93                 menu: moremenu,
94                 container: "moremenuc"
95             });
96
97             <!-- TMPL_IF name="adultborrower" -->new YAHOO.widget.Button("addchild");<!-- /TMPL_IF -->
98             new YAHOO.widget.Button("editpatron");
99             new YAHOO.widget.Button("addnote");
100         <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_IF NAME="CAN_user_staffaccess" --> new YAHOO.widget.Button("changepassword");  <!-- /TMPL_IF-->
101             <!-- TMPL_ELSE--> new YAHOO.widget.Button("changepassword"); <!-- /TMPL_IF -->
102             new YAHOO.widget.Button("printslip");
103                 new YAHOO.widget.Button("printpage");
104             new YAHOO.widget.Button("renewpatron");
105         <!-- TMPL_IF NAME="CAN_user_permissions" -->
106           <!-- TMPL_IF NAME="StaffMember" -->
107             <!-- TMPL_IF NAME="CAN_user_staffaccess" -->
108               new YAHOO.widget.Button("patronflags");
109             <!-- /TMPL_IF -->
110           <!-- TMPL_ELSE-->
111           new YAHOO.widget.Button("patronflags");
112           <!-- /TMPL_IF -->
113         <!-- /TMPL_IF -->
114         <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->new YAHOO.widget.Button("deletepatron");<!-- /TMPL_UNLESS -->
115             <!-- TMPL_ELSE -->new YAHOO.widget.Button("deletepatron");<!-- /TMPL_IF -->
116         }
117
118         //]]>
119         </script>
120         <ul class="toolbar">
121         <!-- TMPL_IF NAME="CAN_user_borrowers" -->
122         <!-- TMPL_IF NAME="category_type" -->
123             <!--TMPL_IF NAME="guarantor"-->
124                 <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;guarantorid=<!-- TMPL_VAR NAME="guarantorborrowernumber" -->&amp;category_type=<!-- TMPL_VAR NAME="category_type"-->">
125             <!--TMPL_ELSE-->
126             <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=<!-- TMPL_VAR NAME="category_type"-->">
127             <!--/TMPL_IF-->Edit</a></li>
128         <!-- TMPL_ELSE --> <!-- try with categorycode if no category_type -->
129             <!-- TMPL_IF NAME="categorycode" -->
130             <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;categorycode=<!-- TMPL_VAR NAME="categorycode"-->">Edit</a></li>
131             <!-- TMPL_ELSE --> <!-- if no categorycode, set category_type to A by default -->
132                 <li><a id="editpatron" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=A">Edit</a></li>
133             <!-- /TMPL_IF -->
134         <!-- /TMPL_IF -->
135         <!-- /TMPL_IF -->
136         <!-- TMPL_IF NAME="CAN_user_borrowers" -->
137         <!-- TMPL_IF name="adultborrower" --><li><a id="addchild" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;category_type=C">Add child</a></li><!-- /TMPL_IF -->
138 <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_IF NAME="CAN_user_staffaccess" --> <li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Change Password</a></li><!-- /TMPL_IF-->
139           <!-- TMPL_ELSE--> <li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Change Password</a></li><!-- /TMPL_IF --> 
140           <!-- /TMPL_IF -->
141         <li id="printmenuc"><a id="printpage" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=page">Print Page</a></li>
142         <li><a id="printslip" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;print=slip">Print Slip</a></li>
143         <li id="searchtoholdc"><a id="searchtohold" href="#">Search to hold</a></li>
144         <li id="moremenuc"><a id="renewpatron" href="/cgi-bin/koha/members/moremember.pl?reregistration=y&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Renew Account</a></li>
145     <!-- TMPL_IF NAME="CAN_user_permissions" -->
146         <!-- TMPL_IF NAME="StaffMember" -->
147             <!-- TMPL_IF NAME="CAN_user_staffaccess" -->
148                 <li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Set Permissions</a></li>
149             <!-- /TMPL_IF -->
150           <!-- TMPL_ELSE-->
151                 <li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Set Permissions</a></li>
152         <!-- /TMPL_IF -->
153     <!-- /TMPL_IF -->
154     <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_UNLESS NAME="CAN_user_staffaccess" --><li><a id="deletepatron" href="javascript:confirm_deletion();">Delete</a></li><!-- /TMPL_UNLESS -->
155     <!-- TMPL_ELSE --><li><a id="deletepatron" href="javascript:confirm_deletion();">Delete</a></li><!-- /TMPL_IF -->
156
157 </ul></div>