Bugzilla – Attachment 110685 Details for
Bug 26145
Add the ability to attach a cover image at item level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26145: DBIC schema changes
Bug-26145-DBIC-schema-changes.patch (text/plain), 6.43 KB, created by
ByWater Sandboxes
on 2020-09-24 17:03:21 UTC
(
hide
)
Description:
Bug 26145: DBIC schema changes
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2020-09-24 17:03:21 UTC
Size:
6.43 KB
patch
obsolete
>From b9ce6b3c757d38287f9f36fadefbccc924b9d9d0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 18 Sep 2020 12:17:08 +0200 >Subject: [PATCH] Bug 26145: DBIC schema changes > >Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov> >--- > Koha/Schema/Result/Biblio.pm | 32 ++++----- > Koha/Schema/Result/CoverImage.pm | 151 +++++++++++++++++++++++++++++++++++++++ > Koha/Schema/Result/Item.pm | 19 ++++- > 3 files changed, 184 insertions(+), 18 deletions(-) > create mode 100644 Koha/Schema/Result/CoverImage.pm > >diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm >index 806faf87ad..5ee7d14cf6 100644 >--- a/Koha/Schema/Result/Biblio.pm >+++ b/Koha/Schema/Result/Biblio.pm >@@ -210,48 +210,48 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >-=head2 biblioimages >+=head2 biblioitems > > Type: has_many > >-Related object: L<Koha::Schema::Result::Biblioimage> >+Related object: L<Koha::Schema::Result::Biblioitem> > > =cut > > __PACKAGE__->has_many( >- "biblioimages", >- "Koha::Schema::Result::Biblioimage", >+ "biblioitems", >+ "Koha::Schema::Result::Biblioitem", > { "foreign.biblionumber" => "self.biblionumber" }, > { cascade_copy => 0, cascade_delete => 0 }, > ); > >-=head2 biblioitems >+=head2 club_holds > > Type: has_many > >-Related object: L<Koha::Schema::Result::Biblioitem> >+Related object: L<Koha::Schema::Result::ClubHold> > > =cut > > __PACKAGE__->has_many( >- "biblioitems", >- "Koha::Schema::Result::Biblioitem", >- { "foreign.biblionumber" => "self.biblionumber" }, >+ "club_holds", >+ "Koha::Schema::Result::ClubHold", >+ { "foreign.biblio_id" => "self.biblionumber" }, > { cascade_copy => 0, cascade_delete => 0 }, > ); > >-=head2 club_holds >+=head2 cover_images > > Type: has_many > >-Related object: L<Koha::Schema::Result::ClubHold> >+Related object: L<Koha::Schema::Result::CoverImage> > > =cut > > __PACKAGE__->has_many( >- "club_holds", >- "Koha::Schema::Result::ClubHold", >- { "foreign.biblio_id" => "self.biblionumber" }, >+ "cover_images", >+ "Koha::Schema::Result::CoverImage", >+ { "foreign.biblionumber" => "self.biblionumber" }, > { cascade_copy => 0, cascade_delete => 0 }, > ); > >@@ -451,8 +451,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-17 09:15:51 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:p2SIq565zPyE3ZUkSuXyBA >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-09-18 10:16:50 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JwJoUHVr48DdTaT5qGN6tw > > > __PACKAGE__->has_one( >diff --git a/Koha/Schema/Result/CoverImage.pm b/Koha/Schema/Result/CoverImage.pm >new file mode 100644 >index 0000000000..7ff105dccf >--- /dev/null >+++ b/Koha/Schema/Result/CoverImage.pm >@@ -0,0 +1,151 @@ >+use utf8; >+package Koha::Schema::Result::CoverImage; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::CoverImage >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<cover_images> >+ >+=cut >+ >+__PACKAGE__->table("cover_images"); >+ >+=head1 ACCESSORS >+ >+=head2 imagenumber >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+=head2 biblionumber >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ >+=head2 itemnumber >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ >+=head2 mimetype >+ >+ data_type: 'varchar' >+ is_nullable: 0 >+ size: 15 >+ >+=head2 imagefile >+ >+ data_type: 'mediumblob' >+ is_nullable: 0 >+ >+=head2 thumbnail >+ >+ data_type: 'mediumblob' >+ is_nullable: 0 >+ >+=head2 timestamp >+ >+ data_type: 'timestamp' >+ datetime_undef_if_invalid: 1 >+ default_value: current_timestamp >+ is_nullable: 0 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "imagenumber", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "biblionumber", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "itemnumber", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "mimetype", >+ { data_type => "varchar", is_nullable => 0, size => 15 }, >+ "imagefile", >+ { data_type => "mediumblob", is_nullable => 0 }, >+ "thumbnail", >+ { data_type => "mediumblob", is_nullable => 0 }, >+ "timestamp", >+ { >+ data_type => "timestamp", >+ datetime_undef_if_invalid => 1, >+ default_value => \"current_timestamp", >+ is_nullable => 0, >+ }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</imagenumber> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("imagenumber"); >+ >+=head1 RELATIONS >+ >+=head2 biblionumber >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Biblio> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "biblionumber", >+ "Koha::Schema::Result::Biblio", >+ { biblionumber => "biblionumber" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ >+=head2 itemnumber >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Item> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "itemnumber", >+ "Koha::Schema::Result::Item", >+ { itemnumber => "itemnumber" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-09-18 10:16:50 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bcT7VxNm+4Uk+l03sM1MZg >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index 7d8b9a6cc6..d4a6cc0478 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -548,6 +548,21 @@ __PACKAGE__->might_have( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 cover_images >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::CoverImage> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "cover_images", >+ "Koha::Schema::Result::CoverImage", >+ { "foreign.itemnumber" => "self.itemnumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 creator_batches > > Type: has_many >@@ -754,8 +769,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-06-05 20:21:47 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9AxhV/hJnavWY4OTDTNRcQ >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-09-18 10:16:50 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kvv/3fnYpG3apwKs4/3ozg > > __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); > >-- >2.11.0
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 26145
:
109225
|
109226
|
110342
|
110343
|
110344
|
110345
|
110346
|
110347
|
110348
|
110349
|
110350
|
110351
|
110352
|
110353
|
110354
|
110675
|
110676
|
110677
|
110678
|
110679
|
110680
|
110681
|
110682
|
110683
|
110684
|
110685
|
110800
|
110861
|
110862
|
110863
|
110864
|
110865
|
110866
|
110867
|
110868
|
110869
|
110870
|
110871
|
110872
|
110873
|
110874
|
110875
|
111446
|
111447
|
111448
|
111449
|
111450
|
111451
|
111452
|
111453
|
111454
|
111455
|
111456
|
111457
|
111458