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 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();
370
    $template->param(
372
    $template->param(
371
        holds_count => Koha::Database->new()->schema()->resultset('Reserve')
373
        holds_count  => $holds->Count( { borrowernumber => $borrowernumber } ),
372
          ->count( { borrowernumber => $borrowernumber } ) );
374
        WaitingHolds => scalar $holds->Waiting( { borrowernumber => $borrowernumber } ),
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.EffectiveItemtype %]),
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