Bug 32257: Label for patron attributes misaligned
[koha-ffzg.git] / Koha / Schema / Result / Accountline.pm
1 use utf8;
2 package Koha::Schema::Result::Accountline;
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::Accountline
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<accountlines>
19
20 =cut
21
22 __PACKAGE__->table("accountlines");
23
24 =head1 ACCESSORS
25
26 =head2 accountlines_id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 issue_id
33
34   data_type: 'integer'
35   is_nullable: 1
36
37 =head2 borrowernumber
38
39   data_type: 'integer'
40   is_foreign_key: 1
41   is_nullable: 1
42
43 =head2 itemnumber
44
45   data_type: 'integer'
46   is_foreign_key: 1
47   is_nullable: 1
48
49 =head2 date
50
51   data_type: 'timestamp'
52   datetime_undef_if_invalid: 1
53   is_nullable: 1
54
55 =head2 amount
56
57   data_type: 'decimal'
58   is_nullable: 1
59   size: [28,6]
60
61 =head2 description
62
63   data_type: 'longtext'
64   is_nullable: 1
65
66 =head2 credit_type_code
67
68   data_type: 'varchar'
69   is_foreign_key: 1
70   is_nullable: 1
71   size: 80
72
73 =head2 debit_type_code
74
75   data_type: 'varchar'
76   is_foreign_key: 1
77   is_nullable: 1
78   size: 80
79
80 =head2 credit_number
81
82   data_type: 'varchar'
83   is_nullable: 1
84   size: 20
85
86 autogenerated number for credits
87
88 =head2 status
89
90   data_type: 'varchar'
91   is_nullable: 1
92   size: 16
93
94 =head2 payment_type
95
96   data_type: 'varchar'
97   is_nullable: 1
98   size: 80
99
100 optional authorised value PAYMENT_TYPE
101
102 =head2 amountoutstanding
103
104   data_type: 'decimal'
105   is_nullable: 1
106   size: [28,6]
107
108 =head2 timestamp
109
110   data_type: 'timestamp'
111   datetime_undef_if_invalid: 1
112   default_value: current_timestamp
113   is_nullable: 0
114
115 =head2 note
116
117   data_type: 'mediumtext'
118   is_nullable: 1
119
120 =head2 manager_id
121
122   data_type: 'integer'
123   is_foreign_key: 1
124   is_nullable: 1
125
126 =head2 register_id
127
128   data_type: 'integer'
129   is_foreign_key: 1
130   is_nullable: 1
131
132 =head2 interface
133
134   data_type: 'varchar'
135   is_nullable: 0
136   size: 16
137
138 =head2 branchcode
139
140   data_type: 'varchar'
141   is_foreign_key: 1
142   is_nullable: 1
143   size: 10
144
145 the branchcode of the library where a payment was made, a manual invoice created, etc.
146
147 =cut
148
149 __PACKAGE__->add_columns(
150   "accountlines_id",
151   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
152   "issue_id",
153   { data_type => "integer", is_nullable => 1 },
154   "borrowernumber",
155   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
156   "itemnumber",
157   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
158   "date",
159   {
160     data_type => "timestamp",
161     datetime_undef_if_invalid => 1,
162     is_nullable => 1,
163   },
164   "amount",
165   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
166   "description",
167   { data_type => "longtext", is_nullable => 1 },
168   "credit_type_code",
169   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 80 },
170   "debit_type_code",
171   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 80 },
172   "credit_number",
173   { data_type => "varchar", is_nullable => 1, size => 20 },
174   "status",
175   { data_type => "varchar", is_nullable => 1, size => 16 },
176   "payment_type",
177   { data_type => "varchar", is_nullable => 1, size => 80 },
178   "amountoutstanding",
179   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
180   "timestamp",
181   {
182     data_type => "timestamp",
183     datetime_undef_if_invalid => 1,
184     default_value => \"current_timestamp",
185     is_nullable => 0,
186   },
187   "note",
188   { data_type => "mediumtext", is_nullable => 1 },
189   "manager_id",
190   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
191   "register_id",
192   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
193   "interface",
194   { data_type => "varchar", is_nullable => 0, size => 16 },
195   "branchcode",
196   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
197 );
198
199 =head1 PRIMARY KEY
200
201 =over 4
202
203 =item * L</accountlines_id>
204
205 =back
206
207 =cut
208
209 __PACKAGE__->set_primary_key("accountlines_id");
210
211 =head1 RELATIONS
212
213 =head2 account_offsets_credits
214
215 Type: has_many
216
217 Related object: L<Koha::Schema::Result::AccountOffset>
218
219 =cut
220
221 __PACKAGE__->has_many(
222   "account_offsets_credits",
223   "Koha::Schema::Result::AccountOffset",
224   { "foreign.credit_id" => "self.accountlines_id" },
225   { cascade_copy => 0, cascade_delete => 0 },
226 );
227
228 =head2 account_offsets_debits
229
230 Type: has_many
231
232 Related object: L<Koha::Schema::Result::AccountOffset>
233
234 =cut
235
236 __PACKAGE__->has_many(
237   "account_offsets_debits",
238   "Koha::Schema::Result::AccountOffset",
239   { "foreign.debit_id" => "self.accountlines_id" },
240   { cascade_copy => 0, cascade_delete => 0 },
241 );
242
243 =head2 article_requests
244
245 Type: has_many
246
247 Related object: L<Koha::Schema::Result::ArticleRequest>
248
249 =cut
250
251 __PACKAGE__->has_many(
252   "article_requests",
253   "Koha::Schema::Result::ArticleRequest",
254   { "foreign.debit_id" => "self.accountlines_id" },
255   { cascade_copy => 0, cascade_delete => 0 },
256 );
257
258 =head2 borrowernumber
259
260 Type: belongs_to
261
262 Related object: L<Koha::Schema::Result::Borrower>
263
264 =cut
265
266 __PACKAGE__->belongs_to(
267   "borrowernumber",
268   "Koha::Schema::Result::Borrower",
269   { borrowernumber => "borrowernumber" },
270   {
271     is_deferrable => 1,
272     join_type     => "LEFT",
273     on_delete     => "SET NULL",
274     on_update     => "CASCADE",
275   },
276 );
277
278 =head2 branchcode
279
280 Type: belongs_to
281
282 Related object: L<Koha::Schema::Result::Branch>
283
284 =cut
285
286 __PACKAGE__->belongs_to(
287   "branchcode",
288   "Koha::Schema::Result::Branch",
289   { branchcode => "branchcode" },
290   {
291     is_deferrable => 1,
292     join_type     => "LEFT",
293     on_delete     => "SET NULL",
294     on_update     => "CASCADE",
295   },
296 );
297
298 =head2 credit_type_code
299
300 Type: belongs_to
301
302 Related object: L<Koha::Schema::Result::AccountCreditType>
303
304 =cut
305
306 __PACKAGE__->belongs_to(
307   "credit_type_code",
308   "Koha::Schema::Result::AccountCreditType",
309   { code => "credit_type_code" },
310   {
311     is_deferrable => 1,
312     join_type     => "LEFT",
313     on_delete     => "RESTRICT",
314     on_update     => "CASCADE",
315   },
316 );
317
318 =head2 debit_type_code
319
320 Type: belongs_to
321
322 Related object: L<Koha::Schema::Result::AccountDebitType>
323
324 =cut
325
326 __PACKAGE__->belongs_to(
327   "debit_type_code",
328   "Koha::Schema::Result::AccountDebitType",
329   { code => "debit_type_code" },
330   {
331     is_deferrable => 1,
332     join_type     => "LEFT",
333     on_delete     => "RESTRICT",
334     on_update     => "CASCADE",
335   },
336 );
337
338 =head2 itemnumber
339
340 Type: belongs_to
341
342 Related object: L<Koha::Schema::Result::Item>
343
344 =cut
345
346 __PACKAGE__->belongs_to(
347   "itemnumber",
348   "Koha::Schema::Result::Item",
349   { itemnumber => "itemnumber" },
350   {
351     is_deferrable => 1,
352     join_type     => "LEFT",
353     on_delete     => "SET NULL",
354     on_update     => "CASCADE",
355   },
356 );
357
358 =head2 manager
359
360 Type: belongs_to
361
362 Related object: L<Koha::Schema::Result::Borrower>
363
364 =cut
365
366 __PACKAGE__->belongs_to(
367   "manager",
368   "Koha::Schema::Result::Borrower",
369   { borrowernumber => "manager_id" },
370   {
371     is_deferrable => 1,
372     join_type     => "LEFT",
373     on_delete     => "SET NULL",
374     on_update     => "CASCADE",
375   },
376 );
377
378 =head2 register
379
380 Type: belongs_to
381
382 Related object: L<Koha::Schema::Result::CashRegister>
383
384 =cut
385
386 __PACKAGE__->belongs_to(
387   "register",
388   "Koha::Schema::Result::CashRegister",
389   { id => "register_id" },
390   {
391     is_deferrable => 1,
392     join_type     => "LEFT",
393     on_delete     => "SET NULL",
394     on_update     => "CASCADE",
395   },
396 );
397
398
399 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-28 20:21:02
400 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PjQR7oUkefiDt+eV69jZ3A
401
402 =head2 library
403
404 Type: belongs_to
405
406 Related object: L<Koha::Schema::Result::Branch>
407
408 =cut
409
410 __PACKAGE__->belongs_to(
411   "library",
412   "Koha::Schema::Result::Branch",
413   { branchcode => "branchcode" },
414   {
415     is_deferrable => 1,
416     join_type     => "LEFT",
417     on_delete     => "SET NULL",
418     on_update     => "CASCADE",
419   },
420 );
421
422 __PACKAGE__->has_many(
423   "additional_field_values",
424   "Koha::Schema::Result::AdditionalFieldValue",
425   sub {
426     my ($args) = @_;
427
428     return {
429         "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.accountlines_id" },
430
431         "$args->{foreign_alias}.field_id" =>
432             { -in => \'(SELECT id FROM additional_fields WHERE tablename LIKE "accountlines:%")' },
433     };
434   },
435   { cascade_copy => 0, cascade_delete => 0 },
436 );
437
438 sub koha_objects_class {
439     'Koha::Account::Lines';
440 }
441 sub koha_object_class {
442     'Koha::Account::Line';
443 }
444
445 1;