Bugzilla – Attachment 151211 Details for
Bug 29002
Add ability to book items ahead of time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29002: DBIC Schema Build
Bug-29002-DBIC-Schema-Build.patch (text/plain), 6.55 KB, created by
Martin Renvoize (ashimema)
on 2023-05-15 18:05:35 UTC
(
hide
)
Description:
Bug 29002: DBIC Schema Build
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-05-15 18:05:35 UTC
Size:
6.55 KB
patch
obsolete
>From 46d773ee5186a257495f49554a21ad104dca0087 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 15 Sep 2021 16:30:15 +0100 >Subject: [PATCH] Bug 29002: DBIC Schema Build > >--- > Koha/Schema/Result/Biblio.pm | 19 +++- > Koha/Schema/Result/Booking.pm | 181 +++++++++++++++++++++++++++++++++ > Koha/Schema/Result/Borrower.pm | 19 +++- > Koha/Schema/Result/Item.pm | 15 +++ > 4 files changed, 230 insertions(+), 4 deletions(-) > create mode 100644 Koha/Schema/Result/Booking.pm > >diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm >index 42481e0ea2..8687c5773b 100644 >--- a/Koha/Schema/Result/Biblio.pm >+++ b/Koha/Schema/Result/Biblio.pm >@@ -255,6 +255,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 bookings >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::Booking> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "bookings", >+ "Koha::Schema::Result::Booking", >+ { "foreign.biblio_id" => "self.biblionumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 club_holds > > Type: has_many >@@ -601,8 +616,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-05-05 12:10:09 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xDa15D5QckMdwVzVy4FX2g >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-05-09 07:11:30 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AZgt+4mVV/QYtSsdhxmaBQ > > __PACKAGE__->has_many( > "biblioitem", >diff --git a/Koha/Schema/Result/Booking.pm b/Koha/Schema/Result/Booking.pm >new file mode 100644 >index 0000000000..4c3a971529 >--- /dev/null >+++ b/Koha/Schema/Result/Booking.pm >@@ -0,0 +1,181 @@ >+use utf8; >+package Koha::Schema::Result::Booking; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::Booking >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<bookings> >+ >+=cut >+ >+__PACKAGE__->table("bookings"); >+ >+=head1 ACCESSORS >+ >+=head2 booking_id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+primary key >+ >+=head2 patron_id >+ >+ data_type: 'integer' >+ default_value: 0 >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+foreign key from the borrowers table defining which patron this booking is for >+ >+=head2 biblio_id >+ >+ data_type: 'integer' >+ default_value: 0 >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+foreign key from the biblio table defining which bib record this booking is on >+ >+=head2 item_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ >+foreign key from the items table defining the specific item the patron has placed a booking for >+ >+=head2 start_date >+ >+ data_type: 'datetime' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 1 >+ >+the start date of the booking >+ >+=head2 end_date >+ >+ data_type: 'datetime' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 1 >+ >+the end date of the booking >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "booking_id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "patron_id", >+ { >+ data_type => "integer", >+ default_value => 0, >+ is_foreign_key => 1, >+ is_nullable => 0, >+ }, >+ "biblio_id", >+ { >+ data_type => "integer", >+ default_value => 0, >+ is_foreign_key => 1, >+ is_nullable => 0, >+ }, >+ "item_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "start_date", >+ { >+ data_type => "datetime", >+ datetime_undef_if_invalid => 1, >+ is_nullable => 1, >+ }, >+ "end_date", >+ { >+ data_type => "datetime", >+ datetime_undef_if_invalid => 1, >+ is_nullable => 1, >+ }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</booking_id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("booking_id"); >+ >+=head1 RELATIONS >+ >+=head2 biblio >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Biblio> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "biblio", >+ "Koha::Schema::Result::Biblio", >+ { biblionumber => "biblio_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+=head2 item >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Item> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "item", >+ "Koha::Schema::Result::Item", >+ { itemnumber => "item_id" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ >+=head2 patron >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Borrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "patron", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "patron_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-04 10:01:46 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LoOYu7IflBkC4+VUZLd+Tg >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm >index 5576e8fcd2..e48d6d9560 100644 >--- a/Koha/Schema/Result/Borrower.pm >+++ b/Koha/Schema/Result/Borrower.pm >@@ -1057,6 +1057,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 bookings >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::Booking> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "bookings", >+ "Koha::Schema::Result::Booking", >+ { "foreign.patron_id" => "self.borrowernumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 borrower_attributes > > Type: has_many >@@ -2103,8 +2118,8 @@ Composing rels: L</user_permissions> -> permission > __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); > > >-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-06 15:46:57 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:f6omVb7EtiysdaWTX3IRzg >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-05-09 07:11:30 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6Dg1BEP0T6C3J6hQPn4Wkw > > __PACKAGE__->has_many( > "restrictions", >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index 308a63f804..eeb11511b9 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -602,6 +602,21 @@ __PACKAGE__->belongs_to( > { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, > ); > >+=head2 bookings >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::Booking> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "bookings", >+ "Koha::Schema::Result::Booking", >+ { "foreign.item_id" => "self.itemnumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 branchtransfers > > Type: has_many >-- >2.40.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29002
:
125456
|
125457
|
125458
|
125459
|
151209
|
151211
|
151213
|
151216
|
151217
|
151218
|
158357
|
158358
|
160831