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

(-)a/Koha/Biblio.pm (+15 lines)
Lines 48-53 use Koha::Subscriptions; Link Here
48
use Koha::SearchEngine;
48
use Koha::SearchEngine;
49
use Koha::SearchEngine::Search;
49
use Koha::SearchEngine::Search;
50
use Koha::SearchEngine::QueryBuilder;
50
use Koha::SearchEngine::QueryBuilder;
51
use Koha::Tickets;
51
52
52
=head1 NAME
53
=head1 NAME
53
54
Lines 119-124 sub active_orders { Link Here
119
    return $self->orders->search({ datecancellationprinted => undef });
120
    return $self->orders->search({ datecancellationprinted => undef });
120
}
121
}
121
122
123
=head3 tickets
124
125
  my $tickets = $biblio->tickets();
126
127
Returns all tickets linked to the biblio
128
129
=cut
130
131
sub tickets {
132
    my ( $self ) = @_;
133
    my $rs = $self->_result->tickets;
134
    return Koha::Tickets->_new_from_dbic( $rs );
135
}
136
122
=head3 item_groups
137
=head3 item_groups
123
138
124
my $item_groups = $biblio->item_groups();
139
my $item_groups = $biblio->item_groups();
(-)a/Koha/Ticket.pm (+111 lines)
Line 0 Link Here
1
package Koha::Ticket;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use base qw(Koha::Object);
21
22
use Koha::Ticket::Update;
23
use Koha::Ticket::Updates;
24
25
=head1 NAME
26
27
Koha::Ticket - Koha Ticket Object class
28
29
=head1 API
30
31
=head2 Relations
32
33
=cut
34
35
=head3 reporter
36
37
Return the patron who submitted this ticket
38
39
=cut
40
41
sub reporter {
42
    my ($self) = @_;
43
    my $rs = $self->_result->reporter;
44
    return unless $rs;
45
    return Koha::Patron->_new_from_dbic($rs);
46
}
47
48
=head3 resolver
49
50
Return the user who resolved this ticket
51
52
=cut
53
54
sub resolver {
55
    my ($self) = @_;
56
    my $rs = $self->_result->resolver;
57
    return unless $rs;
58
    return Koha::Patron->_new_from_dbic($rs) if $rs;
59
}
60
61
=head3 biblio
62
63
Return the biblio linked to this ticket
64
65
=cut
66
67
sub biblio {
68
    my ($self) = @_;
69
    my $rs = $self->_result->biblio;
70
    return unless $rs;
71
    return Koha::Biblio->_new_from_dbic($rs);
72
}
73
74
=head3 updates
75
76
Return any updates attached to this ticket
77
78
=cut
79
80
sub updates {
81
    my ($self) = @_;
82
    my $rs = $self->_result->ticket_updates;
83
    return unless $rs;
84
    return Koha::Ticket::Updates->_new_from_dbic($rs) if $rs;
85
}
86
87
=head2 Actions
88
89
=head3 add_update
90
91
=cut
92
93
sub add_update {
94
    my ( $self, $params ) = @_;
95
96
    my $rs = $self->_result->add_to_ticket_updates($params)->discard_changes;
97
98
    return Koha::Ticket::Updates->_new_from_dbic($rs);
99
}
100
101
=head2 Internal methods
102
103
=head3 _type
104
105
=cut
106
107
sub _type {
108
    return 'Ticket';
109
}
110
111
1;
(-)a/Koha/Ticket/Update.pm (+68 lines)
Line 0 Link Here
1
package Koha::Ticket::Update;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use base qw(Koha::Object);
21
22
=head1 NAME
23
24
Koha::Ticket::Update - Koha Ticket Update Object class
25
26
=head1 API
27
28
=head2 Relations
29
30
=cut
31
32
=head3 ticket
33
34
Return the ticket this update relates to
35
36
=cut
37
38
sub ticket {
39
    my ($self) = @_;
40
    my $rs = $self->_result->ticket;
41
    return unless $rs;
42
    return Koha::Ticket->_new_from_dbic($rs);
43
}
44
45
=head3 user
46
47
Return the patron who submitted this update
48
49
=cut
50
51
sub user {
52
    my ($self) = @_;
53
    my $rs = $self->_result->user;
54
    return unless $rs;
55
    return Koha::Patron->_new_from_dbic($rs);
56
}
57
58
=head2 Internal methods
59
60
=head3 _type
61
62
=cut
63
64
sub _type {
65
    return 'TicketUpdate';
66
}
67
68
1;
(-)a/Koha/Ticket/Updates.pm (+48 lines)
Line 0 Link Here
1
package Koha::Ticket::Updates;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use base qw(Koha::Objects);
21
22
=head1 NAME
23
24
Koha::Ticket::Updates - Koha Ticket Update Objects class
25
26
=head1 API
27
28
=head2 Internal methods
29
30
=cut
31
32
=head3 _type
33
34
=cut
35
36
sub _type {
37
    return 'TicketUpdate';
38
}
39
40
=head3 object_class
41
42
=cut
43
44
sub object_class {
45
    return 'Koha::Ticket::Update';
46
}
47
48
1;
(-)a/Koha/Tickets.pm (-1 / +49 lines)
Line 0 Link Here
0
- 
1
package Koha::Tickets;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
21
use base qw(Koha::Objects);
22
23
=head1 NAME
24
25
Koha::Tickets - Koha Ticket Objects class
26
27
=head1 API
28
29
=head2 Internal methods
30
31
=cut
32
33
=head3 _type
34
35
=cut
36
37
sub _type {
38
    return 'Ticket';
39
}
40
41
=head3 object_class
42
43
=cut
44
45
sub object_class {
46
    return 'Koha::Ticket';
47
}
48
49
1;

Return to bug 31028