Bug 40366: Update the label export process to avoid Greybox modal

This patch updates the label export process to eliminate the use of the
Greybox modal, opting to move from page to page through the process.

Tangentially related: I updated the DataTables table configuration of
the tables on the label batch management page and label batch edit page
in order to remove the DataTables "Export" button because of the
possibility that its presence might be confusing.

To test apply the patch and go to Cataloging -> Label creator.

- Create more than one batch  add multiple items to each.
- From the label batches page, test the process of exporting labels,
  observing at each step the page title and breadcrumbs.
  - Check a box next to a single batch and click the "Export selected"
    button at the bottom.
  - Check multiple boxes and click "Export selected."
  - Click "Edit" on one of the batches
    - In the list of items, check one or more checkboxes, and click
      "Export select items."
    - Click an individual "Export" button from the list of items.
    - Click "Export full batch"
- In each case, you should be forwarded to a new page for choosing label
  options.
  - After submitting the form, you should be forwarded to another page
    where you have options for downloading the batch as a PDF, CSV, or
    XML.
- Test the new "Return to label batches" to confirm that it takes you to
  the label batches page.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2025-07-14 17:32:25 +00:00 committed by Lucas Gass
parent 31022ba0c5
commit b333397914
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
4 changed files with 57 additions and 40 deletions

View File

@ -315,9 +315,9 @@
alert(_("Please select at least one label to export."));
return; // no batch selected
}
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
location.href = "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]&" + getstr;
} else if (mode == 'batch') {
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]", 400, 800);
location.href = "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]";
} else {
// some pass-through error trapping just in case...
}
@ -347,6 +347,7 @@
$("#description").hide();
[% END %]
$("#batcht").kohaTable({
dom: '<"dt-info"i><"top pager"<"table_entries"lp><"table_controls"f>>tr<"bottom pager"ip>',
autoWidth: false,
order: [[0, "asc"]],
pagingType: "full",
@ -379,7 +380,7 @@
e.preventDefault();
var label_id = $(this).data("label-id");
var batch_id = $(this).data("batch-id");
GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800);
location.href = "/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id;
});
$("#savedesc").click(function(event){
event.preventDefault(); // prevent form submission

View File

@ -61,7 +61,7 @@
var str = "";
str += "from=" + document.getElementById("from-input").value + "&";
str += "to=" + document.getElementById("to-input").value;
return GB_showCenter("Export labels", "/cgi-bin/koha/labels/label-print.pl?" + str, 400, 800);
location.href = "/cgi-bin/koha/labels/label-print.pl?" + str;
}
function checkTwoValue(_from, _to, _id) {

View File

@ -180,7 +180,7 @@
alert(_("Please select at least one batch to export."));
return; // no batch selected
}
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?" + getstr, 400, 800);
location.href = "/cgi-bin/koha/labels/label-print.pl?" + getstr;
}
function selected_layout(op) {
var selected = new Array;
@ -216,6 +216,7 @@
return confirmDelete( _("Are you sure you want to delete this?") );
});
$("#labels-table").kohaTable({
dom: '<"dt-info"i><"top pager"<"table_entries"lp><"table_controls"f>>tr<"bottom pager"ip>',
pagingType: "full",
order: [[1, "asc"]],
});

View File

@ -1,12 +1,13 @@
[% USE raw %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title
>[% FILTER collapse %]
[% t("Label printing/exporting") | html %]
&rsaquo; [% t("Label creator") | html %] &rsaquo; [% t("Tools") | html %] &rsaquo; [% t("Koha") | html %]
[% END %]</title
>
<title>
[% FILTER collapse %]
[% t("Label export") | html %]
&rsaquo; [% t("Label creator") | html %] &rsaquo; [% t("Cataloging") | html %] &rsaquo; [% t("Koha") | html %]
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' popup => 1 %]
<style>
table {
@ -22,13 +23,33 @@
</style>
</head>
<body id="labels_label-print" class="tools labels">
<div class="main container-fluid">
[% INCLUDE 'messages.inc' %]
<h1>Label printing/exporting</h1>
<body id="labels_label-export-batch" class="tools labels">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
[% END %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a>
[% END %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Label batches</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Label export</span>
[% END %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
[% WRAPPER 'main-container.inc' %]
<h1>Label export</h1>
[% IF ( batches ) %]
<form method="get">
<h3>Click on the following links to download the exported batch(es).</h3>
<h3>Click any of the following links to download the exported batch</h3>
[% IF warn_empty_range %]
<div class="alert alert-warning">
<p>Some or all of the barcodes in the range you have selected have no corresponding items.</p>
@ -39,11 +60,14 @@
<fieldset>
[% IF ( batche.label_ids ) %]
<legend>[% IF ( batche.label_count == 1 ) %][% batche.label_count | html %] single label[% ELSE %][% batche.label_count | html %] single labels[% END %]</legend>
<a
class="document pdf"
href="/cgi-bin/koha/labels/label-create-pdf.pl?batch_id=[% batche.batch_id | html %]&amp;template_id=[% batche.template_id | html %]&amp;layout_id=[% batche.layout_id | html %]&amp;start_label=[% batche.start_label | html %][% batche.label_ids | html %]"
>Download as PDF</a
>
<p>
<a
class="document pdf"
href="/cgi-bin/koha/labels/label-create-pdf.pl?batch_id=[% batche.batch_id | html %]&amp;template_id=[% batche.template_id | html %]&amp;layout_id=[% batche.layout_id | html %]&amp;start_label=[% batche.start_label | html %][% batche.label_ids | html %]"
>
Download as PDF
</a>
</p>
<p
><a
@ -117,7 +141,7 @@
</fieldset>
[% END %]
<fieldset class="action">
<input type="button" class="gb-close" value="Done" />
<a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch" class="btn btn-default">Return to label batches</a>
</fieldset>
</form>
[% ELSE %]
@ -127,7 +151,11 @@
[% ELSIF ( item_numbers ) %]
[% IF ( item_count == 1 ) %]<span>Exporting 1 label</span>[% ELSE %]<span>Exporting [% item_count | html %] labels</span>[% END %]
[% ELSE %]
[% IF ( multi_batch_count == 1 ) %]<span>1 batch to export</span>[% ELSE %]<span>[% multi_batch_count | html %] batches to export</span>[% END %]
[% IF ( multi_batch_count == 1 ) %]
<span>1 batch to export</span>
[% ELSE %]
<span>[% multi_batch_count | html %] batches to export</span>
[% END %]
[% END %]
</h3>
<form name="exporting" method="post" action="/cgi-bin/koha/labels/label-print.pl">
@ -176,22 +204,9 @@
</fieldset>
</form>
[% END %]
</div>
<!-- /.main.container-fluid -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% INCLUDE 'greybox.inc' %]
<script>
function Done() {
window.location = "[% referer | html %]";
};
$(document).ready(function(){
$(".gb-close").on("click",function(){
parent.parent.GB_hide();
});
});
</script>
[% END %]
[% INCLUDE 'popup-bottom.inc' %]
[% MACRO jsinclude BLOCK %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]