Bug 19482: DBIC schema changes
[koha.git] / Koha / Schema / Result / Subscription.pm
1 use utf8;
2 package Koha::Schema::Result::Subscription;
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::Subscription
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<subscription>
19
20 =cut
21
22 __PACKAGE__->table("subscription");
23
24 =head1 ACCESSORS
25
26 =head2 biblionumber
27
28   data_type: 'integer'
29   is_foreign_key: 1
30   is_nullable: 0
31
32 =head2 subscriptionid
33
34   data_type: 'integer'
35   is_auto_increment: 1
36   is_nullable: 0
37
38 =head2 librarian
39
40   data_type: 'varchar'
41   default_value: (empty string)
42   is_nullable: 1
43   size: 100
44
45 =head2 startdate
46
47   data_type: 'date'
48   datetime_undef_if_invalid: 1
49   is_nullable: 1
50
51 =head2 aqbooksellerid
52
53   data_type: 'integer'
54   default_value: 0
55   is_nullable: 1
56
57 =head2 cost
58
59   data_type: 'integer'
60   default_value: 0
61   is_nullable: 1
62
63 =head2 aqbudgetid
64
65   data_type: 'integer'
66   default_value: 0
67   is_nullable: 1
68
69 =head2 weeklength
70
71   data_type: 'integer'
72   default_value: 0
73   is_nullable: 1
74
75 =head2 monthlength
76
77   data_type: 'integer'
78   default_value: 0
79   is_nullable: 1
80
81 =head2 numberlength
82
83   data_type: 'integer'
84   default_value: 0
85   is_nullable: 1
86
87 =head2 periodicity
88
89   data_type: 'integer'
90   is_foreign_key: 1
91   is_nullable: 1
92
93 =head2 countissuesperunit
94
95   data_type: 'integer'
96   default_value: 1
97   is_nullable: 0
98
99 =head2 notes
100
101   data_type: 'longtext'
102   is_nullable: 1
103
104 =head2 status
105
106   data_type: 'varchar'
107   default_value: (empty string)
108   is_nullable: 0
109   size: 100
110
111 =head2 lastvalue1
112
113   data_type: 'integer'
114   is_nullable: 1
115
116 =head2 innerloop1
117
118   data_type: 'integer'
119   default_value: 0
120   is_nullable: 1
121
122 =head2 lastvalue2
123
124   data_type: 'integer'
125   is_nullable: 1
126
127 =head2 innerloop2
128
129   data_type: 'integer'
130   default_value: 0
131   is_nullable: 1
132
133 =head2 lastvalue3
134
135   data_type: 'integer'
136   is_nullable: 1
137
138 =head2 innerloop3
139
140   data_type: 'integer'
141   default_value: 0
142   is_nullable: 1
143
144 =head2 firstacquidate
145
146   data_type: 'date'
147   datetime_undef_if_invalid: 1
148   is_nullable: 1
149
150 =head2 manualhistory
151
152   data_type: 'tinyint'
153   default_value: 0
154   is_nullable: 0
155
156 =head2 irregularity
157
158   data_type: 'mediumtext'
159   is_nullable: 1
160
161 =head2 skip_serialseq
162
163   data_type: 'tinyint'
164   default_value: 0
165   is_nullable: 0
166
167 =head2 letter
168
169   data_type: 'varchar'
170   is_nullable: 1
171   size: 20
172
173 =head2 numberpattern
174
175   data_type: 'integer'
176   is_foreign_key: 1
177   is_nullable: 1
178
179 =head2 locale
180
181   data_type: 'varchar'
182   is_nullable: 1
183   size: 80
184
185 =head2 distributedto
186
187   data_type: 'mediumtext'
188   is_nullable: 1
189
190 =head2 internalnotes
191
192   data_type: 'longtext'
193   is_nullable: 1
194
195 =head2 callnumber
196
197   data_type: 'mediumtext'
198   is_nullable: 1
199
200 =head2 location
201
202   data_type: 'varchar'
203   default_value: (empty string)
204   is_nullable: 1
205   size: 80
206
207 =head2 branchcode
208
209   data_type: 'varchar'
210   default_value: (empty string)
211   is_nullable: 0
212   size: 10
213
214 =head2 lastbranch
215
216   data_type: 'varchar'
217   is_nullable: 1
218   size: 10
219
220 =head2 serialsadditems
221
222   data_type: 'tinyint'
223   default_value: 0
224   is_nullable: 0
225
226 =head2 staffdisplaycount
227
228   data_type: 'varchar'
229   is_nullable: 1
230   size: 10
231
232 =head2 opacdisplaycount
233
234   data_type: 'varchar'
235   is_nullable: 1
236   size: 10
237
238 =head2 graceperiod
239
240   data_type: 'integer'
241   default_value: 0
242   is_nullable: 0
243
244 =head2 enddate
245
246   data_type: 'date'
247   datetime_undef_if_invalid: 1
248   is_nullable: 1
249
250 =head2 closed
251
252   data_type: 'tinyint'
253   default_value: 0
254   is_nullable: 0
255
256 =head2 reneweddate
257
258   data_type: 'date'
259   datetime_undef_if_invalid: 1
260   is_nullable: 1
261
262 =head2 itemtype
263
264   data_type: 'varchar'
265   is_nullable: 1
266   size: 10
267
268 =head2 previousitemtype
269
270   data_type: 'varchar'
271   is_nullable: 1
272   size: 10
273
274 =head2 mana_id
275
276   data_type: 'integer'
277   is_nullable: 1
278
279 =cut
280
281 __PACKAGE__->add_columns(
282   "biblionumber",
283   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
284   "subscriptionid",
285   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
286   "librarian",
287   { data_type => "varchar", default_value => "", is_nullable => 1, size => 100 },
288   "startdate",
289   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
290   "aqbooksellerid",
291   { data_type => "integer", default_value => 0, is_nullable => 1 },
292   "cost",
293   { data_type => "integer", default_value => 0, is_nullable => 1 },
294   "aqbudgetid",
295   { data_type => "integer", default_value => 0, is_nullable => 1 },
296   "weeklength",
297   { data_type => "integer", default_value => 0, is_nullable => 1 },
298   "monthlength",
299   { data_type => "integer", default_value => 0, is_nullable => 1 },
300   "numberlength",
301   { data_type => "integer", default_value => 0, is_nullable => 1 },
302   "periodicity",
303   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
304   "countissuesperunit",
305   { data_type => "integer", default_value => 1, is_nullable => 0 },
306   "notes",
307   { data_type => "longtext", is_nullable => 1 },
308   "status",
309   { data_type => "varchar", default_value => "", is_nullable => 0, size => 100 },
310   "lastvalue1",
311   { data_type => "integer", is_nullable => 1 },
312   "innerloop1",
313   { data_type => "integer", default_value => 0, is_nullable => 1 },
314   "lastvalue2",
315   { data_type => "integer", is_nullable => 1 },
316   "innerloop2",
317   { data_type => "integer", default_value => 0, is_nullable => 1 },
318   "lastvalue3",
319   { data_type => "integer", is_nullable => 1 },
320   "innerloop3",
321   { data_type => "integer", default_value => 0, is_nullable => 1 },
322   "firstacquidate",
323   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
324   "manualhistory",
325   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
326   "irregularity",
327   { data_type => "mediumtext", is_nullable => 1 },
328   "skip_serialseq",
329   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
330   "letter",
331   { data_type => "varchar", is_nullable => 1, size => 20 },
332   "numberpattern",
333   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
334   "locale",
335   { data_type => "varchar", is_nullable => 1, size => 80 },
336   "distributedto",
337   { data_type => "mediumtext", is_nullable => 1 },
338   "internalnotes",
339   { data_type => "longtext", is_nullable => 1 },
340   "callnumber",
341   { data_type => "mediumtext", is_nullable => 1 },
342   "location",
343   { data_type => "varchar", default_value => "", is_nullable => 1, size => 80 },
344   "branchcode",
345   { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
346   "lastbranch",
347   { data_type => "varchar", is_nullable => 1, size => 10 },
348   "serialsadditems",
349   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
350   "staffdisplaycount",
351   { data_type => "varchar", is_nullable => 1, size => 10 },
352   "opacdisplaycount",
353   { data_type => "varchar", is_nullable => 1, size => 10 },
354   "graceperiod",
355   { data_type => "integer", default_value => 0, is_nullable => 0 },
356   "enddate",
357   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
358   "closed",
359   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
360   "reneweddate",
361   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
362   "itemtype",
363   { data_type => "varchar", is_nullable => 1, size => 10 },
364   "previousitemtype",
365   { data_type => "varchar", is_nullable => 1, size => 10 },
366   "mana_id",
367   { data_type => "integer", is_nullable => 1 },
368 );
369
370 =head1 PRIMARY KEY
371
372 =over 4
373
374 =item * L</subscriptionid>
375
376 =back
377
378 =cut
379
380 __PACKAGE__->set_primary_key("subscriptionid");
381
382 =head1 RELATIONS
383
384 =head2 aqorders
385
386 Type: has_many
387
388 Related object: L<Koha::Schema::Result::Aqorder>
389
390 =cut
391
392 __PACKAGE__->has_many(
393   "aqorders",
394   "Koha::Schema::Result::Aqorder",
395   { "foreign.subscriptionid" => "self.subscriptionid" },
396   { cascade_copy => 0, cascade_delete => 0 },
397 );
398
399 =head2 biblionumber
400
401 Type: belongs_to
402
403 Related object: L<Koha::Schema::Result::Biblio>
404
405 =cut
406
407 __PACKAGE__->belongs_to(
408   "biblionumber",
409   "Koha::Schema::Result::Biblio",
410   { biblionumber => "biblionumber" },
411   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
412 );
413
414 =head2 numberpattern
415
416 Type: belongs_to
417
418 Related object: L<Koha::Schema::Result::SubscriptionNumberpattern>
419
420 =cut
421
422 __PACKAGE__->belongs_to(
423   "numberpattern",
424   "Koha::Schema::Result::SubscriptionNumberpattern",
425   { id => "numberpattern" },
426   {
427     is_deferrable => 1,
428     join_type     => "LEFT",
429     on_delete     => "SET NULL",
430     on_update     => "CASCADE",
431   },
432 );
433
434 =head2 periodicity
435
436 Type: belongs_to
437
438 Related object: L<Koha::Schema::Result::SubscriptionFrequency>
439
440 =cut
441
442 __PACKAGE__->belongs_to(
443   "periodicity",
444   "Koha::Schema::Result::SubscriptionFrequency",
445   { id => "periodicity" },
446   {
447     is_deferrable => 1,
448     join_type     => "LEFT",
449     on_delete     => "SET NULL",
450     on_update     => "CASCADE",
451   },
452 );
453
454 =head2 serials
455
456 Type: has_many
457
458 Related object: L<Koha::Schema::Result::Serial>
459
460 =cut
461
462 __PACKAGE__->has_many(
463   "serials",
464   "Koha::Schema::Result::Serial",
465   { "foreign.subscriptionid" => "self.subscriptionid" },
466   { cascade_copy => 0, cascade_delete => 0 },
467 );
468
469 =head2 subscriptionhistory
470
471 Type: might_have
472
473 Related object: L<Koha::Schema::Result::Subscriptionhistory>
474
475 =cut
476
477 __PACKAGE__->might_have(
478   "subscriptionhistory",
479   "Koha::Schema::Result::Subscriptionhistory",
480   { "foreign.subscriptionid" => "self.subscriptionid" },
481   { cascade_copy => 0, cascade_delete => 0 },
482 );
483
484 =head2 subscriptionroutinglists
485
486 Type: has_many
487
488 Related object: L<Koha::Schema::Result::Subscriptionroutinglist>
489
490 =cut
491
492 __PACKAGE__->has_many(
493   "subscriptionroutinglists",
494   "Koha::Schema::Result::Subscriptionroutinglist",
495   { "foreign.subscriptionid" => "self.subscriptionid" },
496   { cascade_copy => 0, cascade_delete => 0 },
497 );
498
499
500 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-17 09:15:51
501 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Bw7XzPSvv9fjc9F6+uIBUw
502
503 __PACKAGE__->has_many(
504   "additional_field_values",
505   "Koha::Schema::Result::AdditionalFieldValue",
506   sub {
507     my ($args) = @_;
508
509     return {
510         "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.subscriptionid" },
511
512         "$args->{foreign_alias}.field_id" =>
513             { -in => \'(SELECT id FROM additional_fields WHERE tablename = "subscription")' },
514     };
515   },
516   { cascade_copy => 0, cascade_delete => 0 },
517 );
518
519 __PACKAGE__->add_columns(
520     '+closed'         => { is_boolean => 1 },
521     '+skip_serialseq' => { is_boolean => 1 },
522 );
523
524 # You can replace this text with custom content, and it will be preserved on regeneration
525 1;