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

(-)a/Koha/Patron.pm (-1 / +7 lines)
Lines 1897-1905 sub create_hold_group { Link Here
1897
        hold_ids => \@already_in_group_holds,
1897
        hold_ids => \@already_in_group_holds,
1898
    ) if @already_in_group_holds && !$force_grouped;
1898
    ) if @already_in_group_holds && !$force_grouped;
1899
1899
1900
    my @existing_ids                        = $self->_result->hold_groups->get_column('visual_hold_group_id')->all;
1901
    my $next_available_visual_hold_group_id = 1;
1902
    while ( grep { $_ == $next_available_visual_hold_group_id } @existing_ids ) {
1903
        $next_available_visual_hold_group_id++;
1904
    }
1905
1900
    my $hold_group_rs = $self->_result->create_related(
1906
    my $hold_group_rs = $self->_result->create_related(
1901
        'hold_groups',
1907
        'hold_groups',
1902
        {}
1908
        { visual_hold_group_id => $next_available_visual_hold_group_id }
1903
    );
1909
    );
1904
    foreach my $hold_id (@$hold_ids) {
1910
    foreach my $hold_id (@$hold_ids) {
1905
        my $hold = Koha::Holds->find($hold_id);
1911
        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 (-12 / +12 lines)
Lines 392-409 __PACKAGE__->belongs_to( Link Here
392
  },
392
  },
393
);
393
);
394
394
395
=head2 item_group
395
=head2 hold_group
396
396
397
Type: belongs_to
397
Type: belongs_to
398
398
399
Related object: L<Koha::Schema::Result::ItemGroup>
399
Related object: L<Koha::Schema::Result::HoldGroup>
400
400
401
=cut
401
=cut
402
402
403
__PACKAGE__->belongs_to(
403
__PACKAGE__->belongs_to(
404
  "item_group",
404
  "hold_group",
405
  "Koha::Schema::Result::ItemGroup",
405
  "Koha::Schema::Result::HoldGroup",
406
  { item_group_id => "item_group_id" },
406
  { hold_group_id => "hold_group_id" },
407
  {
407
  {
408
    is_deferrable => 1,
408
    is_deferrable => 1,
409
    join_type     => "LEFT",
409
    join_type     => "LEFT",
Lines 412-429 __PACKAGE__->belongs_to( Link Here
412
  },
412
  },
413
);
413
);
414
414
415
=head2 hold_group
415
=head2 item_group
416
416
417
Type: belongs_to
417
Type: belongs_to
418
418
419
Related object: L<Koha::Schema::Result::HoldGroup>
419
Related object: L<Koha::Schema::Result::ItemGroup>
420
420
421
=cut
421
=cut
422
422
423
__PACKAGE__->belongs_to(
423
__PACKAGE__->belongs_to(
424
  "hold_group",
424
  "item_group",
425
  "Koha::Schema::Result::HoldGroup",
425
  "Koha::Schema::Result::ItemGroup",
426
  { hold_group_id => "hold_group_id" },
426
  { item_group_id => "item_group_id" },
427
  {
427
  {
428
    is_deferrable => 1,
428
    is_deferrable => 1,
429
    join_type     => "LEFT",
429
    join_type     => "LEFT",
Lines 473-480 __PACKAGE__->belongs_to( Link Here
473
);
473
);
474
474
475
475
476
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-10-30 17:21:09
476
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-17 12:06:49
477
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6huDoFe9Uil1WyJ7EOcQSw
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 (-12 / +12 lines)
Lines 420-437 __PACKAGE__->belongs_to( Link Here
420
  },
420
  },
421
);
421
);
422
422
423
=head2 item_group
423
=head2 hold_group
424
424
425
Type: belongs_to
425
Type: belongs_to
426
426
427
Related object: L<Koha::Schema::Result::ItemGroup>
427
Related object: L<Koha::Schema::Result::HoldGroup>
428
428
429
=cut
429
=cut
430
430
431
__PACKAGE__->belongs_to(
431
__PACKAGE__->belongs_to(
432
  "item_group",
432
  "hold_group",
433
  "Koha::Schema::Result::ItemGroup",
433
  "Koha::Schema::Result::HoldGroup",
434
  { item_group_id => "item_group_id" },
434
  { hold_group_id => "hold_group_id" },
435
  {
435
  {
436
    is_deferrable => 1,
436
    is_deferrable => 1,
437
    join_type     => "LEFT",
437
    join_type     => "LEFT",
Lines 440-457 __PACKAGE__->belongs_to( Link Here
440
  },
440
  },
441
);
441
);
442
442
443
=head2 hold_group
443
=head2 item_group
444
444
445
Type: belongs_to
445
Type: belongs_to
446
446
447
Related object: L<Koha::Schema::Result::HoldGroup>
447
Related object: L<Koha::Schema::Result::ItemGroup>
448
448
449
=cut
449
=cut
450
450
451
__PACKAGE__->belongs_to(
451
__PACKAGE__->belongs_to(
452
  "hold_group",
452
  "item_group",
453
  "Koha::Schema::Result::HoldGroup",
453
  "Koha::Schema::Result::ItemGroup",
454
  { hold_group_id => "hold_group_id" },
454
  { item_group_id => "item_group_id" },
455
  {
455
  {
456
    is_deferrable => 1,
456
    is_deferrable => 1,
457
    join_type     => "LEFT",
457
    join_type     => "LEFT",
Lines 501-508 __PACKAGE__->belongs_to( Link Here
501
);
501
);
502
502
503
503
504
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-10-30 17:21:09
504
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-25 13:02:35
505
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bmt1FkgXdJSOMQFdAHO3cQ
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 5065-5072 DROP TABLE IF EXISTS `hold_groups`; Link Here
5065
/*!40101 SET @saved_cs_client     = @@character_set_client */;
5065
/*!40101 SET @saved_cs_client     = @@character_set_client */;
5066
/*!40101 SET character_set_client = utf8 */;
5066
/*!40101 SET character_set_client = utf8 */;
5067
CREATE TABLE hold_groups (
5067
CREATE TABLE hold_groups (
5068
    hold_group_id int unsigned NOT NULL AUTO_INCREMENT,
5068
    `hold_group_id` int unsigned NOT NULL AUTO_INCREMENT,
5069
    `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table',
5069
    `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table',
5070
    `visual_hold_group_id` int(11) DEFAULT NULL COMMENT 'visual ID for this hold group, in the context of the related patron',
5070
    KEY `hold_groups_borrowernumber` (`borrowernumber`),
5071
    KEY `hold_groups_borrowernumber` (`borrowernumber`),
5071
    CONSTRAINT `hold_groups_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE,
5072
    CONSTRAINT `hold_groups_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE,
5072
    PRIMARY KEY (hold_group_id)
5073
    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