View | Details | Raw Unified | Return to bug 10599
Collapse All | Expand All

(-)a/C4/Circulation.pm (+20 lines)
Lines 88-93 BEGIN { Link Here
88
		&GetOpenIssue
88
		&GetOpenIssue
89
		&AnonymiseIssueHistory
89
		&AnonymiseIssueHistory
90
        &CheckIfIssuedToPatron
90
        &CheckIfIssuedToPatron
91
        &IsItemIssued
91
	);
92
	);
92
93
93
	# subs to deal with returns
94
	# subs to deal with returns
Lines 3477-3482 sub CheckIfIssuedToPatron { Link Here
3477
    return;
3478
    return;
3478
}
3479
}
3479
3480
3481
=head2 IsItemIssued
3482
3483
  IsItemIssued( $itemnumber )
3484
3485
  Return 1 if the item is on loan, otherwise return 0
3486
3487
=cut
3488
3489
sub IsItemIssued {
3490
    my $itemnumber = shift;
3491
    my $dbh = C4::Context->dbh;
3492
    my $sth = $dbh->prepare(q{
3493
        SELECT COUNT(*)
3494
        FROM issues
3495
        WHERE itemnumber = ?
3496
    });
3497
    $sth->execute($itemnumber);
3498
    return $sth->fetchrow;
3499
}
3480
3500
3481
1;
3501
1;
3482
3502
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js (-1 / +7 lines)
Lines 102-108 function hideAllColumns(){ Link Here
102
        "aoColumnDefs": [
102
        "aoColumnDefs": [
103
            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }
103
            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }
104
        ],
104
        ],
105
        "bPaginate": false
105
        "bPaginate": false,
106
    }));
106
    }));
