Bug 26922: Regression tests
[koha.git] / Koha / Schema / Result / Itemtype.pm
blob3a4c46ae1d971625ed3c2a2604d733117de34713
1 use utf8;
2 package Koha::Schema::Result::Itemtype;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
7 =head1 NAME
9 Koha::Schema::Result::Itemtype
11 =cut
13 use strict;
14 use warnings;
16 use base 'DBIx::Class::Core';
18 =head1 TABLE: C<itemtypes>
20 =cut
22 __PACKAGE__->table("itemtypes");
24 =head1 ACCESSORS
26 =head2 itemtype
28 data_type: 'varchar'
29 default_value: (empty string)
30 is_nullable: 0
31 size: 10
33 =head2 parent_type
35 data_type: 'varchar'
36 is_foreign_key: 1
37 is_nullable: 1
38 size: 10
40 =head2 description
42 data_type: 'longtext'
43 is_nullable: 1
45 =head2 rentalcharge
47 data_type: 'decimal'
48 is_nullable: 1
49 size: [28,6]
51 =head2 rentalcharge_daily
53 data_type: 'decimal'
54 is_nullable: 1
55 size: [28,6]
57 =head2 rentalcharge_daily_calendar
59 data_type: 'tinyint'
60 default_value: 1
61 is_nullable: 0
63 =head2 rentalcharge_hourly
65 data_type: 'decimal'
66 is_nullable: 1
67 size: [28,6]
69 =head2 rentalcharge_hourly_calendar
71 data_type: 'tinyint'
72 default_value: 1
73 is_nullable: 0
75 =head2 defaultreplacecost
77 data_type: 'decimal'
78 is_nullable: 1
79 size: [28,6]
81 =head2 processfee
83 data_type: 'decimal'
84 is_nullable: 1
85 size: [28,6]
87 =head2 notforloan
89 data_type: 'smallint'
90 is_nullable: 1
92 =head2 imageurl
94 data_type: 'varchar'
95 is_nullable: 1
96 size: 200
98 =head2 summary
100 data_type: 'mediumtext'
101 is_nullable: 1
103 =head2 checkinmsg
105 data_type: 'varchar'
106 is_nullable: 1
107 size: 255
109 =head2 checkinmsgtype
111 data_type: 'char'
112 default_value: 'message'
113 is_nullable: 0
114 size: 16
116 =head2 sip_media_type
118 data_type: 'varchar'
119 is_nullable: 1
120 size: 3
122 =head2 hideinopac
124 data_type: 'tinyint'
125 default_value: 0
126 is_nullable: 0
128 =head2 searchcategory
130 data_type: 'varchar'
131 is_nullable: 1
132 size: 80
134 =cut
136 __PACKAGE__->add_columns(
137 "itemtype",
138 { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
139 "parent_type",
140 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
141 "description",
142 { data_type => "longtext", is_nullable => 1 },
143 "rentalcharge",
144 { data_type => "decimal", is_nullable => 1, size => [28, 6] },
145 "rentalcharge_daily",
146 { data_type => "decimal", is_nullable => 1, size => [28, 6] },
147 "rentalcharge_daily_calendar",
148 { data_type => "tinyint", default_value => 1, is_nullable => 0 },
149 "rentalcharge_hourly",
150 { data_type => "decimal", is_nullable => 1, size => [28, 6] },
151 "rentalcharge_hourly_calendar",
152 { data_type => "tinyint", default_value => 1, is_nullable => 0 },
153 "defaultreplacecost",
154 { data_type => "decimal", is_nullable => 1, size => [28, 6] },
155 "processfee",
156 { data_type => "decimal", is_nullable => 1, size => [28, 6] },
157 "notforloan",
158 { data_type => "smallint", is_nullable => 1 },
159 "imageurl",
160 { data_type => "varchar", is_nullable => 1, size => 200 },
161 "summary",
162 { data_type => "mediumtext", is_nullable => 1 },
163 "checkinmsg",
164 { data_type => "varchar", is_nullable => 1, size => 255 },
165 "checkinmsgtype",
167 data_type => "char",
168 default_value => "message",
169 is_nullable => 0,
170 size => 16,
172 "sip_media_type",
173 { data_type => "varchar", is_nullable => 1, size => 3 },
174 "hideinopac",
175 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
176 "searchcategory",
177 { data_type => "varchar", is_nullable => 1, size => 80 },
180 =head1 PRIMARY KEY
182 =over 4
184 =item * L</itemtype>
186 =back
188 =cut
190 __PACKAGE__->set_primary_key("itemtype");
192 =head1 RELATIONS
194 =head2 circulation_rules
196 Type: has_many
198 Related object: L<Koha::Schema::Result::CirculationRule>
200 =cut
202 __PACKAGE__->has_many(
203 "circulation_rules",
204 "Koha::Schema::Result::CirculationRule",
205 { "foreign.itemtype" => "self.itemtype" },
206 { cascade_copy => 0, cascade_delete => 0 },
209 =head2 itemtypes
211 Type: has_many
213 Related object: L<Koha::Schema::Result::Itemtype>
215 =cut
217 __PACKAGE__->has_many(
218 "itemtypes",
219 "Koha::Schema::Result::Itemtype",
220 { "foreign.parent_type" => "self.itemtype" },
221 { cascade_copy => 0, cascade_delete => 0 },
224 =head2 itemtypes_branches
226 Type: has_many
228 Related object: L<Koha::Schema::Result::ItemtypesBranch>
230 =cut
232 __PACKAGE__->has_many(
233 "itemtypes_branches",
234 "Koha::Schema::Result::ItemtypesBranch",
235 { "foreign.itemtype" => "self.itemtype" },
236 { cascade_copy => 0, cascade_delete => 0 },
239 =head2 old_reserves
241 Type: has_many
243 Related object: L<Koha::Schema::Result::OldReserve>
245 =cut
247 __PACKAGE__->has_many(
248 "old_reserves",
249 "Koha::Schema::Result::OldReserve",
250 { "foreign.itemtype" => "self.itemtype" },
251 { cascade_copy => 0, cascade_delete => 0 },
254 =head2 parent_type
256 Type: belongs_to
258 Related object: L<Koha::Schema::Result::Itemtype>
260 =cut
262 __PACKAGE__->belongs_to(
263 "parent_type",
264 "Koha::Schema::Result::Itemtype",
265 { itemtype => "parent_type" },
267 is_deferrable => 1,
268 join_type => "LEFT",
269 on_delete => "CASCADE",
270 on_update => "CASCADE",
274 =head2 reserves
276 Type: has_many
278 Related object: L<Koha::Schema::Result::Reserve>
280 =cut
282 __PACKAGE__->has_many(
283 "reserves",
284 "Koha::Schema::Result::Reserve",
285 { "foreign.itemtype" => "self.itemtype" },
286 { cascade_copy => 0, cascade_delete => 0 },
290 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-08-13 08:14:04
291 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5RxmTmtrwJJhTZMur1N05A
293 __PACKAGE__->add_columns(
294 '+rentalcharge_hourly_calendar' => { is_boolean => 1 },
295 '+rentalcharge_daily_calendar' => { is_boolean => 1 },
298 # Use the ItemtypeLocalization view to create the join on localization
299 our $LANGUAGE;
300 __PACKAGE__->has_many(
301 "localization" => "Koha::Schema::Result::ItemtypeLocalization",
302 sub {
303 my $args = shift;
305 die "no lang specified!" unless $LANGUAGE;
307 return ({
308 "$args->{self_alias}.itemtype" => { -ident => "$args->{foreign_alias}.code" },
309 "$args->{foreign_alias}.lang" => $LANGUAGE,
315 sub koha_object_class {
316 'Koha::ItemType';
318 sub koha_objects_class {
319 'Koha::ItemTypes';