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 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->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 (+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 (-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 367-375 if ($borrowernumber) { Link Here
367
# BUILD HTML
368
# BUILD HTML
368
# show all reserves of this borrower, and the position of the reservation ....
369
# show all reserves of this borrower, and the position of the reservation ....
369
if ($borrowernumber) {
370
if ($borrowernumber) {
371
    my $holds = Koha::Holds->new()->search( { borrowernumber => $borrowernumber } );
370
    $template->param(
372
    $template->param(
371
        holds_count => Koha::Database->new()->schema()->resultset('Reserve')
373
        holds_count  => $holds->count(),
372
          ->count( { borrowernumber => $borrowernumber } ) );
374
        WaitingHolds => scalar $holds->waiting(),
375
    );
373
376
374
    $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
377
    $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
375
}
378
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-14 / +22 lines)
Lines 605-624 No patron matched <span class="ex">[% message %]</span> Link Here
605
			</ul>
605
			</ul>
606
        </div>
606
        </div>
607
607
608
			[% IF ( WaitingReserveLoop ) %]
608
            [% IF ( WaitingHolds ) %]
609
			<div id="holdswaiting" class="circmessage">
609
                <div id="holdswaiting" class="circmessage">
610
		    <h4>Holds waiting:</h4>
610
                    <h4>Holds waiting:</h4>
611
			        [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %]
611
                    [% FOREACH w IN WaitingHolds %]
612
			            <ul>
612
                        <ul>
613
			                <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 %].
613
                            <li>
614
			            [% IF ( WaitingReserveLoo.waitingat ) %]
614
                                <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.biblio.biblionumber %]">[% w.biblio.title | html %]</a>
615
			                <br />[% IF ( WaitingReserveLoo.waitinghere ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]Waiting at [% WaitingReserveLoo.waitingat %]</strong>
615
                                ([% w.item.effective_itemtype %]),
616
			            [% END %]
616
                                [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
617
			                </li>
617
                                [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber %]] [% END %]
618
			            </ul>
618
                                Hold placed on [% w.reservedate | $KohaDates %].
619
			    [% END %]
619
620
			</div>
620
                                <br/>
621
			<!-- /If WaitingReserveLoop -->[% END %]
621
                                [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
622
                                    Waiting at [% w.branch.branchname | html %]
623
                                </strong>
624
                            </li>
625
                        </ul>
626
                    [% END %]
627
                </div>
628
            [% END %]
629
622
	[% IF ( notes ) %]
630
	[% IF ( notes ) %]
623
			<div id="circnotes" class="circmessage">
631
			<div id="circnotes" class="circmessage">
624
			<h4>Notes:</h4>
632
			<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 => 50;
20
use Test::More tests => 52;
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 238-243 is($reserves[0]{priority}, 0, 'Item is correctly waiting'); Link Here
238
is($reserves[1]{priority}, 1, 'Item is correctly priority 1');
239
is($reserves[1]{priority}, 1, 'Item is correctly priority 1');
239
is($reserves[2]{priority}, 2, 'Item is correctly priority 2');
240
is($reserves[2]{priority}, 2, 'Item is correctly priority 2');
240
241
242
@reserves = Koha::Holds->new()->Waiting({ borrowernumber => $requesters{'RPL'} });
243
is( @reserves, 1, 'GetWaiting got only the waiting reserve' );
244
is( $reserves[0]->borrowernumber(), $requesters{'RPL'}, 'GetWaiting got the reserve for the correct borrower' );
245
241
246
242
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
247
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
243
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
248
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
244
- 

Return to bug 12892