107
    $("#selectallbutton").click(function(){
107
    $("#selectallbutton").click(function(){
108
      $("#itemst").checkCheckboxes();
108
      $("#itemst").checkCheckboxes();
Lines 112-117 function hideAllColumns(){ Link Here
112
      $("#itemst").unCheckCheckboxes();
112
      $("#itemst").unCheckCheckboxes();
113
      return false;
113
      return false;
114
    });
114
    });
115
    $("#clearonloanbutton").click(function(){
116
      $("#itemst input[name='itemnumber'][data-is-onloan='1']").each(function(){
117
        $(this).attr('checked', false);
118
      });
119
      return false;
120
    });
115
    $("#selections input").change(function(e){
121
    $("#selections input").change(function(e){
116
      var num = $(this).attr("id");
122
      var num = $(this).attr("id");
117
      if(num == 'showall'){
123
      if(num == 'showall'){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt (-12 / +18 lines)
Lines 19-34 for( x=0; x<allColumns.length; x++ ){ Link Here
19
  allColumns[x] = Number(allColumns[x]) + 2;
19
  allColumns[x] = Number(allColumns[x]) + 2;
20
}
20
}
21
$(document).ready(function(){
21
$(document).ready(function(){
22
  $("#selectallbutton").click(function() {
22
23
      $("#itemst").find("input:checkbox").each(function() {
24
   $(this).attr("checked", "checked");
25
      });
26
  });
27
  $("#clearallbutton").click(function() {
28
      $("#itemst").find("input:checkbox").each(function() {
29
   $(this).removeAttr("checked");
30
      });
31
  });
32
  $("input[name='disable_input']").click(function() {
23
  $("input[name='disable_input']").click(function() {
33
      var row = $(this).attr("id");
24
      var row = $(this).attr("id");
34
      row = row.replace("row","hint");
25
      row = row.replace("row","hint");
Lines 42-47 $(document).ready(function(){ Link Here
42
          $("#"+row).html("");
33
          $("#"+row).html("");
43
      }
34
      }
44
  });
35
  });
36
45
});
37
});
46
//]]>
38
//]]>
47
</script>
39
</script>
Lines 97-103 $(document).ready(function(){ Link Here
97
     <input type="hidden" name="src" id="src" value="[% src %]" />
89
     <input type="hidden" name="src" id="src" value="[% src %]" />
98
90
99
[% IF ( item_loop ) %]
91
[% IF ( item_loop ) %]
100
  [% IF ( show ) %]<div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div>[% ELSE %][% END %]
92
  [% IF show %]
93
    <div id="toolbar">
94
      <a id="selectallbutton" href="#">Select all</a> | <a id="clearallbutton" href="#">Clear all</a> | <a id="clearonloanbutton" href="#">Clear on loan</a>
95
    </div>
96
  [% END %]
101
<div id="cataloguing_additem_itemlist">
97
<div id="cataloguing_additem_itemlist">
102
98
103
<p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span> 
99
<p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span> 
Lines 116-122 $(document).ready(function(){ Link Here
116
    </tr>
112
    </tr>
117
      </thead>
113
      </thead>
118
      <tbody>
114
      <tbody>
119
            [% FOREACH item_loo IN item_loop %] <tr> [% IF ( show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot Edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% ELSE %]<td>&nbsp;</td>[% END %]
115
            [% FOREACH item_loo IN item_loop %]
116
              <tr>
117
                [% IF show %]
118
                  [% IF item_loo.nomod %]
119
                    <td class="error">Cannot Edit</td>
120
                  [% ELSE %]
121
                    <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" data-is-onloan="[% item_loo.onloan %]" /></td>
122
                  [% END %]
123
                [% ELSE %]
124
                  <td>&nbsp;</td>
125
                [% END %]
120
                <td><label for="row[% item_loo.itemnumber %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">[% item_loo.title %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author %][% END %]</label></td>
126
                <td><label for="row[% item_loo.itemnumber %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">[% item_loo.title %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author %][% END %]</label></td>
121
                [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field |html %]</td> 
127
                [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field |html %]</td> 
122
        [% END %] </tr>
128
        [% END %] </tr>
(-)a/t/db_dependent/Circulation/IsItemIssued.t (+40 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Test::More tests => 1;
3
4
use C4::Biblio;
5
use C4::Circulation;
6
use C4::Items;
7
use C4::Members;
8
use Koha::DateUtils;
9
10
use MARC::Record;
11
12
*C4::Context::userenv = \&Mock_userenv;
13
14
my $dbh = C4::Context->dbh;
15
$dbh->{AutoCommit} = 0;
16
$dbh->{RaiseError} = 1;
17
18
my $borrowernumber = AddMember(
19
    firstname =>  'my firstname',
20
    surname => 'my surname',
21
    categorycode => 'S',
22
    branchcode => 'CPL',
23
);
24
25
26
my $borrower = GetMember( borrowernumber => $borrowernumber );
27
my $record = MARC::Record->new();
28
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' );
29
30
my ( undef, undef, $itemnumber ) = AddItem( { homebranch => 'CPL', holdingbranch => 'CPL', barcode => 'i_dont_exist' }, $biblionumber );
31
my $item = GetItem( $itemnumber );
32
33
is ( IsItemIssued( $item->{itemnumber} ), 1, "Item is issued" );
34
35
$dbh->rollback;
36
37
# C4::Context->userenv
38
sub Mock_userenv {
39
    return { branch => 'CPL' };
40
}
(-)a/tools/batchMod.pl (-1 / +2 lines)
Lines 545-550 sub BuildItemsData{ Link Here
545
      $row_data{title} = $row->{title};
545
      $row_data{title} = $row->{title};
546
      $row_data{isbn} = $row->{isbn};
546
      $row_data{isbn} = $row->{isbn};
547
      $row_data{biblionumber} = $row->{biblionumber};
547
      $row_data{biblionumber} = $row->{biblionumber};
548
      my $is_on_loan = C4::Circulation::IsItemIssued( $row->{itemnumber} );
549
      $row_data{onloan} = $is_on_loan ? 1 : 0;
548
			push(@item_value_loop,\%row_data);
550
			push(@item_value_loop,\%row_data);
549
		}
551
		}
550
		my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted;
552
		my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted;
551
- 

Return to bug 10599