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

(-)a/Koha/Illcomment.pm (-4 / +4 lines)
Lines 1-4 Link Here
1
package Koha::Illcomment;
1
package Koha::ILL::Comment;
2
2
3
# Copyright Magnus Enger Libriotech 2017
3
# Copyright Magnus Enger Libriotech 2017
4
#
4
#
Lines 23-35 use base qw(Koha::Object); Link Here
23
23
24
=head1 NAME
24
=head1 NAME
25
25
26
Koha::Illcomment - Koha Illcomment Object class
26
Koha::ILL::Comment - Koha Illcomment Object class
27
27
28
=head2 Class methods
28
=head2 Class methods
29
29
30
=head3 patron
30
=head3 patron
31
31
32
    my $patron = Koha::Illcomment->patron;
32
    my $patron = Koha::ILL::Comment->patron;
33
33
34
Return the patron object associated with this comment
34
Return the patron object associated with this comment
35
35
Lines 46-52 sub patron { Link Here
46
46
47
=head3 _type
47
=head3 _type
48
48
49
    my $type = Koha::IllComment->_type;
49
    my $type = Koha::ILL::Comment->_type;
50
50
51
Return this object's type
51
Return this object's type
52
52
(-)a/Koha/Illcomments.pm (-6 / +6 lines)
Lines 1-4 Link Here
1
package Koha::Illcomments;
1
package Koha::ILL::Comments;
2
2
3
# Copyright Magnus Enger Libriotech 2017
3
# Copyright Magnus Enger Libriotech 2017
4
#
4
#
Lines 19-36 package Koha::Illcomments; Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Koha::Database;
21
use Koha::Database;
22
use Koha::Illcomment;
22
use Koha::ILL::Comment;
23
use base qw(Koha::Objects);
23
use base qw(Koha::Objects);
24
24
25
=head1 NAME
25
=head1 NAME
26
26
27
Koha::Illcomments - Koha Illcomments Object class
27
Koha::ILL::Comments - Koha Illcomments Object class
28
28
29
=head2 Internal methods
29
=head2 Internal methods
30
30
31
=head3 _type
31
=head3 _type
32
32
33
    my $type = Koha::IllComments->_type;
33
    my $type = Koha::ILL::Comments->_type;
34
34
35
Return this object's type
35
Return this object's type
36
36
Lines 42-55 sub _type { Link Here
42
42
43
=head3 object_class
43
=head3 object_class
44
44
45
    my $class = Koha::IllComments->object_class;
45
    my $class = Koha::ILL::Comments->object_class;
46
46
47
Return this object's class name
47
Return this object's class name
48
48
49
=cut
49
=cut
50
50
51
sub object_class {
51
sub object_class {
52
    return 'Koha::Illcomment';
52
    return 'Koha::ILL::Comment';
53
}
53
}
54
54
55
=head1 AUTHOR
55
=head1 AUTHOR
(-)a/Koha/Illrequest.pm (-4 / +4 lines)
Lines 30-36 use Koha::Cache::Memory::Lite; Link Here
30
use Koha::Database;
30
use Koha::Database;
31
use Koha::DateUtils qw( dt_from_string );
31
use Koha::DateUtils qw( dt_from_string );
32
use Koha::Exceptions::Ill;
32
use Koha::Exceptions::Ill;
33
use Koha::Illcomments;
33
use Koha::ILL::Comments;
34
use Koha::Illrequestattributes;
34
use Koha::Illrequestattributes;
35
use Koha::AuthorisedValue;
35
use Koha::AuthorisedValue;
36
use Koha::Illrequest::Logger;
36
use Koha::Illrequest::Logger;
Lines 208-214 sub illrequestattributes { Link Here
208
208
209
sub illcomments {
209
sub illcomments {
210
    my ( $self ) = @_;
210
    my ( $self ) = @_;
211
    return Koha::Illcomments->_new_from_dbic(
211
    return Koha::ILL::Comments->_new_from_dbic(
212
        scalar $self->_result->illcomments
212
        scalar $self->_result->illcomments
213
    );
213
    );
214
}
214
}
Lines 217-229 sub illcomments { Link Here
217
217
218
    my $ill_comments = $req->comments;
218
    my $ill_comments = $req->comments;
219
219
220
Returns a I<Koha::Illcomments> resultset for the linked comments.
220
Returns a I<Koha::ILL::Comments> resultset for the linked comments.
221
221
222
=cut
222
=cut
223
223
224
sub comments {
224
sub comments {
225
    my ( $self ) = @_;
225
    my ( $self ) = @_;
226
    return Koha::Illcomments->_new_from_dbic(
226
    return Koha::ILL::Comments->_new_from_dbic(
227
        scalar $self->_result->comments
227
        scalar $self->_result->comments
228
    );
228
    );
229
}
229
}
(-)a/ill/ill-requests.pl (-2 / +2 lines)
Lines 25-31 use C4::Auth qw( get_template_and_user ); Link Here
25
use C4::Output qw( output_and_exit output_html_with_http_headers );
25
use C4::Output qw( output_and_exit output_html_with_http_headers );
26
use Koha::Notice::Templates;
26
use Koha::Notice::Templates;
27
use Koha::AuthorisedValues;
27
use Koha::AuthorisedValues;
28
use Koha::Illcomment;
28
use Koha::ILL::Comment;
29
use Koha::Illrequests;
29
use Koha::Illrequests;
30
use Koha::Illrequest;
30
use Koha::Illrequest;
31
use Koha::ILL::Batches;
31
use Koha::ILL::Batches;
Lines 409-415 if ( $backends_available ) { Link Here
409
409
410
        $template->param( table_actions => encode_json( Koha::Illrequest->get_staff_table_actions ) );
410
        $template->param( table_actions => encode_json( Koha::Illrequest->get_staff_table_actions ) );
411
    } elsif ( $op eq "save_comment" ) {
411
    } elsif ( $op eq "save_comment" ) {
412
        my $comment = Koha::Illcomment->new({
412
        my $comment = Koha::ILL::Comment->new({
413
            illrequest_id  => scalar $params->{illrequest_id},
413
            illrequest_id  => scalar $params->{illrequest_id},
414
            borrowernumber => $patronnumber,
414
            borrowernumber => $patronnumber,
415
            comment        => scalar $params->{comment},
415
            comment        => scalar $params->{comment},
(-)a/t/db_dependent/Illcomments.t (-4 / +4 lines)
Lines 32-39 use Test::More tests => 9; Link Here
32
32
33
my $schema = Koha::Database->new->schema;
33
my $schema = Koha::Database->new->schema;
34
my $builder = t::lib::TestBuilder->new;
34
my $builder = t::lib::TestBuilder->new;
35
use_ok('Koha::Illcomment');
35
use_ok('Koha::ILL::Comment');
36
use_ok('Koha::Illcomments');
36
use_ok('Koha::ILL::Comments');
37
37
38
$schema->storage->txn_begin;
38
$schema->storage->txn_begin;
39
39
Lines 66-78 my $illcomment = $builder->build({ Link Here
66
66
67
# Get all the comments
67
# Get all the comments
68
my $comments = $illrq_obj->illcomments;
68
my $comments = $illrq_obj->illcomments;
69
isa_ok( $comments, 'Koha::Illcomments', "Illcomments" );
69
isa_ok( $comments, 'Koha::ILL::Comments', "Illcomments" );
70
my @comments_list = $comments->as_list();
70
my @comments_list = $comments->as_list();
71
is( scalar @comments_list, 1, "We have 1 comment" );
71
is( scalar @comments_list, 1, "We have 1 comment" );
72
72
73
# Get the first (and only) comment
73
# Get the first (and only) comment
74
my $comment = $comments->next();
74
my $comment = $comments->next();
75
isa_ok( $comment, 'Koha::Illcomment', "Illcomment" );
75
isa_ok( $comment, 'Koha::ILL::Comment', "Illcomment" );
76
76
77
# Check the different data in the comment
77
# Check the different data in the comment
78
is( $comment->illrequest_id,  $illrq_obj->illrequest_id,    'illrequest_id getter works' );
78
is( $comment->illrequest_id,  $illrq_obj->illrequest_id,    'illrequest_id getter works' );
(-)a/t/db_dependent/api/v1/ill_requests.t (-2 / +1 lines)
Lines 209-215 subtest 'list() tests' => sub { Link Here
209
    # x-koha-embed: comments
209
    # x-koha-embed: comments
210
    # Create comment
210
    # Create comment
211
    my $comment_text = "This is the comment";
211
    my $comment_text = "This is the comment";
212
    my $comment = $builder->build_object({ class => 'Koha::Illcomments', value => { illrequest_id => $req_1->illrequest_id, comment => $comment_text , borrowernumber => $patron->borrowernumber } } );
212
    my $comment = $builder->build_object({ class => 'Koha::ILL::Comments', value => { illrequest_id => $req_1->illrequest_id, comment => $comment_text , borrowernumber => $patron->borrowernumber } } );
213
213
214
    # Make sure comments come back
214
    # Make sure comments come back
215
    $t->get_ok("//$userid:$password@/api/v1/ill/requests" => {"x-koha-embed" => "comments"} )
215
    $t->get_ok("//$userid:$password@/api/v1/ill/requests" => {"x-koha-embed" => "comments"} )
216
- 

Return to bug 35581