Bug 32257: Label for patron attributes misaligned
[koha-ffzg.git] / Koha / Schema / Result / Aqinvoice.pm
1 use utf8;
2 package Koha::Schema::Result::Aqinvoice;
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::Aqinvoice
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<aqinvoices>
19
20 =cut
21
22 __PACKAGE__->table("aqinvoices");
23
24 =head1 ACCESSORS
25
26 =head2 invoiceid
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 ID of the invoice, primary key
33
34 =head2 invoicenumber
35
36   data_type: 'longtext'
37   is_nullable: 0
38
39 Name of invoice
40
41 =head2 booksellerid
42
43   data_type: 'integer'
44   is_foreign_key: 1
45   is_nullable: 0
46
47 foreign key to aqbooksellers
48
49 =head2 shipmentdate
50
51   data_type: 'date'
52   datetime_undef_if_invalid: 1
53   is_nullable: 1
54
55 date of shipment
56
57 =head2 billingdate
58
59   data_type: 'date'
60   datetime_undef_if_invalid: 1
61   is_nullable: 1
62
63 date of billing
64
65 =head2 closedate
66
67   data_type: 'date'
68   datetime_undef_if_invalid: 1
69   is_nullable: 1
70
71 invoice close date, NULL means the invoice is open
72
73 =head2 shipmentcost
74
75   data_type: 'decimal'
76   is_nullable: 1
77   size: [28,6]
78
79 shipment cost
80
81 =head2 shipmentcost_budgetid
82
83   data_type: 'integer'
84   is_foreign_key: 1
85   is_nullable: 1
86
87 foreign key to aqbudgets, link the shipment cost to a budget
88
89 =head2 message_id
90
91   data_type: 'integer'
92   is_foreign_key: 1
93   is_nullable: 1
94
95 foreign key to edifact invoice message
96
97 =cut
98
99 __PACKAGE__->add_columns(
100   "invoiceid",
101   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
102   "invoicenumber",
103   { data_type => "longtext", is_nullable => 0 },
104   "booksellerid",
105   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
106   "shipmentdate",
107   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
108   "billingdate",
109   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
110   "closedate",
111   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
112   "shipmentcost",
113   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
114   "shipmentcost_budgetid",
115   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
116   "message_id",
117   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
118 );
119
120 =head1 PRIMARY KEY
121
122 =over 4
123
124 =item * L</invoiceid>
125
126 =back
127
128 =cut
129
130 __PACKAGE__->set_primary_key("invoiceid");
131
132 =head1 RELATIONS
133
134 =head2 aqinvoice_adjustments
135
136 Type: has_many
137
138 Related object: L<Koha::Schema::Result::AqinvoiceAdjustment>
139
140 =cut
141
142 __PACKAGE__->has_many(
143   "aqinvoice_adjustments",
144   "Koha::Schema::Result::AqinvoiceAdjustment",
145   { "foreign.invoiceid" => "self.invoiceid" },
146   { cascade_copy => 0, cascade_delete => 0 },
147 );
148
149 =head2 aqorders
150
151 Type: has_many
152
153 Related object: L<Koha::Schema::Result::Aqorder>
154
155 =cut
156
157 __PACKAGE__->has_many(
158   "aqorders",
159   "Koha::Schema::Result::Aqorder",
160   { "foreign.invoiceid" => "self.invoiceid" },
161   { cascade_copy => 0, cascade_delete => 0 },
162 );
163
164 =head2 booksellerid
165
166 Type: belongs_to
167
168 Related object: L<Koha::Schema::Result::Aqbookseller>
169
170 =cut
171
172 __PACKAGE__->belongs_to(
173   "booksellerid",
174   "Koha::Schema::Result::Aqbookseller",
175   { id => "booksellerid" },
176   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
177 );
178
179 =head2 message
180
181 Type: belongs_to
182
183 Related object: L<Koha::Schema::Result::EdifactMessage>
184
185 =cut
186
187 __PACKAGE__->belongs_to(
188   "message",
189   "Koha::Schema::Result::EdifactMessage",
190   { id => "message_id" },
191   {
192     is_deferrable => 1,
193     join_type     => "LEFT",
194     on_delete     => "SET NULL",
195     on_update     => "RESTRICT",
196   },
197 );
198
199 =head2 shipmentcost_budgetid
200
201 Type: belongs_to
202
203 Related object: L<Koha::Schema::Result::Aqbudget>
204
205 =cut
206
207 __PACKAGE__->belongs_to(
208   "shipmentcost_budgetid",
209   "Koha::Schema::Result::Aqbudget",
210   { budget_id => "shipmentcost_budgetid" },
211   {
212     is_deferrable => 1,
213     join_type     => "LEFT",
214     on_delete     => "SET NULL",
215     on_update     => "CASCADE",
216   },
217 );
218
219
220 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29
221 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LkekSbup37Z2WVnU/c9K+g
222
223 __PACKAGE__->has_many(
224     "additional_field_values",
225     "Koha::Schema::Result::AdditionalFieldValue",
226     sub {
227         my ($args) = @_;
228
229         return {
230             "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.invoiceid" },
231
232             "$args->{foreign_alias}.field_id" =>
233               { -in => \'(SELECT id FROM additional_fields WHERE tablename="aqinvoices")' },
234         };
235     },
236     { cascade_copy => 0, cascade_delete => 0 },
237 );
238
239 sub koha_object_class {
240     'Koha::Acquisition::Invoice';
241 }
242 sub koha_objects_class {
243     'Koha::Acquisition::Invoices';
244 }
245
246 1;