Bug 19482: DBIC schema changes
[koha.git] / Koha / Schema / Result / Aqorder.pm
1 use utf8;
2 package Koha::Schema::Result::Aqorder;
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::Aqorder
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<aqorders>
19
20 =cut
21
22 __PACKAGE__->table("aqorders");
23
24 =head1 ACCESSORS
25
26 =head2 ordernumber
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 biblionumber
33
34   data_type: 'integer'
35   is_foreign_key: 1
36   is_nullable: 1
37
38 =head2 entrydate
39
40   data_type: 'date'
41   datetime_undef_if_invalid: 1
42   is_nullable: 1
43
44 =head2 quantity
45
46   data_type: 'smallint'
47   is_nullable: 1
48
49 =head2 currency
50
51   data_type: 'varchar'
52   is_foreign_key: 1
53   is_nullable: 1
54   size: 10
55
56 =head2 listprice
57
58   data_type: 'decimal'
59   is_nullable: 1
60   size: [28,6]
61
62 =head2 datereceived
63
64   data_type: 'date'
65   datetime_undef_if_invalid: 1
66   is_nullable: 1
67
68 =head2 invoiceid
69
70   data_type: 'integer'
71   is_foreign_key: 1
72   is_nullable: 1
73
74 =head2 freight
75
76   data_type: 'decimal'
77   is_nullable: 1
78   size: [28,6]
79
80 =head2 unitprice
81
82   data_type: 'decimal'
83   is_nullable: 1
84   size: [28,6]
85
86 =head2 unitprice_tax_excluded
87
88   data_type: 'decimal'
89   is_nullable: 1
90   size: [28,6]
91
92 =head2 unitprice_tax_included
93
94   data_type: 'decimal'
95   is_nullable: 1
96   size: [28,6]
97
98 =head2 quantityreceived
99
100   data_type: 'smallint'
101   default_value: 0
102   is_nullable: 0
103
104 =head2 created_by
105
106   data_type: 'integer'
107   is_foreign_key: 1
108   is_nullable: 1
109
110 =head2 datecancellationprinted
111
112   data_type: 'date'
113   datetime_undef_if_invalid: 1
114   is_nullable: 1
115
116 =head2 cancellationreason
117
118   data_type: 'mediumtext'
119   is_nullable: 1
120
121 =head2 order_internalnote
122
123   data_type: 'longtext'
124   is_nullable: 1
125
126 =head2 order_vendornote
127
128   data_type: 'longtext'
129   is_nullable: 1
130
131 =head2 purchaseordernumber
132
133   data_type: 'longtext'
134   is_nullable: 1
135
136 =head2 basketno
137
138   data_type: 'integer'
139   is_foreign_key: 1
140   is_nullable: 1
141
142 =head2 timestamp
143
144   data_type: 'timestamp'
145   datetime_undef_if_invalid: 1
146   default_value: current_timestamp
147   is_nullable: 0
148
149 =head2 rrp
150
151   data_type: 'decimal'
152   is_nullable: 1
153   size: [13,2]
154
155 =head2 replacementprice
156
157   data_type: 'decimal'
158   is_nullable: 1
159   size: [28,6]
160
161 =head2 rrp_tax_excluded
162
163   data_type: 'decimal'
164   is_nullable: 1
165   size: [28,6]
166
167 =head2 rrp_tax_included
168
169   data_type: 'decimal'
170   is_nullable: 1
171   size: [28,6]
172
173 =head2 ecost
174
175   data_type: 'decimal'
176   is_nullable: 1
177   size: [13,2]
178
179 =head2 ecost_tax_excluded
180
181   data_type: 'decimal'
182   is_nullable: 1
183   size: [28,6]
184
185 =head2 ecost_tax_included
186
187   data_type: 'decimal'
188   is_nullable: 1
189   size: [28,6]
190
191 =head2 tax_rate_bak
192
193   data_type: 'decimal'
194   is_nullable: 1
195   size: [6,4]
196
197 =head2 tax_rate_on_ordering
198
199   data_type: 'decimal'
200   is_nullable: 1
201   size: [6,4]
202
203 =head2 tax_rate_on_receiving
204
205   data_type: 'decimal'
206   is_nullable: 1
207   size: [6,4]
208
209 =head2 tax_value_bak
210
211   data_type: 'decimal'
212   is_nullable: 1
213   size: [28,6]
214
215 =head2 tax_value_on_ordering
216
217   data_type: 'decimal'
218   is_nullable: 1
219   size: [28,6]
220
221 =head2 tax_value_on_receiving
222
223   data_type: 'decimal'
224   is_nullable: 1
225   size: [28,6]
226
227 =head2 discount
228
229   data_type: 'float'
230   is_nullable: 1
231   size: [6,4]
232
233 =head2 budget_id
234
235   data_type: 'integer'
236   is_foreign_key: 1
237   is_nullable: 0
238
239 =head2 budgetdate
240
241   data_type: 'date'
242   datetime_undef_if_invalid: 1
243   is_nullable: 1
244
245 =head2 sort1
246
247   data_type: 'varchar'
248   is_nullable: 1
249   size: 80
250
251 =head2 sort2
252
253   data_type: 'varchar'
254   is_nullable: 1
255   size: 80
256
257 =head2 sort1_authcat
258
259   data_type: 'varchar'
260   is_nullable: 1
261   size: 10
262
263 =head2 sort2_authcat
264
265   data_type: 'varchar'
266   is_nullable: 1
267   size: 10
268
269 =head2 uncertainprice
270
271   data_type: 'tinyint'
272   is_nullable: 1
273
274 =head2 subscriptionid
275
276   data_type: 'integer'
277   is_foreign_key: 1
278   is_nullable: 1
279
280 =head2 parent_ordernumber
281
282   data_type: 'integer'
283   is_nullable: 1
284
285 =head2 orderstatus
286
287   data_type: 'varchar'
288   default_value: 'new'
289   is_nullable: 1
290   size: 16
291
292 =head2 line_item_id
293
294   data_type: 'varchar'
295   is_nullable: 1
296   size: 35
297
298 =head2 suppliers_reference_number
299
300   data_type: 'varchar'
301   is_nullable: 1
302   size: 35
303
304 =head2 suppliers_reference_qualifier
305
306   data_type: 'varchar'
307   is_nullable: 1
308   size: 3
309
310 =head2 suppliers_report
311
312   data_type: 'mediumtext'
313   is_nullable: 1
314
315 =cut
316
317 __PACKAGE__->add_columns(
318   "ordernumber",
319   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
320   "biblionumber",
321   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
322   "entrydate",
323   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
324   "quantity",
325   { data_type => "smallint", is_nullable => 1 },
326   "currency",
327   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
328   "listprice",
329   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
330   "datereceived",
331   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
332   "invoiceid",
333   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
334   "freight",
335   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
336   "unitprice",
337   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
338   "unitprice_tax_excluded",
339   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
340   "unitprice_tax_included",
341   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
342   "quantityreceived",
343   { data_type => "smallint", default_value => 0, is_nullable => 0 },
344   "created_by",
345   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
346   "datecancellationprinted",
347   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
348   "cancellationreason",
349   { data_type => "mediumtext", is_nullable => 1 },
350   "order_internalnote",
351   { data_type => "longtext", is_nullable => 1 },
352   "order_vendornote",
353   { data_type => "longtext", is_nullable => 1 },
354   "purchaseordernumber",
355   { data_type => "longtext", is_nullable => 1 },
356   "basketno",
357   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
358   "timestamp",
359   {
360     data_type => "timestamp",
361     datetime_undef_if_invalid => 1,
362     default_value => \"current_timestamp",
363     is_nullable => 0,
364   },
365   "rrp",
366   { data_type => "decimal", is_nullable => 1, size => [13, 2] },
367   "replacementprice",
368   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
369   "rrp_tax_excluded",
370   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
371   "rrp_tax_included",
372   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
373   "ecost",
374   { data_type => "decimal", is_nullable => 1, size => [13, 2] },
375   "ecost_tax_excluded",
376   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
377   "ecost_tax_included",
378   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
379   "tax_rate_bak",
380   { data_type => "decimal", is_nullable => 1, size => [6, 4] },
381   "tax_rate_on_ordering",
382   { data_type => "decimal", is_nullable => 1, size => [6, 4] },
383   "tax_rate_on_receiving",
384   { data_type => "decimal", is_nullable => 1, size => [6, 4] },
385   "tax_value_bak",
386   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
387   "tax_value_on_ordering",
388   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
389   "tax_value_on_receiving",
390   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
391   "discount",
392   { data_type => "float", is_nullable => 1, size => [6, 4] },
393   "budget_id",
394   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
395   "budgetdate",
396   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
397   "sort1",
398   { data_type => "varchar", is_nullable => 1, size => 80 },
399   "sort2",
400   { data_type => "varchar", is_nullable => 1, size => 80 },
401   "sort1_authcat",
402   { data_type => "varchar", is_nullable => 1, size => 10 },
403   "sort2_authcat",
404   { data_type => "varchar", is_nullable => 1, size => 10 },
405   "uncertainprice",
406   { data_type => "tinyint", is_nullable => 1 },
407   "subscriptionid",
408   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
409   "parent_ordernumber",
410   { data_type => "integer", is_nullable => 1 },
411   "orderstatus",
412   {
413     data_type => "varchar",
414     default_value => "new",
415     is_nullable => 1,
416     size => 16,
417   },
418   "line_item_id",
419   { data_type => "varchar", is_nullable => 1, size => 35 },
420   "suppliers_reference_number",
421   { data_type => "varchar", is_nullable => 1, size => 35 },
422   "suppliers_reference_qualifier",
423   { data_type => "varchar", is_nullable => 1, size => 3 },
424   "suppliers_report",
425   { data_type => "mediumtext", is_nullable => 1 },
426 );
427
428 =head1 PRIMARY KEY
429
430 =over 4
431
432 =item * L</ordernumber>
433
434 =back
435
436 =cut
437
438 __PACKAGE__->set_primary_key("ordernumber");
439
440 =head1 RELATIONS
441
442 =head2 aqorder_users
443
444 Type: has_many
445
446 Related object: L<Koha::Schema::Result::AqorderUser>
447
448 =cut
449
450 __PACKAGE__->has_many(
451   "aqorder_users",
452   "Koha::Schema::Result::AqorderUser",
453   { "foreign.ordernumber" => "self.ordernumber" },
454   { cascade_copy => 0, cascade_delete => 0 },
455 );
456
457 =head2 aqorders_claims
458
459 Type: has_many
460
461 Related object: L<Koha::Schema::Result::AqordersClaim>
462
463 =cut
464
465 __PACKAGE__->has_many(
466   "aqorders_claims",
467   "Koha::Schema::Result::AqordersClaim",
468   { "foreign.ordernumber" => "self.ordernumber" },
469   { cascade_copy => 0, cascade_delete => 0 },
470 );
471
472 =head2 aqorders_items
473
474 Type: has_many
475
476 Related object: L<Koha::Schema::Result::AqordersItem>
477
478 =cut
479
480 __PACKAGE__->has_many(
481   "aqorders_items",
482   "Koha::Schema::Result::AqordersItem",
483   { "foreign.ordernumber" => "self.ordernumber" },
484   { cascade_copy => 0, cascade_delete => 0 },
485 );
486
487 =head2 aqorders_transfers_ordernumber_from
488
489 Type: might_have
490
491 Related object: L<Koha::Schema::Result::AqordersTransfer>
492
493 =cut
494
495 __PACKAGE__->might_have(
496   "aqorders_transfers_ordernumber_from",
497   "Koha::Schema::Result::AqordersTransfer",
498   { "foreign.ordernumber_from" => "self.ordernumber" },
499   { cascade_copy => 0, cascade_delete => 0 },
500 );
501
502 =head2 aqorders_transfers_ordernumber_to
503
504 Type: might_have
505
506 Related object: L<Koha::Schema::Result::AqordersTransfer>
507
508 =cut
509
510 __PACKAGE__->might_have(
511   "aqorders_transfers_ordernumber_to",
512   "Koha::Schema::Result::AqordersTransfer",
513   { "foreign.ordernumber_to" => "self.ordernumber" },
514   { cascade_copy => 0, cascade_delete => 0 },
515 );
516
517 =head2 basketno
518
519 Type: belongs_to
520
521 Related object: L<Koha::Schema::Result::Aqbasket>
522
523 =cut
524
525 __PACKAGE__->belongs_to(
526   "basketno",
527   "Koha::Schema::Result::Aqbasket",
528   { basketno => "basketno" },
529   {
530     is_deferrable => 1,
531     join_type     => "LEFT",
532     on_delete     => "CASCADE",
533     on_update     => "CASCADE",
534   },
535 );
536
537 =head2 biblionumber
538
539 Type: belongs_to
540
541 Related object: L<Koha::Schema::Result::Biblio>
542
543 =cut
544
545 __PACKAGE__->belongs_to(
546   "biblionumber",
547   "Koha::Schema::Result::Biblio",
548   { biblionumber => "biblionumber" },
549   {
550     is_deferrable => 1,
551     join_type     => "LEFT",
552     on_delete     => "SET NULL",
553     on_update     => "CASCADE",
554   },
555 );
556
557 =head2 budget
558
559 Type: belongs_to
560
561 Related object: L<Koha::Schema::Result::Aqbudget>
562
563 =cut
564
565 __PACKAGE__->belongs_to(
566   "budget",
567   "Koha::Schema::Result::Aqbudget",
568   { budget_id => "budget_id" },
569   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
570 );
571
572 =head2 created_by
573
574 Type: belongs_to
575
576 Related object: L<Koha::Schema::Result::Borrower>
577
578 =cut
579
580 __PACKAGE__->belongs_to(
581   "created_by",
582   "Koha::Schema::Result::Borrower",
583   { borrowernumber => "created_by" },
584   {
585     is_deferrable => 1,
586     join_type     => "LEFT",
587     on_delete     => "SET NULL",
588     on_update     => "CASCADE",
589   },
590 );
591
592 =head2 currency
593
594 Type: belongs_to
595
596 Related object: L<Koha::Schema::Result::Currency>
597
598 =cut
599
600 __PACKAGE__->belongs_to(
601   "currency",
602   "Koha::Schema::Result::Currency",
603   { currency => "currency" },
604   {
605     is_deferrable => 1,
606     join_type     => "LEFT",
607     on_delete     => "SET NULL",
608     on_update     => "SET NULL",
609   },
610 );
611
612 =head2 invoiceid
613
614 Type: belongs_to
615
616 Related object: L<Koha::Schema::Result::Aqinvoice>
617
618 =cut
619
620 __PACKAGE__->belongs_to(
621   "invoiceid",
622   "Koha::Schema::Result::Aqinvoice",
623   { invoiceid => "invoiceid" },
624   {
625     is_deferrable => 1,
626     join_type     => "LEFT",
627     on_delete     => "SET NULL",
628     on_update     => "CASCADE",
629   },
630 );
631
632 =head2 subscriptionid
633
634 Type: belongs_to
635
636 Related object: L<Koha::Schema::Result::Subscription>
637
638 =cut
639
640 __PACKAGE__->belongs_to(
641   "subscriptionid",
642   "Koha::Schema::Result::Subscription",
643   { subscriptionid => "subscriptionid" },
644   {
645     is_deferrable => 1,
646     join_type     => "LEFT",
647     on_delete     => "CASCADE",
648     on_update     => "CASCADE",
649   },
650 );
651
652 =head2 borrowernumbers
653
654 Type: many_to_many
655
656 Composing rels: L</aqorder_users> -> borrowernumber
657
658 =cut
659
660 __PACKAGE__->many_to_many("borrowernumbers", "aqorder_users", "borrowernumber");
661
662
663 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-05-04 08:25:41
664 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Pf6reFaSldsjIA6XThbDFA
665
666 __PACKAGE__->belongs_to(
667   "basket",
668   "Koha::Schema::Result::Aqbasket",
669   { "foreign.basketno" => "self.basketno" },
670   {
671     is_deferrable => 1,
672     join_type     => "LEFT",
673     on_delete     => "CASCADE",
674     on_update     => "CASCADE",
675   },
676 );
677
678 __PACKAGE__->belongs_to(
679   "biblio",
680   "Koha::Schema::Result::Biblio",
681   { 'foreign.biblionumber' => "self.biblionumber" },
682   {
683     is_deferrable => 1,
684     join_type     => "LEFT",
685     on_delete     => "SET NULL",
686     on_update     => "CASCADE",
687   },
688 );
689
690 __PACKAGE__->belongs_to(
691   "fund",
692   "Koha::Schema::Result::Aqbudget",
693   { "foreign.budget_id" => "self.budget_id" },
694   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
695 );
696
697 __PACKAGE__->belongs_to(
698   "invoice",
699   "Koha::Schema::Result::Aqinvoice",
700   { "foreign.invoiceid" => "self.invoiceid" },
701   {
702     is_deferrable => 1,
703     join_type     => "LEFT",
704     on_delete     => "SET NULL",
705     on_update     => "CASCADE",
706   },
707 );
708
709 __PACKAGE__->belongs_to(
710   "subscription",
711   "Koha::Schema::Result::Subscription",
712   { "foreign.subscriptionid" => "self.subscriptionid" },
713   {
714     is_deferrable => 1,
715     join_type     => "LEFT",
716     on_delete     => "CASCADE",
717     on_update     => "CASCADE",
718   },
719 );
720
721 sub koha_objects_class {
722     'Koha::Acquisition::Orders';
723 }
724
725 sub koha_object_class {
726     'Koha::Acquisition::Order';
727 }
728
729 __PACKAGE__->add_columns(
730     '+uncertainprice' => { is_boolean => 1 }
731 );
732
733 1;