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

(-)a/C4/HoldsQueue.pm (-18 / +15 lines)
Lines 657-670 sub least_cost_branch { Link Here
657
sub MarkHoldPrinted {
657
sub MarkHoldPrinted {
658
   my ( $reserve_id ) = @_;
658
   my ( $reserve_id ) = @_;
659
   my $dbh = C4::Context->dbh;
659
   my $dbh = C4::Context->dbh;
660
   my $strsth="UPDATE reserves INNER JOIN tmp_holdsqueue USING (reserve_id)
660
   my $strsth="UPDATE reserves LEFT JOIN tmp_holdsqueue USING (reserve_id)
661
                SET reserves.print_status = 1 , tmp_holdsqueue.print_status = 1
661
                SET reserves.print_status = '1' , tmp_holdsqueue.print_status = '1'
662
                WHERE reserve_id = ?
662
                WHERE reserve_id = ?
663
		";
663
               ";
664
    my $sth = $dbh->prepare($strsth);
664
    my $sth = $dbh->prepare($strsth);
665
	$sth->execute($reserve_id);
665
    return $sth->execute($reserve_id);
666
667
    return 1;
668
}
666
}
669
667
670
=head2 GetItemNumberFromTmpHold
668
=head2 GetItemNumberFromTmpHold
Lines 672-691 sub MarkHoldPrinted { Link Here
672
    Returns itemnumber associated with hold.
670
    Returns itemnumber associated with hold.
673
    Item number is taken from tmp_holdsqueue table, which is
671
    Item number is taken from tmp_holdsqueue table, which is
674
    populated by bulid_holds_queue.pl script.
672
    populated by bulid_holds_queue.pl script.
675
676
=cut
673
=cut
677
sub	GetItemNumberFromTmpHold{
674
sub GetItemNumberFromTmpHold {
678
	my ( $reserve_id ) = @_;
675
    my ( $reserve_id ) = @_;
679
	my $dbh = C4::Context->dbh;
676
    my $dbh = C4::Context->dbh;
680
	my $strsth="SELECT itemnumber
677
    my $strsth="SELECT itemnumber
681
                  FROM tmp_holdsqueue
678
               FROM tmp_holdsqueue
682
                WHERE reserve_id = ?
679
               WHERE reserve_id = ?
683
		";
680
        ";
684
	my $sth = $dbh->prepare($strsth);
681
    my $sth = $dbh->prepare($strsth);
685
	$sth->execute($reserve_id);
682
    $sth->execute($reserve_id);
686
683
687
	my $data = $sth->fetchrow;
684
    my $data = $sth->fetchrow;
688
	return $data;
685
    return $data;
689
}
686
}
690
687
691
1;
688
1;
(-)a/circ/hold-pull-print.pl (-12 / +11 lines)
Lines 2-22 Link Here
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
5
# Koha is free software; you can redistribute it and/or modify it
6
# terms of the GNU General Public License as published by the Free Software
6
# under the terms of the GNU General Public License as published by
7
# Foundation; either version 2 of the License, or (at your option) any later
7
# the Free Software Foundation; either version 3 of the License, or
8
# version.
8
# (at your option) any later version.
9
#
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
10
# Koha is distributed in the hope that it will be useful, but
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
13
#
14
#
14
# You should have received a copy of the GNU General Public License along
15
# You should have received a copy of the GNU General Public License
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
17
18
use strict;
18
use Modern::Perl;
19
#use warnings; #FIXME - Bug 2505
20
use C4::Context;
19
use C4::Context;
21
use C4::Output;
20
use C4::Output;
22
use CGI;
21
use CGI;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt (-23 / +23 lines)
Lines 11-49 Link Here
11
[% INCLUDE 'cat-search.inc' %]
11
[% INCLUDE 'cat-search.inc' %]
12
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
12
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
13
[% INCLUDE 'datatables.inc' %]
13
[% INCLUDE 'datatables.inc' %]
14
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
14
<script type="text/javascript">//<![CDATA[
15
<script type="text/javascript">//<![CDATA[
15
$(document).ready(function() {
16
$(document).ready(function() {
16
    $("#holdst").dataTable({
17
    $("#holdst").dataTable({
17
        "aaSorting": [[ 3, "asc" ]],
18
        "aaSorting": [[ 3, "asc" ]],
18
        "aoColumns": [
19
        "aoColumns": [
20
            [%- IF (printenable) -%]
21
            null,{ "sType": "anti-the" },null,null,null,null,null,null,null,null,{ "sType": "title-string" },null
22
            [%- ELSE -%]
19
            { "sType": "anti-the" },null,null,null,null,null,null,null,null,{ "sType": "title-string" },null
23
            { "sType": "anti-the" },null,null,null,null,null,null,null,null,{ "sType": "title-string" },null
24
            [%- END -%]
20
        ],
25
        ],
21
        "sDom": 't',
26
        "sDom": 't',
22
        "bPaginate": false
27
        "bPaginate": false
23
    });
28
    });
29
[% IF ( printenable ) %]
30
    $("#CheckAll").click(function(){
31
        $(".checkboxed").checkCheckboxes();
32
        return false;
33
    });
34
    $("#CheckNone").click(function(){
35
        $(".checkboxed").unCheckCheckboxes();
36
        return false;
37
    });
24
});
38
});
25
26
function printReservations() {
39
function printReservations() {
27
    document.hold_print.submit();
40
    document.hold_print.submit();
28
}
41
}
29
function selectAll () {
42
[% ELSE %]
30
    if(document.hold_print.reserve_id.length == undefined ){
43
});
31
        document.hold_print.reserve_id.checked=true;
44
[% END%]
32
    }else if(document.hold_print.reserve_id.length > 0) {
33
        for (var i=0; i < document.hold_print.reserve_id.length; i++) {
34
            document.hold_print.reserve_id[i].checked=true;
35
        }
36
    }
37
}
38
function clearAll () {
39
    if(document.hold_print.reserve_id.length == undefined ){
40
        document.hold_print.reserve_id.checked=false;
41
    }else if(document.hold_print.reserve_id.length > 0) {
42
        for (var i=0; i < document.hold_print.reserve_id.length; i++) {
43
            document.hold_print.reserve_id[i].checked=false;
44
        }
45
    }
46
}
47
//]]>
45
//]]>
48
</script>
46
</script>
49
47
Lines 72-79 function clearAll () { Link Here
72
    [% IF ( printenable ) %]
70
    [% IF ( printenable ) %]
73
        <p>
71
        <p>
74
        <input id="printhold" type="submit" class="submit" onclick="printReservations()" value="Print checked holds"/>
72
        <input id="printhold" type="submit" class="submit" onclick="printReservations()" value="Print checked holds"/>
75
        <a href="#" onclick="selectAll(); return false;">Select all</a> |
73
        <a id="CheckAll" href="#" >Select all</a> |
76
        <a href="#" onclick="clearAll(); return false;">Clear all</a>
74
        <a id="CheckNone" href="#" >Clear all</a>
77
        <br/>
75
        <br/>
78
        </p>
76
        </p>
79
        <form id="showprinted" name="showprinted" method="get" action="/cgi-bin/koha/circ/view_holdsqueue.pl">
77
        <form id="showprinted" name="showprinted" method="get" action="/cgi-bin/koha/circ/view_holdsqueue.pl">
Lines 89-95 function clearAll () { Link Here
89
        </form>
87
        </form>
90
    [% END %]
88
    [% END %]
91
    [% IF ( itemsloop ) %]
89
    [% IF ( itemsloop ) %]
92
        <form id="hold_print" name="hold_print" method="get" action="/cgi-bin/koha/circ/hold-pull-print.pl" target="_blank">
90
        [% IF ( printenable ) %]
91
        <form id="hold_print" name="hold_print" class="checkboxed" method="get" action="/cgi-bin/koha/circ/hold-pull-print.pl" target="_blank">
92
        [% END %]
93
<table id="holdst">
93
<table id="holdst">
94
	<thead>
94
	<thead>
95
	<tr>
95
	<tr>
Lines 110-116 function clearAll () { Link Here
110
     <tbody>[% FOREACH itemsloo IN itemsloop %]
110
     <tbody>[% FOREACH itemsloo IN itemsloop %]
111
        <tr>
111
        <tr>
112
        [% IF ( printenable ) %]
112
        [% IF ( printenable ) %]
113
			<td class="hq-print"><input type="checkbox" id="res[% itemsloo.reserve_id %]" name="reserve_id" value="[% itemsloo.reserve_id %]"/></td>
113
            <td class="hq-print"><input type="checkbox" id="res[% itemsloo.reserve_id %]" name="reserve_id" value="[% itemsloo.reserve_id %]"/></td>
114
        [% END %]
114
        [% END %]
115
            <td class="hq-title"><p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itemsloo.biblionumber %]"><strong>[% itemsloo.title |html %]</strong> [% IF ( itemsloo.subtitle ) %][% itemsloo.subtitle %][% END %]</a></p>
115
            <td class="hq-title"><p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itemsloo.biblionumber %]"><strong>[% itemsloo.title |html %]</strong> [% IF ( itemsloo.subtitle ) %][% itemsloo.subtitle %][% END %]</a></p>
116
                         <p><strong>[% itemsloo.author %]</strong>
116
                         <p><strong>[% itemsloo.author %]</strong>
(-)a/t/db_dependent/HoldsQueue.t (-1 / +25 lines)
Lines 12-18 use C4::Context; Link Here
12
12
13
use Data::Dumper;
13
use Data::Dumper;
14
14
15
use Test::More tests => 21;
15
use Test::More tests => 28;
16
16
17
17
18
use C4::Branch;
18
use C4::Branch;
Lines 281-286 $sth->execute( $borrower3->{borrowernumber}, $biblionumber, $branchcodes[0], 3 ) Link Here
281
#warn "RESERVES" . Data::Dumper::Dumper( $dbh->selectall_arrayref("SELECT * FROM reserves", { Slice => {} }) );
281
#warn "RESERVES" . Data::Dumper::Dumper( $dbh->selectall_arrayref("SELECT * FROM reserves", { Slice => {} }) );
282
#warn "ITEMS: " . Data::Dumper::Dumper( $dbh->selectall_arrayref("SELECT * FROM items WHERE biblionumber = $biblionumber", { Slice => {} }) );
282
#warn "ITEMS: " . Data::Dumper::Dumper( $dbh->selectall_arrayref("SELECT * FROM items WHERE biblionumber = $biblionumber", { Slice => {} }) );
283
283
284
my $reserve_id = $dbh->selectcol_arrayref("SELECT reserve_id FROM reserves");
285
my $print_status = $dbh->selectcol_arrayref("SELECT print_status FROM reserves WHERE reserve_id = ?", undef, $reserve_id->[0]);
286
is( $print_status->[0], "0", "Default print status in reserves for new reserve set as 0");
287
C4::HoldsQueue::MarkHoldPrinted($reserve_id->[0]);
288
$print_status = $dbh->selectcol_arrayref("SELECT print_status FROM reserves WHERE reserve_id = ?", undef, $reserve_id->[0]);
289
is( $print_status->[0], "1", "Hold status in reserves correctly marked as printed");
290
C4::HoldsQueue::MarkHoldPrinted($reserve_id->[1]);
291
284
my $holds_queue;
292
my $holds_queue;
285
293
286
$dbh->do("DELETE FROM default_circ_rules");
294
$dbh->do("DELETE FROM default_circ_rules");
Lines 298-303 $holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice Link Here
298
ok( @$holds_queue == 3, "Holds queue filling correct number for holds for default holds policy 'from any library'" );
306
ok( @$holds_queue == 3, "Holds queue filling correct number for holds for default holds policy 'from any library'" );
299
#warn "HOLDS QUEUE: " . Data::Dumper::Dumper( $holds_queue );
307
#warn "HOLDS QUEUE: " . Data::Dumper::Dumper( $holds_queue );
300
308
309
my $print_status_tmp = $dbh->selectcol_arrayref("SELECT print_status FROM reserves WHERE reserve_id = ?", undef, $reserve_id->[1]);
310
is( $print_status_tmp->[0], "1", "Hold status printed moved to tmp_holdsqueue from reserves");
311
$print_status_tmp = $dbh->selectcol_arrayref("SELECT print_status FROM reserves WHERE reserve_id = ?", undef, $reserve_id->[2]);
312
is( $print_status_tmp->[0], "0", "Default print status in tmp_holdsqueue moved from reserves");
313
C4::HoldsQueue::MarkHoldPrinted($reserve_id->[2]);
314
$print_status_tmp = $dbh->selectcol_arrayref("SELECT print_status FROM reserves WHERE reserve_id = ?", undef, $reserve_id->[2]);
315
is( $print_status_tmp->[0], "1", "Hold status in tmp_holdsqueue correctly marked as printed");
316
317
my $select_itnum = $dbh->selectcol_arrayref("SELECT itemnumber FROM tmp_holdsqueue WHERE reserve_id = ?", undef, $reserve_id->[0]);
318
my $get_itnum = C4::HoldsQueue::GetItemNumberFromTmpHold($reserve_id->[0]);
319
is( $select_itnum->[0],  $get_itnum, "Correct itemnumber selected from tmp_holdsqueue");
320
321
C4::Context->set_preference('printSlipFromHoldsQueue', 1);
322
my $getholds_queue = C4::HoldsQueue::GetHoldsQueueItems(undef, 1);
323
is( @$getholds_queue, "3", "Get printed holds from tmp_holdsqueue");
324
301
# Cleanup
325
# Cleanup
302
$dbh->rollback;
326
$dbh->rollback;
303
327
(-)a/t/db_dependent/Reserves.t (-2 / +5 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Test::More tests => 35;
5
use Test::More tests => 36;
6
6
7
use MARC::Record;
7
use MARC::Record;
8
use DateTime::Duration;
8
use DateTime::Duration;
Lines 395-400 $p = C4::Reserves::CalculatePriority($bibnum, $resdate); Link Here
395
is($p, 3, 'CalculatePriority should now return priority 3');
395
is($p, 3, 'CalculatePriority should now return priority 3');
396
# End of tests for bug 8918
396
# End of tests for bug 8918
397
397
398
@results = GetReservesFromItemnumber($itemnumber);
399
my $hold_slip = C4::Reserves::HoldSlip('CPL', $results[3], $itemnumber);
400
ok(defined($hold_slip), 'can successfully generate hold slip');
401
398
$dbh->rollback;
402
$dbh->rollback;
399
403
400
sub count_hold_print_messages {
404
sub count_hold_print_messages {
401
- 

Return to bug 11651