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

(-)a/C4/Members.pm (-21 / +33 lines)
Lines 42-47 use Text::Unaccent qw( unac_string ); Link Here
42
use Koha::AuthUtils qw(hash_password);
42
use Koha::AuthUtils qw(hash_password);
43
use Koha::Database;
43
use Koha::Database;
44
use Module::Load;
44
use Module::Load;
45
use Koha::Borrowers;
46
45
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
47
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
46
    load Koha::NorwegianPatronDB, qw( NLUpdateHashedPIN NLEncryptPIN NLSync );
48
    load Koha::NorwegianPatronDB, qw( NLUpdateHashedPIN NLEncryptPIN NLSync );
47
}
49
}
Lines 1116-1146 sub GetAllIssues { Link Here
1116
    my ( $borrowernumber, $order, $limit ) = @_;
1118
    my ( $borrowernumber, $order, $limit ) = @_;
1117
1119
1118
    return unless $borrowernumber;
1120
    return unless $borrowernumber;
1121
1119
    $order = 'date_due desc' unless $order;
1122
    $order = 'date_due desc' unless $order;
1123
    my ( $column, $sort ) = split( / /, $order );
1124
    $column ||= 'date_due';
1125
    $sort ||= 'desc';
1120
1126
1121
    my $dbh = C4::Context->dbh;
1127
    my $borrower = Koha::Borrowers->find( $borrowernumber );
1122
    my $query =
1128
    my $checkouts = $borrower->all_checkouts( { order => { column => $column, sort => $sort } , limit => $limit } );
1123
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
1129
1124
  FROM issues 
1130
    my @results;
1125
  LEFT JOIN items on items.itemnumber=issues.itemnumber
1131
    foreach my $checkout (@$checkouts) {
1126
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1132
        my $item = $checkout->item( { deleted => 1 } );
1127
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
1133
        next unless $item;
1128
  WHERE borrowernumber=? 
1134
1129
  UNION ALL
1135
        my $biblio = $item->biblio( { deleted => 1 } );
1130
  SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp 
1136
        next unless $biblio;
1131
  FROM old_issues 
1137
1132
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
1138
        my $biblioitem = $item->biblioitem( { deleted => 1 } );
1133
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1139
        next unless $biblioitem;
1134
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
1140
1135
  WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL
1141
        my $checkout_hashref = $checkout->unblessed();
1136
  order by ' . $order;
1142
        my $item_hashref = $item->unblessed();
1137
    if ($limit) {
1143
        my $biblio_hashref = $biblio->unblessed();
1138
        $query .= " limit $limit";
1144
        my $biblioitem_hashref = $biblioitem->unblessed();
1145
1146
        my $hashref = { %$checkout_hashref, %$item_hashref, %$biblio_hashref, %$biblioitem_hashref };
1147
        $hashref->{issuestimestamp} = $checkout->timestamp();
1148
        $hashref->{renewals} = $checkout->renewals();
1149
        $hashref->{totalrenewals} = $item->renewals();
1150
        $hashref->{itemstimestamp} = $item->timestamp();
1151
1152
        push( @results, $hashref );
1139
    }
1153
    }
1140
1154
1141
    my $sth = $dbh->prepare($query);
1155
    return \@results;
1142
    $sth->execute( $borrowernumber, $borrowernumber );
1143
    return $sth->fetchall_arrayref( {} );
1144
}
1156
}
1145
1157
1146
1158
(-)a/Koha/Biblio.pm (+52 lines)
Line 0 Link Here
1
package Koha::Biblio;
2
3
# Copyright ByWater Solutions 2015
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/BiblioItem.pm (+52 lines)
Line 0 Link Here
1
package Koha::BiblioItem;
2
3
# Copyright ByWater Solutions 2015
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::BiblioItem - Koha BiblioItem 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 'Biblioitem';
44
}
45
46
=head1 AUTHOR
47
48
Kyle M Hall <kyle@bywatersolutions.com>
49
50
=cut
51
52
1;
(-)a/Koha/BiblioItems.pm (+58 lines)
Line 0 Link Here
1
package Koha::BiblioItems;
2
3
# Copyright ByWater Solutions 2015
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::BiblioItem;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::BiblioItem - Koha BiblioItem 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 'Biblioitem';
46
}
47
48
sub object_class {
49
    return 'Koha::BiblioItem';
50
}
51
52
=head1 AUTHOR
53
54
Kyle M Hall <kyle@bywatersolutions.com>
55
56
=cut
57
58
1;
(-)a/Koha/Biblios.pm (+58 lines)
Line 0 Link Here
1
package Koha::Biblios;
2
3
# Copyright ByWater Solutions 2015
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::Biblio - Koha Biblio 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
sub object_class {
49
    return 'Koha::Biblio';
50
}
51
52
=head1 AUTHOR
53
54
Kyle M Hall <kyle@bywatersolutions.com>
55
56
=cut
57
58
1;
(-)a/Koha/Borrower.pm (+55 lines)
Lines 23-28 use Carp; Link Here
23
23
24
use Koha::Database;
24
use Koha::Database;
25
25
26
use Koha::Checkouts;
27
use Koha::OldCheckouts;
28
26
use base qw(Koha::Object);
29
use base qw(Koha::Object);
27
30
28
=head1 NAME
31
=head1 NAME
Lines 35-40 Koha::Borrower - Koha Borrower Object class Link Here
35
38
36
=cut
39
=cut
37
40
41
=head3 all_checkouts
42
43
=cut
44
45
sub all_checkouts {
46
    my ( $self, $params ) = @_;
47
48
    my $limit = $params->{limit};
49
50
    my $order_by_column = $params->{order} ? $params->{order}->{column} : 'date_due';
51
    my $order_by_sort   = $params->{order} ? $params->{order}->{sort}   : 'desc';
52
53
    my @results;
54
    my $results_found = 0;
55
56
    my $issues = Koha::Checkouts->search(
57
        {
58
            borrowernumber => $self->borrowernumber(),
59
        },
60
        {
61
            order_by => { "-$order_by_sort" => $order_by_column }
62
        }
63
    );
64
65
    while ( my $i = $issues->next() ) {
66
        push( @results, $i );
67
        $results_found++;
68
        last if ( $limit && $results_found >= $limit );
69
    }
70
71
    if ( !$limit || $results_found < $limit ) {
72
73
        $issues = Koha::OldCheckouts->search(
74
            {
75
                borrowernumber => $self->borrowernumber(),
76
            },
77
            {
78
                order_by => { "-$order_by_sort" => $order_by_column }
79
            }
80
        );
81
82
        while ( my $i = $issues->next() ) {
83
            push( @results, $i );
84
            $results_found++;
85
            last if ( $limit && $results_found >= $limit );
86
        }
87
88
    }
89
90
    return wantarray ? @results : \@results;
91
}
92
38
=head3 type
93
=head3 type
39
94
40
=cut
95
=cut
(-)a/Koha/Checkout.pm (+76 lines)
Line 0 Link Here
1
package Koha::Checkout;
2
3
# Copyright ByWater Solutions 2015
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
use Koha::Items;
26
use Koha::Deleted::Items;
27
28
use base qw(Koha::Object);
29
30
=head1 NAME
31
32
Koha::Checkout - Koha Checkout Object class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 item
41
42
my $item = $checkout->item({ deleted => 1 });
43
44
Returns the related Koha::Item for this checkout.
45
46
If the parameter delete is passed and true, and the itemnumber
47
is not found for current items, this method will look for a matching
48
deleted item.
49
50
=cut
51
52
sub item {
53
    my ( $self, $params ) = @_;
54
55
    my $item = Koha::Items->search( { itemnumber => $self->itemnumber() } )->next();
56
57
    $item ||= Koha::Deleted::Items->search( { itemnumber => $self->itemnumber() } )->next() if ( $params->{deleted} );
58
59
    return $item || undef;
60
}
61
62
=head3 type
63
64
=cut
65
66
sub type {
67
    return 'Issue';
68
}
69
70
=head1 AUTHOR
71
72
Kyle M Hall <kyle@bywatersolutions.com>
73
74
=cut
75
76
1;
(-)a/Koha/Checkouts.pm (+58 lines)
Line 0 Link Here
1
package Koha::Checkouts;
2
3
# Copyright ByWater Solutions 2015
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::Checkout;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::Checkouts - Koha Checkouts 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 'Issue';
46
}
47
48
sub object_class {
49
    return 'Koha::Checkout';
50
}
51
52
=head1 AUTHOR
53
54
Kyle M Hall <kyle@bywatersolutions.com>
55
56
=cut
57
58
1;
(-)a/Koha/Deleted/Biblio.pm (+57 lines)
Line 0 Link Here
1
package Koha::Deleted::Biblio;
2
3
# Copyright ByWater Solutions 2015
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::Biblio);
27
28
=head1 NAME
29
30
Koha::Deleted::Biblio - Koha Biblio Object class
31
32
This class is an extension of Koha::Biblio.
33
34
New methods should only be added to Koha::Biblio unless they are specifically
35
and only for dealing with deleted bibs.
36
37
=head1 API
38
39
=head2 Class Methods
40
41
=cut
42
43
=head3 type
44
45
=cut
46
47
sub type {
48
    return 'Deletedbiblio';
49
}
50
51
=head1 AUTHOR
52
53
Kyle M Hall <kyle@bywatersolutions.com>
54
55
=cut
56
57
1;
(-)a/Koha/Deleted/BiblioItem.pm (+57 lines)
Line 0 Link Here
1
package Koha::Deleted::BiblioItem;
2
3
# Copyright ByWater Solutions 2015
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::BiblioItem);
27
28
=head1 NAME
29
30
Koha::Deleted::BiblioItem - Koha Deleted BiblioItem Object class
31
32
This class is an extension of Koha::BiblioItem.
33
34
New methods should only be added to Koha::BiblioItem unless they are specifically
35
and only for dealing with deleted biblioitems.
36
37
=head1 API
38
39
=head2 Class Methods
40
41
=cut
42
43
=head3 type
44
45
=cut
46
47
sub type {
48
    return 'Deletedbiblioitem';
49
}
50
51
=head1 AUTHOR
52
53
Kyle M Hall <kyle@bywatersolutions.com>
54
55
=cut
56
57
1;
(-)a/Koha/Deleted/BiblioItems.pm (+63 lines)
Line 0 Link Here
1
package Koha::Deleted::BiblioItems;
2
3
# Copyright ByWater Solutions 2015
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::Deleted::BiblioItem;
27
28
use base qw(Koha::BiblioItems);
29
30
=head1 NAME
31
32
Koha::BiblioItem - Koha BiblioItem Object class
33
34
This class is an extension of Koha::BiblioItems.
35
36
New methods should only be added to Koha::BiblioItems unless they are specifically
37
and only for dealing with deleted biblioitem sets
38
39
=head1 API
40
41
=head2 Class Methods
42
43
=cut
44
45
=head3 type
46
47
=cut
48
49
sub type {
50
    return 'Deletedbiblioitem';
51
}
52
53
sub object_class {
54
    return 'Koha::Deleted::BiblioItem';
55
}
56
57
=head1 AUTHOR
58
59
Kyle M Hall <kyle@bywatersolutions.com>
60
61
=cut
62
63
1;
(-)a/Koha/Deleted/Biblios.pm (+64 lines)
Line 0 Link Here
1
package Koha::Deleted::Biblios;
2
3
# Copyright ByWater Solutions 2015
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::Deleted::Biblio;
27
28
use base qw(Koha::Biblios);
29
30
=head1 NAME
31
32
Koha::Deleted::Biblios - Koha Deleted Bibliographic Record set object class
33
34
This class is an extension of Koha::Biblios.
35
36
New methods should only be added to Koha::Biblios unless they are specifically
37
and only for dealing with deleted bib sets
38
39
40
=head1 API
41
42
=head2 Class Methods
43
44
=cut
45
46
=head3 type
47
48
=cut
49
50
sub type {
51
    return 'Deletedbiblio';
52
}
53
54
sub object_class {
55
    return 'Koha::Deleted::Biblio';
56
}
57
58
=head1 AUTHOR
59
60
Kyle M Hall <kyle@bywatersolutions.com>
61
62
=cut
63
64
1;
(-)a/Koha/Deleted/Item.pm (+58 lines)
Line 0 Link Here
1
package Koha::Deleted::Item;
2
3
# Copyright ByWater Solutions 2015
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::Item);
27
28
=head1 NAME
29
30
Koha::Deleted::Item - Koha Deleted Item Object class
31
32
This class is an extension of Koha::Item.
33
34
New methods should only be added to Koha::Item unless they are specifically
35
and only for dealing with deleted items only.
36
37
38
=head1 API
39
40
=head2 Class Methods
41
42
=cut
43
44
=head3 type
45
46
=cut
47
48
sub type {
49
    return 'Deleteditem';
50
}
51
52
=head1 AUTHOR
53
54
Kyle M Hall <kyle@bywatersolutions.com>
55
56
=cut
57
58
1;
(-)a/Koha/Deleted/Items.pm (+63 lines)
Line 0 Link Here
1
package Koha::Deleted::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::Deleted::Item;
27
28
use base qw(Koha::Items);
29
30
=head1 NAME
31
32
Koha::Deleted::Items - Koha Deleted Items Object class
33
34
This class is an extension of Koha::Items.
35
36
New methods should only be added to Koha::Items unless they are specifically
37
and only for dealing with deleted item sets
38
39
=head1 API
40
41
=head2 Class Methods
42
43
=cut
44
45
=head3 type
46
47
=cut
48
49
sub type {
50
    return 'Deleteditem';
51
}
52
53
sub object_class {
54
    return 'Koha::Deleted::Item';
55
}
56
57
=head1 AUTHOR
58
59
Kyle M Hall <kyle@bywatersolutions.com>
60
61
=cut
62
63
1;
(-)a/Koha/Item.pm (+100 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
use Koha::Biblios;
26
use Koha::Deleted::Biblios;
27
use Koha::BiblioItems;
28
use Koha::Deleted::BiblioItems;
29
30
use base qw(Koha::Object);
31
32
=head1 NAME
33
34
Koha::Item - Koha Item Object class
35
36
=head1 API
37
38
=head2 Class Methods
39
40
=cut
41
42
=head3 biblio
43
44
my $biblio = $checkout->biblio({ deleted => 1 });
45
46
Returns the related Koha::Biblio for this checkout.
47
48
If the parameter delete is passed and true, and the biblionumber
49
is not found for current biblios, this method will look for a matching
50
deleted biblio.
51
52
=cut
53
54
sub biblio {
55
    my ( $self, $params ) = @_;
56
57
    my $biblio = Koha::Biblios->search( { biblionumber => $self->biblionumber() } )->next();
58
59
    $biblio ||= Koha::Deleted::Biblios->search( { biblionumber => $self->biblionumber() } )->next() if ( $params->{deleted} );
60
61
    return $biblio || undef;
62
}
63
64
=head3 biblioitem
65
66
my $biblioitem = $checkout->biblio({ deleted => 1 });
67
68
Returns the related Koha::Biblio for this checkout.
69
70
If the parameter delete is passed and true, and the biblioitemnumber
71
is not found for current biblioitems, this method will look for a matching
72
deleted biblioitem.
73
74
=cut
75
76
sub biblioitem {
77
    my ( $self, $params ) = @_;
78
79
    my $biblioitem = Koha::BiblioItems->search( { biblionumber => $self->biblionumber() } )->next();
80
81
    $biblioitem ||= Koha::Deleted::BiblioItems->search( { biblionumber => $self->biblionumber() } )->next() if ( $params->{deleted} );
82
83
    return $biblioitem || undef;
84
}
85
86
=head3 type
87
88
=cut
89
90
sub type {
91
    return 'Item';
92
}
93
94
=head1 AUTHOR
95
96
Kyle M Hall <kyle@bywatersolutions.com>
97
98
=cut
99
100
1;
(-)a/Koha/Items.pm (+58 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::Item - Koha Item 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
sub object_class {
49
    return 'Koha::Item';
50
}
51
52
=head1 AUTHOR
53
54
Kyle M Hall <kyle@bywatersolutions.com>
55
56
=cut
57
58
1;
(-)a/Koha/Object.pm (+12 lines)
Lines 266-271 sub AUTOLOAD { Link Here
266
    return;
266
    return;
267
}
267
}
268
268
269
=head3 $object->unblessed();
270
271
Returns an unblessed representation of object.
272
273
=cut
274
275
sub unblessed {
276
    my ($self) = @_;
277
278
    return { $self->_result->get_columns };
279
}
280
269
=head3 type
281
=head3 type
270
282
271
This method must be defined in the child class. The value is the name of the DBIC resultset.
283
This method must be defined in the child class. The value is the name of the DBIC resultset.
(-)a/Koha/Objects.pm (+14 lines)
Lines 195-200 sub _wrap { Link Here
195
    return @objects;
195
    return @objects;
196
}
196
}
197
197
198
=head3 Koha::Objects->unblessed
199
200
Returns an unblessed representation of objects.
201
202
=cut
203
204
sub unblessed {
205
    my ($self) = @_;
206
207
    return [ map { $_->unblessed } $self->as_list ];
208
}
209
210
211
198
=head3 Koha::Objects->_resultset
212
=head3 Koha::Objects->_resultset
199
213
200
Returns the internal resultset or creates it if undefined
214
Returns the internal resultset or creates it if undefined
(-)a/Koha/OldCheckout.pm (+57 lines)
Line 0 Link Here
1
package Koha::OldCheckout;
2
3
# Copyright ByWater Solutions 2015
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::Checkout);
27
28
=head1 NAME
29
30
Koha::OldCheckout - Koha OldCheckout Object class
31
32
This class is an extension of Koha::Checkout.
33
34
New methods should only be added to Koha::Checkout unless they are specifically
35
and only for dealing with old checkouts.
36
37
=head1 API
38
39
=head2 Class Methods
40
41
=cut
42
43
=head3 type
44
45
=cut
46
47
sub type {
48
    return 'OldIssue';
49
}
50
51
=head1 AUTHOR
52
53
Kyle M Hall <kyle@bywatersolutions.com>
54
55
=cut
56
57
1;
(-)a/Koha/OldCheckouts.pm (+63 lines)
Line 0 Link Here
1
package Koha::OldCheckouts;
2
3
# Copyright ByWater Solutions 2015
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::OldCheckout;
27
28
use base qw(Koha::Checkouts);
29
30
=head1 NAME
31
32
Koha::OldIssues - Koha OldIssues Object class
33
34
This class is an extension of Koha::Checkouts.
35
36
New methods should only be added to Koha::Checkouts unless they are specifically
37
and only for dealing with old checkouts.
38
39
=head1 API
40
41
=head2 Class Methods
42
43
=cut
44
45
=head3 type
46
47
=cut
48
49
sub type {
50
    return 'OldIssue';
51
}
52
53
sub object_class {
54
    return 'Koha::OldCheckout';
55
}
56
57
=head1 AUTHOR
58
59
Kyle M Hall <kyle@bywatersolutions.com>
60
61
=cut
62
63
1;
(-)a/installer/data/mysql/atomicupdate/bug_8483.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE `old_issues` DROP FOREIGN KEY `old_issues_ibfk_2`;
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 1162-1168 CREATE TABLE `issues` ( -- information related to check outs or issues Link Here
1162
  KEY `branchcode_idx` (`branchcode`),
1162
  KEY `branchcode_idx` (`branchcode`),
1163
  KEY `bordate` (`borrowernumber`,`timestamp`),
1163
  KEY `bordate` (`borrowernumber`,`timestamp`),
1164
  CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE,
1164
  CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE,
1165
  CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE
1165
  CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1166
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1166
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1167
1167
1168
--
1168
--
(-)a/opac/opac-readingrecord.pl (-1 / +1 lines)
Lines 76-81 $limit //= ''; Link Here
76
$limit = ( $limit eq 'full' ) ? 0 : 50;
76
$limit = ( $limit eq 'full' ) ? 0 : 50;
77
77
78
my $issues = GetAllIssues( $borrowernumber, $order, $limit );
78
my $issues = GetAllIssues( $borrowernumber, $order, $limit );
79
warn "ISSUES: " . scalar @$issues;
79
80
80
my $itype_attribute =
81
my $itype_attribute =
81
  ( C4::Context->preference('item-level_itypes') ) ? 'itype' : 'itemtype';
82
  ( C4::Context->preference('item-level_itypes') ) ? 'itype' : 'itemtype';
82
- 

Return to bug 8483