Bugzilla – Attachment 191132 Details for
Bug 41571
Tidy kohaTable block - labels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41571: labels - auto tidy
7f86593.patch (text/plain), 12.05 KB, created by
Jonathan Druart
on 2026-01-09 14:48:42 UTC
(
hide
)
Description:
Bug 41571: labels - auto tidy
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2026-01-09 14:48:42 UTC
Size:
12.05 KB
patch
obsolete
>From 7f865937ef9d82151653c0f8786fd913fa3bb755 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 9 Jan 2026 13:14:18 +0100 >Subject: [PATCH] Bug 41571: labels - auto tidy > >--- > .../en/modules/labels/label-edit-batch.tt | 133 +++++++++--------- > .../prog/en/modules/labels/label-manage.tt | 1 - > 2 files changed, 66 insertions(+), 68 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >index 5a5e6d7572c..76bb34dd9a2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >@@ -235,43 +235,42 @@ > const batch_id = "[% batch_id | html %]"; > const has_entries = [% table_loop ? 1 : 0 | html %]; > </script> >- > <script> >- function dofocus() { // named function req'd for body onload event by some FF and IE7 security models >+ function dofocus() { >+ // named function req'd for body onload event by some FF and IE7 security models > $(".focus:last").select(); > } > function verifyBarcodes(barcodes) { >- if (barcodes.value == '') { >+ if (barcodes.value == "") { > alert(_("Please add barcodes using either the direct entry text area or the item search.")); >- return false; // not ok >- } >- else { >- return true; // ok >+ return false; // not ok >+ } else { >+ return true; // ok > } > } > > function Remove() { > const batch_remove_form = $("#batch_remove_form"); >- items = new Array; >- item_num = new Array; >- if(document.items.action.length > 0) { >- for (var i=0; i < document.items.action.length; i++) { >+ 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( document.items.action[i].value ); >- item_num.push( i + 1 ); >+ items.push(document.items.action[i].value); >+ item_num.push(i + 1); > } > } > item_msg = item_num.join(", "); > var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg); > } else if (document.items.action.checked) { > alert(_("Deletion of label from a batch with only one label will delete the batch.") + "\n\n" + _("If this is what you want, select the 'Delete batch' option from the toolbar")); >- return; // no deletion for single item batch >+ return; // no deletion for single item batch > } else { > alert(_("Please select at least one label to delete.")); >- return; // no item selected >+ return; // no item selected > } >- if ( confirm( msg ) ) { >- items.forEach(( label_id ) => { >+ if (confirm(msg)) { >+ items.forEach(label_id => { > batch_remove_form.append('<input type="hidden" name="label_id" value="' + label_id + '" />'); > }); > batch_remove_form.submit(); >@@ -282,16 +281,16 @@ > > function Add() { > var number_list = document.getElementById("number_list"); >- if (number_list.value == '') { >- window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=" + batch_id + "&type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes'); >+ if (number_list.value == "") { >+ window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=" + batch_id + "&type=labels", "FindABibIndex", "width=875,height=400,toolbar=no,scrollbars=yes"); > } else { > document.forms["add_by_number"].submit(); > } > } > > function add_item(item_number) { >- $("#itemnum_enter").prop("checked",true); >- $("#number_list").val($("#number_list").val()+item_number+"\r\n"); >+ $("#itemnum_enter").prop("checked", true); >+ $("#number_list").val($("#number_list").val() + item_number + "\r\n"); > } > > function DeDuplicate() { >@@ -299,28 +298,27 @@ > } > > function Xport(mode) { >- if (mode == 'label') { >- labels= new Array; >- if(document.items.action.length > 0) { >- for (var i=0; i < document.items.action.length; i++) { >+ if (mode == "label") { >+ labels = new Array(); >+ if (document.items.action.length > 0) { >+ for (var i = 0; i < document.items.action.length; i++) { > if (document.items.action[i].checked) { >- labels.push("label_id=" + document.items.action[i].value); >+ labels.push("label_id=" + document.items.action[i].value); > } > } > if (labels.length < 1) { > alert(_("Please select at least one label to export.")); >- return; // no batch selected >+ return; // no batch selected > } > getstr = labels.join("&"); >- } >- else if (document.items.action.checked) { >+ } else if (document.items.action.checked) { > getstr = document.items.action.value; > } else { > alert(_("Please select at least one label to export.")); >- return; // no batch selected >+ return; // no batch selected > } > location.href = "/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&" + getstr; >- } else if (mode == 'batch') { >+ } else if (mode == "batch") { > location.href = "/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id; > } else { > // some pass-through error trapping just in case... >@@ -329,23 +327,23 @@ > > 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); >+ 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); >+ if (document.items.action.checked) { >+ return document.items.action.value; > } > } > alert(_("Please select at least one item.")); >- return (-1); >+ return -1; > } > >- $(document).ready(function() { >+ $(document).ready(function () { > $('.sidebar_menu a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current"); >- if (has_entries){ >+ if (has_entries) { > $("#description").show(); > } else { > $("#description").hide(); >@@ -356,65 +354,66 @@ > order: [[0, "asc"]], > pagingType: "full", > }); >- $("#additems").click(function(){ >+ $("#additems").click(function () { > Add(); > return false; > }); >- $("#removeitems").click(function(){ >+ $("#removeitems").click(function () { > Remove(); > return false; > }); > >- $("#deduplicate").click(function(){ >+ $("#deduplicate").click(function () { > DeDuplicate(); > return false; > }); >- $("#exportitems").click(function(){ >- Xport('label'); >+ $("#exportitems").click(function () { >+ Xport("label"); > return false; > }); >- $("#exportbatch").click(function(){ >- Xport('batch'); >+ $("#exportbatch").click(function () { >+ Xport("batch"); > return false; > }); >- $(".delete").on("click", function(){ >- return confirmDelete( _("Are you sure you want to delete this?") ); >+ $(".delete").on("click", function () { >+ return confirmDelete(_("Are you sure you want to delete this?")); > }); >- $(".export").on("click", function(e){ >+ $(".export").on("click", function (e) { > e.preventDefault(); > var label_id = $(this).data("label-id"); > var batch_id = $(this).data("batch-id"); > location.href = "/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id; > }); >- $("#savedesc").click(function(event){ >+ $("#savedesc").click(function (event) { > event.preventDefault(); // prevent form submission > var newdescription = $('input[name="description"]').val(); >- var batch_id = $(this).data('batch_id'); >+ var batch_id = $(this).data("batch_id"); > var ajaxData = { >- 'newdescription': newdescription, >- 'batch_id': batch_id, >- op: 'cud-set_permission', >+ newdescription: newdescription, >+ batch_id: batch_id, >+ op: "cud-set_permission", > csrf_token: $('meta[name="csrf-token"]').attr("content"), > }; > > $.ajax({ >- url: '/cgi-bin/koha/svc/creator_batches', >- type: 'POST', >- dataType: 'json', >+ url: "/cgi-bin/koha/svc/creator_batches", >+ type: "POST", >+ dataType: "json", > data: ajaxData, > }) >- .done(function(data){ >- if (data.status == 'success') { >- $("input[name='description']").text(data.newdesc); >- $("#change-status").text(_("Saved")); >- } else { >+ .done(function (data) { >+ if (data.status == "success") { >+ $("input[name='description']").text(data.newdesc); >+ $("#change-status").text(_("Saved")); >+ } else { >+ $("#change-status").text(_("Unable to save description")); >+ } >+ }) >+ .fail(function () { > $("#change-status").text(_("Unable to save description")); >- } >- }).fail(function(){ >- $("#change-status").text(_("Unable to save description")); >- }); >+ }); > }); >- }); >+ }); > </script> > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt >index 4cfc044224e..4b66a680f69 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt >@@ -161,7 +161,6 @@ > // FIXME This is impossible to translate correctly > const label_element = "[% label_element | html %]"; > </script> >- > <script> > function Xport() { > batches= new Array; >-- >2.43.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41571
:
191130
|
191131
| 191132