From a0d713e5b7ad5d29305d2d3247b5117705cdd221 Mon Sep 17 00:00:00 2001
From: Owen Leonard
Date: Mon, 12 Jan 2026 11:53:03 -0500
Subject: [PATCH] Bug 41563: (follow-up) Tidy parcel.tt
---
.../prog/en/modules/acqui/parcel.tt | 403 +++++++++---------
1 file changed, 205 insertions(+), 198 deletions(-)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
index 15177fc2b79..a595331dc38 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
@@ -379,15 +379,14 @@
var PENDING_MULTI_SELECTION = _("Receive selected (%s)");
var columns_filter = {};
- $(document).ready(function(){
-
- $(".cancel_receipt").on( 'click', function(e){
+ $(document).ready(function () {
+ $(".cancel_receipt").on("click", function (e) {
e.preventDefault();
- $('#cancel_ordernumber').val( $(this).data('ordernumber') );
- $('#cancel_receipt').submit();
+ $("#cancel_ordernumber").val($(this).data("ordernumber"));
+ $("#cancel_receipt").submit();
});
- if ( $("#receivedt").length ) {
+ if ($("#receivedt").length) {
var receivedt = $("#receivedt").kohaTable({
stateSave: true, // We do not have table settings on this table
pageLength: 10,
@@ -395,143 +394,141 @@
[5, 10, 20, 50, 100, -1],
[5, 10, 20, 50, 100, _("All")],
],
- columns: [
- { type: "html" },
- { type: "html" },
- { type: "html" },
- { type: "num-html" },
- { type: "anti-the" },
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- ],
+ columns: [{ type: "html" }, { type: "html" }, { type: "html" }, { type: "num-html" }, { type: "anti-the" }, null, null, null, null, null, null, null, null],
pagingType: "full",
});
}
var options = {
ajax: {
- "url": '/api/v1/acquisitions/orders?only_active=1'
+ url: "/api/v1/acquisitions/orders?only_active=1",
},
- embed: [
- "basket.basket_group",
- "biblio.uncancelled_orders+count",
- "biblio.holds+count",
- "biblio.items+count",
- "biblio.suggestions.suggester",
- "fund",
- "current_item_level_holds+count",
- "items"
- ],
+ embed: ["basket.basket_group", "biblio.uncancelled_orders+count", "biblio.holds+count", "biblio.items+count", "biblio.suggestions.suggester", "fund", "current_item_level_holds+count", "items"],
columns: [
- { data: "basket.name",
- searchable: true,
- orderable: true,
- render: function(data, type, row, meta) {
- if (type != 'display') return escape_str(data);
- return "" + escape_str(data) + " (" + escape_str(row.basket.basket_id) + ")";
- }
+ {
+ data: "basket.name",
+ searchable: true,
+ orderable: true,
+ render: function (data, type, row, meta) {
+ if (type != "display") return escape_str(data);
+ return '' + escape_str(data) + " (" + escape_str(row.basket.basket_id) + ")";
+ },
},
- { data: "basket.basket_group.name",
- orderable: true,
- render: function(data, type, row, meta) {
- if ( type != 'display' ) {
- return escape_str(data);
- }
- if ( row.basket.basket_group_id == null ) {
- return _("No basket group");
- }
- else {
- return ""
- + escape_str(row.basket.basket_group.name) + " (" + escape_str(row.basket.basket_group_id) + ")";
- }
- }
+ {
+ data: "basket.basket_group.name",
+ orderable: true,
+ render: function (data, type, row, meta) {
+ if (type != "display") {
+ return escape_str(data);
+ }
+ if (row.basket.basket_group_id == null) {
+ return _("No basket group");
+ } else {
+ return (
+ '' +
+ escape_str(row.basket.basket_group.name) +
+ " (" +
+ escape_str(row.basket.basket_group_id) +
+ ")"
+ );
+ }
+ },
},
{
data: "order_id",
- render: function(data, type, row, meta) {
- if (type != 'display') return escape_str(data);
- return ""+escape_str(data)+"";
- }
+ render: function (data, type, row, meta) {
+ if (type != "display") return escape_str(data);
+ return '' + escape_str(data) + "";
+ },
},
{
data: summary_fields,
- render: function(data, type, row, meta) {
- var result = '';
- if ( row && row.biblio_id != null ) {
- result = ""+escape_str(row.biblio.title)+"";
- if ( row.biblio.author != null )
- result += _(" by ") + escape_str(row.biblio.author);
- if ( row.biblio.isbn != null )
- result += " – " + escape_str(row.biblio.isbn);
- if (prefs.marcflavour == 'UNIMARC' && row.biblio.ean != null ) {
- result += " – EAN:" + escape_str(row.biblio.ean);
- }
- if ( row.biblio.publisher != null ) {
+ render: function (data, type, row, meta) {
+ var result = "";
+ if (row && row.biblio_id != null) {
+ result = '
' + escape_str(row.biblio.title) + "";
+ if (row.biblio.author != null) result += _(" by ") + escape_str(row.biblio.author);
+ if (row.biblio.isbn != null) result += " – " + escape_str(row.biblio.isbn);
+ if (prefs.marcflavour == "UNIMARC" && row.biblio.ean != null) {
+ result += " – EAN:" + escape_str(row.biblio.ean);
+ }
+ if (row.biblio.publisher != null) {
result += "
" + _("Publisher: ") + escape_str(row.biblio.publisher);
- if ( row.biblio.publication_year != null ) {
+ if (row.biblio.publication_year != null) {
result += ", " + escape_str(row.biblio.publication_year);
- }
- else if ( row.biblio.copyright_date != null ) {
+ } else if (row.biblio.copyright_date != null) {
result += escape_str(row.biblio.copyright_date);
}
}
var suggestions = row.biblio.suggestions;
- if ( suggestions != null && suggestions.length > 0 ) {
+ if (suggestions != null && suggestions.length > 0) {
var suggestion = suggestions[0];
- if ( suggestion.suggester != null ) {
+ if (suggestion.suggester != null) {
var suggester = suggestion.suggester;
var suggested_by = [];
- if ( suggester.surname != null ) {
+ if (suggester.surname != null) {
suggested_by.push(escape_str(suggester.surname));
}
- if ( suggester.firstname != null ) {
+ if (suggester.firstname != null) {
suggested_by.push(escape_str(suggester.firstname));
}
- result += "
" + _("Suggested by: ") +
- ''
- + suggested_by.join(", ")
- + " (#" + escape_str(suggestions[0].suggestionid) + ")"; // FIXME: could be changed if we allow matching multiple suggestions
+ result +=
+ "
" +
+ _("Suggested by: ") +
+ '' +
+ suggested_by.join(", ") +
+ " (#" +
+ escape_str(suggestions[0].suggestionid) +
+ ")"; // FIXME: could be changed if we allow matching multiple suggestions
}
}
- result += '
';
+ result += "
";
}
var internal_note = row.internal_note;
- if ( internal_note != null && internal_note != '' ) {
- result += ''
- + _("Internal note: ")
- + '' + escape_str(internal_note)
- + ' [' + _("Change internal note") + ']
';
- }
- else {
- result += ' [' + _("Add internal note") + ']';
+ if (internal_note != null && internal_note != "") {
+ result +=
+ '' +
+ _("Internal note: ") +
+ "" +
+ escape_str(internal_note) +
+ ' [' +
+ _("Change internal note") +
+ "]
";
+ } else {
+ result +=
+ ' [' +
+ _("Add internal note") +
+ "]";
}
var vendor_note = row.vendor_note;
- if ( vendor_note != null && vendor_note != '' ) {
- result += ''
- + _("Vendor note: ")
- + '' + escape_str(vendor_note) + '
';
- }
- else {
- result += ' [' + _("Add vendor note") + ']';
+ if (vendor_note != null && vendor_note != "") {
+ result += '' + _("Vendor note: ") + "" + escape_str(vendor_note) + "
";
+ } else {
+ result +=
+ ' [' +
+ _("Add vendor note") +
+ "]";
}
return result;
@@ -540,198 +537,208 @@
},
{
data: "",
- render: function(data, type, row, meta) {
+ render: function (data, type, row, meta) {
var result = '';
- result += '';
- result += '';
+ result += '";
+ result +=
+ '';
result += '';
- result += '
';
+ result += '' + i18n.order + "";
+ result += '' + _("MARC") + "";
+ result += '' + _("Card") + "";
+ result += "";
+ result += "";
return result;
},
orderable: false,
- searchable: false
+ searchable: false,
},
{
data: "replacement_price",
- render: function(data, type, row, meta) {
+ render: function (data, type, row, meta) {
return escape_price(row.replacement_price);
},
},
{
data: "quantity",
- orderable: true
+ orderable: true,
},
{
data: "ecost",
- render: function(data, type, row, meta) {
+ render: function (data, type, row, meta) {
return escape_price(row.ecost);
},
},
{
data: "",
- render: function(data, type, row, meta) {
+ render: function (data, type, row, meta) {
return escape_price(row.quantity * row.ecost);
},
orderable: false, // FIXME: How can we do it in DBIC?
- searchable: false
+ searchable: false,
},
{
data: "fund.name",
- render: function(data, type, row, meta) {
- if (type != 'display') return escape_str(data);
+ render: function (data, type, row, meta) {
+ if (type != "display") return escape_str(data);
return escape_str(row.fund.name);
- }
+ },
},
{
data: "",
- render: function(data, type, row, meta) {
- return ''
- + _("Receive") + '
'
- + ''
- + _("Transfer") + '';
+ render: function (data, type, row, meta) {
+ return (
+ '' +
+ _("Receive") +
+ "
" +
+ '' +
+ _("Transfer") +
+ ""
+ );
},
orderable: false,
- searchable: false
+ searchable: false,
},
{
data: "",
- render: function(data, type, row, meta) {
+ render: function (data, type, row, meta) {
var result = "";
- if ( row.current_holds_count > 0 ) {
- result += ''
- + _("Can't cancel order") + '
';
- }
- else {
- result += '
';
+ if (row.current_holds_count > 0) {
+ result +=
+ '' + _("Can't cancel order") + "
";
+ } else {
+ result +=
+ '
";
}
- if ( row.biblio != null ) {
- if ( row.biblio.items_count - row.items.length > 0 ||
- row.biblio.uncancelled_orders_count > 1 ||
- row.biblio.subscriptions_count > 0 ||
- row.biblio.holds_count > 0 ) { // biblio can be deleted
- result += ''
- + _("Can't cancel order and delete catalog record") + '
';
- }
- else {
- result += ''
- + _("Cancel order and catalog record") + '
';
+ if (row.biblio != null) {
+ if (row.biblio.items_count - row.items.length > 0 || row.biblio.uncancelled_orders_count > 1 || row.biblio.subscriptions_count > 0 || row.biblio.holds_count > 0) {
+ // biblio can be deleted
+ result += '' + _("Can't cancel order and delete catalog record") + "
";
+ } else {
+ result +=
+ '' +
+ _("Cancel order and catalog record") +
+ "
";
}
- if ( row.biblio.items_count - row.items.length > 0 ) {
- result += '' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '
';
+ if (row.biblio.items_count - row.items.length > 0) {
+ result +=
+ '' +
+ (row.biblio.items_count - row.items.length) +
+ _(" item(s) left") +
+ "
";
}
- if ( row.biblio.uncancelled_orders_count > 1 ) {
- result += ''
- + (row.biblio.uncancelled_orders_count - 1) + _(" order(s) left") + '
';
+ if (row.biblio.uncancelled_orders_count > 1) {
+ result += '' + (row.biblio.uncancelled_orders_count - 1) + _(" order(s) left") + "
";
}
- if ( row.biblio.subscriptions_count > 0 ) {
- result += ''
- + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
- + '
';
+ if (row.biblio.subscriptions_count > 0) {
+ result += '' + _("%s subscription(s) left").format(row.biblio.subscriptions_count) + "
";
}
- if ( row.biblio.holds_count > 0 ) {
- result += ''
- + _("%s hold(s) left").format(row.biblio.holds_count) + '';
+ if (row.biblio.holds_count > 0) {
+ result += '' + _("%s hold(s) left").format(row.biblio.holds_count) + "";
}
}
return result;
},
orderable: false,
- searchable: false
- }
- ]
+ searchable: false,
+ },
+ ],
};
var selected_rows = {};
- $('#select_multiple').click(function () {
- var ids = Object.keys(selected_rows);
- if (!ids.length) return;
- location.href = 'orderreceive.pl?multiple_orders=' + ids.join(',') + '&invoiceid=' + invoiceid
- }).html(PENDING_MULTI_SELECTION.format('0'))
- options.order = [[1, 'asc']];
+ $("#select_multiple")
+ .click(function () {
+ var ids = Object.keys(selected_rows);
+ if (!ids.length) return;
+ location.href = "orderreceive.pl?multiple_orders=" + ids.join(",") + "&invoiceid=" + invoiceid;
+ })
+ .html(PENDING_MULTI_SELECTION.format("0"));
+ options.order = [[1, "asc"]];
options.columns.unshift({
data: function (row, type, val, meta) {
return '';
},
searchable: false,
- orderable: false
+ orderable: false,
});
var pending_orders_table = $("#pending_orders").kohaTable(options, table_settings, 1, { "basket.vendor_id": vendor_id });
var api = pending_orders_table.api();
- api.on('draw', function () {
+ api.on("draw", function () {
api.rows().every(function () {
var row = this;
var data = row.data();
- $('.selOrder', row.node()).on('click', function (event) {
- if ($(this).prop('checked')) {
+ $(".selOrder", row.node()).on("click", function (event) {
+ if ($(this).prop("checked")) {
selected_rows[data.order_id] = data;
} else {
delete selected_rows[data.order_id];
}
- $('#select_multiple').html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length));
+ $("#select_multiple").html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length));
});
if (selected_rows[data.order_id]) {
- $('.selOrder', row.node()).prop('checked', true);
+ $(".selOrder", row.node()).prop("checked", true);
}
});
});
- $("#dataPreview").on("hidden.bs.modal", function(){
+ $("#dataPreview").on("hidden.bs.modal", function () {
$("#dataPreviewLabel").html("");
- $("#dataPreview .modal-body").html("
"+_("Loading")+"
");
+ $("#dataPreview .modal-body").html('
' + _("Loading") + "
");
});
- $("body").on("click", ".previewData", function(e){
+ $("body").on("click", ".previewData", function (e) {
e.preventDefault();
var ltitle = $(this).text();
var page = $(this).attr("href");
$("#dataPreviewLabel").text(ltitle);
$("#dataPreview .modal-body").load(page + " div");
- $('#dataPreview').modal("show");
+ $("#dataPreview").modal("show");
});
-
});
// Case-insensitive version of jquery's contains function
- jQuery.extend(jQuery.expr[':'], {
- icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
+ jQuery.extend(jQuery.expr[":"], {
+ icontains: "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0",
});
// Contains exactly function
- jQuery.extend(jQuery.expr[':'], {
- containsExactly: "$(a).text() == m[3]"
+ jQuery.extend(jQuery.expr[":"], {
+ containsExactly: "$(a).text() == m[3]",
});
function transfer_order_popup(ordernumber) {
- var url = "/cgi-bin/koha/acqui/transferorder.pl?"
- + "ordernumber=" + ordernumber
- window.open(url, 'TransferOrder');
+ var url = "/cgi-bin/koha/acqui/transferorder.pl?" + "ordernumber=" + ordernumber;
+ window.open(url, "TransferOrder");
}
[% END %]
--
2.39.5