2 package Koha::Schema::Result::Reserve;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
9 Koha::Schema::Result::Reserve
16 use base 'DBIx::Class::Core';
18 =head1 TABLE: C<reserves>
22 __PACKAGE__->table("reserves");
41 foreign key from the borrowers table defining which patron this hold is for
46 datetime_undef_if_invalid: 1
49 the date the hold was placed
58 foreign key from the biblio table defining which bib record this hold is on
66 foreign key from the item_groups table defining if this is an item group level hold
75 foreign key from the branches table defining which branch the patron wishes to pick this hold up at
83 foreign key from the desks table defining which desk the patron should pick this hold up at
85 =head2 notificationdate
88 datetime_undef_if_invalid: 1
96 datetime_undef_if_invalid: 1
101 =head2 cancellationdate
104 datetime_undef_if_invalid: 1
107 the date this hold was cancelled
109 =head2 cancellation_reason
115 optional authorised value CANCELLATION_REASON
119 data_type: 'longtext'
122 notes related to this hold
126 data_type: 'smallint'
130 where in the queue the patron sits
138 a one letter code defining what the status is of the hold is after it has been confirmed
142 data_type: 'timestamp'
143 datetime_undef_if_invalid: 1
144 default_value: current_timestamp
147 the date and time this hold was last updated
155 foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with
160 datetime_undef_if_invalid: 1
163 the date the item was marked as waiting for the patron at the library
165 =head2 expirationdate
168 datetime_undef_if_invalid: 1
171 the date the hold expires (calculated value)
173 =head2 patron_expiration_date
176 datetime_undef_if_invalid: 1
179 the date the hold expires - usually the date entered by the patron to say they don't need the hold after a certain date
181 =head2 lowestPriority
183 accessor: 'lowest_priority'
196 data_type: 'datetime'
197 datetime_undef_if_invalid: 1
207 If record level hold, the optional itemtype of the item the patron is requesting
209 =head2 item_level_hold
215 Is the hold placed at item level
223 Is this a non priority hold
227 __PACKAGE__->add_columns(
229 { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
232 data_type => "integer",
238 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
241 data_type => "integer",
247 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
249 { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
251 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
253 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
255 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
257 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
258 "cancellation_reason",
259 { data_type => "varchar", is_nullable => 1, size => 80 },
261 { data_type => "longtext", is_nullable => 1 },
263 { data_type => "smallint", default_value => 1, is_nullable => 0 },
265 { data_type => "varchar", is_nullable => 1, size => 1 },
268 data_type => "timestamp",
269 datetime_undef_if_invalid => 1,
270 default_value => \"current_timestamp",
274 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
276 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
278 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
279 "patron_expiration_date",
280 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
283 accessor => "lowest_priority",
284 data_type => "tinyint",
289 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
292 data_type => "datetime",
293 datetime_undef_if_invalid => 1,
297 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
299 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
301 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
308 =item * L</reserve_id>
314 __PACKAGE__->set_primary_key("reserve_id");
322 Related object: L<Koha::Schema::Result::Biblio>
326 __PACKAGE__->belongs_to(
328 "Koha::Schema::Result::Biblio",
329 { biblionumber => "biblionumber" },
330 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
333 =head2 borrowernumber
337 Related object: L<Koha::Schema::Result::Borrower>
341 __PACKAGE__->belongs_to(
343 "Koha::Schema::Result::Borrower",
344 { borrowernumber => "borrowernumber" },
345 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
352 Related object: L<Koha::Schema::Result::Branch>
356 __PACKAGE__->belongs_to(
358 "Koha::Schema::Result::Branch",
359 { branchcode => "branchcode" },
360 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
363 =head2 club_holds_to_patron_holds
367 Related object: L<Koha::Schema::Result::ClubHoldsToPatronHold>
371 __PACKAGE__->has_many(
372 "club_holds_to_patron_holds",
373 "Koha::Schema::Result::ClubHoldsToPatronHold",
374 { "foreign.hold_id" => "self.reserve_id" },
375 { cascade_copy => 0, cascade_delete => 0 },
382 Related object: L<Koha::Schema::Result::Desk>
386 __PACKAGE__->belongs_to(
388 "Koha::Schema::Result::Desk",
389 { desk_id => "desk_id" },
393 on_delete => "SET NULL",
394 on_update => "CASCADE",
402 Related object: L<Koha::Schema::Result::ItemGroup>
406 __PACKAGE__->belongs_to(
408 "Koha::Schema::Result::ItemGroup",
409 { item_group_id => "item_group_id" },
413 on_delete => "CASCADE",
414 on_update => "CASCADE",
422 Related object: L<Koha::Schema::Result::Item>
426 __PACKAGE__->belongs_to(
428 "Koha::Schema::Result::Item",
429 { itemnumber => "itemnumber" },
433 on_delete => "CASCADE",
434 on_update => "CASCADE",
442 Related object: L<Koha::Schema::Result::Itemtype>
446 __PACKAGE__->belongs_to(
448 "Koha::Schema::Result::Itemtype",
449 { itemtype => "itemtype" },
453 on_delete => "CASCADE",
454 on_update => "CASCADE",
459 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-02-10 14:01:25
460 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NO6FSSL1Hw3wBRGG6B5BnQ
462 __PACKAGE__->belongs_to(
464 "Koha::Schema::Result::Item",
465 { itemnumber => "itemnumber" },
469 on_delete => "CASCADE",
470 on_update => "CASCADE",
474 __PACKAGE__->belongs_to(
476 "Koha::Schema::Result::Biblio",
477 { biblionumber => "biblionumber" },
481 on_delete => "CASCADE",
482 on_update => "CASCADE",
486 __PACKAGE__->belongs_to(
488 "Koha::Schema::Result::Borrower",
489 { "foreign.borrowernumber" => "self.borrowernumber" },
490 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
493 __PACKAGE__->add_columns(
494 '+item_level_hold' => { is_boolean => 1 },
495 '+lowestPriority' => { is_boolean => 1 },
496 '+suspend' => { is_boolean => 1 },
497 '+non_priority' => { is_boolean => 1 }
500 sub koha_object_class {
503 sub koha_objects_class {
507 __PACKAGE__->belongs_to(
509 "Koha::Schema::Result::Item",
510 { biblionumber => "biblionumber" },
514 on_delete => "CASCADE",
515 on_update => "CASCADE",
519 __PACKAGE__->has_many(
520 "cancellation_requests",
521 "Koha::Schema::Result::HoldCancellationRequest",
522 { "foreign.hold_id" => "self.reserve_id" },
523 { cascade_copy => 0, cascade_delete => 0 },