Bugzilla – Attachment 183325 Details for
Bug 26573
Limit patron attribute types to more than one patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26573: DBIC Schema
Bug-26573-DBIC-Schema.patch (text/plain), 7.19 KB, created by
Julian Maurice
on 2025-06-18 09:11:23 UTC
(
hide
)
Description:
Bug 26573: DBIC Schema
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2025-06-18 09:11:23 UTC
Size:
7.19 KB
patch
obsolete
>From a9b91058873e04d74c7d5d97068e1ec39676a415 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 6 Feb 2025 10:48:13 +0000 >Subject: [PATCH] Bug 26573: DBIC Schema > >--- > Koha/Schema/Result/BorrowerAttributeType.pm | 64 ++++++----- > .../Result/BorrowerAttributeTypesCategory.pm | 101 ++++++++++++++++++ > Koha/Schema/Result/Category.pm | 28 +++-- > 3 files changed, 153 insertions(+), 40 deletions(-) > create mode 100644 Koha/Schema/Result/BorrowerAttributeTypesCategory.pm > >diff --git a/Koha/Schema/Result/BorrowerAttributeType.pm b/Koha/Schema/Result/BorrowerAttributeType.pm >index 5673e86dee..632fe90792 100644 >--- a/Koha/Schema/Result/BorrowerAttributeType.pm >+++ b/Koha/Schema/Result/BorrowerAttributeType.pm >@@ -111,15 +111,6 @@ foreign key from authorised_values that links this custom field to an authorized > > defines if this field displays in checkout screens > >-=head2 category_code >- >- data_type: 'varchar' >- is_foreign_key: 1 >- is_nullable: 1 >- size: 10 >- >-defines a category for an attribute_type >- > =head2 class > > data_type: 'varchar' >@@ -178,8 +169,6 @@ __PACKAGE__->add_columns( > { data_type => "varchar", is_nullable => 1, size => 32 }, > "display_checkout", > { data_type => "tinyint", default_value => 0, is_nullable => 0 }, >- "category_code", >- { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, > "class", > { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, > "keep_for_pseudonymization", >@@ -219,6 +208,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 borrower_attribute_types_categories >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::BorrowerAttributeTypesCategory> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "borrower_attribute_types_categories", >+ "Koha::Schema::Result::BorrowerAttributeTypesCategory", >+ { "foreign.borrower_attribute_type_code" => "self.code" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 borrower_attributes > > Type: has_many >@@ -234,26 +238,6 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >-=head2 category_code >- >-Type: belongs_to >- >-Related object: L<Koha::Schema::Result::Category> >- >-=cut >- >-__PACKAGE__->belongs_to( >- "category_code", >- "Koha::Schema::Result::Category", >- { categorycode => "category_code" }, >- { >- is_deferrable => 1, >- join_type => "LEFT", >- on_delete => "RESTRICT", >- on_update => "RESTRICT", >- }, >-); >- > =head2 pseudonymized_borrower_attributes > > Type: has_many >@@ -269,9 +253,23 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 categorycodes > >-# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-02-20 15:56:54 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Os1rn9zKu7/rVLVjZM3Mbg >+Type: many_to_many >+ >+Composing rels: L</borrower_attribute_types_categories> -> categorycode >+ >+=cut >+ >+__PACKAGE__->many_to_many( >+ "categorycodes", >+ "borrower_attribute_types_categories", >+ "categorycode", >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07052 @ 2025-06-18 09:03:38 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+xXVwvKXoXh17I2CHCdFlQ > > __PACKAGE__->add_columns( > '+display_checkout' => { is_boolean => 1 }, >diff --git a/Koha/Schema/Result/BorrowerAttributeTypesCategory.pm b/Koha/Schema/Result/BorrowerAttributeTypesCategory.pm >new file mode 100644 >index 0000000000..386378c1e7 >--- /dev/null >+++ b/Koha/Schema/Result/BorrowerAttributeTypesCategory.pm >@@ -0,0 +1,101 @@ >+use utf8; >+package Koha::Schema::Result::BorrowerAttributeTypesCategory; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::BorrowerAttributeTypesCategory >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<borrower_attribute_types_categories> >+ >+=cut >+ >+__PACKAGE__->table("borrower_attribute_types_categories"); >+ >+=head1 ACCESSORS >+ >+=head2 borrower_attribute_type_code >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 64 >+ >+=head2 categorycode >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 10 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "borrower_attribute_type_code", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 64 }, >+ "categorycode", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</borrower_attribute_type_code> >+ >+=item * L</categorycode> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("borrower_attribute_type_code", "categorycode"); >+ >+=head1 RELATIONS >+ >+=head2 borrower_attribute_type_code >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::BorrowerAttributeType> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "borrower_attribute_type_code", >+ "Koha::Schema::Result::BorrowerAttributeType", >+ { code => "borrower_attribute_type_code" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+=head2 categorycode >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Category> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "categorycode", >+ "Koha::Schema::Result::Category", >+ { categorycode => "categorycode" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-02-18 12:49:42 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TT15Vl+q4MtAa9ioLsJTGg >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm >index 62c6e3fb4d..255e23c4f5 100644 >--- a/Koha/Schema/Result/Category.pm >+++ b/Koha/Schema/Result/Category.pm >@@ -319,18 +319,18 @@ __PACKAGE__->set_primary_key("categorycode"); > > =head1 RELATIONS > >-=head2 borrower_attribute_types >+=head2 borrower_attribute_types_categories > > Type: has_many > >-Related object: L<Koha::Schema::Result::BorrowerAttributeType> >+Related object: L<Koha::Schema::Result::BorrowerAttributeTypesCategory> > > =cut > > __PACKAGE__->has_many( >- "borrower_attribute_types", >- "Koha::Schema::Result::BorrowerAttributeType", >- { "foreign.category_code" => "self.categorycode" }, >+ "borrower_attribute_types_categories", >+ "Koha::Schema::Result::BorrowerAttributeTypesCategory", >+ { "foreign.categorycode" => "self.categorycode" }, > { cascade_copy => 0, cascade_delete => 0 }, > ); > >@@ -409,9 +409,23 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 borrower_attribute_type_codes > >-# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-12-03 15:46:23 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jiQq3bW+ZfdYpUpfZq1Rzw >+Type: many_to_many >+ >+Composing rels: L</borrower_attribute_types_categories> -> borrower_attribute_type_code >+ >+=cut >+ >+__PACKAGE__->many_to_many( >+ "borrower_attribute_type_codes", >+ "borrower_attribute_types_categories", >+ "borrower_attribute_type_code", >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07052 @ 2025-06-18 09:03:38 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:K+ZrvaTdUlQYzLzahRMVpQ > > # You can replace this text with custom code or comments, and it will be preserved on regeneration > >-- >2.39.5
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 26573
:
139823
|
143113
|
143114
|
143115
|
143116
|
144470
|
144471
|
159210
|
159211
|
171048
|
175628
|
175629
|
177565
|
177566
|
178171
|
178172
|
178252
|
178253
|
178254
|
178255
|
178270
|
178271
|
178272
|
178273
|
183322
|
183323
|
183324
| 183325