Bug 32257: Label for patron attributes misaligned
[koha-ffzg.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 unique key, a code associated with the item type
34
35 =head2 parent_type
36
37   data_type: 'varchar'
38   is_foreign_key: 1
39   is_nullable: 1
40   size: 10
41
42 unique key, a code associated with the item type
43
44 =head2 description
45
46   data_type: 'longtext'
47   is_nullable: 1
48
49 a plain text explanation of the item type
50
51 =head2 rentalcharge
52
53   data_type: 'decimal'
54   is_nullable: 1
55   size: [28,6]
56
57 the amount charged when this item is checked out/issued
58
59 =head2 rentalcharge_daily
60
61   data_type: 'decimal'
62   is_nullable: 1
63   size: [28,6]
64
65 the amount charged for each day between checkout date and due date
66
67 =head2 rentalcharge_daily_calendar
68
69   data_type: 'tinyint'
70   default_value: 1
71   is_nullable: 0
72
73 controls if the daily rental fee is calculated directly or using finesCalendar
74
75 =head2 rentalcharge_hourly
76
77   data_type: 'decimal'
78   is_nullable: 1
79   size: [28,6]
80
81 the amount charged for each hour between checkout date and due date
82
83 =head2 rentalcharge_hourly_calendar
84
85   data_type: 'tinyint'
86   default_value: 1
87   is_nullable: 0
88
89 controls if the hourly rental fee is calculated directly or using finesCalendar
90
91 =head2 defaultreplacecost
92
93   data_type: 'decimal'
94   is_nullable: 1
95   size: [28,6]
96
97 default replacement cost
98
99 =head2 processfee
100
101   data_type: 'decimal'
102   is_nullable: 1
103   size: [28,6]
104
105 default text be recorded in the column note when the processing fee is applied
106
107 =head2 notforloan
108
109   data_type: 'smallint'
110   is_nullable: 1
111
112 1 if the item is not for loan, 0 if the item is available for loan
113
114 =head2 imageurl
115
116   data_type: 'varchar'
117   is_nullable: 1
118   size: 200
119
120 URL for the item type icon
121
122 =head2 summary
123
124   data_type: 'mediumtext'
125   is_nullable: 1
126
127 information from the summary field, may include HTML
128
129 =head2 checkinmsg
130
131   data_type: 'varchar'
132   is_nullable: 1
133   size: 255
134
135 message that is displayed when an item with the given item type is checked in
136
137 =head2 checkinmsgtype
138
139   data_type: 'char'
140   default_value: 'message'
141   is_nullable: 0
142   size: 16
143
144 type (CSS class) for the checkinmsg, can be 'alert' or 'message'
145
146 =head2 sip_media_type
147
148   data_type: 'varchar'
149   is_nullable: 1
150   size: 3
151
152 SIP2 protocol media type for this itemtype
153
154 =head2 hideinopac
155
156   data_type: 'tinyint'
157   default_value: 0
158   is_nullable: 0
159
160 Hide the item type from the search options in OPAC
161
162 =head2 searchcategory
163
164   data_type: 'varchar'
165   is_nullable: 1
166   size: 80
167
168 Group this item type with others with the same value on OPAC search options
169
170 =head2 automatic_checkin
171
172   data_type: 'tinyint'
173   default_value: 0
174   is_nullable: 0
175
176 If automatic checkin is enabled for items of this type
177
178 =cut
179
180 __PACKAGE__->add_columns(
181   "itemtype",
182   { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
183   "parent_type",
184   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
185   "description",
186   { data_type => "longtext", is_nullable => 1 },
187   "rentalcharge",
188   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
189   "rentalcharge_daily",
190   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
191   "rentalcharge_daily_calendar",
192   { data_type => "tinyint", default_value => 1, is_nullable => 0 },
193   "rentalcharge_hourly",
194   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
195   "rentalcharge_hourly_calendar",
196   { data_type => "tinyint", default_value => 1, is_nullable => 0 },
197   "defaultreplacecost",
198   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
199   "processfee",
200   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
201   "notforloan",
202   { data_type => "smallint", is_nullable => 1 },
203   "imageurl",
204   { data_type => "varchar", is_nullable => 1, size => 200 },
205   "summary",
206   { data_type => "mediumtext", is_nullable => 1 },
207   "checkinmsg",
208   { data_type => "varchar", is_nullable => 1, size => 255 },
209   "checkinmsgtype",
210   {
211     data_type => "char",
212     default_value => "message",
213     is_nullable => 0,
214     size => 16,
215   },
216   "sip_media_type",
217   { data_type => "varchar", is_nullable => 1, size => 3 },
218   "hideinopac",
219   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
220   "searchcategory",
221   { data_type => "varchar", is_nullable => 1, size => 80 },
222   "automatic_checkin",
223   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
224 );
225
226 =head1 PRIMARY KEY
227
228 =over 4
229
230 =item * L</itemtype>
231
232 =back
233
234 =cut
235
236 __PACKAGE__->set_primary_key("itemtype");
237
238 =head1 RELATIONS
239
240 =head2 circulation_rules
241
242 Type: has_many
243
244 Related object: L<Koha::Schema::Result::CirculationRule>
245
246 =cut
247
248 __PACKAGE__->has_many(
249   "circulation_rules",
250   "Koha::Schema::Result::CirculationRule",
251   { "foreign.itemtype" => "self.itemtype" },
252   { cascade_copy => 0, cascade_delete => 0 },
253 );
254
255 =head2 itemtypes
256
257 Type: has_many
258
259 Related object: L<Koha::Schema::Result::Itemtype>
260
261 =cut
262
263 __PACKAGE__->has_many(
264   "itemtypes",
265   "Koha::Schema::Result::Itemtype",
266   { "foreign.parent_type" => "self.itemtype" },
267   { cascade_copy => 0, cascade_delete => 0 },
268 );
269
270 =head2 itemtypes_branches
271
272 Type: has_many
273
274 Related object: L<Koha::Schema::Result::ItemtypesBranch>
275
276 =cut
277
278 __PACKAGE__->has_many(
279   "itemtypes_branches",
280   "Koha::Schema::Result::ItemtypesBranch",
281   { "foreign.itemtype" => "self.itemtype" },
282   { cascade_copy => 0, cascade_delete => 0 },
283 );
284
285 =head2 old_reserves
286
287 Type: has_many
288
289 Related object: L<Koha::Schema::Result::OldReserve>
290
291 =cut
292
293 __PACKAGE__->has_many(
294   "old_reserves",
295   "Koha::Schema::Result::OldReserve",
296   { "foreign.itemtype" => "self.itemtype" },
297   { cascade_copy => 0, cascade_delete => 0 },
298 );
299
300 =head2 parent_type
301
302 Type: belongs_to
303
304 Related object: L<Koha::Schema::Result::Itemtype>
305
306 =cut
307
308 __PACKAGE__->belongs_to(
309   "parent_type",
310   "Koha::Schema::Result::Itemtype",
311   { itemtype => "parent_type" },
312   {
313     is_deferrable => 1,
314     join_type     => "LEFT",
315     on_delete     => "RESTRICT",
316     on_update     => "RESTRICT",
317   },
318 );
319
320 =head2 reserves
321
322 Type: has_many
323
324 Related object: L<Koha::Schema::Result::Reserve>
325
326 =cut
327
328 __PACKAGE__->has_many(
329   "reserves",
330   "Koha::Schema::Result::Reserve",
331   { "foreign.itemtype" => "self.itemtype" },
332   { cascade_copy => 0, cascade_delete => 0 },
333 );
334
335
336 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-22 11:31:25
337 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SoRKIMEqXE2+RkGq6zBejA
338
339 __PACKAGE__->add_columns(
340     '+rentalcharge_hourly_calendar' => { is_boolean => 1 },
341     '+rentalcharge_daily_calendar'  => { is_boolean => 1 },
342     '+automatic_checkin'            => { is_boolean => 1 },
343 );
344
345 # Use the ItemtypeLocalization view to create the join on localization
346 our $LANGUAGE;
347 __PACKAGE__->has_many(
348   "localization" => "Koha::Schema::Result::ItemtypeLocalization",
349     sub {
350         my $args = shift;
351
352         die "no lang specified!" unless $LANGUAGE;
353
354         return ({
355             "$args->{self_alias}.itemtype" => { -ident => "$args->{foreign_alias}.code" },
356             "$args->{foreign_alias}.lang" => $LANGUAGE,
357         });
358
359     }
360 );
361
362 sub koha_object_class {
363     'Koha::ItemType';
364 }
365 sub koha_objects_class {
366     'Koha::ItemTypes';
367 }
368
369 1;