From 29e31009dcda33e739a7ac8450f65f420d68abac Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Wed, 26 Jun 2024 22:33:19 +0000 Subject: [PATCH] Bug 37205: Fix printing patron cards from the patron lists page This patch allows for the printing of patron cards from the patron lists page. Previously when attempting to do this, some errors show up, saying : "Programming error - op 'cud-export' must not start with 'cud-' for GET ...". To fix this issue, rather than send this info as a GET request, we can send it as a POST request to print.pl and extract the correct html code. To test: 1) Go to Tools -> Patron lists 2) Create a new patron list 3) Populate with patrons 4) Go back to Tools -> Patron lists 5) Find your list, click on 'Action' and select 'Print patron cards', then select "Export" 6) Notice infinite load as well as error in dev tools 7) Apply patch 8) Go back to your patron list and attempt to print patron cards again. 9) When you select "Export" this time, it should load properly giving you a pdf of the patron cards like requested. --- .../prog/en/modules/patron_lists/lists.tt | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt index 29fd544762..4d03a3c4f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt @@ -118,15 +118,15 @@ @@ -203,11 +203,23 @@ patronExportModal.on("submit", "#exportingf", function(e){ e.preventDefault(); - modal_body = patronExportModalBody; + var modal_body = patronExportModalBody; modal_body.html("
\"\" "+_("Loading")+"
"); target_url = $(this).attr("action"); params = $( this ).serialize(); - $("#patronExportModal .modal-body").load( target_url + "?" + params + " #export_patron_list"); + $.ajax({ + url: target_url, + type: "POST", + data: params, + success: function(response) { + // Extract and load the #export_patron_list part of the response into the modal body + var html = $(response).find("#export_patron_list").html(); + modal_body.html(html); + }, + error: function() { + modal_body.html("
An error occurred while processing the request.
"); + } + }); }); patronExportModal.on("click",".closebtn,.gb-close",function(e){ -- 2.39.2