Browse Source

Bug 26497: "Hide all columns" throws Javascript error on aqplan.pl

This patch updates the JavaScript for checking and unchecking checkboxes
on the Acquisitions planning page so that it doesn't require the
checkboxes plugin.

To test, apply the patch and go to Administration -> Budgets -> Budget
details -> Planning.

On the planning page, test the "Show all columns" and "Hide all columns"
checkboxes. They should work correctly to show and hide the correct
columns.

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Owen Leonard 2 years ago
committed by Jonathan Druart
parent
commit
be7c705d3b
  1. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt
  2. 8
      koha-tmpl/intranet-tmpl/prog/js/acq.js

4
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt

@ -139,8 +139,8 @@
<td class="actions">
[% UNLESS ( budget_line.budget_lock ) %]
<input type="button" class="auto_fill_row" data-budget-id="[% budget_line.budget_id | html %]" value="Auto-fill row"/>
<input type="button" class="clear_fields" data-budget-id="[% budget_line.budget_id | html %]" value="Clear">
<input type="button" class="auto_fill_row btn btn-default btn-xs" data-budget-id="[% budget_line.budget_id | html %]" value="Auto-fill row"/>
<input type="button" class="clear_fields btn btn-default btn-xs" data-budget-id="[% budget_line.budget_id | html %]" value="Clear">
[% ELSE %]
<div style="color:red;">not owned</div>
[% END %]

8
koha-tmpl/intranet-tmpl/prog/js/acq.js

@ -364,14 +364,18 @@ function showColumn(num){
}
function showAllColumns(){
$("#selections").checkCheckboxes();
$("#selections").find("input:checkbox").each(function () {
$(this).prop("checked", true);
});
$("#selections span").addClass("selected");
$("#plan td:nth-child(2),#plan tr th:nth-child(2)").nextAll().show();
$("#hideall").prop("checked", false).parent().removeClass("selected");
}
function hideAllColumns(){
var allCols = $("#plan th").length;
$("#selections").unCheckCheckboxes();
$("#selections").find("input:checkbox").each(function () {
$(this).prop("checked", false);
});
$("#selections span").removeClass("selected");
$("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns
$("#hideall").prop("checked", true).parent().addClass("selected");

Loading…
Cancel
Save