Bug 8976: DBIC schema changes
[koha.git] / Koha / Schema / Result / Aqbudget.pm
1 use utf8;
2 package Koha::Schema::Result::Aqbudget;
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::Aqbudget
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<aqbudgets>
19
20 =cut
21
22 __PACKAGE__->table("aqbudgets");
23
24 =head1 ACCESSORS
25
26 =head2 budget_id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 primary key and unique number assigned to each fund by Koha
33
34 =head2 budget_parent_id
35
36   data_type: 'integer'
37   is_nullable: 1
38
39 if this fund is a child of another this will include the parent id (aqbudgets.budget_id)
40
41 =head2 budget_code
42
43   data_type: 'varchar'
44   is_nullable: 1
45   size: 30
46
47 code assigned to the fund by the user
48
49 =head2 budget_name
50
51   data_type: 'varchar'
52   is_nullable: 1
53   size: 80
54
55 name assigned to the fund by the user
56
57 =head2 budget_branchcode
58
59   data_type: 'varchar'
60   is_nullable: 1
61   size: 10
62
63 branch that this fund belongs to (branches.branchcode)
64
65 =head2 budget_amount
66
67   data_type: 'decimal'
68   default_value: 0.000000
69   is_nullable: 1
70   size: [28,6]
71
72 total amount for this fund
73
74 =head2 budget_encumb
75
76   data_type: 'decimal'
77   default_value: 0.000000
78   is_nullable: 1
79   size: [28,6]
80
81 budget warning at percentage
82
83 =head2 budget_expend
84
85   data_type: 'decimal'
86   default_value: 0.000000
87   is_nullable: 1
88   size: [28,6]
89
90 budget warning at amount
91
92 =head2 budget_notes
93
94   data_type: 'longtext'
95   is_nullable: 1
96
97 notes related to this fund
98
99 =head2 timestamp
100
101   data_type: 'timestamp'
102   datetime_undef_if_invalid: 1
103   default_value: current_timestamp
104   is_nullable: 0
105
106 date and time this fund was last touched (created or modified)
107
108 =head2 budget_period_id
109
110   data_type: 'integer'
111   is_foreign_key: 1
112   is_nullable: 1
113
114 id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)
115
116 =head2 sort1_authcat
117
118   data_type: 'varchar'
119   is_nullable: 1
120   size: 80
121
122 statistical category for this fund
123
124 =head2 sort2_authcat
125
126   data_type: 'varchar'
127   is_nullable: 1
128   size: 80
129
130 second statistical category for this fund
131
132 =head2 budget_owner_id
133
134   data_type: 'integer'
135   is_nullable: 1
136
137 borrowernumber of the person who owns this fund (borrowers.borrowernumber)
138
139 =head2 budget_permission
140
141   data_type: 'integer'
142   default_value: 0
143   is_nullable: 1
144
145 level of permission for this fund (used only by the owner, only by the library, or anyone)
146
147 =cut
148
149 __PACKAGE__->add_columns(
150   "budget_id",
151   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
152   "budget_parent_id",
153   { data_type => "integer", is_nullable => 1 },
154   "budget_code",
155   { data_type => "varchar", is_nullable => 1, size => 30 },
156   "budget_name",
157   { data_type => "varchar", is_nullable => 1, size => 80 },
158   "budget_branchcode",
159   { data_type => "varchar", is_nullable => 1, size => 10 },
160   "budget_amount",
161   {
162     data_type => "decimal",
163     default_value => "0.000000",
164     is_nullable => 1,
165     size => [28, 6],
166   },
167   "budget_encumb",
168   {
169     data_type => "decimal",
170     default_value => "0.000000",
171     is_nullable => 1,
172     size => [28, 6],
173   },
174   "budget_expend",
175   {
176     data_type => "decimal",
177     default_value => "0.000000",
178     is_nullable => 1,
179     size => [28, 6],
180   },
181   "budget_notes",
182   { data_type => "longtext", is_nullable => 1 },
183   "timestamp",
184   {
185     data_type => "timestamp",
186     datetime_undef_if_invalid => 1,
187     default_value => \"current_timestamp",
188     is_nullable => 0,
189   },
190   "budget_period_id",
191   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
192   "sort1_authcat",
193   { data_type => "varchar", is_nullable => 1, size => 80 },
194   "sort2_authcat",
195   { data_type => "varchar", is_nullable => 1, size => 80 },
196   "budget_owner_id",
197   { data_type => "integer", is_nullable => 1 },
198   "budget_permission",
199   { data_type => "integer", default_value => 0, is_nullable => 1 },
200 );
201
202 =head1 PRIMARY KEY
203
204 =over 4
205
206 =item * L</budget_id>
207
208 =back
209
210 =cut
211
212 __PACKAGE__->set_primary_key("budget_id");
213
214 =head1 RELATIONS
215
216 =head2 aqbudgetborrowers
217
218 Type: has_many
219
220 Related object: L<Koha::Schema::Result::Aqbudgetborrower>
221
222 =cut
223
224 __PACKAGE__->has_many(
225   "aqbudgetborrowers",
226   "Koha::Schema::Result::Aqbudgetborrower",
227   { "foreign.budget_id" => "self.budget_id" },
228   { cascade_copy => 0, cascade_delete => 0 },
229 );
230
231 =head2 aqbudgets_plannings
232
233 Type: has_many
234
235 Related object: L<Koha::Schema::Result::AqbudgetsPlanning>
236
237 =cut
238
239 __PACKAGE__->has_many(
240   "aqbudgets_plannings",
241   "Koha::Schema::Result::AqbudgetsPlanning",
242   { "foreign.budget_id" => "self.budget_id" },
243   { cascade_copy => 0, cascade_delete => 0 },
244 );
245
246 =head2 aqinvoice_adjustments
247
248 Type: has_many
249
250 Related object: L<Koha::Schema::Result::AqinvoiceAdjustment>
251
252 =cut
253
254 __PACKAGE__->has_many(
255   "aqinvoice_adjustments",
256   "Koha::Schema::Result::AqinvoiceAdjustment",
257   { "foreign.budget_id" => "self.budget_id" },
258   { cascade_copy => 0, cascade_delete => 0 },
259 );
260
261 =head2 aqinvoices
262
263 Type: has_many
264
265 Related object: L<Koha::Schema::Result::Aqinvoice>
266
267 =cut
268
269 __PACKAGE__->has_many(
270   "aqinvoices",
271   "Koha::Schema::Result::Aqinvoice",
272   { "foreign.shipmentcost_budgetid" => "self.budget_id" },
273   { cascade_copy => 0, cascade_delete => 0 },
274 );
275
276 =head2 aqorders
277
278 Type: has_many
279
280 Related object: L<Koha::Schema::Result::Aqorder>
281
282 =cut
283
284 __PACKAGE__->has_many(
285   "aqorders",
286   "Koha::Schema::Result::Aqorder",
287   { "foreign.budget_id" => "self.budget_id" },
288   { cascade_copy => 0, cascade_delete => 0 },
289 );
290
291 =head2 budget_period
292
293 Type: belongs_to
294
295 Related object: L<Koha::Schema::Result::Aqbudgetperiod>
296
297 =cut
298
299 __PACKAGE__->belongs_to(
300   "budget_period",
301   "Koha::Schema::Result::Aqbudgetperiod",
302   { budget_period_id => "budget_period_id" },
303   {
304     is_deferrable => 1,
305     join_type     => "LEFT",
306     on_delete     => "CASCADE",
307     on_update     => "CASCADE",
308   },
309 );
310
311 =head2 suggestions
312
313 Type: has_many
314
315 Related object: L<Koha::Schema::Result::Suggestion>
316
317 =cut
318
319 __PACKAGE__->has_many(
320   "suggestions",
321   "Koha::Schema::Result::Suggestion",
322   { "foreign.budgetid" => "self.budget_id" },
323   { cascade_copy => 0, cascade_delete => 0 },
324 );
325
326 =head2 vendor_edi_accounts
327
328 Type: has_many
329
330 Related object: L<Koha::Schema::Result::VendorEdiAccount>
331
332 =cut
333
334 __PACKAGE__->has_many(
335   "vendor_edi_accounts",
336   "Koha::Schema::Result::VendorEdiAccount",
337   { "foreign.shipment_budget" => "self.budget_id" },
338   { cascade_copy => 0, cascade_delete => 0 },
339 );
340
341 =head2 borrowernumbers
342
343 Type: many_to_many
344
345 Composing rels: L</aqbudgetborrowers> -> borrowernumber
346
347 =cut
348
349 __PACKAGE__->many_to_many("borrowernumbers", "aqbudgetborrowers", "borrowernumber");
350
351
352 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29
353 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sl+TGQXY85UWwS+Ld/vvyQ
354
355 __PACKAGE__->belongs_to(
356   "budget",
357   "Koha::Schema::Result::Aqbudgetperiod",
358   { "foreign.budget_period_id" => "self.budget_period_id" },
359   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
360 );
361
362 sub koha_object_class {
363     'Koha::Acquisition::Fund';
364 }
365 sub koha_objects_class {
366     'Koha::Acquisition::Funds';
367 }
368
369 1;