View | Details | Raw Unified | Return to bug 12892
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 ObjectClass
49
50
=cut
51
52
sub ObjectClass {
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 ObjectClass
49
50
=cut
51
52
sub ObjectClass {
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->new()->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->new()->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->new()->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 (+77 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, $params ) = @_;
46
47
    carp("No borrowernumber passed in to Koha::Reserves::Waiting!")
48
      unless $params->{borrowernumber};
49
50
    $params->{found} = 'W';
51
52
    return $self->Search($params);
53
}
54
55
=head3 Type
56
57
=cut
58
59
sub Type {
60
    return 'Reserve';
61
}
62
63
=head3 ObjectClass
64
65
=cut
66
67
sub ObjectClass {
68
    return 'Koha::Hold';
69
}
70
71
=head1 AUTHOR
72
73
Kyle M Hall <kyle@bywatersolutions.com>
74
75
=cut
76
77
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 EffectiveItemtype
39
40
Returns the itemtype for the item based on whether item level itemtypes are set or not.
41
42
=cut
43
44
sub EffectiveItemtype {
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 ObjectClass
49
50
=cut
51
52
sub ObjectClass {
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 (-2 / +5 lines)
Lines 37-42 use C4::Biblio; Link Here
37
use C4::Search;
37
use C4::Search;
38
use MARC::Record;
38
use MARC::Record;
39
use C4::Reserves;
39
use C4::Reserves;
40
use Koha::Holds;
40
use C4::Context;
41
use C4::Context;
41
use CGI::Session;
42
use CGI::Session;
42
use C4::Members::Attributes qw(GetBorrowerAttributes);
43
use C4::Members::Attributes qw(GetBorrowerAttributes);
Lines 362-370 if ($borrowernumber) { Link Here
362
# BUILD HTML
363
# BUILD HTML
363
# show all reserves of this borrower, and the position of the reservation ....
364
# show all reserves of this borrower, and the position of the reservation ....
364
if ($borrowernumber) {
365
if ($borrowernumber) {
366
    my $holds = Koha::Holds->new();
365
    $template->param(
367
    $template->param(
366
        holds_count => Koha::Database->new()->schema()->resultset('Reserve')
368
        holds_count  => $holds->Count( { borrowernumber => $borrowernumber } ),
367
          ->count( { borrowernumber => $borrowernumber } ) );
369
        WaitingHolds => scalar $holds->Waiting( { borrowernumber => $borrowernumber } ),
370
    );
368
371
369
    $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
372
    $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
370
}
373
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-14 / +22 lines)
Lines 596-615 No patron matched <span class="ex">[% message %]</span> Link Here
596
			</ul>
596
			</ul>
597
        </div>
597
        </div>
598
598
599
			[% IF ( WaitingReserveLoop ) %]
599
            [% IF ( WaitingHolds ) %]
600
			<div id="holdswaiting" class="circmessage">
600
                <div id="holdswaiting" class="circmessage">
601
		    <h4>Holds waiting:</h4>
601
                    <h4>Holds waiting:</h4>
602
			        [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %]
602
                    [% FOREACH w IN WaitingHolds %]
603
			            <ul>
603
                        <ul>
604
			                <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 %].
604
                            <li>
605
			            [% IF ( WaitingReserveLoo.waitingat ) %]
605
                                <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.Biblio.biblionumber %]">[% w.Biblio.title | html %]</a>
606
			                <br />[% IF ( WaitingReserveLoo.waitinghere ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]Waiting at [% WaitingReserveLoo.waitingat %]</strong>
606
                                ([% w.Item.EffectiveItemtype %]),
607
			            [% END %]
607
                                [% IF ( w.Biblio.author ) %] by [% w.Biblio.author | html %] [% END %]
608
			                </li>
608
                                [% IF ( w.Item.itemcallnumber ) %] [[% w.Item.itemcallnumber %]] [% END %]
609
			            </ul>
609
                                Hold placed on [% w.reservedate | $KohaDates %].
610
			    [% END %]
610
611
			</div>
611
                                <br/>
612
			<!-- /If WaitingReserveLoop -->[% END %]
612
                                [% IF ( w.Branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
613
                                    Waiting at [% w.Branch.branchname | html %]
614
                                </strong>
615
                            </li>
616
                        </ul>
617
                    [% END %]
618
                </div>
619
            [% END %]
620
613
	[% IF ( notes ) %]
621
	[% IF ( notes ) %]
614
			<div id="circnotes" class="circmessage">
622
			<div id="circnotes" class="circmessage">
615
			<h4>Notes:</h4>
623
			<h4>Notes:</h4>
(-)a/t/db_dependent/Reserves.t (-2 / +6 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 => 37;
6
6
7
use MARC::Record;
7
use MARC::Record;
8
use DateTime::Duration;
8
use DateTime::Duration;
Lines 12-17 use C4::Biblio; Link Here
12
use C4::Items;
12
use C4::Items;
13
use C4::Members;
13
use C4::Members;
14
use C4::Circulation;
14
use C4::Circulation;
15
use Koha::Holds;
15
use t::lib::Mocks;
16
use t::lib::Mocks;
16
17
17
use Koha::DateUtils;
18
use Koha::DateUtils;
Lines 225-230 is($reserves[0]{priority}, 0, 'Item is correctly waiting'); Link Here
225
is($reserves[1]{priority}, 1, 'Item is correctly priority 1');
226
is($reserves[1]{priority}, 1, 'Item is correctly priority 1');
226
is($reserves[2]{priority}, 2, 'Item is correctly priority 2');
227
is($reserves[2]{priority}, 2, 'Item is correctly priority 2');
227
228
229
@reserves = Koha::Holds->new()->Waiting({ borrowernumber => $requesters{'RPL'} });
230
is( @reserves, 1, 'GetWaiting got only the waiting reserve' );
231
is( $reserves[0]->borrowernumber(), $requesters{'RPL'}, 'GetWaiting got the reserve for the correct borrower' );
232
228
233
229
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
234
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
230
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
235
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
231
- 

Return to bug 12892