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