Bug 15774: (follow-up) Address QA issues
[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   default_value: 0
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: 'integer'
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", default_value => 0, 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 => "integer", 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 numberpattern
400
401 Type: belongs_to
402
403 Related object: L<Koha::Schema::Result::SubscriptionNumberpattern>
404
405 =cut
406
407 __PACKAGE__->belongs_to(
408   "numberpattern",
409   "Koha::Schema::Result::SubscriptionNumberpattern",
410   { id => "numberpattern" },
411   {
412     is_deferrable => 1,
413     join_type     => "LEFT",
414     on_delete     => "SET NULL",
415     on_update     => "CASCADE",
416   },
417 );
418
419 =head2 periodicity
420
421 Type: belongs_to
422
423 Related object: L<Koha::Schema::Result::SubscriptionFrequency>
424
425 =cut
426
427 __PACKAGE__->belongs_to(
428   "periodicity",
429   "Koha::Schema::Result::SubscriptionFrequency",
430   { id => "periodicity" },
431   {
432     is_deferrable => 1,
433     join_type     => "LEFT",
434     on_delete     => "SET NULL",
435     on_update     => "CASCADE",
436   },
437 );
438
439 =head2 subscriptionroutinglists
440
441 Type: has_many
442
443 Related object: L<Koha::Schema::Result::Subscriptionroutinglist>
444
445 =cut
446
447 __PACKAGE__->has_many(
448   "subscriptionroutinglists",
449   "Koha::Schema::Result::Subscriptionroutinglist",
450   { "foreign.subscriptionid" => "self.subscriptionid" },
451   { cascade_copy => 0, cascade_delete => 0 },
452 );
453
454
455 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-01-23 12:56:39
456 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dTb/JOO3KQ3NZGypFbRiEw
457
458 __PACKAGE__->has_many(
459   "additional_field_values",
460   "Koha::Schema::Result::AdditionalFieldValue",
461   sub {
462     my ($args) = @_;
463
464     return {
465         "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.subscriptionid" },
466
467         "$args->{foreign_alias}.field_id" =>
468             { -in => \'(SELECT id FROM additional_fields WHERE tablename = "subscription")' },
469     };
470   },
471   { cascade_copy => 0, cascade_delete => 0 },
472 );
473
474 # You can replace this text with custom content, and it will be preserved on regeneration
475 1;