Koha/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt
Owen Leonard 3d8f462cce Bug 9924 - Simplify and rename patron card creator error message include
The patron card creator error message include uses a non-standard method
for displaying error messages, and is poorly-named.

This patch converts the method of displaying error messages for various
patron card creator options to the standard one ('<div class="dialog
alert">') and renames the include file to make it clear that it relates
only to patron card creator operations.

To test, perform various operations:

- Go to 'manage images' and try to upload a file which exceeds the
  500KBfile size limit
- Go to the edit batch page and manually append an error code to the
  URL:  /cgi-bin/koha/patroncards/edit-batch.pl?op=new&error=403
- Go to one of the manage pages and manually append an error code to the
  URL:
  /cgi-bin/koha/patroncards/manage.pl?card_element=profile&error=201

Correct display of an error message indicates that the include file is
being found.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes test plan, test suite and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-08 19:19:23 +00:00

204 lines
9.5 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Patron card creator &rsaquo; Manage patron card batches</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'greybox.inc' %]
<script type="text/javascript">
//<![CDATA[
function DeleteConfirm() {
var msg = _("Are you sure you want to delete batch") + " [% batch_id %]?";
var answer = confirm(msg);
if (answer) {
window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&amp;card_element=batch&amp;element_id=[% batch_id %]";
}
else {
return; // abort delete
}
};
function Remove() {
items = new Array;
item_num = new Array;
if(document.items.action.length > 0) {
for (var i=0; i < document.items.action.length; i++) {
if (document.items.action[i].checked) {
items.push("label_id=" + document.items.action[i].value);
item_num.push(i+1);
}
}
if (items.length < 1) {
alert(_("Please select at least one item to delete."));
return; // no item selected
}
getstr = items.join("&");
item_msg = item_num.join(", ");
var msg = "Are you sure you want to remove card number(s): " + item_msg + " from this batch?"
}
else {
alert(_("Please select at least label to delete."));
return; // no item selected
}
var answer = confirm(msg);
if (answer) {
window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&amp;batch_id=[% batch_id %]&amp;" + getstr;
}
else {
return; // abort delete
}
};
function Add() {
window.open("/cgi-bin/koha/patroncards/members-search.pl?batch_id=[% batch_id %]",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes');
};
function DeDuplicate() {
window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&amp;batch_id=[% batch_id %]";
};
function Xport(mode) {
if (mode == 'label') {
patroncards= new Array;
if(document.items.action.length > 0) {
for (var i=0; i < document.items.action.length; i++) {
if (document.items.action[i].checked) {
patroncards.push("label_id=" + document.items.action[i].value);
}
}
if (patroncards.length < 1) {
alert(_("Please select at least one card to export."));
return; // no batch selected
}
getstr = patroncards.join("&");
}
else if (document.items.action.checked) {
getstr = document.items.action.value;
}
else {
alert(_("Please select at least one card to export."));
return; // no batch selected
}
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]&" + getstr, 700, 800);
}
else if (mode == 'batch') {
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]", 700, 800);
}
else {
// some pass-thru error trapping just in case...
}
};
function selected_layout() {
if (document.items.action.length) {
for (i=0;i<document.items.action.length;i++){
if (document.items.action[i].checked==true){
return(document.items.action[i].value);
}
};
}
else {
if (document.items.action.checked){
return(document.items.action.value);
}
};
alert(_("Please select at least one item."));
return (-1);
};
$(document).ready(function() {
$("#additems").click(function(){
Add();
return false;
});
$("#removeitems").click(function(){
Remove();
return false;
});
$("#deletebatch").click(function(){
DeleteConfirm();
return false;
});
$("#deduplicate").click(function(){
DeDuplicate();
return false;
});
$("#exportitems").click(function(){
Xport('label');
return false;
});
$("#exportbatch").click(function(){
Xport('batch');
return false;
});
});
//]]>
</script>
</head>
<body id="pcard_edit-batch" class="tools pcard">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
<a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> &rsaquo;
<a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Manage patron card batches</a> &rsaquo;
Manage batch number [% batch_id %]
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-small" id="additems" href="#">Add item(s)</a>[% IF ( table_loop ) %]
<a class="btn btn-small" id="removeitems" href="#">Remove item(s)</a>
<a class="btn btn-small" id="deletebatch" href="#">Delete batch</a>
<a class="btn btn-small" id="deduplicate" href="#">Remove duplicates</a>
<a class="btn btn-small" id="exportitems" href="#">Export item(s)</a>
<a class="btn btn-small" id="exportbatch" href="#">Export batch</a>[% END %]
</div>
[% INCLUDE 'patroncards-errors.inc' %]
<div class="yui-g">
<div class="yui-u first" id="manage-patroncard-batches">
<div class="hint">Current library: [% LoginBranchname %]</div>
[% IF ( table_loop ) %]
<form name="items" class="checkboxed">
<h2>Items in batch number [% batch_id %]</h2>
<table>
[% FOREACH table_loo IN table_loop %]
[% IF ( table_loo.header_fields ) %]
<tr>
[% FOREACH header_field IN table_loo.header_fields %]
<th>[% header_field.field_label %]</th>
[% END %]
</tr>
[% ELSE %]
<tr>
[% FOREACH text_field IN table_loo.text_fields %]
[% IF ( text_field.select_field ) %]
<td align="center"><input type="checkbox" name="action" value="[% text_field.field_value %]"></td>
[% ELSE %]
<td>[% text_field.field_value %]</td>
[% END %]
[% END %]
</tr>
[% END %]
[% END %]
</table>
</form>
[% ELSE %]
<div class="dialog message"><h4>There are no items in batch [% batch_id %] yet</h4>
<p>Use the toolbar above to add items.</p></div>
[% END %]
</div>
[% IF ( duplicate_message ) %]
<div class="yui-u">
<div class="dialog message">
<strong>[% duplicate_count %] duplicate item(s) found</strong> and removed from batch [% batch_id %].
</div>
</div>
[% END %]
</div>
</div>
</div>
<div class="yui-b">
[% INCLUDE 'patroncards-menu.inc' %]
</div>
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]