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

(-)a/Koha/Biblio.pm (+52 lines)
Line 0 Link Here
1
package Koha::Biblio;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use base qw(Koha::Object);
27
28
=head1 NAME
29
30
Koha::Biblio - Koha Biblio Object class
31
32
=head1 API
33
34
=head2 Class Methods
35
36
=cut
37
38
=head3 type
39
40
=cut
41
42
sub type {
43
    return 'Biblio';
44
}
45
46
=head1 AUTHOR
47
48
Kyle M Hall <kyle@bywatersolutions.com>
49
50
=cut
51
52
1;
(-)a/Koha/Biblios.pm (+62 lines)
Line 0 Link Here
1
package Koha::Biblios;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use Koha::Biblio;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::Reserve - Koha Reserve Object class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 type
41
42
=cut
43
44
sub type {
45
    return 'Biblio';
46
}
47
48
=head3 object_class
49
50
=cut
51
52
sub object_class {
53
    return 'Koha::Biblio';
54
}
55
56
=head1 AUTHOR
57
58
Kyle M Hall <kyle@bywatersolutions.com>
59
60
=cut
61
62
1;
(-)a/Koha/Branch.pm (+52 lines)
Line 0 Link Here
1
package Koha::Branch;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use base qw(Koha::Object);
27
28
=head1 NAME
29
30
Koha::Branch - Koha Item Object class
31
32
=head1 API
33
34
=head2 Class Methods
35
36
=cut
37
38
=head3 type
39
40
=cut
41
42
sub type {
43
    return 'Branch';
44
}
45
46
=head1 AUTHOR
47
48
Kyle M Hall <kyle@bywatersolutions.com>
49
50
=cut
51
52
1;
(-)a/Koha/Branches.pm (+62 lines)
Line 0 Link Here
1
package Koha::Branches;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use Koha::Branch;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::Reserve - Koha Reserve Object class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 type
41
42
=cut
43
44
sub type {
45
    return 'Branch';
46
}
47
48
=head3 object_class
49
50
=cut
51
52
sub object_class {
53
    return 'Koha::Branch';
54
}
55
56
=head1 AUTHOR
57
58
Kyle M Hall <kyle@bywatersolutions.com>
59
60
=cut
61
62
1;
(-)a/Koha/Hold.pm (+96 lines)
Line 0 Link Here
1
package Koha::Hold;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Branches;
25
use Koha::Biblios;
26
use Koha::Items;
27
28
use base qw(Koha::Object);
29
30
=head1 NAME
31
32
Koha::Branch - Koha Item Object class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 biblio
41
42
Returns the related Koha::Biblio object for this hold
43
44
=cut
45
46
sub biblio {
47
    my ($self) = @_;
48
49
    $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );
50
51
    return $self->{_biblio};
