90e80437737aba9b01d6083870879348b7248254
[koha-equinox.git] / Koha / Schema / Result / Aqbasket.pm
1 use utf8;
2 package Koha::Schema::Result::Aqbasket;
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::Aqbasket
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<aqbasket>
19
20 =cut
21
22 __PACKAGE__->table("aqbasket");
23
24 =head1 ACCESSORS
25
26 =head2 basketno
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 basketname
33
34   data_type: 'varchar'
35   is_nullable: 1
36   size: 50
37
38 =head2 note
39
40   data_type: 'longtext'
41   is_nullable: 1
42
43 =head2 booksellernote
44
45   data_type: 'longtext'
46   is_nullable: 1
47
48 =head2 contractnumber
49
50   data_type: 'integer'
51   is_foreign_key: 1
52   is_nullable: 1
53
54 =head2 creationdate
55
56   data_type: 'date'
57   datetime_undef_if_invalid: 1
58   is_nullable: 1
59
60 =head2 closedate
61
62   data_type: 'date'
63   datetime_undef_if_invalid: 1
64   is_nullable: 1
65
66 =head2 booksellerid
67
68   data_type: 'integer'
69   default_value: 1
70   is_foreign_key: 1
71   is_nullable: 0
72
73 =head2 authorisedby
74
75   data_type: 'varchar'
76   is_nullable: 1
77   size: 10
78
79 =head2 booksellerinvoicenumber
80
81   data_type: 'longtext'
82   is_nullable: 1
83
84 =head2 basketgroupid
85
86   data_type: 'integer'
87   is_foreign_key: 1
88   is_nullable: 1
89
90 =head2 deliveryplace
91
92   data_type: 'varchar'
93   is_nullable: 1
94   size: 10
95
96 =head2 billingplace
97
98   data_type: 'varchar'
99   is_nullable: 1
100   size: 10
101
102 =head2 branch
103
104   data_type: 'varchar'
105   is_foreign_key: 1
106   is_nullable: 1
107   size: 10
108
109 =head2 is_standing
110
111   data_type: 'tinyint'
112   default_value: 0
113   is_nullable: 0
114
115 =head2 create_items
116
117   data_type: 'enum'
118   extra: {list => ["ordering","receiving","cataloguing"]}
119   is_nullable: 1
120
121 =cut
122
123 __PACKAGE__->add_columns(
124   "basketno",
125   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
126   "basketname",
127   { data_type => "varchar", is_nullable => 1, size => 50 },
128   "note",
129   { data_type => "longtext", is_nullable => 1 },
130   "booksellernote",
131   { data_type => "longtext", is_nullable => 1 },
132   "contractnumber",
133   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
134   "creationdate",
135   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
136   "closedate",
137   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
138   "booksellerid",
139   {
140     data_type      => "integer",
141     default_value  => 1,
142     is_foreign_key => 1,
143     is_nullable    => 0,
144   },
145   "authorisedby",
146   { data_type => "varchar", is_nullable => 1, size => 10 },
147   "booksellerinvoicenumber",
148   { data_type => "longtext", is_nullable => 1 },
149   "basketgroupid",
150   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
151   "deliveryplace",
152   { data_type => "varchar", is_nullable => 1, size => 10 },
153   "billingplace",
154   { data_type => "varchar", is_nullable => 1, size => 10 },
155   "branch",
156   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
157   "is_standing",
158   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
159   "create_items",
160   {
161     data_type => "enum",
162     extra => { list => ["ordering", "receiving", "cataloguing"] },
163     is_nullable => 1,
164   },
165 );
166
167 =head1 PRIMARY KEY
168
169 =over 4
170
171 =item * L</basketno>
172
173 =back
174
175 =cut
176
177 __PACKAGE__->set_primary_key("basketno");
178
179 =head1 RELATIONS
180
181 =head2 aqbasketusers
182
183 Type: has_many
184
185 Related object: L<Koha::Schema::Result::Aqbasketuser>
186
187 =cut
188
189 __PACKAGE__->has_many(
190   "aqbasketusers",
191   "Koha::Schema::Result::Aqbasketuser",
192   { "foreign.basketno" => "self.basketno" },
193   { cascade_copy => 0, cascade_delete => 0 },
194 );
195
196 =head2 aqorders
197
198 Type: has_many
199
200 Related object: L<Koha::Schema::Result::Aqorder>
201
202 =cut
203
204 __PACKAGE__->has_many(
205   "aqorders",
206   "Koha::Schema::Result::Aqorder",
207   { "foreign.basketno" => "self.basketno" },
208   { cascade_copy => 0, cascade_delete => 0 },
209 );
210
211 =head2 basketgroupid
212
213 Type: belongs_to
214
215 Related object: L<Koha::Schema::Result::Aqbasketgroup>
216
217 =cut
218
219 __PACKAGE__->belongs_to(
220   "basketgroupid",
221   "Koha::Schema::Result::Aqbasketgroup",
222   { id => "basketgroupid" },
223   {
224     is_deferrable => 1,
225     join_type     => "LEFT",
226     on_delete     => "RESTRICT",
227     on_update     => "CASCADE",
228   },
229 );
230
231 =head2 booksellerid
232
233 Type: belongs_to
234
235 Related object: L<Koha::Schema::Result::Aqbookseller>
236
237 =cut
238
239 __PACKAGE__->belongs_to(
240   "booksellerid",
241   "Koha::Schema::Result::Aqbookseller",
242   { id => "booksellerid" },
243   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "CASCADE" },
244 );
245
246 =head2 branch
247
248 Type: belongs_to
249
250 Related object: L<Koha::Schema::Result::Branch>
251
252 =cut
253
254 __PACKAGE__->belongs_to(
255   "branch",
256   "Koha::Schema::Result::Branch",
257   { branchcode => "branch" },
258   {
259     is_deferrable => 1,
260     join_type     => "LEFT",
261     on_delete     => "SET NULL",
262     on_update     => "CASCADE",
263   },
264 );
265
266 =head2 contractnumber
267
268 Type: belongs_to
269
270 Related object: L<Koha::Schema::Result::Aqcontract>
271
272 =cut
273
274 __PACKAGE__->belongs_to(
275   "contractnumber",
276   "Koha::Schema::Result::Aqcontract",
277   { contractnumber => "contractnumber" },
278   {
279     is_deferrable => 1,
280     join_type     => "LEFT",
281     on_delete     => "RESTRICT",
282     on_update     => "RESTRICT",
283   },
284 );
285
286 =head2 edifact_messages
287
288 Type: has_many
289
290 Related object: L<Koha::Schema::Result::EdifactMessage>
291
292 =cut
293
294 __PACKAGE__->has_many(
295   "edifact_messages",
296   "Koha::Schema::Result::EdifactMessage",
297   { "foreign.basketno" => "self.basketno" },
298   { cascade_copy => 0, cascade_delete => 0 },
299 );
300
301 =head2 borrowernumbers
302
303 Type: many_to_many
304
305 Composing rels: L</aqbasketusers> -> borrowernumber
306
307 =cut
308
309 __PACKAGE__->many_to_many("borrowernumbers", "aqbasketusers", "borrowernumber");
310
311
312 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53
313 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gSw/f4JmMBzEssEFRg2fAQ
314
315 __PACKAGE__->has_many(
316   "additional_field_values",
317   "Koha::Schema::Result::AdditionalFieldValue",
318   sub {
319     my ($args) = @_;
320
321     return {
322         "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.basketno" },
323
324         "$args->{foreign_alias}.field_id" =>
325             { -in => \'(SELECT id FROM additional_fields WHERE tablename = "aqbasket")' },
326     };
327   },
328   { cascade_copy => 0, cascade_delete => 0 },
329 );
330
331 # You can replace this text with custom code or comments, and it will be preserved on regeneration
332 1;