Bug 31374: (follow-up) change private note to staff_note and reorder columns
[koha.git] / Koha / Schema / Result / Suggestion.pm
1 use utf8;
2 package Koha::Schema::Result::Suggestion;
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::Suggestion
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<suggestions>
19
20 =cut
21
22 __PACKAGE__->table("suggestions");
23
24 =head1 ACCESSORS
25
26 =head2 suggestionid
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 unique identifier assigned automatically by Koha
33
34 =head2 suggestedby
35
36   data_type: 'integer'
37   is_foreign_key: 1
38   is_nullable: 1
39
40 borrowernumber for the person making the suggestion, foreign key linking to the borrowers table
41
42 =head2 suggesteddate
43
44   data_type: 'date'
45   datetime_undef_if_invalid: 1
46   is_nullable: 0
47
48 date the suggestion was submitted
49
50 =head2 managedby
51
52   data_type: 'integer'
53   is_foreign_key: 1
54   is_nullable: 1
55
56 borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table
57
58 =head2 manageddate
59
60   data_type: 'date'
61   datetime_undef_if_invalid: 1
62   is_nullable: 1
63
64 date the suggestion was updated
65
66 =head2 acceptedby
67
68   data_type: 'integer'
69   is_foreign_key: 1
70   is_nullable: 1
71
72 borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table
73
74 =head2 accepteddate
75
76   data_type: 'date'
77   datetime_undef_if_invalid: 1
78   is_nullable: 1
79
80 date the suggestion was marked as accepted
81
82 =head2 rejectedby
83
84   data_type: 'integer'
85   is_foreign_key: 1
86   is_nullable: 1
87
88 borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
89
90 =head2 rejecteddate
91
92   data_type: 'date'
93   datetime_undef_if_invalid: 1
94   is_nullable: 1
95
96 date the suggestion was marked as rejected
97
98 =head2 lastmodificationby
99
100   data_type: 'integer'
101   is_foreign_key: 1
102   is_nullable: 1
103
104 borrowernumber for the librarian who edit the suggestion for the last time
105
106 =head2 lastmodificationdate
107
108   data_type: 'date'
109   datetime_undef_if_invalid: 1
110   is_nullable: 1
111
112 date of the last modification
113
114 =head2 STATUS
115
116   accessor: 'status'
117   data_type: 'varchar'
118   default_value: (empty string)
119   is_nullable: 0
120   size: 10
121
122 suggestion status (ASKED, CHECKED, ACCEPTED, REJECTED, ORDERED, AVAILABLE or a value from the SUGGEST_STATUS authorised value category)
123
124 =head2 archived
125
126   data_type: 'tinyint'
127   default_value: 0
128   is_nullable: 0
129
130 is the suggestion archived?
131
132 =head2 note
133
134   data_type: 'longtext'
135   is_nullable: 1
136
137 note entered on the suggestion
138
139 =head2 staff_note
140
141   data_type: 'longtext'
142   is_nullable: 1
143
144 non-public note entered on the suggestion
145
146 =head2 author
147
148   data_type: 'varchar'
149   is_nullable: 1
150   size: 80
151
152 author of the suggested item
153
154 =head2 title
155
156   data_type: 'varchar'
157   is_nullable: 1
158   size: 255
159
160 title of the suggested item
161
162 =head2 copyrightdate
163
164   data_type: 'smallint'
165   is_nullable: 1
166
167 copyright date of the suggested item
168
169 =head2 publishercode
170
171   data_type: 'varchar'
172   is_nullable: 1
173   size: 255
174
175 publisher of the suggested item
176
177 =head2 date
178
179   data_type: 'timestamp'
180   datetime_undef_if_invalid: 1
181   default_value: current_timestamp
182   is_nullable: 0
183
184 date and time the suggestion was updated
185
186 =head2 volumedesc
187
188   data_type: 'varchar'
189   is_nullable: 1
190   size: 255
191
192 =head2 publicationyear
193
194   data_type: 'smallint'
195   default_value: 0
196   is_nullable: 1
197
198 =head2 place
199
200   data_type: 'varchar'
201   is_nullable: 1
202   size: 255
203
204 publication place of the suggested item
205
206 =head2 isbn
207
208   data_type: 'varchar'
209   is_nullable: 1
210   size: 30
211
212 isbn of the suggested item
213
214 =head2 biblionumber
215
216   data_type: 'integer'
217   is_foreign_key: 1
218   is_nullable: 1
219
220 foreign key linking the suggestion to the biblio table after the suggestion has been ordered
221
222 =head2 reason
223
224   data_type: 'mediumtext'
225   is_nullable: 1
226
227 reason for accepting or rejecting the suggestion
228
229 =head2 patronreason
230
231   data_type: 'mediumtext'
232   is_nullable: 1
233
234 reason for making the suggestion
235
236 =head2 budgetid
237
238   data_type: 'integer'
239   is_foreign_key: 1
240   is_nullable: 1
241
242 foreign key linking the suggested budget to the aqbudgets table
243
244 =head2 branchcode
245
246   data_type: 'varchar'
247   is_foreign_key: 1
248   is_nullable: 1
249   size: 10
250
251 foreign key linking the suggested branch to the branches table
252
253 =head2 collectiontitle
254
255   data_type: 'mediumtext'
256   is_nullable: 1
257
258 collection name for the suggested item
259
260 =head2 itemtype
261
262   data_type: 'varchar'
263   is_nullable: 1
264   size: 30
265
266 suggested item type
267
268 =head2 quantity
269
270   data_type: 'smallint'
271   is_nullable: 1
272
273 suggested quantity to be purchased
274
275 =head2 currency
276
277   data_type: 'varchar'
278   is_nullable: 1
279   size: 10
280
281 suggested currency for the suggested price
282
283 =head2 price
284
285   data_type: 'decimal'
286   is_nullable: 1
287   size: [28,6]
288
289 suggested price
290
291 =head2 total
292
293   data_type: 'decimal'
294   is_nullable: 1
295   size: [28,6]
296
297 suggested total cost (price*quantity updated for currency)
298
299 =cut
300
301 __PACKAGE__->add_columns(
302   "suggestionid",
303   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
304   "suggestedby",
305   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
306   "suggesteddate",
307   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 },
308   "managedby",
309   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
310   "manageddate",
311   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
312   "acceptedby",
313   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
314   "accepteddate",
315   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
316   "rejectedby",
317   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
318   "rejecteddate",
319   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
320   "lastmodificationby",
321   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
322   "lastmodificationdate",
323   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
324   "STATUS",
325   {
326     accessor => "status",
327     data_type => "varchar",
328     default_value => "",
329     is_nullable => 0,
330     size => 10,
331   },
332   "archived",
333   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
334   "note",
335   { data_type => "longtext", is_nullable => 1 },
336   "staff_note",
337   { data_type => "longtext", is_nullable => 1 },
338   "author",
339   { data_type => "varchar", is_nullable => 1, size => 80 },
340   "title",
341   { data_type => "varchar", is_nullable => 1, size => 255 },
342   "copyrightdate",
343   { data_type => "smallint", is_nullable => 1 },
344   "publishercode",
345   { data_type => "varchar", is_nullable => 1, size => 255 },
346   "date",
347   {
348     data_type => "timestamp",
349     datetime_undef_if_invalid => 1,
350     default_value => \"current_timestamp",
351     is_nullable => 0,
352   },
353   "volumedesc",
354   { data_type => "varchar", is_nullable => 1, size => 255 },
355   "publicationyear",
356   { data_type => "smallint", default_value => 0, is_nullable => 1 },
357   "place",
358   { data_type => "varchar", is_nullable => 1, size => 255 },
359   "isbn",
360   { data_type => "varchar", is_nullable => 1, size => 30 },
361   "biblionumber",
362   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
363   "reason",
364   { data_type => "mediumtext", is_nullable => 1 },
365   "patronreason",
366   { data_type => "mediumtext", is_nullable => 1 },
367   "budgetid",
368   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
369   "branchcode",
370   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
371   "collectiontitle",
372   { data_type => "mediumtext", is_nullable => 1 },
373   "itemtype",
374   { data_type => "varchar", is_nullable => 1, size => 30 },
375   "quantity",
376   { data_type => "smallint", is_nullable => 1 },
377   "currency",
378   { data_type => "varchar", is_nullable => 1, size => 10 },
379   "price",
380   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
381   "total",
382   { data_type => "decimal", is_nullable => 1, size => [28, 6] },
383 );
384
385 =head1 PRIMARY KEY
386
387 =over 4
388
389 =item * L</suggestionid>
390
391 =back
392
393 =cut
394
395 __PACKAGE__->set_primary_key("suggestionid");
396
397 =head1 RELATIONS
398
399 =head2 acceptedby
400
401 Type: belongs_to
402
403 Related object: L<Koha::Schema::Result::Borrower>
404
405 =cut
406
407 __PACKAGE__->belongs_to(
408   "acceptedby",
409   "Koha::Schema::Result::Borrower",
410   { borrowernumber => "acceptedby" },
411   {
412     is_deferrable => 1,
413     join_type     => "LEFT",
414     on_delete     => "SET NULL",
415     on_update     => "CASCADE",
416   },
417 );
418
419 =head2 biblionumber
420
421 Type: belongs_to
422
423 Related object: L<Koha::Schema::Result::Biblio>
424
425 =cut
426
427 __PACKAGE__->belongs_to(
428   "biblionumber",
429   "Koha::Schema::Result::Biblio",
430   { biblionumber => "biblionumber" },
431   {
432     is_deferrable => 1,
433     join_type     => "LEFT",
434     on_delete     => "SET NULL",
435     on_update     => "CASCADE",
436   },
437 );
438
439 =head2 branchcode
440
441 Type: belongs_to
442
443 Related object: L<Koha::Schema::Result::Branch>
444
445 =cut
446
447 __PACKAGE__->belongs_to(
448   "branchcode",
449   "Koha::Schema::Result::Branch",
450   { branchcode => "branchcode" },
451   {
452     is_deferrable => 1,
453     join_type     => "LEFT",
454     on_delete     => "SET NULL",
455     on_update     => "CASCADE",
456   },
457 );
458
459 =head2 budgetid
460
461 Type: belongs_to
462
463 Related object: L<Koha::Schema::Result::Aqbudget>
464
465 =cut
466
467 __PACKAGE__->belongs_to(
468   "budgetid",
469   "Koha::Schema::Result::Aqbudget",
470   { budget_id => "budgetid" },
471   {
472     is_deferrable => 1,
473     join_type     => "LEFT",
474     on_delete     => "SET NULL",
475     on_update     => "CASCADE",
476   },
477 );
478
479 =head2 lastmodificationby
480
481 Type: belongs_to
482
483 Related object: L<Koha::Schema::Result::Borrower>
484
485 =cut
486
487 __PACKAGE__->belongs_to(
488   "lastmodificationby",
489   "Koha::Schema::Result::Borrower",
490   { borrowernumber => "lastmodificationby" },
491   {
492     is_deferrable => 1,
493     join_type     => "LEFT",
494     on_delete     => "SET NULL",
495     on_update     => "CASCADE",
496   },
497 );
498
499 =head2 managedby
500
501 Type: belongs_to
502
503 Related object: L<Koha::Schema::Result::Borrower>
504
505 =cut
506
507 __PACKAGE__->belongs_to(
508   "managedby",
509   "Koha::Schema::Result::Borrower",
510   { borrowernumber => "managedby" },
511   {
512     is_deferrable => 1,
513     join_type     => "LEFT",
514     on_delete     => "SET NULL",
515     on_update     => "CASCADE",
516   },
517 );
518
519 =head2 rejectedby
520
521 Type: belongs_to
522
523 Related object: L<Koha::Schema::Result::Borrower>
524
525 =cut
526
527 __PACKAGE__->belongs_to(
528   "rejectedby",
529   "Koha::Schema::Result::Borrower",
530   { borrowernumber => "rejectedby" },
531   {
532     is_deferrable => 1,
533     join_type     => "LEFT",
534     on_delete     => "SET NULL",
535     on_update     => "CASCADE",
536   },
537 );
538
539 =head2 suggestedby
540
541 Type: belongs_to
542
543 Related object: L<Koha::Schema::Result::Borrower>
544
545 =cut
546
547 __PACKAGE__->belongs_to(
548   "suggestedby",
549   "Koha::Schema::Result::Borrower",
550   { borrowernumber => "suggestedby" },
551   {
552     is_deferrable => 1,
553     join_type     => "LEFT",
554     on_delete     => "SET NULL",
555     on_update     => "CASCADE",
556   },
557 );
558
559
560 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29
561 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3hkIGEbrTi7MUug0zjvyFg
562
563 __PACKAGE__->belongs_to(
564   "suggester",
565   "Koha::Schema::Result::Borrower",
566   { "foreign.borrowernumber" => "self.suggestedby" },
567   {
568     is_deferrable => 1,
569     join_type     => "LEFT",
570     on_delete     => "SET NULL",
571     on_update     => "CASCADE",
572   },
573 );
574
575 __PACKAGE__->add_columns(
576     '+archived' => { is_boolean => 1 },
577 );
578
579 sub koha_objects_class {
580     'Koha::Suggestions';
581 }
582
583 sub koha_object_class {
584     'Koha::Suggestion';
585 }
586
587 1;