52
}
53
54
=head3 item
55
56
Returns the related Koha::item object for this Hold
57
58
=cut
59
60
sub item {
61
    my ($self) = @_;
62
63
    $self->{_item} ||= Koha::Items->find( $self->itemnumber() );
64
65
    return $self->{_item};
66
}
67
68
=head3 branch
69
70
Returns the related Koha::branch object for this Hold
71
72
=cut
73
74
sub branch {
75
    my ($self) = @_;
76
77
    $self->{_branch} ||= Koha::Branches->find( $self->branchcode() );
78
79
    return $self->{_branch};
80
}
81
82
=head3 type
83
84
=cut
85
86
sub type {
87
    return 'Reserve';
88
}
89
90
=head1 AUTHOR
91
92
Kyle M Hall <kyle@bywatersolutions.com>
93
94
=cut
95
96
1;
(-)a/Koha/Holds.pm (+72 lines)
Line 0 Link Here
1
package Koha::Holds;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use Koha::Hold;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::Reserve - Koha Reserve Object class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 waiting
41
42
=cut
43
44
sub waiting {
45
    my ( $self ) = @_;
46
47
    return $self->search( { found => 'W' } );
48
}
49
50
=head3 type
51
52
=cut
53
54
sub type {
55
    return 'Reserve';
56
}
57
58
=head3 object_class
59
60
=cut
61
62
sub object_class {
63
    return 'Koha::Hold';
64
}
65
66
=head1 AUTHOR
67
68
Kyle M Hall <kyle@bywatersolutions.com>
69
70
=cut
71
72
1;
(-)a/Koha/Item.pm (+64 lines)
Line 0 Link Here
1
package Koha::Item;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use base qw(Koha::Object);
27
28
=head1 NAME
29
30
Koha::Item - Koha Item Object class
31
32
=head1 API
33
34
=head2 Class Methods
35
36
=cut
37
38
=head3 effective_itemtype
39
40
Returns the itemtype for the item based on whether item level itemtypes are set or not.
41
42
=cut
43
44
sub effective_itemtype {
45
    my ( $self ) = @_;
46
47
    return $self->_result()->effective_itemtype();
48
}
49
50
=head3 type
51
52
=cut
53
54
sub type {
55
    return 'Item';
56
}
57
58
=head1 AUTHOR
59
60
Kyle M Hall <kyle@bywatersolutions.com>
61
62
=cut
63
64
1;
(-)a/Koha/Items.pm (+62 lines)
Line 0 Link Here
1
package Koha::Items;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use Koha::Item;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::Reserve - Koha Reserve Object class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 type
41
42
=cut
43
44
sub type {
45
    return 'Item';
46
}
47
48
=head3 object_class
49
50
=cut
51
52
sub object_class {
53
    return 'Koha::Item';
54
}
55
56
=head1 AUTHOR
57
58
Kyle M Hall <kyle@bywatersolutions.com>
59
60
=cut
61
62
1;
(-)a/circ/circulation.pl (-29 / +7 lines)
Lines 39-44 use C4::Biblio; Link Here
39
use C4::Search;
39
use C4::Search;
40
use MARC::Record;
40
use MARC::Record;
41
use C4::Reserves;
41
use C4::Reserves;
42
use Koha::Holds;
42
use C4::Context;
43
use C4::Context;
43
use CGI::Session;
44
use CGI::Session;
44
use C4::Members::Attributes qw(GetBorrowerAttributes);
45
use C4::Members::Attributes qw(GetBorrowerAttributes);
Lines 388-423 if ($borrowernumber) { Link Here
388
# BUILD HTML
389
# BUILD HTML
389
# show all reserves of this borrower, and the position of the reservation ....
390
# show all reserves of this borrower, and the position of the reservation ....
390
if ($borrowernumber) {
391
if ($borrowernumber) {
392
    my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } );
391
    $template->param(
393
    $template->param(
392
        holds_count => Koha::Database->new()->schema()->resultset('Reserve')
394
        holds_count  => $holds->count(),
393
          ->count( { borrowernumber => $borrowernumber } ) );
395
        WaitingHolds => scalar $holds->waiting(),
394
    my @borrowerreserv = GetReservesFromBorrowernumber($borrowernumber);
396
    );
395
397
396
    my @WaitingReserveLoop;
398
    $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
397
    foreach my $num_res (@borrowerreserv) {
398
        if ( $num_res->{'found'} && $num_res->{'found'} eq 'W' ) {
399
            my $getiteminfo  = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
400
            my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} );
401
            my %getWaitingReserveInfo;
402
            $getWaitingReserveInfo{title} = $getiteminfo->{'title'};
403
            $getWaitingReserveInfo{biblionumber} =
404
              $getiteminfo->{'biblionumber'};
405
            $getWaitingReserveInfo{itemtype} = $itemtypeinfo->{'description'};
406
            $getWaitingReserveInfo{author}   = $getiteminfo->{'author'};
407
            $getWaitingReserveInfo{itemcallnumber} =
408
              $getiteminfo->{'itemcallnumber'};
409
            $getWaitingReserveInfo{reservedate} =
410
              format_date( $num_res->{'reservedate'} );
411
            $getWaitingReserveInfo{waitingat} =
412
              GetBranchName( $num_res->{'branchcode'} );
413
            $getWaitingReserveInfo{waitinghere} = 1
414
              if $num_res->{'branchcode'} eq $branch;
415
            push( @WaitingReserveLoop, \%getWaitingReserveInfo );
416
        }
