Lines 4-196
Link Here
|
4 |
<title>Koha › Tools › Patron card creator › Batches › [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]New[% END %]</title> |
4 |
<title>Koha › Tools › Patron card creator › Batches › [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]New[% END %]</title> |
5 |
[% INCLUDE 'doc-head-close.inc' %] |
5 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% Asset.css("css/datatables.css") %] |
6 |
[% Asset.css("css/datatables.css") %] |
7 |
[% INCLUDE 'greybox.inc' %] |
|
|
8 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
9 |
[% INCLUDE 'datatables.inc' %] |
10 |
<script type="text/javascript"> |
11 |
//<![CDATA[ |
12 |
function DeleteConfirm() { |
13 |
var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id %]"); |
14 |
var answer = confirm(msg); |
15 |
if (answer) { |
16 |
window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id %]"; |
17 |
} |
18 |
else { |
19 |
return; // abort delete |
20 |
} |
21 |
}; |
22 |
function Remove() { |
23 |
items = new Array; |
24 |
|
25 |
if(document.items.action.length > 0) { |
26 |
for (var i=0; i < document.items.action.length; i++) { |
27 |
if (document.items.action[i].checked) { |
28 |
items.push("label_id=" + document.items.action[i].value); |
29 |
} |
30 |
} |
31 |
getstr = items.join("&"); |
32 |
var msg = _("Are you sure you want to remove the selected patron(s) from this batch?"); |
33 |
} else if (document.items.action.checked) { |
34 |
alert(_("Deletion of patron from a batch with only one patron will delete the batch.") + "\n\n" + _("If this is what you want, select the 'Delete batch' option from the toolbar")); |
35 |
return; // no deletion for single item batch |
36 |
} |
37 |
else { |
38 |
alert(_("Please select at least one patron to delete.")); |
39 |
return; // no item selected |
40 |
} |
41 |
var answer = confirm(msg); |
42 |
if (answer) { |
43 |
window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr; |
44 |
} |
45 |
else { |
46 |
return; // abort delete |
47 |
} |
48 |
}; |
49 |
function Add() { |
50 |
var bor_nums = document.getElementById("bor_num_list"); |
51 |
if (bor_nums.value == '') { |
52 |
window.open("/cgi-bin/koha/patroncards/add_user_search.pl", |
53 |
'PatronPopup', |
54 |
'width=840,height=500,location=yes,toolbar=no,' |
55 |
+ 'scrollbars=yes,resize=yes'); |
56 |
} |
57 |
else { |
58 |
document.forms["add_by_bor_num"].submit(); |
59 |
} |
60 |
}; |
61 |
|
62 |
function add_user(borrowernumber) { |
63 |
$("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n"); |
64 |
} |
65 |
|
66 |
function DeDuplicate() { |
67 |
window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]"; |
68 |
}; |
69 |
function Xport(mode) { |
70 |
if (mode == 'label') { |
71 |
patroncards= new Array; |
72 |
if(document.items.action.length > 0) { |
73 |
for (var i=0; i < document.items.action.length; i++) { |
74 |
if (document.items.action[i].checked) { |
75 |
patroncards.push("label_id=" + document.items.action[i].value); |
76 |
} |
77 |
} |
78 |
if (patroncards.length < 1) { |
79 |
alert(_("Please select at least one card to export.")); |
80 |
return; // no batch selected |
81 |
} |
82 |
getstr = patroncards.join("&"); |
83 |
} |
84 |
else if (document.items.action.checked) { |
85 |
getstr = document.items.action.value; |
86 |
} |
87 |
else { |
88 |
alert(_("Please select at least one card to export.")); |
89 |
return; // no batch selected |
90 |
} |
91 |
return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]&" + getstr, 400, 800); |
92 |
} |
93 |
else if (mode == 'batch') { |
94 |
return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]", 400, 800); |
95 |
} |
96 |
else { |
97 |
// some pass-thru error trapping just in case... |
98 |
} |
99 |
}; |
100 |
function selected_layout() { |
101 |
if (document.items.action.length) { |
102 |
for (i=0;i<document.items.action.length;i++){ |
103 |
if (document.items.action[i].checked==true){ |
104 |
return(document.items.action[i].value); |
105 |
} |
106 |
}; |
107 |
} |
108 |
else { |
109 |
if (document.items.action.checked){ |
110 |
return(document.items.action.value); |
111 |
} |
112 |
}; |
113 |
alert(_("Please select at least one item.")); |
114 |
return (-1); |
115 |
}; |
116 |
|
117 |
$(document).ready(function() { |
118 |
[% IF table_loop %] |
119 |
$("#description").show(); |
120 |
[% ELSE %] |
121 |
$("#description").hide(); |
122 |
[% END %] |
123 |
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, { |
124 |
"aoColumnDefs": [ |
125 |
{ "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false } |
126 |
], |
127 |
"aaSorting": [[ 0, "asc" ]], |
128 |
"sPaginationType": "four_button", |
129 |
"autoWidth": false |
130 |
})); |
131 |
$("#additems").click(function(){ |
132 |
Add(); |
133 |
return false; |
134 |
}); |
135 |
$("#removeitems").click(function(){ |
136 |
Remove(); |
137 |
return false; |
138 |
}); |
139 |
$("#deletebatch").click(function(){ |
140 |
DeleteConfirm(); |
141 |
return false; |
142 |
}); |
143 |
$("#deduplicate").click(function(){ |
144 |
DeDuplicate(); |
145 |
return false; |
146 |
}); |
147 |
$("#exportitems").click(function(){ |
148 |
Xport('label'); |
149 |
return false; |
150 |
}); |
151 |
$("#exportbatch").click(function(){ |
152 |
Xport('batch'); |
153 |
return false; |
154 |
}); |
155 |
$(".delete").on("click", function(){ |
156 |
return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") ); |
157 |
}); |
158 |
$(".export").on("click", function(e){ |
159 |
e.preventDefault(); |
160 |
var label_id = $(this).data("label-id"); |
161 |
var batch_id = $(this).data("batch-id"); |
162 |
GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id+'&label_id='+label_id, 400, 800); |
163 |
}); |
164 |
$("#savedesc").click(function(event){ |
165 |
var newdescription = $(this).siblings('input[name="description"]').val(); |
166 |
var batch_id = $(this).data('batch_id'); |
167 |
var ajaxData = { |
168 |
'newdescription': newdescription, |
169 |
'batch_id': batch_id, |
170 |
'card_element': "batch", |
171 |
'creator': "patroncard", |
172 |
}; |
173 |
|
174 |
$.ajax({ |
175 |
url: '/cgi-bin/koha/svc/creator_batches', |
176 |
type: 'POST', |
177 |
dataType: 'json', |
178 |
data: ajaxData, |
179 |
}) |
180 |
|
181 |
.done(function(data){ |
182 |
if (data.status == 'success') { |
183 |
$("input[name='description']").text(data.newdesc); |
184 |
$("#change-status").text(_("Saved")); |
185 |
} else { |
186 |
$("#change-status").text(_("Unable to save description")); |
187 |
} |
188 |
}); |
189 |
}); |
190 |
}); |
191 |
//]]> |
192 |
</script> |
193 |
>>>>>>> Bug 15766: Adding descriptions to patron card batches |
194 |
</head> |
7 |
</head> |
195 |
|
8 |
|
196 |
<body id="pcard_edit-batch" class="tools pcard"> |
9 |
<body id="pcard_edit-batch" class="tools pcard"> |
Lines 457-462
Link Here
|
457 |
var batch_id = $(this).data("batch-id"); |
270 |
var batch_id = $(this).data("batch-id"); |
458 |
GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id+'&label_id='+label_id, 400, 800); |
271 |
GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id+'&label_id='+label_id, 400, 800); |
459 |
}); |
272 |
}); |
|
|
273 |
$("#savedesc").click(function(event){ |
274 |
var newdescription = $(this).siblings('input[name="description"]').val(); |
275 |
var batch_id = $(this).data('batch_id'); |
276 |
var ajaxData = { |
277 |
'newdescription': newdescription, |
278 |
'batch_id': batch_id, |
279 |
'card_element': "batch", |
280 |
'creator': "patroncard", |
281 |
}; |
282 |
|
283 |
$.ajax({ |
284 |
url: '/cgi-bin/koha/svc/creator_batches', |
285 |
type: 'POST', |
286 |
dataType: 'json', |
287 |
data: ajaxData, |
288 |
}) |
289 |
|
290 |
.done(function(data){ |
291 |
if (data.status == 'success') { |
292 |
$("input[name='description']").text(data.newdesc); |
293 |
$("#change-status").text(_("Saved")); |
294 |
} else { |
295 |
$("#change-status").text(_("Unable to save description")); |
296 |
} |
297 |
}); |
298 |
}); |
460 |
}); |
299 |
}); |
461 |
</script> |
300 |
</script> |
462 |
[% END %] |
301 |
[% END %] |
463 |
- |
|
|