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

(-)a/Koha/Patron.pm (-1 / +7 lines)
Lines 1957-1965 sub create_hold_group { Link Here
1957
        hold_ids => \@already_in_group_holds,
1957
        hold_ids => \@already_in_group_holds,
1958
    ) if @already_in_group_holds && !$force_grouped;
1958
    ) if @already_in_group_holds && !$force_grouped;
1959
1959
1960
    my @existing_ids                        = $self->_result->hold_groups->get_column('visual_hold_group_id')->all;
1961
    my $next_available_visual_hold_group_id = 1;
1962
    while ( grep { $_ == $next_available_visual_hold_group_id } @existing_ids ) {
1963
        $next_available_visual_hold_group_id++;
1964
    }
1965
1960
    my $hold_group_rs = $self->_result->create_related(
1966
    my $hold_group_rs = $self->_result->create_related(
1961
        'hold_groups',
1967
        'hold_groups',
1962
        {}
1968
        { visual_hold_group_id => $next_available_visual_hold_group_id }
1963
    );
1969
    );
1964
    foreach my $hold_id (@$hold_ids) {
1970
    foreach my $hold_id (@$hold_ids) {
1965
        my $hold = Koha::Holds->find($hold_id);
1971
        my $hold = Koha::Holds->find($hold_id);
(-)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 lines)
Lines 3552-3557 DROP TABLE IF EXISTS `hold_groups`; Link Here
3552
CREATE TABLE `hold_groups` (
3552
CREATE TABLE `hold_groups` (
3553
  `hold_group_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3553
  `hold_group_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3554
  `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table',
3554
  `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table',
3555
  `visual_hold_group_id` int(11) DEFAULT NULL COMMENT 'visual ID for this hold group, in the context of the related patron',
3555
  KEY `hold_groups_borrowernumber` (`borrowernumber`),
3556
  KEY `hold_groups_borrowernumber` (`borrowernumber`),
3556
  CONSTRAINT `hold_groups_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE,
3557
  CONSTRAINT `hold_groups_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE,
3557
  PRIMARY KEY (`hold_group_id`)
3558
  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