Line 0
Link Here
|
|
|
1 |
use utf8; |
2 |
package Koha::Schema::Result::HoldCancellationRequest; |
3 |
|
4 |
# Created by DBIx::Class::Schema::Loader |
5 |
# DO NOT MODIFY THE FIRST PART OF THIS FILE |
6 |
|
7 |
=head1 NAME |
8 |
|
9 |
Koha::Schema::Result::HoldCancellationRequest |
10 |
|
11 |
=cut |
12 |
|
13 |
use strict; |
14 |
use warnings; |
15 |
|
16 |
use base 'DBIx::Class::Core'; |
17 |
|
18 |
=head1 TABLE: C<hold_cancellation_requests> |
19 |
|
20 |
=cut |
21 |
|
22 |
__PACKAGE__->table("hold_cancellation_requests"); |
23 |
|
24 |
=head1 ACCESSORS |
25 |
|
26 |
=head2 hold_cancellation_request_id |
27 |
|
28 |
data_type: 'integer' |
29 |
is_auto_increment: 1 |
30 |
is_nullable: 0 |
31 |
|
32 |
Unique ID of the cancellation request |
33 |
|
34 |
=head2 hold_id |
35 |
|
36 |
data_type: 'integer' |
37 |
is_nullable: 0 |
38 |
|
39 |
ID of the hold |
40 |
|
41 |
=head2 requester_id |
42 |
|
43 |
data_type: 'integer' |
44 |
is_foreign_key: 1 |
45 |
is_nullable: 1 |
46 |
|
47 |
ID of the user that made the cancellation request |
48 |
|
49 |
=head2 creation_date |
50 |
|
51 |
data_type: 'timestamp' |
52 |
datetime_undef_if_invalid: 1 |
53 |
is_nullable: 1 |
54 |
|
55 |
Time and date the cancellation request was created |
56 |
|
57 |
=head2 source |
58 |
|
59 |
data_type: 'enum' |
60 |
default_value: 'owner' |
61 |
extra: {list => ["owner"]} |
62 |
is_nullable: 0 |
63 |
|
64 |
The source for the cancellation request |
65 |
|
66 |
=head2 status |
67 |
|
68 |
data_type: 'enum' |
69 |
default_value: 'requested' |
70 |
extra: {list => ["requested","accepted","rejected"]} |
71 |
is_nullable: 1 |
72 |
|
73 |
request status |
74 |
|
75 |
=head2 resolution_date |
76 |
|
77 |
data_type: 'timestamp' |
78 |
datetime_undef_if_invalid: 1 |
79 |
is_nullable: 1 |
80 |
|
81 |
Time and date cancellation request was resolved |
82 |
|
83 |
=head2 resolver_id |
84 |
|
85 |
data_type: 'integer' |
86 |
is_foreign_key: 1 |
87 |
is_nullable: 1 |
88 |
|
89 |
ID of the staff member that resolved the request |
90 |
|
91 |
=cut |
92 |
|
93 |
__PACKAGE__->add_columns( |
94 |
"hold_cancellation_request_id", |
95 |
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, |
96 |
"hold_id", |
97 |
{ data_type => "integer", is_nullable => 0 }, |
98 |
"requester_id", |
99 |
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, |
100 |
"creation_date", |
101 |
{ |
102 |
data_type => "timestamp", |
103 |
datetime_undef_if_invalid => 1, |
104 |
is_nullable => 1, |
105 |
}, |
106 |
"source", |
107 |
{ |
108 |
data_type => "enum", |
109 |
default_value => "owner", |
110 |
extra => { list => ["owner"] }, |
111 |
is_nullable => 0, |
112 |
}, |
113 |
"status", |
114 |
{ |
115 |
data_type => "enum", |
116 |
default_value => "requested", |
117 |
extra => { list => ["requested", "accepted", "rejected"] }, |
118 |
is_nullable => 1, |
119 |
}, |
120 |
"resolution_date", |
121 |
{ |
122 |
data_type => "timestamp", |
123 |
datetime_undef_if_invalid => 1, |
124 |
is_nullable => 1, |
125 |
}, |
126 |
"resolver_id", |
127 |
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, |
128 |
); |
129 |
|
130 |
=head1 PRIMARY KEY |
131 |
|
132 |
=over 4 |
133 |
|
134 |
=item * L</hold_cancellation_request_id> |
135 |
|
136 |
=back |
137 |
|
138 |
=cut |
139 |
|
140 |
__PACKAGE__->set_primary_key("hold_cancellation_request_id"); |
141 |
|
142 |
=head1 UNIQUE CONSTRAINTS |
143 |
|
144 |
=head2 C<hold_requester_uniq> |
145 |
|
146 |
=over 4 |
147 |
|
148 |
=item * L</hold_id> |
149 |
|
150 |
=item * L</requester_id> |
151 |
|
152 |
=back |
153 |
|
154 |
=cut |
155 |
|
156 |
__PACKAGE__->add_unique_constraint("hold_requester_uniq", ["hold_id", "requester_id"]); |
157 |
|
158 |
=head1 RELATIONS |
159 |
|
160 |
=head2 requester |
161 |
|
162 |
Type: belongs_to |
163 |
|
164 |
Related object: L<Koha::Schema::Result::Borrower> |
165 |
|
166 |
=cut |
167 |
|
168 |
__PACKAGE__->belongs_to( |
169 |
"requester", |
170 |
"Koha::Schema::Result::Borrower", |
171 |
{ borrowernumber => "requester_id" }, |
172 |
{ |
173 |
is_deferrable => 1, |
174 |
join_type => "LEFT", |
175 |
on_delete => "CASCADE", |
176 |
on_update => "CASCADE", |
177 |
}, |
178 |
); |
179 |
|
180 |
=head2 resolver |
181 |
|
182 |
Type: belongs_to |
183 |
|
184 |
Related object: L<Koha::Schema::Result::Borrower> |
185 |
|
186 |
=cut |
187 |
|
188 |
__PACKAGE__->belongs_to( |
189 |
"resolver", |
190 |
"Koha::Schema::Result::Borrower", |
191 |
{ borrowernumber => "resolver_id" }, |
192 |
{ |
193 |
is_deferrable => 1, |
194 |
join_type => "LEFT", |
195 |
on_delete => "SET NULL", |
196 |
on_update => "CASCADE", |
197 |
}, |
198 |
); |
199 |
|
200 |
|
201 |
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-05-18 17:36:48 |
202 |
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LQw6vNCU3DspZ7UOdgHvjg |
203 |
|
204 |
# FIXME: Revisit after bug 25260 |
205 |
__PACKAGE__->might_have( |
206 |
"hold", |
207 |
"Koha::Schema::Result::Reserve", |
208 |
{ "foreign.reserve_id" => "self.hold_id" }, |
209 |
{ cascade_copy => 0, cascade_delete => 0 }, |
210 |
); |
211 |
|
212 |
sub koha_object_class { |
213 |
'Koha::Hold::CancellationRequest'; |
214 |
} |
215 |
sub koha_objects_class { |
216 |
'Koha::Hold::CancellationRequests'; |
217 |
} |
218 |
|
219 |
1; |