Bug 13970: Remove category_type related code
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / members-toolbar.inc
1 [% USE Koha %]
2 [% SET NorwegianPatronDBEnable = Koha.Preference( 'NorwegianPatronDBEnable' ) %]
3 <script type="text/javascript">
4 //<![CDATA[
5 $(document).ready(function(){
6     [% IF ( CAN_user_borrowers ) %]
7         [% IF ( NorwegianPatronDBEnable == 1 ) %]
8             $("#deletepatronlocal").click(function(){
9                 confirm_local_deletion();
10                 $(".btn-group").removeClass("open");
11                 return false;
12             });
13             $("#deletepatronremote").click(function(){
14                 confirm_remote_deletion();
15                 $(".btn-group").removeClass("open");
16                 return false;
17             });
18             $("#deletepatronboth").click(function(){
19                 confirm_both_deletion();
20                 $(".btn-group").removeClass("open");
21                 return false;
22             });
23         [% ELSE %]
24             $("#deletepatron").click(function(){
25                 confirm_deletion();
26                 $(".btn-group").removeClass("open");
27                 return false;
28             });
29         [% END %]
30         $("#renewpatron").click(function(){
31             confirm_reregistration();
32             $(".btn-group").removeClass("open");
33             return false;
34         });
35         [% IF ( is_child ) %]$("#updatechild").click(function(){
36             update_child();
37             $(".btn-group").removeClass("open");
38         });[% END %]
39     [% END %]
40     $("#updatechild, #patronflags, #renewpatron, #deletepatron").tooltip();
41     $("#exportcheckins").click(function(){
42         export_barcodes();
43         $(".btn-group").removeClass("open");
44         return false;
45     });
46     $("#printsummary").click(function(){
47         printx_window("page");
48         $(".btn-group").removeClass("open");
49         return false;
50     });
51     $("#printslip").click(function(){
52         printx_window("slip");
53         $(".btn-group").removeClass("open");
54         return false;
55     });
56     $("#printquickslip").click(function(){
57         printx_window("qslip");
58         $(".btn-group").removeClass("open");
59         return false;
60     });
61     $("#searchtohold").click(function(){
62         searchToHold();
63         return false;
64     })
65 });
66 function confirm_deletion() {
67     var is_confirmed = window.confirm(_("Are you sure you want to delete this patron? This cannot be undone."));
68     if (is_confirmed) {
69         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]';
70     }
71 }
72 function confirm_local_deletion() {
73     var is_confirmed = window.confirm(_("Are you sure you want to delete this patron from the local database? This cannot be undone."));
74     if (is_confirmed) {
75         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]&deletelocal=true&deleteremote=false';
76     }
77 }
78 function confirm_remote_deletion() {
79     var is_confirmed = window.confirm(_("Are you sure you want to delete this patron from the Norwegian national patron database? This cannot be undone."));
80     if (is_confirmed) {
81         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]&deletelocal=false&deleteremote=true';
82     }
83 }
84 function confirm_both_deletion() {
85     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."));
86     if (is_confirmed) {
87         window.location='/cgi-bin/koha/members/deletemem.pl?member=[% borrowernumber %]&deletelocal=true&deleteremote=true';
88     }
89 }
90
91 [% IF ( is_child ) %]function confirm_updatechild() {
92     var is_confirmed = window.confirm(_("Are you sure you want to update this child to an Adult category?  This cannot be undone."));
93     if (is_confirmed) {
94         window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=[% borrowernumber %]&catcode=[% catcode %]&catcode_multi=[% CATCODE_MULTI %]';
95     }
96 }
97
98 function update_child() {
99     [% IF ( CATCODE_MULTI ) %]
100         window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=[% borrowernumber %]','UpdateChild','width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes');
101     [% ELSE %]
102         confirm_updatechild();
103     [% END %]
104 }
105 [% END %]
106
107 function confirm_reregistration() {
108     var is_confirmed = window.confirm(_("Are you sure you want to renew this patron's registration?"));
109     if (is_confirmed) {
110     window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;desintation=[% destination %]&amp;reregistration=y';
111     }
112 }
113 function export_barcodes() {
114     window.open('/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrowernumber %]&amp;op=export_barcodes');
115 }
116 var slip_re = /slip/;
117 function printx_window(print_type) {
118     var handler = print_type.match(slip_re) ? "printslip" : "summary-print";
119     window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&amp;print=" + print_type, "printwindow");
120     return false;
121 }
122 function searchToHold(){
123     var date = new Date();
124     date.setTime(date.getTime() + (10 * 60 * 1000));
125     $.cookie("holdfor", "[% borrowernumber %]", { path: "/", expires: date });
126     location.href="/cgi-bin/koha/catalogue/search.pl";
127 }
128 //]]>
129 </script>
130
131 <div id="toolbar" class="btn-toolbar">
132     [% IF ( CAN_user_borrowers ) %]
133         [% IF ( guarantor ) %]
134             <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 %]">
135         [% ELSE %]
136             <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 %]">
137         [% END %]
138         <i class="icon-pencil"></i> Edit</a>
139     [% END %]
140
141     [% IF ( CAN_user_borrowers ) %]
142         [% IF ( adultborrower AND activeBorrowerRelationship ) %]
143             <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]"><i class="icon-plus"></i> Add child</a>
144         [% END %]
145         [% IF ( CAN_user_borrowers ) %]
146             <a id="changepassword" class="btn btn-small" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]"><i class="icon-lock"></i> Change password</a>
147         [% END %]
148         <a id="duplicate" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]"><i class="icon-copy"></i>Duplicate</a>
149     [% END %]
150
151     <div class="btn-group">
152         <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-print"></i> Print <span class="caret"></span></button>
153             <ul class="dropdown-menu">
154                 [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %]
155                 <li><a id="printslip" href="#">Print slip</a></li>
156                 <li><a id="printquickslip" href="#">Print quick slip</a></li>
157             </ul>
158     </div>
159     <a id="searchtohold" class="btn btn-small" href="#"><i class="icon-search"></i> Search to hold</a>
160     <div class="btn-group">
161         <button class="btn btn-small dropdown-toggle" data-toggle="dropdown">More <span class="caret"></span></button>
162             <ul class="dropdown-menu">
163                 [% IF ( CAN_user_borrowers ) %]
164                     <li><a id="renewpatron" href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;destination=[% destination %]&amp;reregistration=y">Renew patron</a></li>
165                 [% ELSE %]
166                     <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>
167                 [% END %]
168                 [% IF ( CAN_user_permissions ) %]
169                     <li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=[% borrowernumber %]">Set permissions</a></li>
170                 [% ELSE %]
171                     <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>
172                 [% END %]
173                 [% IF ( CAN_user_borrowers ) %]
174                     [% IF ( NorwegianPatronDBEnable == 1 ) %]
175                         <li><a id="deletepatronlocal" href="#">Delete local</a></li>
176                         <li><a id="deletepatronremote" href="#">Delete remote</a></li>
177                         <li><a id="deletepatronboth" href="#">Delete local and remote</a></li>
178                     [% ELSE %]
179                         <li><a id="deletepatron" href="#">Delete</a></li>
180                     [% END %]
181                 [% ELSE %]
182                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to delete patrons" id="deletepatron" href="#">Delete</a></li>
183                 [% END %]
184                 [% IF ( is_child ) %]
185                     <li><a id="updatechild" href="#">Update child to adult patron</a></li>
186                 [% ELSE %]
187                     <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>
188                 [% END %]
189                 <li><a id="exportcheckins" href="#">Export today's checked in barcodes</a></li>
190             </ul>
191     </div>
192 </div>