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::Biblios - Koha Biblio object set 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 Branch 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::Branches - Koha Reserve object set 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::Hold - Koha Hold 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 (+74 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::Holds - Koha Hold object set class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 waiting
41
42
Returns a set of holds that are waiting from an existing set
43
44
=cut
45
46
sub waiting {
47
    my ( $self ) = @_;
48
49
    return $self->search( { found => 'W' } );
50
}
51
52
=head3 type
53
54
=cut
55
56
sub type {
57
    return 'Reserve';
58
}
59
60
=head3 object_class
61
62
=cut
63
64
sub object_class {
65
    return 'Koha::Hold';
66
}
67
68
=head1 AUTHOR
69
70
Kyle M Hall <kyle@bywatersolutions.com>
71
72
=cut
73
74
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::Items - Koha Item object set 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 40-45 use C4::Biblio; Link Here
40
use C4::Search;
40
use C4::Search;
41
use MARC::Record;
41
use MARC::Record;
42
use C4::Reserves;
42
use C4::Reserves;
43
use Koha::Holds;
43
use C4::Context;
44
use C4::Context;
44
use CGI::Session;
45
use CGI::Session;
45
use C4::Members::Attributes qw(GetBorrowerAttributes);
46
use C4::Members::Attributes qw(GetBorrowerAttributes);
Lines 392-427 if ($borrowernumber) { Link Here
392
# BUILD HTML
393
# BUILD HTML
393
# show all reserves of this borrower, and the position of the reservation ....
394
# show all reserves of this borrower, and the position of the reservation ....
394
if ($borrowernumber) {
395
if ($borrowernumber) {
396
    my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } );
395
    $template->param(
397
    $template->param(
396
        holds_count => Koha::Database->new()->schema()->resultset('Reserve')
398
        holds_count  => $holds->count(),
397
          ->count( { borrowernumber => $borrowernumber } ) );
399
        WaitingHolds => scalar $holds->waiting(),
398
    my @borrowerreserv = GetReservesFromBorrowernumber($borrowernumber);
400
    );
399
401
400
    my @WaitingReserveLoop;
402
    $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
401
    foreach my $num_res (@borrowerreserv) {
402
        if ( $num_res->{'found'} && $num_res->{'found'} eq 'W' ) {
403
            my $getiteminfo  = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
404
            my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} );
405
            my %getWaitingReserveInfo;
406
            $getWaitingReserveInfo{title} = $getiteminfo->{'title'};
407
            $getWaitingReserveInfo{biblionumber} =
408
              $getiteminfo->{'biblionumber'};
409
            $getWaitingReserveInfo{itemtype} = $itemtypeinfo->{'description'};
410
            $getWaitingReserveInfo{author}   = $getiteminfo->{'author'};
411
            $getWaitingReserveInfo{itemcallnumber} =
412
              $getiteminfo->{'itemcallnumber'};
413
            $getWaitingReserveInfo{reservedate} =
414
              format_date( $num_res->{'reservedate'} );
415
            $getWaitingReserveInfo{waitingat} =
416
              GetBranchName( $num_res->{'branchcode'} );
417
            $getWaitingReserveInfo{waitinghere} = 1
418
              if $num_res->{'branchcode'} eq $branch;
419
            push( @WaitingReserveLoop, \%getWaitingReserveInfo );
420
        }
421
    }
422
    $template->param( WaitingReserveLoop => \@WaitingReserveLoop );
423
    $template->param( adultborrower => 1 )
424
      if ( $borrower->{'category_type'} eq 'A' );
425
}
403
}
426
404
427
#title
405
#title
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-14 / +23 lines)
Lines 2-7 Link Here
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE KohaDates %]
3
[% USE KohaDates %]
4
[% USE ColumnsSettings %]
4
[% USE ColumnsSettings %]
5
[% USE ItemTypes %]
5
[% IF Koha.Preference('ExportRemoveFields') OR Koha.Preference('ExportWithCsvProfile') %]
6
[% IF Koha.Preference('ExportRemoveFields') OR Koha.Preference('ExportWithCsvProfile') %]
6
   [% SET exports_enabled = 1 %]
7
   [% SET exports_enabled = 1 %]
7
[% END %]
8
[% END %]
Lines 760-779 No patron matched <span class="ex">[% message %]</span> Link Here
760
			</ul>
761
			</ul>
761
        </div>
762
        </div>
762
763
763
			[% IF ( WaitingReserveLoop ) %]
764
            [% IF ( WaitingHolds ) %]
764
			<div id="holdswaiting" class="circmessage">
765
                <div id="holdswaiting" class="circmessage">
765
		    <h4>Holds waiting:</h4>
766
                    <h4>Holds waiting:</h4>
766
			        [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %]
767
                    [% FOREACH w IN WaitingHolds %]
767
			            <ul>
768
                        <ul>
768
			                <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 %].
769
                            <li>
769
			            [% IF ( WaitingReserveLoo.waitingat ) %]
770
                                <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.biblio.biblionumber %]">[% w.biblio.title | html %]</a>
770
			                <br />[% IF ( WaitingReserveLoo.waitinghere ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]Waiting at [% WaitingReserveLoo.waitingat %]</strong>
771
                                ([% ItemTypes.GetDescription( w.item.effective_itemtype ) %]),
771
			            [% END %]
772
                                [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
772
			                </li>
773
                                [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber %]] [% END %]
773
			            </ul>
774
                                Hold placed on [% w.reservedate | $KohaDates %].
774
			    [% END %]
775
775
			</div>
776
                                <br/>
776
			<!-- /If WaitingReserveLoop -->[% END %]
777
                                [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
778
                                    Waiting at [% w.branch.branchname | html %]
779
                                </strong>
780
                            </li>
781
                        </ul>
782
                    [% END %]
783
                </div>
784
            [% END %]
785
777
	[% IF ( notes ) %]
786
	[% IF ( notes ) %]
778
			<div id="circnotes" class="circmessage">
787
			<div id="circnotes" class="circmessage">
779
			<h4>Notes:</h4>
788
			<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