417
    }
418
    $template->param( WaitingReserveLoop => \@WaitingReserveLoop );
419
    $template->param( adultborrower => 1 )
420
      if ( $borrower->{'category_type'} eq 'A' );
421
}
399
}
422
400
423
my @values;
401
my @values;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-14 / +22 lines)
Lines 705-724 No patron matched <span class="ex">[% message %]</span> Link Here
705
			</ul>
705
			</ul>
706
        </div>
706
        </div>
707
707
708
			[% IF ( WaitingReserveLoop ) %]
708
            [% IF ( WaitingHolds ) %]
709
			<div id="holdswaiting" class="circmessage">
709
                <div id="holdswaiting" class="circmessage">
710
		    <h4>Holds waiting:</h4>
710
                    <h4>Holds waiting:</h4>
711
			        [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %]
711
                    [% FOREACH w IN WaitingHolds %]
712
			            <ul>
712
                        <ul>
713
			                <li> <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% WaitingReserveLoo.biblionumber %]">[% WaitingReserveLoo.title |html %]</a> ([% WaitingReserveLoo.itemtype %]), [% IF ( WaitingReserveLoo.author ) %]by [% WaitingReserveLoo.author %][% END %] [% IF ( WaitingReserveLoo.itemcallnumber ) %][[% WaitingReserveLoo.itemcallnumber %]] [% END %]Hold placed on [% WaitingReserveLoo.reservedate %].
713
                            <li>
714
			            [% IF ( WaitingReserveLoo.waitingat ) %]
714
                                <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.biblio.biblionumber %]">[% w.biblio.title | html %]</a>
715
			                <br />[% IF ( WaitingReserveLoo.waitinghere ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]Waiting at [% WaitingReserveLoo.waitingat %]</strong>
715
                                ([% w.item.effective_itemtype %]),
716
			            [% END %]
716
                                [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
717
			                </li>
717
                                [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber %]] [% END %]
718
			            </ul>
718
                                Hold placed on [% w.reservedate | $KohaDates %].
719
			    [% END %]
719
720
			</div>
720
                                <br/>
721
			<!-- /If WaitingReserveLoop -->[% END %]
721
                                [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
722
                                    Waiting at [% w.branch.branchname | html %]
723
                                </strong>
724
                            </li>
725
                        </ul>
726
                    [% END %]
727
                </div>
728
            [% END %]
729
722
	[% IF ( notes ) %]
730
	[% IF ( notes ) %]
723
			<div id="circnotes" class="circmessage">
731
			<div id="circnotes" class="circmessage">
724
			<h4>Notes:</h4>
732
			<h4>Notes:</h4>
(-)a/t/db_dependent/Reserves.t (-2 / +6 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 56;
20
use Test::More tests => 58;
21
21
22
use MARC::Record;
22
use MARC::Record;
23
use DateTime::Duration;
23
use DateTime::Duration;
Lines 27-32 use C4::Biblio; Link Here
27
use C4::Items;
27
use C4::Items;
28
use C4::Members;
28
use C4::Members;
29
use C4::Circulation;
29
use C4::Circulation;
30
use Koha::Holds;
30
use t::lib::Mocks;
31
use t::lib::Mocks;
31
32
32
use Koha::DateUtils;
33
use Koha::DateUtils;
Lines 241-246 is($reserves[0]{priority}, 0, 'Item is correctly waiting'); Link Here
241
is($reserves[1]{priority}, 1, 'Item is correctly priority 1');
242
is($reserves[1]{priority}, 1, 'Item is correctly priority 1');
242
is($reserves[2]{priority}, 2, 'Item is correctly priority 2');
243
is($reserves[2]{priority}, 2, 'Item is correctly priority 2');
243
244
245
@reserves = Koha::Holds->search({ borrowernumber => $requesters{'RPL'} })->waiting();
246
is( @reserves, 1, 'GetWaiting got only the waiting reserve' );
247
is( $reserves[0]->borrowernumber(), $requesters{'RPL'}, 'GetWaiting got the reserve for the correct borrower' );
248
244
249
245
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
250
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
246
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
251
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
247
- 

Return to bug 13851