|
Lines 4-9
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 |
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 119 |
"aoColumnDefs": [ |
| 120 |
{ "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false } |
| 121 |
], |
| 122 |
"aaSorting": [[ 0, "asc" ]], |
| 123 |
"sPaginationType": "four_button", |
| 124 |
"autoWidth": false |
| 125 |
})); |
| 126 |
$("#additems").click(function(){ |
| 127 |
Add(); |
| 128 |
return false; |
| 129 |
}); |
| 130 |
$("#removeitems").click(function(){ |
| 131 |
Remove(); |
| 132 |
return false; |
| 133 |
}); |
| 134 |
$("#deletebatch").click(function(){ |
| 135 |
DeleteConfirm(); |
| 136 |
return false; |
| 137 |
}); |
| 138 |
$("#deduplicate").click(function(){ |
| 139 |
DeDuplicate(); |
| 140 |
return false; |
| 141 |
}); |
| 142 |
$("#exportitems").click(function(){ |
| 143 |
Xport('label'); |
| 144 |
return false; |
| 145 |
}); |
| 146 |
$("#exportbatch").click(function(){ |
| 147 |
Xport('batch'); |
| 148 |
return false; |
| 149 |
}); |
| 150 |
$(".delete").on("click", function(){ |
| 151 |
return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") ); |
| 152 |
}); |
| 153 |
$(".export").on("click", function(e){ |
| 154 |
e.preventDefault(); |
| 155 |
var label_id = $(this).data("label-id"); |
| 156 |
var batch_id = $(this).data("batch-id"); |
| 157 |
GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id+'&label_id='+label_id, 400, 800); |
| 158 |
}); |
| 159 |
$("#savedesc").click(function(event){ |
| 160 |
var newdescription = $(this).siblings('input[name="description"]').val(); |
| 161 |
var batch_id = $(this).data('batch_id'); |
| 162 |
var ajaxData = { |
| 163 |
'newdescription': newdescription, |
| 164 |
'batch_id': batch_id, |
| 165 |
'card_element': "batch", |
| 166 |
'creator': "patroncard", |
| 167 |
}; |
| 168 |
|
| 169 |
$.ajax({ |
| 170 |
url: '/cgi-bin/koha/svc/creator_batches', |
| 171 |
type: 'POST', |
| 172 |
dataType: 'json', |
| 173 |
data: ajaxData, |
| 174 |
}) |
| 175 |
|
| 176 |
.done(function(data){ |
| 177 |
if (data.status == 'success') { |
| 178 |
$("input[name='description']").text(data.newdesc); |
| 179 |
$("#change-status").text(_("Saved")); |
| 180 |
} else { |
| 181 |
$("#change-status").text(_("Unable to save description")); |
| 182 |
} |
| 183 |
}); |
| 184 |
}); |
| 185 |
}); |
| 186 |
//]]> |
| 187 |
</script> |
| 188 |
>>>>>>> Bug 15766: Adding descriptions to patron card batches |
| 7 |
</head> |
189 |
</head> |
| 8 |
|
190 |
|
| 9 |
<body id="pcard_edit-batch" class="tools pcard"> |
191 |
<body id="pcard_edit-batch" class="tools pcard"> |
|
Lines 44-55
Link Here
|
| 44 |
<div> |
226 |
<div> |
| 45 |
<fieldset class="rows" style="border-bottom: 0px; border: 0px;"> |
227 |
<fieldset class="rows" style="border-bottom: 0px; border: 0px;"> |
| 46 |
<ol><li> |
228 |
<ol><li> |
| 47 |
<input type="hidden" name="op" value="add" /> |
229 |
<input type="hidden" name="op" value="add" /> |
| 48 |
<input type="hidden" name="batch_id" value="[% batch_id %]" /> |
230 |
<input type="hidden" name="batch_id" value="[% batch_id %]" /> |
| 49 |
<label for="bor_num_list">Add by borrowernumber(s): |
231 |
<label for="description">Batch description: </label> |
| 50 |
<br /> <span class="hint">One borrowernumber per line.</span> |
232 |
<input type="text" name="description" value="[% description %]"> |
| 51 |
</label> |
233 |
<a href="#" id="savedesc" data-batch_id="[% batch_id %]">Save description</a> <span id="change-status"></span> |
| 52 |
<textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea> |
234 |
</li><li> |
|
|
235 |
<label for="bor_num_list">Add by borrowernumber(s): |
| 236 |
<br /> <span class="hint">One borrowernumber per line.</span> |
| 237 |
</label> |
| 238 |
<textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea> |
| 53 |
</li></ol> |
239 |
</li></ol> |
| 54 |
</fieldset> |
240 |
</fieldset> |
| 55 |
</div> |
241 |
</div> |