Bug 26922: Regression tests
[koha.git] / Koha / Schema / Result / Aqorder.pm
blobf873aa6da39b12b1ccb02818abb830368b3f9617
1 use utf8;
2 package Koha::Schema::Result::Aqorder;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
7 =head1 NAME
9 Koha::Schema::Result::Aqorder
11 =cut
13 use strict;
14 use warnings;
16 use base 'DBIx::Class::Core';
18 =head1 TABLE: C<aqorders>
20 =cut
22 __PACKAGE__->table("aqorders");
24 =head1 ACCESSORS
26 =head2 ordernumber
28 data_type: 'integer'
29 is_auto_increment: 1
30 is_nullable: 0
32 =head2 biblionumber
34 data_type: 'integer'
35 is_foreign_key: 1
36 is_nullable: 1
38 =head2 entrydate
40 data_type: 'date'
41 datetime_undef_if_invalid: 1
42 is_nullable: 1
44 =head2 quantity
46 data_type: 'smallint'
47 is_nullable: 1
49 =head2 currency
51 data_type: 'varchar'
52 is_foreign_key: 1
53 is_nullable: 1
54 size: 10
56 =head2 listprice
58 data_type: 'decimal'
59 is_nullable: 1
60 size: [28,6]
62 =head2 datereceived
64 data_type: 'date'
65 datetime_undef_if_invalid: 1
66 is_nullable: 1
68 =head2 invoiceid
70 data_type: 'integer'
71 is_foreign_key: 1
72 is_nullable: 1
74 =head2 freight
76 data_type: 'decimal'
77 is_nullable: 1
78 size: [28,6]
80 =head2 unitprice
82 data_type: 'decimal'
83 is_nullable: 1
84 size: [28,6]
86 =head2 unitprice_tax_excluded
88 data_type: 'decimal'
89 is_nullable: 1
90 size: [28,6]
92 =head2 unitprice_tax_included
94 data_type: 'decimal'
95 is_nullable: 1
96 size: [28,6]
98 =head2 quantityreceived
100 data_type: 'smallint'
101 default_value: 0
102 is_nullable: 0
104 =head2 created_by
106 data_type: 'integer'
107 is_foreign_key: 1
108 is_nullable: 1
110 =head2 datecancellationprinted
112 data_type: 'date'
113 datetime_undef_if_invalid: 1
114 is_nullable: 1
116 =head2 cancellationreason
118 data_type: 'mediumtext'
119 is_nullable: 1
121 =head2 order_internalnote
123 data_type: 'longtext'
124 is_nullable: 1
126 =head2 order_vendornote
128 data_type: 'longtext'
129 is_nullable: 1
131 =head2 purchaseordernumber
133 data_type: 'longtext'
134 is_nullable: 1
136 =head2 basketno
138 data_type: 'integer'
139 is_foreign_key: 1
140 is_nullable: 1
142 =head2 timestamp
144 data_type: 'timestamp'
145 datetime_undef_if_invalid: 1
146 default_value: current_timestamp
147 is_nullable: 0
149 =head2 rrp
151 data_type: 'decimal'
152 is_nullable: 1
153 size: [13,2]
155 =head2 replacementprice
157 data_type: 'decimal'
158 is_nullable: 1
159 size: [28,6]
161 =head2 rrp_tax_excluded
163 data_type: 'decimal'
164 is_nullable: 1
165 size: [28,6]
167 =head2 rrp_tax_included
169 data_type: 'decimal'
170 is_nullable: 1
171 size: [28,6]
173 =head2 ecost
175 data_type: 'decimal'
176 is_nullable: 1
177 size: [13,2]
179 =head2 ecost_tax_excluded
181 data_type: 'decimal'
182 is_nullable: 1
183 size: [28,6]
185 =head2 ecost_tax_included
187 data_type: 'decimal'
188 is_nullable: 1
189 size: [28,6]
191 =head2 tax_rate_bak
193 data_type: 'decimal'
194 is_nullable: 1
195 size: [6,4]
197 =head2 tax_rate_on_ordering
199 data_type: 'decimal'
200 is_nullable: 1
201 size: [6,4]
203 =head2 tax_rate_on_receiving
205 data_type: 'decimal'
206 is_nullable: 1
207 size: [6,4]
209 =head2 tax_value_bak
211 data_type: 'decimal'
212 is_nullable: 1
213 size: [28,6]
215 =head2 tax_value_on_ordering
217 data_type: 'decimal'
218 is_nullable: 1
219 size: [28,6]
221 =head2 tax_value_on_receiving
223 data_type: 'decimal'
224 is_nullable: 1
225 size: [28,6]
227 =head2 discount
229 data_type: 'float'
230 is_nullable: 1
231 size: [6,4]
233 =head2 budget_id
235 data_type: 'integer'
236 is_foreign_key: 1
237 is_nullable: 0
239 =head2 budgetdate
241 data_type: 'date'
242 datetime_undef_if_invalid: 1
243 is_nullable: 1
245 =head2 sort1
247 data_type: 'varchar'
248 is_nullable: 1
249 size: 80
251 =head2 sort2
253 data_type: 'varchar'
254 is_nullable: 1
255 size: 80
257 =head2 sort1_authcat
259 data_type: 'varchar'
260 is_nullable: 1
261 size: 10
263 =head2 sort2_authcat
265 data_type: 'varchar'
266 is_nullable: 1
267 size: 10
269 =head2 uncertainprice
271 data_type: 'tinyint'
272 is_nullable: 1
274 =head2 subscriptionid
276 data_type: 'integer'
277 is_foreign_key: 1
278 is_nullable: 1
280 =head2 parent_ordernumber
282 data_type: 'integer'
283 is_nullable: 1
285 =head2 orderstatus
287 data_type: 'varchar'
288 default_value: 'new'
289 is_nullable: 1
290 size: 16
292 =head2 line_item_id
294 data_type: 'varchar'
295 is_nullable: 1
296 size: 35
298 =head2 suppliers_reference_number
300 data_type: 'varchar'
301 is_nullable: 1
302 size: 35
304 =head2 suppliers_reference_qualifier
306 data_type: 'varchar'
307 is_nullable: 1
308 size: 3
310 =head2 suppliers_report
312 data_type: 'mediumtext'
313 is_nullable: 1
315 =cut
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",
360 data_type => "timestamp",
361 datetime_undef_if_invalid => 1,
362 default_value => \"current_timestamp",
363 is_nullable => 0,
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",
413 data_type => "varchar",
414 default_value => "new",
415 is_nullable => 1,
416 size => 16,
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 },
428 =head1 PRIMARY KEY
430 =over 4
432 =item * L</ordernumber>
434 =back
436 =cut
438 __PACKAGE__->set_primary_key("ordernumber");
440 =head1 RELATIONS
442 =head2 aqorder_users
444 Type: has_many
446 Related object: L<Koha::Schema::Result::AqorderUser>
448 =cut
450 __PACKAGE__->has_many(
451 "aqorder_users",
452 "Koha::Schema::Result::AqorderUser",
453 { "foreign.ordernumber" => "self.ordernumber" },
454 { cascade_copy => 0, cascade_delete => 0 },
457 =head2 aqorders_claims
459 Type: has_many
461 Related object: L<Koha::Schema::Result::AqordersClaim>
463 =cut
465 __PACKAGE__->has_many(
466 "aqorders_claims",
467 "Koha::Schema::Result::AqordersClaim",
468 { "foreign.ordernumber" => "self.ordernumber" },
469 { cascade_copy => 0, cascade_delete => 0 },
472 =head2 aqorders_items
474 Type: has_many
476 Related object: L<Koha::Schema::Result::AqordersItem>
478 =cut
480 __PACKAGE__->has_many(
481 "aqorders_items",
482 "Koha::Schema::Result::AqordersItem",
483 { "foreign.ordernumber" => "self.ordernumber" },
484 { cascade_copy => 0, cascade_delete => 0 },
487 =head2 aqorders_transfers_ordernumber_from
489 Type: might_have
491 Related object: L<Koha::Schema::Result::AqordersTransfer>
493 =cut
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 },
502 =head2 aqorders_transfers_ordernumber_to
504 Type: might_have
506 Related object: L<Koha::Schema::Result::AqordersTransfer>
508 =cut
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 },
517 =head2 basketno
519 Type: belongs_to
521 Related object: L<Koha::Schema::Result::Aqbasket>
523 =cut
525 __PACKAGE__->belongs_to(
526 "basketno",
527 "Koha::Schema::Result::Aqbasket",
528 { basketno => "basketno" },
530 is_deferrable => 1,
531 join_type => "LEFT",
532 on_delete => "CASCADE",
533 on_update => "CASCADE",
537 =head2 biblionumber
539 Type: belongs_to
541 Related object: L<Koha::Schema::Result::Biblio>
543 =cut
545 __PACKAGE__->belongs_to(
546 "biblionumber",
547 "Koha::Schema::Result::Biblio",
548 { biblionumber => "biblionumber" },
550 is_deferrable => 1,
551 join_type => "LEFT",
552 on_delete => "SET NULL",
553 on_update => "CASCADE",
557 =head2 budget
559 Type: belongs_to
561 Related object: L<Koha::Schema::Result::Aqbudget>
563 =cut
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" },
572 =head2 created_by
574 Type: belongs_to
576 Related object: L<Koha::Schema::Result::Borrower>
578 =cut
580 __PACKAGE__->belongs_to(
581 "created_by",
582 "Koha::Schema::Result::Borrower",
583 { borrowernumber => "created_by" },
585 is_deferrable => 1,
586 join_type => "LEFT",
587 on_delete => "SET NULL",
588 on_update => "CASCADE",
592 =head2 currency
594 Type: belongs_to
596 Related object: L<Koha::Schema::Result::Currency>
598 =cut
600 __PACKAGE__->belongs_to(
601 "currency",
602 "Koha::Schema::Result::Currency",
603 { currency => "currency" },
605 is_deferrable => 1,
606 join_type => "LEFT",
607 on_delete => "SET NULL",
608 on_update => "SET NULL",
612 =head2 invoiceid
614 Type: belongs_to
616 Related object: L<Koha::Schema::Result::Aqinvoice>
618 =cut
620 __PACKAGE__->belongs_to(
621 "invoiceid",
622 "Koha::Schema::Result::Aqinvoice",
623 { invoiceid => "invoiceid" },
625 is_deferrable => 1,
626 join_type => "LEFT",
627 on_delete => "SET NULL",
628 on_update => "CASCADE",
632 =head2 subscriptionid
634 Type: belongs_to
636 Related object: L<Koha::Schema::Result::Subscription>
638 =cut
640 __PACKAGE__->belongs_to(
641 "subscriptionid",
642 "Koha::Schema::Result::Subscription",
643 { subscriptionid => "subscriptionid" },
645 is_deferrable => 1,
646 join_type => "LEFT",
647 on_delete => "CASCADE",
648 on_update => "CASCADE",
652 =head2 borrowernumbers
654 Type: many_to_many
656 Composing rels: L</aqorder_users> -> borrowernumber
658 =cut
660 __PACKAGE__->many_to_many("borrowernumbers", "aqorder_users", "borrowernumber");
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
666 __PACKAGE__->belongs_to(
667 "basket",
668 "Koha::Schema::Result::Aqbasket",
669 { "foreign.basketno" => "self.basketno" },
671 is_deferrable => 1,
672 join_type => "LEFT",
673 on_delete => "CASCADE",
674 on_update => "CASCADE",
678 __PACKAGE__->belongs_to(
679 "biblio",
680 "Koha::Schema::Result::Biblio",
681 { 'foreign.biblionumber' => "self.biblionumber" },
683 is_deferrable => 1,
684 join_type => "LEFT",
685 on_delete => "SET NULL",
686 on_update => "CASCADE",
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" },
697 __PACKAGE__->belongs_to(
698 "invoice",
699 "Koha::Schema::Result::Aqinvoice",
700 { "foreign.invoiceid" => "self.invoiceid" },
702 is_deferrable => 1,
703 join_type => "LEFT",
704 on_delete => "SET NULL",
705 on_update => "CASCADE",
709 __PACKAGE__->belongs_to(
710 "subscription",
711 "Koha::Schema::Result::Subscription",
712 { "foreign.subscriptionid" => "self.subscriptionid" },
714 is_deferrable => 1,
715 join_type => "LEFT",
716 on_delete => "CASCADE",
717 on_update => "CASCADE",
721 sub koha_objects_class {
722 'Koha::Acquisition::Orders';
725 sub koha_object_class {
726 'Koha::Acquisition::Order';
729 __PACKAGE__->add_columns(
730 '+uncertainprice' => { is_boolean => 1 }