Bug 22630: Set is_boolean flag for course_items.homebranch_enabled
[koha.git] / Koha / Schema / Result / CourseItem.pm
blob495cf779641ca52b13be42f96d6f5208bfc9edf7
1 use utf8;
2 package Koha::Schema::Result::CourseItem;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
7 =head1 NAME
9 Koha::Schema::Result::CourseItem
11 =cut
13 use strict;
14 use warnings;
16 use base 'DBIx::Class::Core';
18 =head1 TABLE: C<course_items>
20 =cut
22 __PACKAGE__->table("course_items");
24 =head1 ACCESSORS
26 =head2 ci_id
28 data_type: 'integer'
29 is_auto_increment: 1
30 is_nullable: 0
32 =head2 itemnumber
34 data_type: 'integer'
35 is_foreign_key: 1
36 is_nullable: 0
38 =head2 itype
40 data_type: 'varchar'
41 is_nullable: 1
42 size: 10
44 =head2 itype_enabled
46 data_type: 'tinyint'
47 default_value: 0
48 is_nullable: 0
50 =head2 itype_storage
52 data_type: 'varchar'
53 is_nullable: 1
54 size: 10
56 =head2 ccode
58 data_type: 'varchar'
59 is_nullable: 1
60 size: 80
62 =head2 ccode_enabled
64 data_type: 'tinyint'
65 default_value: 0
66 is_nullable: 0
68 =head2 ccode_storage
70 data_type: 'varchar'
71 is_nullable: 1
72 size: 80
74 =head2 homebranch
76 data_type: 'varchar'
77 is_foreign_key: 1
78 is_nullable: 1
79 size: 10
81 =head2 homebranch_enabled
83 data_type: 'tinyint'
84 default_value: 0
85 is_nullable: 0
87 =head2 homebranch_storage
89 data_type: 'varchar'
90 is_foreign_key: 1
91 is_nullable: 1
92 size: 10
94 =head2 holdingbranch
96 data_type: 'varchar'
97 is_foreign_key: 1
98 is_nullable: 1
99 size: 10
101 =head2 holdingbranch_enabled
103 data_type: 'tinyint'
104 default_value: 0
105 is_nullable: 0
107 =head2 holdingbranch_storage
109 data_type: 'varchar'
110 is_nullable: 1
111 size: 10
113 =head2 location
115 data_type: 'varchar'
116 is_nullable: 1
117 size: 80
119 =head2 location_enabled
121 data_type: 'tinyint'
122 default_value: 0
123 is_nullable: 0
125 =head2 location_storage
127 data_type: 'varchar'
128 is_nullable: 1
129 size: 80
131 =head2 enabled
133 data_type: 'enum'
134 default_value: 'no'
135 extra: {list => ["yes","no"]}
136 is_nullable: 0
138 =head2 timestamp
140 data_type: 'timestamp'
141 datetime_undef_if_invalid: 1
142 default_value: current_timestamp
143 is_nullable: 0
145 =cut
147 __PACKAGE__->add_columns(
148 "ci_id",
149 { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
150 "itemnumber",
151 { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
152 "itype",
153 { data_type => "varchar", is_nullable => 1, size => 10 },
154 "itype_enabled",
155 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
156 "itype_storage",
157 { data_type => "varchar", is_nullable => 1, size => 10 },
158 "ccode",
159 { data_type => "varchar", is_nullable => 1, size => 80 },
160 "ccode_enabled",
161 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
162 "ccode_storage",
163 { data_type => "varchar", is_nullable => 1, size => 80 },
164 "homebranch",
165 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
166 "homebranch_enabled",
167 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
168 "homebranch_storage",
169 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
170 "holdingbranch",
171 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
172 "holdingbranch_enabled",
173 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
174 "holdingbranch_storage",
175 { data_type => "varchar", is_nullable => 1, size => 10 },
176 "location",
177 { data_type => "varchar", is_nullable => 1, size => 80 },
178 "location_enabled",
179 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
180 "location_storage",
181 { data_type => "varchar", is_nullable => 1, size => 80 },
182 "enabled",
184 data_type => "enum",
185 default_value => "no",
186 extra => { list => ["yes", "no"] },
187 is_nullable => 0,
189 "timestamp",
191 data_type => "timestamp",
192 datetime_undef_if_invalid => 1,
193 default_value => \"current_timestamp",
194 is_nullable => 0,
198 =head1 PRIMARY KEY
200 =over 4
202 =item * L</ci_id>
204 =back
206 =cut
208 __PACKAGE__->set_primary_key("ci_id");
210 =head1 UNIQUE CONSTRAINTS
212 =head2 C<itemnumber>
214 =over 4
216 =item * L</itemnumber>
218 =back
220 =cut
222 __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]);
224 =head1 RELATIONS
226 =head2 course_reserves
228 Type: has_many
230 Related object: L<Koha::Schema::Result::CourseReserve>
232 =cut
234 __PACKAGE__->has_many(
235 "course_reserves",
236 "Koha::Schema::Result::CourseReserve",
237 { "foreign.ci_id" => "self.ci_id" },
238 { cascade_copy => 0, cascade_delete => 0 },
241 =head2 holdingbranch
243 Type: belongs_to
245 Related object: L<Koha::Schema::Result::Branch>
247 =cut
249 __PACKAGE__->belongs_to(
250 "holdingbranch",
251 "Koha::Schema::Result::Branch",
252 { branchcode => "holdingbranch" },
254 is_deferrable => 1,
255 join_type => "LEFT",
256 on_delete => "CASCADE",
257 on_update => "CASCADE",
261 =head2 homebranch
263 Type: belongs_to
265 Related object: L<Koha::Schema::Result::Branch>
267 =cut
269 __PACKAGE__->belongs_to(
270 "homebranch",
271 "Koha::Schema::Result::Branch",
272 { branchcode => "homebranch" },
274 is_deferrable => 1,
275 join_type => "LEFT",
276 on_delete => "CASCADE",
277 on_update => "CASCADE",
281 =head2 homebranch_storage
283 Type: belongs_to
285 Related object: L<Koha::Schema::Result::Branch>
287 =cut
289 __PACKAGE__->belongs_to(
290 "homebranch_storage",
291 "Koha::Schema::Result::Branch",
292 { branchcode => "homebranch_storage" },
294 is_deferrable => 1,
295 join_type => "LEFT",
296 on_delete => "CASCADE",
297 on_update => "CASCADE",
301 =head2 itemnumber
303 Type: belongs_to
305 Related object: L<Koha::Schema::Result::Item>
307 =cut
309 __PACKAGE__->belongs_to(
310 "itemnumber",
311 "Koha::Schema::Result::Item",
312 { itemnumber => "itemnumber" },
313 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
317 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-04-24 10:54:54
318 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cXNlGAgIZMs+Id7/FJSBRQ
320 __PACKAGE__->add_columns(
321 '+itype_enabled' => { is_boolean => 1 },
322 '+ccode_enabled' => { is_boolean => 1 },
323 '+homebranch_enabled' => { is_boolean => 1 },
324 '+holdingbranch_enabled' => { is_boolean => 1 },
325 '+location_enabled' => { is_boolean => 1 },
328 sub koha_objects_class {
329 'Koha::Course::Items';
331 sub koha_object_class {
332 'Koha::Course::Item';