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