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

(-)a/Koha/ILL/Batch.pm (-2 / +2 lines)
Lines 23-29 use Koha::Database; Link Here
23
23
24
use Koha::Illrequests;
24
use Koha::Illrequests;
25
use Koha::Illrequest::Logger;
25
use Koha::Illrequest::Logger;
26
use Koha::IllbatchStatuses;
26
use Koha::ILL::Batch::Statuses;
27
use Koha::Libraries;
27
use Koha::Libraries;
28
use Koha::Patrons;
28
use Koha::Patrons;
29
29
Lines 46-52 Return the status object associated with this batch Link Here
46
46
47
sub status {
47
sub status {
48
    my ($self) = @_;
48
    my ($self) = @_;
49
    return Koha::IllbatchStatus->_new_from_dbic( scalar $self->_result->status_code );
49
    return Koha::ILL::Batch::Status->_new_from_dbic( scalar $self->_result->status_code );
50
}
50
}
51
51
52
=head3 patron
52
=head3 patron
(-)a/Koha/IllbatchStatus.pm (-4 / +4 lines)
Lines 1-4 Link Here
1
package Koha::IllbatchStatus;
1
package Koha::ILL::Batch::Status;
2
2
3
# Copyright PTFS Europe 2022
3
# Copyright PTFS Europe 2022
4
#
4
#
Lines 26-32 use base qw(Koha::Object); Link Here
26
26
27
=head1 NAME
27
=head1 NAME
28
28
29
Koha::IllbatchStatus - Koha IllbatchStatus Object class
29
Koha::ILL::Batch::Status - Koha IllbatchStatus Object class
30
30
31
=head2 Class methods
31
=head2 Class methods
32
32
Lines 46-52 sub create_and_log { Link Here
46
    $fixed_code =~ s/\W/_/;
46
    $fixed_code =~ s/\W/_/;
47
47
48
    # Ensure this status doesn't already exist
48
    # Ensure this status doesn't already exist
49
    my $status = Koha::IllbatchStatuses->find( { code => $fixed_code } );
49
    my $status = Koha::ILL::Batch::Statuses->find( { code => $fixed_code } );
50
    if ($status) {
50
    if ($status) {
51
        return { error => "Duplicate status found" };
51
        return { error => "Duplicate status found" };
52
    }
52
    }
Lines 145-151 sub delete_and_log { Link Here
145
145
146
=head3 _type
146
=head3 _type
147
147
148
    my $type = Koha::IllbatchStatus->_type;
148
    my $type = Koha::ILL::Batch::Statuses->_type;
149
149
150
Return this object's type
150
Return this object's type
151
151
(-)a/Koha/IllbatchStatuses.pm (-5 / +5 lines)
Lines 1-4 Link Here
1
package Koha::IllbatchStatuses;
1
package Koha::ILL::Batch::Statuses;
2
2
3
# Copyright PTFS Europe 2022
3
# Copyright PTFS Europe 2022
4
#
4
#
Lines 19-36 package Koha::IllbatchStatuses; Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Koha::Database;
21
use Koha::Database;
22
use Koha::IllbatchStatus;
22
use Koha::ILL::Batch::Status;
23
use base qw(Koha::Objects);
23
use base qw(Koha::Objects);
24
24
25
=head1 NAME
25
=head1 NAME
26
26
27
Koha::IllbatchStatuses - Koha IllbatchStatuses Object class
27
Koha::ILL::Batch::Statuses - Koha IllbatchStatuses 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::IllbatchStatuses->_type;
33
    my $type = Koha::ILL::Batch::Statuses->_type;
34
34
35
Return this object's type
35
Return this object's type
36
36
Lines 49-55 Return this object's class name Link Here
49
=cut
49
=cut
50
50
51
sub object_class {
51
sub object_class {
52
    return 'Koha::IllbatchStatus';
52
    return 'Koha::ILL::Batch::Status';
53
}
53
}
54
54
55
=head1 AUTHOR
55
=head1 AUTHOR
(-)a/Koha/REST/V1/IllbatchStatuses.pm (-8 / +8 lines)
Lines 1-4 Link Here
1
package Koha::REST::V1::IllbatchStatuses;
1
package Koha::REST::V1::ILL::Batch::Statuses;
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
Lines 19-29 use Modern::Perl; Link Here
19
19
20
use Mojo::Base 'Mojolicious::Controller';
20
use Mojo::Base 'Mojolicious::Controller';
21
21
22
use Koha::IllbatchStatuses;
22
use Koha::ILL::Batch::Statuses;
23
23
24
=head1 NAME
24
=head1 NAME
25
25
26
Koha::REST::V1::IllbatchStatuses
26
Koha::REST::V1::ILL::Batch::Statuses
27
27
28
=head2 Operations
28
=head2 Operations
29
29
Lines 36-42 Return a list of available ILL batch statuses Link Here
36
sub list {
36
sub list {
37
    my $c = shift->openapi->valid_input;
37
    my $c = shift->openapi->valid_input;
38
38
39
    my @statuses = Koha::IllbatchStatuses->search()->as_list;
39
    my @statuses = Koha::ILL::Batch::Statuses->search()->as_list;
40
40
41
    return $c->render( status => 200, openapi => \@statuses );
41
    return $c->render( status => 200, openapi => \@statuses );
42
}
42
}
Lines 52-58 sub get { Link Here
52
52
53
    my $status_code = $c->param('ill_batchstatus_code');
53
    my $status_code = $c->param('ill_batchstatus_code');
54
54
55
    my $status = Koha::IllbatchStatuses->find( { code => $status_code } );
55
    my $status = Koha::ILL::Batch::Statuses->find( { code => $status_code } );
56
56
57
    if ( not defined $status ) {
57
    if ( not defined $status ) {
58
        return $c->render(
58
        return $c->render(
Lines 78-84 sub add { Link Here
78
78
79
    my $body = $c->req->json;
79
    my $body = $c->req->json;
80
80
81
    my $status = Koha::IllbatchStatus->new($body);
81
    my $status = Koha::ILL::Batch::Status->new($body);
82
82
83
    return try {
83
    return try {
84
        my $return = $status->create_and_log;
84
        my $return = $status->create_and_log;
Lines 107-113 Update a batch status Link Here
107
sub update {
107
sub update {
108
    my $c = shift->openapi->valid_input or return;
108
    my $c = shift->openapi->valid_input or return;
109
109
110
    my $status = Koha::IllbatchStatuses->find( { code => $c->param('ill_batchstatus_code') } );
110
    my $status = Koha::ILL::Batch::Statuses->find( { code => $c->param('ill_batchstatus_code') } );
111
111
112
    if ( not defined $status ) {
112
    if ( not defined $status ) {
113
        return $c->render(
113
        return $c->render(
Lines 142-148 sub delete { Link Here
142
142
143
    my $c = shift->openapi->valid_input or return;
143
    my $c = shift->openapi->valid_input or return;
144
144
145
    my $status = Koha::IllbatchStatuses->find( { code => $c->param('ill_batchstatus_code') } );
145
    my $status = Koha::ILL::Batch::Statuses->find( { code => $c->param('ill_batchstatus_code') } );
146
146
147
    if ( not defined $status ) {
147
    if ( not defined $status ) {
148
        return $c->render( status => 404, openapi => { errors => [ { message => "ILL batch status not found" } ] } );
148
        return $c->render( status => 404, openapi => { errors => [ { message => "ILL batch status not found" } ] } );
(-)a/Koha/REST/V1/ILL/Batches.pm (-1 / +1 lines)
Lines 20-26 use Modern::Perl; Link Here
20
use Mojo::Base 'Mojolicious::Controller';
20
use Mojo::Base 'Mojolicious::Controller';
21
21
22
use Koha::ILL::Batches;
22
use Koha::ILL::Batches;
23
use Koha::IllbatchStatuses;
23
use Koha::ILL::Batch::Statuses;
24
use Koha::Illrequests;
24
use Koha::Illrequests;
25
25
26
use Try::Tiny qw( catch try );
26
use Try::Tiny qw( catch try );
(-)a/Koha/Schema/Result/IllbatchStatus.pm (-2 / +2 lines)
Lines 119-129 __PACKAGE__->add_columns( Link Here
119
);
119
);
120
120
121
sub koha_object_class {
121
sub koha_object_class {
122
    'Koha::IllbatchStatus';
122
    'Koha::ILL::Batch::Status';
123
}
123
}
124
124
125
sub koha_objects_class {
125
sub koha_objects_class {
126
    'Koha::IllbatchStatuses';
126
    'Koha::ILL::Batch::Statuses';
127
}
127
}
128
128
129
1;
129
1;
(-)a/admin/ill_batch_statuses.pl (-5 / +5 lines)
Lines 25-32 use C4::Context; Link Here
25
use C4::Auth   qw( get_template_and_user );
25
use C4::Auth   qw( get_template_and_user );
26
use C4::Output qw( output_html_with_http_headers );
26
use C4::Output qw( output_html_with_http_headers );
27
27
28
use Koha::IllbatchStatus;
28
use Koha::ILL::Batch::Status;
29
use Koha::IllbatchStatuses;
29
use Koha::ILL::Batch::Statuses;
30
30
31
my $input = CGI->new;
31
my $input = CGI->new;
32
my $code  = $input->param('code');
32
my $code  = $input->param('code');
Lines 44-50 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
44
44
45
my $status;
45
my $status;
46
if ($code) {
46
if ($code) {
47
    $status = Koha::IllbatchStatuses->find( { code => $code } );
47
    $status = Koha::ILL::Batch::Statuses->find( { code => $code } );
48
}
48
}
49
49
50
if ( $op eq 'add_form' ) {
50
if ( $op eq 'add_form' ) {
Lines 56-62 if ( $op eq 'add_form' ) { Link Here
56
    my $code = $input->param('code');
56
    my $code = $input->param('code');
57
57
58
    if ( not defined $status ) {
58
    if ( not defined $status ) {
59
        $status = Koha::IllbatchStatus->new(
59
        $status = Koha::ILL::Batch::Status->new(
60
            {
60
            {
61
                name => $name,
61
                name => $name,
62
                code => $code
62
                code => $code
Lines 86-92 if ( $op eq 'add_form' ) { Link Here
86
    $op = 'list';
86
    $op = 'list';
87
}
87
}
88
if ( $op eq 'list' ) {
88
if ( $op eq 'list' ) {
89
    my $statuses = Koha::IllbatchStatuses->search();
89
    my $statuses = Koha::ILL::Batch::Statuses->search();
90
    $template->param( statuses => $statuses );
90
    $template->param( statuses => $statuses );
91
}
91
}
92
92
(-)a/api/v1/swagger/paths/ill_batchstatuses.yaml (-5 / +5 lines)
Lines 1-7 Link Here
1
---
1
---
2
/ill/batchstatuses:
2
/ill/batchstatuses:
3
  get:
3
  get:
4
    x-mojo-to: IllbatchStatuses#list
4
    x-mojo-to: ILL::Batch::Statuses#list
5
    operationId: listIllbatchstatuses
5
    operationId: listIllbatchstatuses
6
    tags:
6
    tags:
7
      - ill_batchstatuses
7
      - ill_batchstatuses
Lines 41-47 Link Here
41
      permissions:
41
      permissions:
42
        ill: "1"
42
        ill: "1"
43
  post:
43
  post:
44
    x-mojo-to: IllbatchStatuses#add
44
    x-mojo-to: ILL::Batch::Statuses#add
45
    operationId: addIllbatchstatus
45
    operationId: addIllbatchstatus
46
    tags:
46
    tags:
47
      - ill_batchstatuses
47
      - ill_batchstatuses
Lines 92-98 Link Here
92
        ill: "1"
92
        ill: "1"
93
"/ill/batchstatuses/{ill_batchstatus_code}":
93
"/ill/batchstatuses/{ill_batchstatus_code}":
94
  get:
94
  get:
95
    x-mojo-to: IllbatchStatuses#get
95
    x-mojo-to: ILL::Batch::Statuses#get
96
    operationId: getIllbatchstatuses
96
    operationId: getIllbatchstatuses
97
    tags:
97
    tags:
98
      - ill_batchstatuses
98
      - ill_batchstatuses
Lines 137-143 Link Here
137
      permissions:
137
      permissions:
138
        ill: "1"
138
        ill: "1"
139
  put:
139
  put:
140
    x-mojo-to: IllbatchStatuses#update
140
    x-mojo-to: ILL::Batch::Statuses#update
141
    operationId: updateIllBatchstatus
141
    operationId: updateIllBatchstatus
142
    tags:
142
    tags:
143
      - ill_batchstatuses
143
      - ill_batchstatuses
Lines 190-196 Link Here
190
      permissions:
190
      permissions:
191
        ill: "1"
191
        ill: "1"
192
  delete:
192
  delete:
193
    x-mojo-to: IllbatchStatuses#delete
193
    x-mojo-to: ILL::Batch::Statuses#delete
194
    operationId: deleteBatchstatus
194
    operationId: deleteBatchstatus
195
    tags:
195
    tags:
196
      - ill_batchstatuses
196
      - ill_batchstatuses
(-)a/t/db_dependent/IllbatchStatuses.t (-20 / +20 lines)
Lines 19-26 use Modern::Perl; Link Here
19
19
20
use File::Basename qw/basename/;
20
use File::Basename qw/basename/;
21
use Koha::Database;
21
use Koha::Database;
22
use Koha::IllbatchStatus;
22
use Koha::ILL::Batch::Status;
23
use Koha::IllbatchStatuses;
23
use Koha::ILL::Batch::Statuses;
24
use Koha::Patrons;
24
use Koha::Patrons;
25
use Koha::Libraries;
25
use Koha::Libraries;
26
use t::lib::Mocks;
26
use t::lib::Mocks;
Lines 32-43 use Test::More tests => 13; 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::IllbatchStatus');
35
use_ok('Koha::ILL::Batch::Status');
36
use_ok('Koha::IllbatchStatuses');
36
use_ok('Koha::ILL::Batch::Statuses');
37
37
38
$schema->storage->txn_begin;
38
$schema->storage->txn_begin;
39
39
40
Koha::IllbatchStatuses->search->delete;
40
Koha::ILL::Batch::Statuses->search->delete;
41
41
42
# Keep track of whether our CRUD logging side-effects are happening
42
# Keep track of whether our CRUD logging side-effects are happening
43
my $effects = {
43
my $effects = {
Lines 68-85 my $status = $builder->build( Link Here
68
    }
68
    }
69
);
69
);
70
70
71
my $status_obj = Koha::IllbatchStatuses->find( { code => $status->{code} } );
71
my $status_obj = Koha::ILL::Batch::Statuses->find( { code => $status->{code} } );
72
isa_ok( $status_obj, 'Koha::IllbatchStatus' );
72
isa_ok( $status_obj, 'Koha::ILL::Batch::Status' );
73
73
74
# Try to delete the status, it's a system status, so this should fail
74
# Try to delete the status, it's a system status, so this should fail
75
$status_obj->delete_and_log;
75
$status_obj->delete_and_log;
76
my $status_obj_del = Koha::IllbatchStatuses->find( { code => $status->{code} } );
76
my $status_obj_del = Koha::ILL::Batch::Statuses->find( { code => $status->{code} } );
77
isa_ok( $status_obj_del, 'Koha::IllbatchStatus' );
77
isa_ok( $status_obj_del, 'Koha::ILL::Batch::Status' );
78
78
79
## Status create
79
## Status create
80
80
81
# Try creating a duplicate status
81
# Try creating a duplicate status
82
my $status2 = Koha::IllbatchStatus->new(
82
my $status2 = Koha::ILL::Batch::Status->new(
83
    {
83
    {
84
        name      => "Obi-wan",
84
        name      => "Obi-wan",
85
        code      => $status->{code},
85
        code      => $status->{code},
Lines 93-99 is_deeply( Link Here
93
);
93
);
94
94
95
# Create a non-duplicate status and ensure that the logger is called
95
# Create a non-duplicate status and ensure that the logger is called
96
my $status3 = Koha::IllbatchStatus->new(
96
my $status3 = Koha::ILL::Batch::Status->new(
97
    {
97
    {
98
        name      => "Kylo",
98
        name      => "Kylo",
99
        code      => "DARK_SIDE",
99
        code      => "DARK_SIDE",
Lines 108-114 is( Link Here
108
);
108
);
109
109
110
# Try creating a system status and ensure it's not created
110
# Try creating a system status and ensure it's not created
111
my $cannot_create_system = Koha::IllbatchStatus->new(
111
my $cannot_create_system = Koha::ILL::Batch::Status->new(
112
    {
112
    {
113
        name      => "Jar Jar Binks",
113
        name      => "Jar Jar Binks",
114
        code      => "GUNGAN",
114
        code      => "GUNGAN",
Lines 116-122 my $cannot_create_system = Koha::IllbatchStatus->new( Link Here
116
    }
116
    }
117
);
117
);
118
$cannot_create_system->create_and_log;
118
$cannot_create_system->create_and_log;
119
my $created_but_not_system = Koha::IllbatchStatuses->find( { code => "GUNGAN" } );
119
my $created_but_not_system = Koha::ILL::Batch::Statuses->find( { code => "GUNGAN" } );
120
is( $created_but_not_system->{is_system}, undef, "is_system statuses cannot be created" );
120
is( $created_but_not_system->{is_system}, undef, "is_system statuses cannot be created" );
121
121
122
## Status update
122
## Status update
Lines 131-137 $status3->update_and_log( Link Here
131
);
131
);
132
132
133
# Get our updated status, if we can get it by it's code, we know that hasn't changed
133
# Get our updated status, if we can get it by it's code, we know that hasn't changed
134
my $not_updated = Koha::IllbatchStatuses->find( { code => "DARK_SIDE" } )->unblessed;
134
my $not_updated = Koha::ILL::Batch::Statuses->find( { code => "DARK_SIDE" } )->unblessed;
135
is( $not_updated->{is_system}, 0,     "is_system cannot be changed" );
135
is( $not_updated->{is_system}, 0,     "is_system cannot be changed" );
136
is( $not_updated->{name},      "Rey", "name can be changed" );
136
is( $not_updated->{name},      "Rey", "name can be changed" );
137
137
Lines 143-156 is( Link Here
143
);
143
);
144
144
145
## Status delete
145
## Status delete
146
my $cannot_delete = Koha::IllbatchStatus->new(
146
my $cannot_delete = Koha::ILL::Batch::Status->new(
147
    {
147
    {
148
        name      => "Palapatine",
148
        name      => "Palapatine",
149
        code      => "SITH",
149
        code      => "SITH",
150
        is_system => 1
150
        is_system => 1
151
    }
151
    }
152
)->store;
152
)->store;
153
my $can_delete = Koha::IllbatchStatus->new(
153
my $can_delete = Koha::ILL::Batch::Status->new(
154
    {
154
    {
155
        name      => "Windu",
155
        name      => "Windu",
156
        code      => "JEDI",
156
        code      => "JEDI",
Lines 158-165 my $can_delete = Koha::IllbatchStatus->new( Link Here
158
    }
158
    }
159
);
159
);
160
$cannot_delete->delete_and_log;
160
$cannot_delete->delete_and_log;
161
my $not_deleted = Koha::IllbatchStatuses->find( { code => "SITH" } );
161
my $not_deleted = Koha::ILL::Batch::Statuses->find( { code => "SITH" } );
162
isa_ok( $not_deleted, 'Koha::IllbatchStatus', "is_system statuses cannot be deleted" );
162
isa_ok( $not_deleted, 'Koha::ILL::Batch::Status', "is_system statuses cannot be deleted" );
163
$can_delete->create_and_log;
163
$can_delete->create_and_log;
164
$can_delete->delete_and_log;
164
$can_delete->delete_and_log;
165
165
Lines 171-177 is( Link Here
171
);
171
);
172
172
173
# Create a system "UNKNOWN" status
173
# Create a system "UNKNOWN" status
174
my $status_unknown = Koha::IllbatchStatus->new(
174
my $status_unknown = Koha::ILL::Batch::Status->new(
175
    {
175
    {
176
        name      => "Unknown",
176
        name      => "Unknown",
177
        code      => "UNKNOWN",
177
        code      => "UNKNOWN",
Lines 183-189 $status_unknown->create_and_log; Link Here
183
# Create a batch and assign it a status
183
# Create a batch and assign it a status
184
my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
184
my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
185
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
185
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
186
my $status5 = Koha::IllbatchStatus->new(
186
my $status5 = Koha::ILL::Batch::Status->new(
187
    {
187
    {
188
        name      => "Plagueis",
188
        name      => "Plagueis",
189
        code      => "DEAD_SITH",
189
        code      => "DEAD_SITH",
(-)a/t/db_dependent/api/v1/ill_batches.t (-3 / +3 lines)
Lines 28-34 use JSON qw(encode_json); Link Here
28
use Koha::ILL::Batch;
28
use Koha::ILL::Batch;
29
use Koha::ILL::Batches;
29
use Koha::ILL::Batches;
30
use Koha::Illrequests;
30
use Koha::Illrequests;
31
use Koha::IllbatchStatuses;
31
use Koha::ILL::Batch::Statuses;
32
use Koha::Database;
32
use Koha::Database;
33
33
34
my $schema  = Koha::Database->new->schema;
34
my $schema  = Koha::Database->new->schema;
Lines 214-220 subtest 'add() tests' => sub { Link Here
214
214
215
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
215
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
216
216
217
    my $batch_status = $builder->build_object( { class => 'Koha::IllbatchStatuses' } );
217
    my $batch_status = $builder->build_object( { class => 'Koha::ILL::Batch::Statuses' } );
218
218
219
    my $batch_metadata = {
219
    my $batch_metadata = {
220
        name        => "Anakin's requests",
220
        name        => "Anakin's requests",
Lines 294-300 subtest 'update() tests' => sub { Link Here
294
    $t->put_ok( "//$unauth_userid:$password@/api/v1/ill/batches/$batch_id" => json =>
294
    $t->put_ok( "//$unauth_userid:$password@/api/v1/ill/batches/$batch_id" => json =>
295
            { name => 'These are not the droids you are looking for' } )->status_is(403);
295
            { name => 'These are not the droids you are looking for' } )->status_is(403);
296
296
297
    my $batch_status = $builder->build_object( { class => 'Koha::IllbatchStatuses' } );
297
    my $batch_status = $builder->build_object( { class => 'Koha::ILL::Batch::Statuses' } );
298
298
299
    # Attempt partial update on a PUT
299
    # Attempt partial update on a PUT
300
    my $batch_with_missing_field = {
300
    my $batch_with_missing_field = {
(-)a/t/db_dependent/api/v1/ill_batchstatuses.t (-11 / +10 lines)
Lines 23-30 use Test::Mojo; Link Here
23
use t::lib::TestBuilder;
23
use t::lib::TestBuilder;
24
use t::lib::Mocks;
24
use t::lib::Mocks;
25
25
26
use Koha::IllbatchStatus;
26
use Koha::ILL::Batch::Status;
27
use Koha::IllbatchStatuses;
27
use Koha::ILL::Batch::Statuses;
28
use Koha::Database;
28
use Koha::Database;
29
29
30
my $schema  = Koha::Database->new->schema;
30
my $schema  = Koha::Database->new->schema;
Lines 39-45 subtest 'list() tests' => sub { Link Here
39
39
40
    $schema->storage->txn_begin;
40
    $schema->storage->txn_begin;
41
41
42
    Koha::IllbatchStatuses->search->delete;
42
    Koha::ILL::Batch::Statuses->search->delete;
43
43
44
    # Create an admin user
44
    # Create an admin user
45
    my $librarian = $builder->build_object(
45
    my $librarian = $builder->build_object(
Lines 60-66 subtest 'list() tests' => sub { Link Here
60
60
61
    my $status = $builder->build_object(
61
    my $status = $builder->build_object(
62
        {
62
        {
63
            class => 'Koha::IllbatchStatuses',
63
            class => 'Koha::ILL::Batch::Statuses',
64
            value => {
64
            value => {
65
                name      => "Han Solo",
65
                name      => "Han Solo",
66
                code      => "SOLO",
66
                code      => "SOLO",
Lines 94-100 subtest 'get() tests' => sub { Link Here
94
94
95
    my $status = $builder->build_object(
95
    my $status = $builder->build_object(
96
        {
96
        {
97
            class => 'Koha::IllbatchStatuses',
97
            class => 'Koha::ILL::Batch::Statuses',
98
            value => {
98
            value => {
99
                name      => "Han Solo",
99
                name      => "Han Solo",
100
                code      => "SOLO",
100
                code      => "SOLO",
Lines 119-125 subtest 'get() tests' => sub { Link Here
119
119
120
    $t->get_ok( "//$unauth_userid:$password@/api/v1/ill/batchstatuses/" . $status->id )->status_is(403);
120
    $t->get_ok( "//$unauth_userid:$password@/api/v1/ill/batchstatuses/" . $status->id )->status_is(403);
121
121
122
    my $status_to_delete  = $builder->build_object( { class => 'Koha::IllbatchStatuses' } );
122
    my $status_to_delete  = $builder->build_object( { class => 'Koha::ILL::Batch::Statuses' } );
123
    my $non_existent_code = $status_to_delete->code;
123
    my $non_existent_code = $status_to_delete->code;
124
    $status_to_delete->delete;
124
    $status_to_delete->delete;
125
125
Lines 218-224 subtest 'update() tests' => sub { Link Here
218
    $patron->set_password( { password => $password, skip_validation => 1 } );
218
    $patron->set_password( { password => $password, skip_validation => 1 } );
219
    my $unauth_userid = $patron->userid;
219
    my $unauth_userid = $patron->userid;
220
220
221
    my $status_code = $builder->build_object( { class => 'Koha::IllbatchStatuses' } )->code;
221
    my $status_code = $builder->build_object( { class => 'Koha::ILL::Batch::Statuses' } )->code;
222
222
223
    # Unauthorized attempt to update
223
    # Unauthorized attempt to update
224
    $t->put_ok( "//$unauth_userid:$password@/api/v1/ill/batchstatuses/$status_code" => json =>
224
    $t->put_ok( "//$unauth_userid:$password@/api/v1/ill/batchstatuses/$status_code" => json =>
Lines 260-266 subtest 'update() tests' => sub { Link Here
260
        ]
260
        ]
261
        );
261
        );
262
262
263
    my $status_to_delete  = $builder->build_object( { class => 'Koha::IllbatchStatuses' } );
263
    my $status_to_delete  = $builder->build_object( { class => 'Koha::ILL::Batch::Statuses' } );
264
    my $non_existent_code = $status_to_delete->code;
264
    my $non_existent_code = $status_to_delete->code;
265
    $status_to_delete->delete;
265
    $status_to_delete->delete;
266
266
Lines 299-312 subtest 'delete() tests' => sub { Link Here
299
299
300
    my $non_system_status = $builder->build_object(
300
    my $non_system_status = $builder->build_object(
301
        {
301
        {
302
            class => 'Koha::IllbatchStatuses',
302
            class => 'Koha::ILL::Batch::Statuses',
303
            value => { is_system => 0 }
303
            value => { is_system => 0 }
304
        }
304
        }
305
    );
305
    );
306
306
307
    my $system_status = $builder->build_object(
307
    my $system_status = $builder->build_object(
308
        {
308
        {
309
            class => 'Koha::IllbatchStatuses',
309
            class => 'Koha::ILL::Batch::Statuses',
310
            value => { is_system => 1 }
310
            value => { is_system => 1 }
311
        }
311
        }
312
    );
312
    );
313
- 

Return to bug 35581