|
Line 0
Link Here
|
|
|
1 |
use utf8; |
| 2 |
package Koha::Schema::Result::Booking; |
| 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::Booking |
| 10 |
|
| 11 |
=cut |
| 12 |
|
| 13 |
use strict; |
| 14 |
use warnings; |
| 15 |
|
| 16 |
use base 'DBIx::Class::Core'; |
| 17 |
|
| 18 |
=head1 TABLE: C<bookings> |
| 19 |
|
| 20 |
=cut |
| 21 |
|
| 22 |
__PACKAGE__->table("bookings"); |
| 23 |
|
| 24 |
=head1 ACCESSORS |
| 25 |
|
| 26 |
=head2 booking_id |
| 27 |
|
| 28 |
data_type: 'integer' |
| 29 |
is_auto_increment: 1 |
| 30 |
is_nullable: 0 |
| 31 |
|
| 32 |
primary key |
| 33 |
|
| 34 |
=head2 patron_id |
| 35 |
|
| 36 |
data_type: 'integer' |
| 37 |
default_value: 0 |
| 38 |
is_foreign_key: 1 |
| 39 |
is_nullable: 0 |
| 40 |
|
| 41 |
foreign key from the borrowers table defining which patron this booking is for |
| 42 |
|
| 43 |
=head2 biblio_id |
| 44 |
|
| 45 |
data_type: 'integer' |
| 46 |
default_value: 0 |
| 47 |
is_foreign_key: 1 |
| 48 |
is_nullable: 0 |
| 49 |
|
| 50 |
foreign key from the biblio table defining which bib record this booking is on |
| 51 |
|
| 52 |
=head2 item_id |
| 53 |
|
| 54 |
data_type: 'integer' |
| 55 |
is_foreign_key: 1 |
| 56 |
is_nullable: 1 |
| 57 |
|
| 58 |
foreign key from the items table defining the specific item the patron has placed a booking for |
| 59 |
|
| 60 |
=head2 start_date |
| 61 |
|
| 62 |
data_type: 'datetime' |
| 63 |
datetime_undef_if_invalid: 1 |
| 64 |
is_nullable: 1 |
| 65 |
|
| 66 |
the start date of the booking |
| 67 |
|
| 68 |
=head2 end_date |
| 69 |
|
| 70 |
data_type: 'datetime' |
| 71 |
datetime_undef_if_invalid: 1 |
| 72 |
is_nullable: 1 |
| 73 |
|
| 74 |
the end date of the booking |
| 75 |
|
| 76 |
=cut |
| 77 |
|
| 78 |
__PACKAGE__->add_columns( |
| 79 |
"booking_id", |
| 80 |
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, |
| 81 |
"patron_id", |
| 82 |
{ |
| 83 |
data_type => "integer", |
| 84 |
default_value => 0, |
| 85 |
is_foreign_key => 1, |
| 86 |
is_nullable => 0, |
| 87 |
}, |
| 88 |
"biblio_id", |
| 89 |
{ |
| 90 |
data_type => "integer", |
| 91 |
default_value => 0, |
| 92 |
is_foreign_key => 1, |
| 93 |
is_nullable => 0, |
| 94 |
}, |
| 95 |
"item_id", |
| 96 |
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, |
| 97 |
"start_date", |
| 98 |
{ |
| 99 |
data_type => "datetime", |
| 100 |
datetime_undef_if_invalid => 1, |
| 101 |
is_nullable => 1, |
| 102 |
}, |
| 103 |
"end_date", |
| 104 |
{ |
| 105 |
data_type => "datetime", |
| 106 |
datetime_undef_if_invalid => 1, |
| 107 |
is_nullable => 1, |
| 108 |
}, |
| 109 |
); |
| 110 |
|
| 111 |
=head1 PRIMARY KEY |
| 112 |
|
| 113 |
=over 4 |
| 114 |
|
| 115 |
=item * L</booking_id> |
| 116 |
|
| 117 |
=back |
| 118 |
|
| 119 |
=cut |
| 120 |
|
| 121 |
__PACKAGE__->set_primary_key("booking_id"); |
| 122 |
|
| 123 |
=head1 RELATIONS |
| 124 |
|
| 125 |
=head2 biblio |
| 126 |
|
| 127 |
Type: belongs_to |
| 128 |
|
| 129 |
Related object: L<Koha::Schema::Result::Biblio> |
| 130 |
|
| 131 |
=cut |
| 132 |
|
| 133 |
__PACKAGE__->belongs_to( |
| 134 |
"biblio", |
| 135 |
"Koha::Schema::Result::Biblio", |
| 136 |
{ biblionumber => "biblio_id" }, |
| 137 |
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, |
| 138 |
); |
| 139 |
|
| 140 |
=head2 item |
| 141 |
|
| 142 |
Type: belongs_to |
| 143 |
|
| 144 |
Related object: L<Koha::Schema::Result::Item> |
| 145 |
|
| 146 |
=cut |
| 147 |
|
| 148 |
__PACKAGE__->belongs_to( |
| 149 |
"item", |
| 150 |
"Koha::Schema::Result::Item", |
| 151 |
{ itemnumber => "item_id" }, |
| 152 |
{ |
| 153 |
is_deferrable => 1, |
| 154 |
join_type => "LEFT", |
| 155 |
on_delete => "CASCADE", |
| 156 |
on_update => "CASCADE", |
| 157 |
}, |
| 158 |
); |
| 159 |
|
| 160 |
=head2 patron |
| 161 |
|
| 162 |
Type: belongs_to |
| 163 |
|
| 164 |
Related object: L<Koha::Schema::Result::Borrower> |
| 165 |
|
| 166 |
=cut |
| 167 |
|
| 168 |
__PACKAGE__->belongs_to( |
| 169 |
"patron", |
| 170 |
"Koha::Schema::Result::Borrower", |
| 171 |
{ borrowernumber => "patron_id" }, |
| 172 |
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, |
| 173 |
); |
| 174 |
|
| 175 |
|
| 176 |
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-04 10:01:46 |
| 177 |
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LoOYu7IflBkC4+VUZLd+Tg |
| 178 |
|
| 179 |
|
| 180 |
# You can replace this text with custom code or comments, and it will be preserved on regeneration |
| 181 |
1; |