Bug 24151: DBIC changes
[koha.git] / Koha / Schema / Result / Itemtype.pm
1 use utf8;
2 package Koha::Schema::Result::Itemtype;
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::Itemtype
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<itemtypes>
19
20 =cut
21
22 __PACKAGE__->table("itemtypes");
23
24 =head1 ACCESSORS
25
26 =head2 itemtype
27
28   data_type: 'varchar'
29   default_value: (empty string)
30   is_nullable: 0
31   size: 10
32
33 =head2 description
34
35   data_type: 'longtext'
36   is_nullable: 1
37
38 =head2 rentalcharge
39
40   data_type: 'decimal'
41   is_nullable: 1
42   size: [28,6]
43
44 =head2 rentalcharge_daily
45
46   data_type: 'decimal'
47   is_nullable: 1
48   size: [28,6]
49
50 =head2 rentalcharge_daily_calendar
51
52   data_type: 'tinyint'
53   default_value: 1
54   is_nullable: 0
55
56 =head2 rentalcharge_hourly
57
58   data_type: 'decimal'
59   is_nullable: 1
60   size: [28,6]
61
62 =head2 rentalcharge_hourly_calendar
63
64   data_type: 'tinyint'
65   default_value: 1
66   is_nullable: 0
67
68 =head2 defaultreplacecost
69
70   data_type: 'decimal'
71   is_nullable: 1
72   size: [28,6]
73
74 =head2 processfee
75
76   data_type: 'decimal'
77   is_nullable: 1
78   size: [28,6]
79
80 =head2 notforloan
81
82   data_type: 'smallint'
83   is_nullable: 1
84
85 =head2 imageurl
86
87   data_type: 'varchar'
88   is_nullable: 1
89   size: 200
90
91 =head2 summary
92
93   data_type: 'mediumtext'
94   is_nullable: 1
95
96 =head2 checkinmsg
97
98   data_type: 'varchar'
99   is_nullable: 1
100   size: 255
101
102 =head2 checkinmsgtype
103
104   data_type: 'char'
105   default_value: 'message'
106   is_nullable: 0
107   size: 16
108
109 =head2 sip_media_type
110
111   data_type: 'varchar'
112   is_nullable: 1
113   size: 3
114
115 =head2 hideinopac
116
117   data_type: 'tinyint'
118   default_value: 0
119   is_nullable: 0
120
121 =head2 searchcategory
122
123   data_type: 'varchar'
124   is_nullable: 1
125   size: 80
126
127 =cut
128
129 __PACKAGE__->add_columns(
130   "itemtype",
131   { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
132   "description",
133   { data_type => "longtext", is_nullable => 1 },
134   "rentalcharge",
135   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
136   "rentalcharge_daily",
137   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
138   "rentalcharge_daily_calendar",
139   { data_type => "tinyint", default_value => 1, is_nullable => 0 },
140   "rentalcharge_hourly",
141   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
142   "rentalcharge_hourly_calendar",
143   { data_type => "tinyint", default_value => 1, is_nullable => 0 },
144   "defaultreplacecost",
145   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
146   "processfee",
147   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
148   "notforloan",
149   { data_type => "smallint", is_nullable => 1 },
150   "imageurl",
151   { data_type => "varchar", is_nullable => 1, size => 200 },
152   "summary",
153   { data_type => "mediumtext", is_nullable => 1 },
154   "checkinmsg",
155   { data_type => "varchar", is_nullable => 1, size => 255 },
156   "checkinmsgtype",
157   {
158     data_type => "char",
159     default_value => "message",
160     is_nullable => 0,
161     size => 16,
162   },
163   "sip_media_type",
164   { data_type => "varchar", is_nullable => 1, size => 3 },
165   "hideinopac",
166   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
167   "searchcategory",
168   { data_type => "varchar", is_nullable => 1, size => 80 },
169 );
170
171 =head1 PRIMARY KEY
172
173 =over 4
174
175 =item * L</itemtype>
176
177 =back
178
179 =cut
180
181 __PACKAGE__->set_primary_key("itemtype");
182
183 =head1 RELATIONS
184
185 =head2 circulation_rules
186
187 Type: has_many
188
189 Related object: L<Koha::Schema::Result::CirculationRule>
190
191 =cut
192
193 __PACKAGE__->has_many(
194   "circulation_rules",
195   "Koha::Schema::Result::CirculationRule",
196   { "foreign.itemtype" => "self.itemtype" },
197   { cascade_copy => 0, cascade_delete => 0 },
198 );
199
200 =head2 itemtypes_branches
201
202 Type: has_many
203
204 Related object: L<Koha::Schema::Result::ItemtypesBranch>
205
206 =cut
207
208 __PACKAGE__->has_many(
209   "itemtypes_branches",
210   "Koha::Schema::Result::ItemtypesBranch",
211   { "foreign.itemtype" => "self.itemtype" },
212   { cascade_copy => 0, cascade_delete => 0 },
213 );
214
215 =head2 old_reserves
216
217 Type: has_many
218
219 Related object: L<Koha::Schema::Result::OldReserve>
220
221 =cut
222
223 __PACKAGE__->has_many(
224   "old_reserves",
225   "Koha::Schema::Result::OldReserve",
226   { "foreign.itemtype" => "self.itemtype" },
227   { cascade_copy => 0, cascade_delete => 0 },
228 );
229
230 =head2 reserves
231
232 Type: has_many
233
234 Related object: L<Koha::Schema::Result::Reserve>
235
236 =cut
237
238 __PACKAGE__->has_many(
239   "reserves",
240   "Koha::Schema::Result::Reserve",
241   { "foreign.itemtype" => "self.itemtype" },
242   { cascade_copy => 0, cascade_delete => 0 },
243 );
244
245
246 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-09 17:13:18
247 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7ojvTzsDvdHPAJMwJrAZ7A
248
249 __PACKAGE__->add_columns(
250     '+rentalcharge_hourly_calendar' => { is_boolean => 1 },
251     '+rentalcharge_daily_calendar'  => { is_boolean => 1 },
252 );
253
254 # Use the ItemtypeLocalization view to create the join on localization
255 our $LANGUAGE;
256 __PACKAGE__->has_many(
257   "localization" => "Koha::Schema::Result::ItemtypeLocalization",
258     sub {
259         my $args = shift;
260
261         die "no lang specified!" unless $LANGUAGE;
262
263         return ({
264             "$args->{self_alias}.itemtype" => { -ident => "$args->{foreign_alias}.code" },
265             "$args->{foreign_alias}.lang" => $LANGUAGE,
266         });
267
268     }
269 );
270
271 sub koha_object_class {
272     'Koha::ItemType';
273 }
274 sub koha_objects_class {
275     'Koha::ItemTypes';
276 }
277
278 1;