Bug 26947: DBIC schema changes
[koha.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 borrowernumber
244
245 Type: belongs_to
246
247 Related object: L<Koha::Schema::Result::Borrower>
248
249 =cut
250
251 __PACKAGE__->belongs_to(
252   "borrowernumber",
253   "Koha::Schema::Result::Borrower",
254   { borrowernumber => "borrowernumber" },
255   {
256     is_deferrable => 1,
257     join_type     => "LEFT",
258     on_delete     => "SET NULL",
259     on_update     => "CASCADE",
260   },
261 );
262
263 =head2 branchcode
264
265 Type: belongs_to
266
267 Related object: L<Koha::Schema::Result::Branch>
268
269 =cut
270
271 __PACKAGE__->belongs_to(
272   "branchcode",
273   "Koha::Schema::Result::Branch",
274   { branchcode => "branchcode" },
275   {
276     is_deferrable => 1,
277     join_type     => "LEFT",
278     on_delete     => "SET NULL",
279     on_update     => "CASCADE",
280   },
281 );
282
283 =head2 credit_type_code
284
285 Type: belongs_to
286
287 Related object: L<Koha::Schema::Result::AccountCreditType>
288
289 =cut
290
291 __PACKAGE__->belongs_to(
292   "credit_type_code",
293   "Koha::Schema::Result::AccountCreditType",
294   { code => "credit_type_code" },
295   {
296     is_deferrable => 1,
297     join_type     => "LEFT",
298     on_delete     => "RESTRICT",
299     on_update     => "CASCADE",
300   },
301 );
302
303 =head2 debit_type_code
304
305 Type: belongs_to
306
307 Related object: L<Koha::Schema::Result::AccountDebitType>
308
309 =cut
310
311 __PACKAGE__->belongs_to(
312   "debit_type_code",
313   "Koha::Schema::Result::AccountDebitType",
314   { code => "debit_type_code" },
315   {
316     is_deferrable => 1,
317     join_type     => "LEFT",
318     on_delete     => "RESTRICT",
319     on_update     => "CASCADE",
320   },
321 );
322
323 =head2 itemnumber
324
325 Type: belongs_to
326
327 Related object: L<Koha::Schema::Result::Item>
328
329 =cut
330
331 __PACKAGE__->belongs_to(
332   "itemnumber",
333   "Koha::Schema::Result::Item",
334   { itemnumber => "itemnumber" },
335   {
336     is_deferrable => 1,
337     join_type     => "LEFT",
338     on_delete     => "SET NULL",
339     on_update     => "CASCADE",
340   },
341 );
342
343 =head2 manager
344
345 Type: belongs_to
346
347 Related object: L<Koha::Schema::Result::Borrower>
348
349 =cut
350
351 __PACKAGE__->belongs_to(
352   "manager",
353   "Koha::Schema::Result::Borrower",
354   { borrowernumber => "manager_id" },
355   {
356     is_deferrable => 1,
357     join_type     => "LEFT",
358     on_delete     => "SET NULL",
359     on_update     => "CASCADE",
360   },
361 );
362
363 =head2 register
364
365 Type: belongs_to
366
367 Related object: L<Koha::Schema::Result::CashRegister>
368
369 =cut
370
371 __PACKAGE__->belongs_to(
372   "register",
373   "Koha::Schema::Result::CashRegister",
374   { id => "register_id" },
375   {
376     is_deferrable => 1,
377     join_type     => "LEFT",
378     on_delete     => "SET NULL",
379     on_update     => "CASCADE",
380   },
381 );
382
383
384 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29
385 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MBdnk+5gD5TMX/ZOqEf3kA
386
387 =head2 library
388
389 Type: belongs_to
390
391 Related object: L<Koha::Schema::Result::Branch>
392
393 =cut
394
395 __PACKAGE__->belongs_to(
396   "library",
397   "Koha::Schema::Result::Branch",
398   { branchcode => "branchcode" },
399   {
400     is_deferrable => 1,
401     join_type     => "LEFT",
402     on_delete     => "SET NULL",
403     on_update     => "CASCADE",
404   },
405 );
406
407 sub koha_objects_class {
408     'Koha::Account::Lines';
409 }
410 sub koha_object_class {
411     'Koha::Account::Line';
412 }
413
414 1;