Bug 19490: Add a 'Holds' column to the items batchmodification tool

To test:
1 - Add some items to bathc modification
2 - Note there is no indication fo holds
3 - Apply patch
4 - Reload and note you can see how many holds (or none)
5 - Note you can hide this column with css:
    #batchMod-edit .holds_count { display: none; }
6 - Note the column has a tooltip to indicate item vs. record holds

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2018-05-14 20:57:57 +00:00
parent e520d69910
commit e427cf5b3f
3 changed files with 11 additions and 5 deletions

View File

@ -158,6 +158,7 @@ $(document).ready(function(){
<tr>
<th>&nbsp;</th>
<th class="anti-the">Title</th>
<th class="holds_count" title="Item holds / Total holds">Holds</th>
[% FOREACH item_header_loo IN item_header_loop %]
<th> [% item_header_loo.header_value | html %] </th>
[% END %]
@ -176,6 +177,7 @@ $(document).ready(function(){
<td>&nbsp;</td>
[% END %]
<td><label for="row[% item_loo.itemnumber | html %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber | uri %]">[% item_loo.title | html %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author | html %][% END %]</label></td>
<td class="holds_count"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% item_loo.biblionumber | uri %]">[% IF item_loo.holds %][% item_loo.item_holds | html %]/[% item_loo.holds | html %][% ELSE %][% item_loo.holds | html %][% END %]</a></td>
[% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field | html %]</td>
[% END %] </tr>
[% END %]

View File

@ -11,7 +11,7 @@ function hideColumns(){
$("#showall").prop("checked", false).parent().removeClass("selected");
for( i=0; i<valCookie.length; i++ ){
if(valCookie[i] !== ''){
index = valCookie[i] - 2;
index = valCookie[i] - 3;
$("#itemst td:nth-child("+valCookie[i]+"),#itemst th:nth-child("+valCookie[i]+")").toggle();
$("#checkheader"+index).prop("checked", false).parent().removeClass("selected");
}
@ -24,7 +24,7 @@ function hideColumn(num) {
valCookie = $.cookie("showColumns");
// set the index of the table column to hide
$("#"+num).parent().removeClass("selected");
var hide = Number(num.replace("checkheader","")) + 2;
var hide = Number(num.replace("checkheader","")) + 3;
// hide header and cells matching the index
$("#itemst td:nth-child("+hide+"),#itemst th:nth-child("+hide+")").toggle();
// set or modify cookie with the hidden column's index
@ -60,7 +60,7 @@ function showColumn(num){
$("#"+num).parent().addClass("selected");
valCookie = $.cookie("showColumns");
// set the index of the table column to hide
show = Number(num.replace("checkheader","")) + 2;
show = Number(num.replace("checkheader","")) + 3;
// hide header and cells matching the index
$("#itemst td:nth-child("+show+"),#itemst th:nth-child("+show+")").toggle();
// set or modify cookie with the hidden column's index
@ -82,14 +82,14 @@ function showColumn(num){
function showAllColumns(){
$("#selections").checkCheckboxes();
$("#selections span").addClass("selected");
$("#itemst td:nth-child(2),#itemst tr th:nth-child(2)").nextAll().show();
$("#itemst td:nth-child(3),#itemst tr th:nth-child(3)").nextAll().show();
$.removeCookie("showColumns", { path: '/' });
$("#hideall").prop("checked", false).parent().removeClass("selected");
}
function hideAllColumns(){
$("#selections").unCheckCheckboxes();
$("#selections span").removeClass("selected");
$("#itemst td:nth-child(2),#itemst th:nth-child(2)").nextAll().hide();
$("#itemst td:nth-child(3),#itemst th:nth-child(3)").nextAll().hide();
$("#hideall").prop("checked", true).parent().addClass("selected");
var cookieString = allColumns.join("/");
$.cookie("showColumns", cookieString, { expires : date, path: '/' });

View File

@ -569,6 +569,8 @@ sub BuildItemsData{
$this_row{author} = $biblio->author;
$this_row{isbn} = $biblio->biblioitem->isbn;
$this_row{biblionumber} = $biblio->biblionumber;
$this_row{holds} = $biblio->holds->count;
$this_row{item_holds} = Koha::Holds->search( itemnumber => $itemnumber )->count;
if (%this_row) {
push(@big_array, \%this_row);
@ -592,6 +594,8 @@ sub BuildItemsData{
$row_data{title} = $row->{title};
$row_data{isbn} = $row->{isbn};
$row_data{biblionumber} = $row->{biblionumber};
$row_data{holds} = $row->{holds};
$row_data{item_holds} = $row->{item_holds};
my $is_on_loan = C4::Circulation::IsItemIssued( $row->{itemnumber} );
$row_data{onloan} = $is_on_loan ? 1 : 0;
push(@item_value_loop,\%row_data);