Bug 12768: DBIC Schema 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: 'mediumtext'
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: 'text'
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 => "mediumtext", 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 => "text", 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 default_branch_item_rule
169
170 Type: might_have
171
172 Related object: L<Koha::Schema::Result::DefaultBranchItemRule>
173
174 =cut
175
176 __PACKAGE__->might_have(
177   "default_branch_item_rule",
178   "Koha::Schema::Result::DefaultBranchItemRule",
179   { "foreign.itemtype" => "self.itemtype" },
180   { cascade_copy => 0, cascade_delete => 0 },
181 );
182
183 =head2 old_reserves
184
185 Type: has_many
186
187 Related object: L<Koha::Schema::Result::OldReserve>
188
189 =cut
190
191 __PACKAGE__->has_many(
192   "old_reserves",
193   "Koha::Schema::Result::OldReserve",
194   { "foreign.itemtype" => "self.itemtype" },
195   { cascade_copy => 0, cascade_delete => 0 },
196 );
197
198 =head2 reserves
199
200 Type: has_many
201
202 Related object: L<Koha::Schema::Result::Reserve>
203
204 =cut
205
206 __PACKAGE__->has_many(
207   "reserves",
208   "Koha::Schema::Result::Reserve",
209   { "foreign.itemtype" => "self.itemtype" },
210   { cascade_copy => 0, cascade_delete => 0 },
211 );
212
213
214 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-10 14:27:09
215 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vERtWCf17tayLdzgnXpQcA
216
217 # Use the ItemtypeLocalization view to create the join on localization
218 our $LANGUAGE;
219 __PACKAGE__->has_many(
220   "localization" => "Koha::Schema::Result::ItemtypeLocalization",
221     sub {
222         my $args = shift;
223
224         die "no lang specified!" unless $LANGUAGE;
225
226         return ({
227             "$args->{self_alias}.itemtype" => { -ident => "$args->{foreign_alias}.code" },
228             "$args->{foreign_alias}.lang" => $LANGUAGE,
229         });
230
231     }
232 );
233
234 1;