55331fe32a9a64c8dccd8ca527db1c7dab44d24a
[koha-equinox.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_hourly
51
52   data_type: 'decimal'
53   is_nullable: 1
54   size: [28,6]
55
56 =head2 defaultreplacecost
57
58   data_type: 'decimal'
59   is_nullable: 1
60   size: [28,6]
61
62 =head2 processfee
63
64   data_type: 'decimal'
65   is_nullable: 1
66   size: [28,6]
67
68 =head2 notforloan
69
70   data_type: 'smallint'
71   is_nullable: 1
72
73 =head2 imageurl
74
75   data_type: 'varchar'
76   is_nullable: 1
77   size: 200
78
79 =head2 summary
80
81   data_type: 'mediumtext'
82   is_nullable: 1
83
84 =head2 checkinmsg
85
86   data_type: 'varchar'
87   is_nullable: 1
88   size: 255
89
90 =head2 checkinmsgtype
91
92   data_type: 'char'
93   default_value: 'message'
94   is_nullable: 0
95   size: 16
96
97 =head2 sip_media_type
98
99   data_type: 'varchar'
100   is_nullable: 1
101   size: 3
102
103 =head2 hideinopac
104
105   data_type: 'tinyint'
106   default_value: 0
107   is_nullable: 0
108
109 =head2 searchcategory
110
111   data_type: 'varchar'
112   is_nullable: 1
113   size: 80
114
115 =cut
116
117 __PACKAGE__->add_columns(
118   "itemtype",
119   { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
120   "description",
121   { data_type => "longtext", is_nullable => 1 },
122   "rentalcharge",
123   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
124   "rentalcharge_daily",
125   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
126   "rentalcharge_hourly",
127   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
128   "defaultreplacecost",
129   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
130   "processfee",
131   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
132   "notforloan",
133   { data_type => "smallint", is_nullable => 1 },
134   "imageurl",
135   { data_type => "varchar", is_nullable => 1, size => 200 },
136   "summary",
137   { data_type => "mediumtext", is_nullable => 1 },
138   "checkinmsg",
139   { data_type => "varchar", is_nullable => 1, size => 255 },
140   "checkinmsgtype",
141   {
142     data_type => "char",
143     default_value => "message",
144     is_nullable => 0,
145     size => 16,
146   },
147   "sip_media_type",
148   { data_type => "varchar", is_nullable => 1, size => 3 },
149   "hideinopac",
150   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
151   "searchcategory",
152   { data_type => "varchar", is_nullable => 1, size => 80 },
153 );
154
155 =head1 PRIMARY KEY
156
157 =over 4
158
159 =item * L</itemtype>
160
161 =back
162
163 =cut
164
165 __PACKAGE__->set_primary_key("itemtype");
166
167 =head1 RELATIONS
168
169 =head2 branch_item_rules
170
171 Type: has_many
172
173 Related object: L<Koha::Schema::Result::BranchItemRule>
174
175 =cut
176
177 __PACKAGE__->has_many(
178   "branch_item_rules",
179   "Koha::Schema::Result::BranchItemRule",
180   { "foreign.itemtype" => "self.itemtype" },
181   { cascade_copy => 0, cascade_delete => 0 },
182 );
183
184 =head2 circulation_rules
185
186 Type: has_many
187
188 Related object: L<Koha::Schema::Result::CirculationRule>
189
190 =cut
191
192 __PACKAGE__->has_many(
193   "circulation_rules",
194   "Koha::Schema::Result::CirculationRule",
195   { "foreign.itemtype" => "self.itemtype" },
196   { cascade_copy => 0, cascade_delete => 0 },
197 );
198
199 =head2 default_branch_item_rule
200
201 Type: might_have
202
203 Related object: L<Koha::Schema::Result::DefaultBranchItemRule>
204
205 =cut
206
207 __PACKAGE__->might_have(
208   "default_branch_item_rule",
209   "Koha::Schema::Result::DefaultBranchItemRule",
210   { "foreign.itemtype" => "self.itemtype" },
211   { cascade_copy => 0, cascade_delete => 0 },
212 );
213
214 =head2 old_reserves
215
216 Type: has_many
217
218 Related object: L<Koha::Schema::Result::OldReserve>
219
220 =cut
221
222 __PACKAGE__->has_many(
223   "old_reserves",
224   "Koha::Schema::Result::OldReserve",
225   { "foreign.itemtype" => "self.itemtype" },
226   { cascade_copy => 0, cascade_delete => 0 },
227 );
228
229 =head2 reserves
230
231 Type: has_many
232
233 Related object: L<Koha::Schema::Result::Reserve>
234
235 =cut
236
237 __PACKAGE__->has_many(
238   "reserves",
239   "Koha::Schema::Result::Reserve",
240   { "foreign.itemtype" => "self.itemtype" },
241   { cascade_copy => 0, cascade_delete => 0 },
242 );
243
244
245 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-07 17:30:46
246 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CDIOU6LmF7suaujk1NQOeg
247
248 # Use the ItemtypeLocalization view to create the join on localization
249 our $LANGUAGE;
250 __PACKAGE__->has_many(
251   "localization" => "Koha::Schema::Result::ItemtypeLocalization",
252     sub {
253         my $args = shift;
254
255         die "no lang specified!" unless $LANGUAGE;
256
257         return ({
258             "$args->{self_alias}.itemtype" => { -ident => "$args->{foreign_alias}.code" },
259             "$args->{foreign_alias}.lang" => $LANGUAGE,
260         });
261
262     }
263 );
264
265 1;