Bugzilla – Attachment 186748 Details for
Bug 40517
Allow grouping existing holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40517: Add visual_group_id to hold_groups
Bug-40517-Add-visualgroupid-to-holdgroups.patch (text/plain), 7.28 KB, created by
Andrew Fuerste-Henry
on 2025-09-22 20:05:39 UTC
(
hide
)
Description:
Bug 40517: Add visual_group_id to hold_groups
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2025-09-22 20:05:39 UTC
Size:
7.28 KB
patch
obsolete
>From 5f02b76207d49f32fcd47a8985217e8d3466b317 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Thu, 17 Jul 2025 14:42:56 +0000 >Subject: [PATCH] Bug 40517: Add visual_group_id to hold_groups > >Signed-off-by: Anneli <anneli.osterman@koha-suomi.fi> >Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> >--- > Koha/Patron.pm | 8 +++++++- > Koha/Schema/Result/HoldGroup.pm | 13 +++++++++++-- > Koha/Schema/Result/OldReserve.pm | 4 ++-- > Koha/Schema/Result/Reserve.pm | 4 ++-- > api/v1/swagger/definitions/hold_group.yaml | 3 +++ > .../bug_40517_-_hold_group_table_updates.pl | 9 ++++++++- > installer/data/mysql/kohastructure.sql | 3 ++- > svc/holds | 1 + > 8 files changed, 36 insertions(+), 9 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 541ec2bf237..1d0631d015f 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1916,9 +1916,15 @@ sub create_hold_group { > hold_ids => \@already_in_group_holds, > ) if @already_in_group_holds && !$force_grouped; > >+ my @existing_ids = $self->_result->hold_groups->get_column('visual_hold_group_id')->all; >+ my $next_available_visual_hold_group_id = 1; >+ while ( grep { $_ == $next_available_visual_hold_group_id } @existing_ids ) { >+ $next_available_visual_hold_group_id++; >+ } >+ > my $hold_group_rs = $self->_result->create_related( > 'hold_groups', >- {} >+ { visual_hold_group_id => $next_available_visual_hold_group_id } > ); > foreach my $hold_id (@$hold_ids) { > my $hold = Koha::Holds->find($hold_id); >diff --git a/Koha/Schema/Result/HoldGroup.pm b/Koha/Schema/Result/HoldGroup.pm >index ac2c9ffdbbf..173e7443e2a 100644 >--- a/Koha/Schema/Result/HoldGroup.pm >+++ b/Koha/Schema/Result/HoldGroup.pm >@@ -38,6 +38,13 @@ __PACKAGE__->table("hold_groups"); > > foreign key, linking this to the borrowers table > >+=head2 visual_hold_group_id >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ >+visual ID for this hold group, in the context of the related patron >+ > =cut > > __PACKAGE__->add_columns( >@@ -50,6 +57,8 @@ __PACKAGE__->add_columns( > }, > "borrowernumber", > { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "visual_hold_group_id", >+ { data_type => "integer", is_nullable => 1 }, > ); > > =head1 PRIMARY KEY >@@ -117,8 +126,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-16 10:57:50 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Y1eP6naEI2vi94gTHqtubw >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-25 13:02:35 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hlAYDHvqpFZRpNU+d+y4RA > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/Koha/Schema/Result/OldReserve.pm b/Koha/Schema/Result/OldReserve.pm >index 028386206dc..07bbcbc8079 100644 >--- a/Koha/Schema/Result/OldReserve.pm >+++ b/Koha/Schema/Result/OldReserve.pm >@@ -473,8 +473,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-09-03 17:08:22 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bo/exwlpahEVYtkWjusWLw >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-17 12:06:49 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gjkXXK86royQ6IaAFZI4Yg > > __PACKAGE__->belongs_to( > "item", >diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm >index 3e65b00f67c..664df77b482 100644 >--- a/Koha/Schema/Result/Reserve.pm >+++ b/Koha/Schema/Result/Reserve.pm >@@ -501,8 +501,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-09-03 17:08:22 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:57Fw53HngTXhDU7kVEjqYw >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-25 13:02:35 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:x5AS7F7aOMb9ihb8gaxZvQ > > __PACKAGE__->belongs_to( > "item", >diff --git a/api/v1/swagger/definitions/hold_group.yaml b/api/v1/swagger/definitions/hold_group.yaml >index cb9d34cc88e..271c262b58b 100644 >--- a/api/v1/swagger/definitions/hold_group.yaml >+++ b/api/v1/swagger/definitions/hold_group.yaml >@@ -7,6 +7,9 @@ properties: > borrowernumber: > type: integer > description: Patron this hold group belongs to >+ visual_hold_group_id: >+ type: integer >+ description: Visual ID for this hold group, in the context of the related patron > holds: > type: > - array >diff --git a/installer/data/mysql/atomicupdate/bug_40517_-_hold_group_table_updates.pl b/installer/data/mysql/atomicupdate/bug_40517_-_hold_group_table_updates.pl >index e520c378a40..0d7511eb763 100755 >--- a/installer/data/mysql/atomicupdate/bug_40517_-_hold_group_table_updates.pl >+++ b/installer/data/mysql/atomicupdate/bug_40517_-_hold_group_table_updates.pl >@@ -3,7 +3,7 @@ use Koha::Installer::Output qw(say_warning say_success say_info); > > return { > bug_number => "40517", >- description => "Add 'borrower' column to hold_groups", >+ description => "Add 'borrower' and 'visual_hold_group_id' column to hold_groups", > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; >@@ -27,5 +27,12 @@ return { > ); > say_success( $out, "Added column 'borrowernumber' to hold_groups" ); > } >+ >+ unless ( column_exists( 'hold_groups', 'visual_hold_group_id' ) ) { >+ $dbh->do( >+ q{ALTER TABLE hold_groups ADD COLUMN visual_hold_group_id int(11) DEFAULT NULL COMMENT 'visual ID for this hold group, in the context of the related patron' AFTER borrowernumber} >+ ); >+ say_success( $out, "Added column 'visual_hold_group_id' to hold_groups" ); >+ } > }, > }; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index fad2f319441..c320b1056cf 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -5070,8 +5070,9 @@ DROP TABLE IF EXISTS `hold_groups`; > /*!40101 SET @saved_cs_client = @@character_set_client */; > /*!40101 SET character_set_client = utf8 */; > CREATE TABLE hold_groups ( >- hold_group_id int unsigned NOT NULL AUTO_INCREMENT, >+ `hold_group_id` int unsigned NOT NULL AUTO_INCREMENT, > `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table', >+ `visual_hold_group_id` int(11) DEFAULT NULL COMMENT 'visual ID for this hold group, in the context of the related patron', > KEY `hold_groups_borrowernumber` (`borrowernumber`), > CONSTRAINT `hold_groups_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE, > PRIMARY KEY (hold_group_id) >diff --git a/svc/holds b/svc/holds >index 8dc9c75cd03..a755a7f422a 100755 >--- a/svc/holds >+++ b/svc/holds >@@ -114,6 +114,7 @@ while ( my $h = $holds_rs->next() ) { > reservenotes => $h->reservenotes(), > itemtype_limit => $itemtype_limit, > hold_group_id => $h->hold_group_id, >+ visual_hold_group_id => $h->hold_group ? $h->hold_group->visual_hold_group_id : q{}, > reservedate_formatted => $h->reservedate() > ? output_pref( { dt => dt_from_string( $h->reservedate() ), dateonly => 1 } ) > : q{}, >-- >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 40517
:
184640
|
184641
|
184642
|
184643
|
184644
|
184645
|
184646
|
184729
|
184732
|
184733
|
184734
|
184735
|
184736
|
184737
|
184738
|
184739
|
185217
|
186672
|
186673
|
186674
|
186675
|
186676
|
186677
|
186678
|
186679
|
186680
|
186745
|
186746
|
186747
|
186748
|
186749
|
186750
|
186751
|
186752
|
186753
|
187789
|
187790
|
187791
|
187792
|
187793
|
187794
|
187795
|
187796
|
187797
|
187801
|
187802
|
187803
|
187804
|
187805
|
187806
|
187807
|
187808
|
187809
|
187810
|
187811
|
187812
|
187965
|
187966
|
187967
|
187968
|
187969
|
187970
|
187971
|
187972
|
187973
|
187974
|
187975
|
187976
|
188293
|
188294
|
188343
|
188422