View | Details | Raw Unified | Return to bug 40517
Collapse All | Expand All

(-)a/Koha/Patron.pm (-1 / +7 lines)
Lines 1916-1924 sub create_hold_group { Link Here
1916
        hold_ids => \@already_in_group_holds,
1916
        hold_ids => \@already_in_group_holds,
1917
    ) if @already_in_group_holds && !$force_grouped;
1917
    ) if @already_in_group_holds && !$force_grouped;
1918
1918
1919
    my @existing_ids                        = $self->_result->hold_groups->get_column('visual_hold_group_id')->all;
1920
    my $next_available_visual_hold_group_id = 1;
1921
    while ( grep { $_ == $next_available_visual_hold_group_id } @existing_ids ) {
1922
        $next_available_visual_hold_group_id++;
1923
    }
1924
1919
    my $hold_group_rs = $self->_result->create_related(
1925
    my $hold_group_rs = $self->_result->create_related(
1920
        'hold_groups',
1926
        'hold_groups',
1921
        {}
1927
        { visual_hold_group_id => $next_available_visual_hold_group_id }
1922
    );
1928
    );
1923
    foreach my $hold_id (@$hold_ids) {
1929
    foreach my $hold_id (@$hold_ids) {
1924
        my $hold = Koha::Holds->find($hold_id);
1930
        my $hold = Koha::Holds->find($hold_id);
(-)a/Koha/Schema/Result/HoldGroup.pm (-2 / +11 lines)
Lines 38-43 __PACKAGE__->table("hold_groups"); Link Here
38
38
39
foreign key, linking this to the borrowers table
39
foreign key, linking this to the borrowers table
40
40
41
=head2 visual_hold_group_id
42
43
  data_type: 'integer'
44
  is_nullable: 1
45
46
visual ID for this hold group, in the context of the related patron
47
41
=cut
48
=cut
42
49
43
__PACKAGE__->add_columns(
50
__PACKAGE__->add_columns(
Lines 50-55 __PACKAGE__->add_columns( Link Here
50
  },
57
  },
51
  "borrowernumber",
58
  "borrowernumber",
52
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
59
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
60
  "visual_hold_group_id",
61
  { data_type => "integer", is_nullable => 1 },
53
);
62
);
54
63
55
=head1 PRIMARY KEY
64
=head1 PRIMARY KEY
Lines 117-124 __PACKAGE__->has_many( Link Here
117
);
126
);
118
127
119
128
120
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-16 10:57:50
129
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-25 13:02:35
121
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Y1eP6naEI2vi94gTHqtubw
130
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hlAYDHvqpFZRpNU+d+y4RA
122
131
123
132
124
# You can replace this text with custom code or comments, and it will be preserved on regeneration
133
# You can replace this text with custom code or comments, and it will be preserved on regeneration
(-)a/Koha/Schema/Result/OldReserve.pm (-2 / +2 lines)
Lines 473-480 __PACKAGE__->belongs_to( Link Here
473
);
473
);
474
474
475
475
476
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-09-03 17:08:22
476
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-17 12:06:49
477
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bo/exwlpahEVYtkWjusWLw
477
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gjkXXK86royQ6IaAFZI4Yg
478
478
479
__PACKAGE__->belongs_to(
479
__PACKAGE__->belongs_to(
480
  "item",
480
  "item",
(-)a/Koha/Schema/Result/Reserve.pm (-2 / +2 lines)
Lines 501-508 __PACKAGE__->belongs_to( Link Here
501
);
501
);
502
502
503
503
504
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-09-03 17:08:22
504
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-25 13:02:35
505
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:57Fw53HngTXhDU7kVEjqYw
505
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:x5AS7F7aOMb9ihb8gaxZvQ
506
506
507
__PACKAGE__->belongs_to(
507
__PACKAGE__->belongs_to(
508
  "item",
508
  "item",
(-)a/api/v1/swagger/definitions/hold_group.yaml (+3 lines)
Lines 7-12 properties: Link Here
7
  borrowernumber:
7
  borrowernumber:
8
    type: integer
8
    type: integer
9
    description: Patron this hold group belongs to
9
    description: Patron this hold group belongs to
10
  visual_hold_group_id:
11
    type: integer
12
    description: Visual ID for this hold group, in the context of the related patron
10
  holds:
13
  holds:
11
    type:
14
    type:
12
      - array
15
      - array
(-)a/installer/data/mysql/atomicupdate/bug_40517_-_hold_group_table_updates.pl (-1 / +8 lines)
Lines 3-9 use Koha::Installer::Output qw(say_warning say_success say_info); Link Here
3
3
4
return {
4
return {
5
    bug_number  => "40517",
5
    bug_number  => "40517",
6
    description => "Add 'borrower' column to hold_groups",
6
    description => "Add 'borrower' and 'visual_hold_group_id' column to hold_groups",
7
    up          => sub {
7
    up          => sub {
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
Lines 27-31 return { Link Here
27
            );
27
            );
28
            say_success( $out, "Added column 'borrowernumber' to hold_groups" );
28
            say_success( $out, "Added column 'borrowernumber' to hold_groups" );
29
        }
29
        }
30
31
        unless ( column_exists( 'hold_groups', 'visual_hold_group_id' ) ) {
32
            $dbh->do(
33
                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}
34
            );
35
            say_success( $out, "Added column 'visual_hold_group_id' to hold_groups" );
36
        }
30
    },
37
    },
31
};
38
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 5070-5077 DROP TABLE IF EXISTS `hold_groups`; Link Here
5070
/*!40101 SET @saved_cs_client     = @@character_set_client */;
5070
/*!40101 SET @saved_cs_client     = @@character_set_client */;
5071
/*!40101 SET character_set_client = utf8 */;
5071
/*!40101 SET character_set_client = utf8 */;
5072
CREATE TABLE hold_groups (
5072
CREATE TABLE hold_groups (
5073
    hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
5073
    `hold_group_id` int unsigned NOT NULL AUTO_INCREMENT,
5074
    `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table',
5074
    `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table',
5075
    `visual_hold_group_id` int(11) DEFAULT NULL COMMENT 'visual ID for this hold group, in the context of the related patron',
5075
    KEY `hold_groups_borrowernumber` (`borrowernumber`),
5076
    KEY `hold_groups_borrowernumber` (`borrowernumber`),
5076
    CONSTRAINT `hold_groups_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE,
5077
    CONSTRAINT `hold_groups_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE,
5077
    PRIMARY KEY (hold_group_id)
5078
    PRIMARY KEY (hold_group_id)
(-)a/svc/holds (-1 / +1 lines)
Lines 114-119 while ( my $h = $holds_rs->next() ) { Link Here
114
        reservenotes          => $h->reservenotes(),
114
        reservenotes          => $h->reservenotes(),
115
        itemtype_limit        => $itemtype_limit,
115
        itemtype_limit        => $itemtype_limit,
116
        hold_group_id         => $h->hold_group_id,
116
        hold_group_id         => $h->hold_group_id,
117
        visual_hold_group_id  => $h->hold_group ? $h->hold_group->visual_hold_group_id : q{},
117
        reservedate_formatted => $h->reservedate()
118
        reservedate_formatted => $h->reservedate()
118
        ? output_pref( { dt => dt_from_string( $h->reservedate() ), dateonly => 1 } )
119
        ? output_pref( { dt => dt_from_string( $h->reservedate() ), dateonly => 1 } )
119
        : q{},
120
        : q{},
120
- 

Return to bug 40517