Bugzilla – Attachment 189818 Details for
Bug 16631
Limit listing of reports using patron library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16631: [DO NOT PUSH] Add schema files for reports_branches and adjust saved_sql table
Bug-16631-DO-NOT-PUSH-Add-schema-files-for-reports.patch (text/plain), 8.30 KB, created by
Casey Conlin
on 2025-11-21 00:50:46 UTC
(
hide
)
Description:
Bug 16631: [DO NOT PUSH] Add schema files for reports_branches and adjust saved_sql table
Filename:
MIME Type:
Creator:
Casey Conlin
Created:
2025-11-21 00:50:46 UTC
Size:
8.30 KB
patch
obsolete
>From 435d63114df0ea3efe4ee43eddbae489d1fdcff1 Mon Sep 17 00:00:00 2001 >From: "Cameron E. Tidd" <ctidd@citlink.net> >Date: Sat, 26 Jul 2025 02:02:50 +0000 >Subject: [PATCH] Bug 16631: [DO NOT PUSH] Add schema files for > reports_branches and adjust saved_sql table > >This patch adds the reports_branches table to enforce library limits for reports, and adjusts the saved_sql table to point to reports_branches. >--- > Koha/Schema/Result/Branch.pm | 19 ++- > Koha/Schema/Result/ReportsBranch.pm | 86 +++++++++++ > Koha/Schema/Result/SavedSql.pm | 220 ++++++++++++++++++++++++++++ > 3 files changed, 323 insertions(+), 2 deletions(-) > create mode 100644 Koha/Schema/Result/ReportsBranch.pm > >diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm >index 787c077219..151e09a4f3 100644 >--- a/Koha/Schema/Result/Branch.pm >+++ b/Koha/Schema/Result/Branch.pm >@@ -905,6 +905,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 reports_branches >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::ReportsBranch> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "reports_branches", >+ "Koha::Schema::Result::ReportsBranch", >+ { "foreign.branchcode" => "self.branchcode" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 reserves > > Type: has_many >@@ -996,8 +1011,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-05-03 13:13:25 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HiH1QNlDqKcq9GeM85Pu0A >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-25 23:49:56 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FzlapmLTM+K9Lh7Fq4BwdQ > > __PACKAGE__->has_many( > "additional_field_values", >diff --git a/Koha/Schema/Result/ReportsBranch.pm b/Koha/Schema/Result/ReportsBranch.pm >new file mode 100644 >index 0000000000..80472a5ff1 >--- /dev/null >+++ b/Koha/Schema/Result/ReportsBranch.pm >@@ -0,0 +1,86 @@ >+use utf8; >+ >+package Koha::Schema::Result::ReportsBranch; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::ItemtypesBranch >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<itemtypes_branches> >+ >+=cut >+ >+__PACKAGE__->table("reports_branches"); >+ >+=head1 ACCESSORS >+ >+=head2 report_id >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ size: 80 >+ >+=head2 branchcode >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ size: 10 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "report_id", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 80 }, >+ "branchcode", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, >+); >+ >+=head1 RELATIONS >+ >+=head2 branchcode >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Branch> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "branchcode", >+ "Koha::Schema::Result::Branch", >+ { branchcode => "branchcode" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, >+); >+ >+=head2 itemtype >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Itemtype> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "report_id", >+ "Koha::Schema::Result::Report", >+ { report_id => "report_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, >+); >+ >+# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-07-04 04:56:48 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cBTswjKV8VWN1iueB+PygQ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/SavedSql.pm b/Koha/Schema/Result/SavedSql.pm >index 6f75ae3b31..88d54b52ef 100644 >--- a/Koha/Schema/Result/SavedSql.pm >+++ b/Koha/Schema/Result/SavedSql.pm >@@ -185,6 +185,221 @@ __PACKAGE__->add_columns( > > __PACKAGE__->set_primary_key("id"); > >+=head1 RELATIONS >+ >+=head2 reports_branches >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::ReportsBranch> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "reports_branches", >+ "Koha::Schema::Result::ReportsBranch", >+ { "foreign.report_id" => "self.id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-26 01:58:59 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:w7XKvOV/ylS6Dq8tsUNmSg >+# These lines were loaded from '/kohadevbox/koha/Koha/Schema/Result/SavedSql.pm' found in @INC. >+# They are now part of the custom portion of this file >+# for you to hand-edit. If you do not either delete >+# this section or remove that file from @INC, this section >+# will be repeated redundantly when you re-create this >+# file again via Loader! See skip_load_external to disable >+# this feature. >+ >+use utf8; >+package Koha::Schema::Result::SavedSql; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::SavedSql >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<saved_sql> >+ >+=cut >+ >+__PACKAGE__->table("saved_sql"); >+ >+=head1 ACCESSORS >+ >+=head2 id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+unique id and primary key assigned by Koha >+ >+=head2 borrowernumber >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ >+the staff member who created this report (borrowers.borrowernumber) >+ >+=head2 date_created >+ >+ data_type: 'datetime' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 1 >+ >+the date this report was created >+ >+=head2 last_modified >+ >+ data_type: 'datetime' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 1 >+ >+the date this report was last edited >+ >+=head2 savedsql >+ >+ data_type: 'mediumtext' >+ is_nullable: 1 >+ >+the SQL for this report >+ >+=head2 last_run >+ >+ data_type: 'datetime' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 1 >+ >+=head2 report_name >+ >+ data_type: 'varchar' >+ default_value: (empty string) >+ is_nullable: 0 >+ size: 255 >+ >+the name of this report >+ >+=head2 type >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ >+always 1 for tabular >+ >+=head2 notes >+ >+ data_type: 'mediumtext' >+ is_nullable: 1 >+ >+the notes or description given to this report >+ >+=head2 cache_expiry >+ >+ data_type: 'integer' >+ default_value: 300 >+ is_nullable: 0 >+ >+=head2 public >+ >+ data_type: 'tinyint' >+ default_value: 0 >+ is_nullable: 0 >+ >+=head2 report_area >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 6 >+ >+=head2 report_group >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 80 >+ >+=head2 report_subgroup >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 80 >+ >+=head2 mana_id >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "borrowernumber", >+ { data_type => "integer", is_nullable => 1 }, >+ "date_created", >+ { >+ data_type => "datetime", >+ datetime_undef_if_invalid => 1, >+ is_nullable => 1, >+ }, >+ "last_modified", >+ { >+ data_type => "datetime", >+ datetime_undef_if_invalid => 1, >+ is_nullable => 1, >+ }, >+ "savedsql", >+ { data_type => "mediumtext", is_nullable => 1 }, >+ "last_run", >+ { >+ data_type => "datetime", >+ datetime_undef_if_invalid => 1, >+ is_nullable => 1, >+ }, >+ "report_name", >+ { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, >+ "type", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, >+ "notes", >+ { data_type => "mediumtext", is_nullable => 1 }, >+ "cache_expiry", >+ { data_type => "integer", default_value => 300, is_nullable => 0 }, >+ "public", >+ { data_type => "tinyint", default_value => 0, is_nullable => 0 }, >+ "report_area", >+ { data_type => "varchar", is_nullable => 1, size => 6 }, >+ "report_group", >+ { data_type => "varchar", is_nullable => 1, size => 80 }, >+ "report_subgroup", >+ { data_type => "varchar", is_nullable => 1, size => 80 }, >+ "mana_id", >+ { data_type => "integer", is_nullable => 1 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("id"); >+ > > # Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:198dNG9DGQzop+s5IHy7sw >@@ -214,3 +429,8 @@ sub koha_objects_class { > } > > 1; >+# End of lines loaded from '/kohadevbox/koha/Koha/Schema/Result/SavedSql.pm' >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >-- >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 16631
:
184422
|
184508
|
184509
|
184510
|
184511
|
184512
|
184513
|
184514
|
184515
|
184516
|
184517
|
184518
|
184519
|
184520
|
184521
|
184522
|
184525
|
184526
|
184657
|
184674
|
184686
|
184687
|
184688
|
184689
|
184690
|
184691
|
184692
|
184693
|
184694
|
184695
|
184845
|
184846
|
184847
|
184848
|
184859
|
184861
|
185627
|
185628
|
185779
|
185780
|
185781
|
185782
|
185788
|
185789
|
185790
|
186299
|
186300
|
186335
|
186393
|
186632
|
186633
|
188444
|
188445
|
189818
|
189819
|
190276
|
190277
|
190573
|
190574
|
190749
|
190750
|
190751
|
190752