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

(-)a/Koha/Patron.pm (+15 lines)
Lines 46-51 use Koha::Encryption; Link Here
46
use Koha::Exceptions;
46
use Koha::Exceptions;
47
use Koha::Exceptions::Password;
47
use Koha::Exceptions::Password;
48
use Koha::Holds;
48
use Koha::Holds;
49
use Koha::HoldGroups;
49
use Koha::ILL::Requests;
50
use Koha::ILL::Requests;
50
use Koha::Old::Checkouts;
51
use Koha::Old::Checkouts;
51
use Koha::OverdueRules;
52
use Koha::OverdueRules;
Lines 1828-1833 sub old_holds { Link Here
1828
    return Koha::Old::Holds->_new_from_dbic($old_holds_rs);
1829
    return Koha::Old::Holds->_new_from_dbic($old_holds_rs);
1829
}
1830
}
1830
1831
1832
=head3 hold_groups
1833
1834
my $hold_groups = $patron->hold_groups
1835
1836
Return all of this patron's hold groups
1837
1838
=cut
1839
1840
sub hold_groups {
1841
    my ($self) = @_;
1842
    my $hold_group_rs = $self->_result->hold_groups->search( {}, { order_by => 'hold_group_id' } );
1843
    return Koha::HoldGroups->_new_from_dbic($hold_group_rs);
1844
}
1845
1831
=head3 curbside_pickups
1846
=head3 curbside_pickups
1832
1847
1833
my $curbside_pickups = $patron->curbside_pickups;
1848
my $curbside_pickups = $patron->curbside_pickups;
(-)a/Koha/Schema/Result/Borrower.pm (-2 / +17 lines)
Lines 1391-1396 __PACKAGE__->has_many( Link Here
1391
  { cascade_copy => 0, cascade_delete => 0 },
1391
  { cascade_copy => 0, cascade_delete => 0 },
1392
);
1392
);
1393
1393
1394
=head2 hold_groups
1395
1396
Type: has_many
1397
1398
Related object: L<Koha::Schema::Result::HoldGroup>
1399
1400
=cut
1401
1402
__PACKAGE__->has_many(
1403
  "hold_groups",
1404
  "Koha::Schema::Result::HoldGroup",
1405
  { "foreign.borrowernumber" => "self.borrowernumber" },
1406
  { cascade_copy => 0, cascade_delete => 0 },
1407
);
1408
1394
=head2 housebound_profile
1409
=head2 housebound_profile
1395
1410
1396
Type: might_have
1411
Type: might_have
Lines 2197-2204 Composing rels: L</user_permissions> -> permission Link Here
2197
__PACKAGE__->many_to_many("permissions", "user_permissions", "permission");
2212
__PACKAGE__->many_to_many("permissions", "user_permissions", "permission");
2198
2213
2199
2214
2200
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-10 07:11:31
2215
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-16 10:57:50
2201
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XFOe2X4k2DUziaNS5pWd/Q
2216
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1mCQb2VuHB10JWtlJXTBWw
2202
2217
2203
__PACKAGE__->belongs_to(
2218
__PACKAGE__->belongs_to(
2204
  "library",
2219
  "library",
(-)a/Koha/Schema/Result/HoldGroup.pm (-2 / +32 lines)
Lines 30-35 __PACKAGE__->table("hold_groups"); Link Here
30
  is_auto_increment: 1
30
  is_auto_increment: 1
31
  is_nullable: 0
31
  is_nullable: 0
32
32
33
=head2 borrowernumber
34
35
  data_type: 'integer'
36
  is_foreign_key: 1
37
  is_nullable: 1
38
39
foreign key, linking this to the borrowers table
40
33
=cut
41
=cut
34
42
35
__PACKAGE__->add_columns(
43
__PACKAGE__->add_columns(
Lines 40-45 __PACKAGE__->add_columns( Link Here
40
    is_auto_increment => 1,
48
    is_auto_increment => 1,
41
    is_nullable => 0,
49
    is_nullable => 0,
42
  },
50
  },
51
  "borrowernumber",
52
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
43
);
53
);
44
54
45
=head1 PRIMARY KEY
55
=head1 PRIMARY KEY
Lines 56-61 __PACKAGE__->set_primary_key("hold_group_id"); Link Here
56
66
57
=head1 RELATIONS
67
=head1 RELATIONS
58
68
69
=head2 borrowernumber
70
71
Type: belongs_to
72
73
Related object: L<Koha::Schema::Result::Borrower>
74
75
=cut
76
77
__PACKAGE__->belongs_to(
78
  "borrowernumber",
79
  "Koha::Schema::Result::Borrower",
80
  { borrowernumber => "borrowernumber" },
81
  {
82
    is_deferrable => 1,
83
    join_type     => "LEFT",
84
    on_delete     => "CASCADE",
85
    on_update     => "RESTRICT",
86
  },
87
);
88
59
=head2 old_reserves
89
=head2 old_reserves
60
90
61
Type: has_many
91
Type: has_many
Lines 87-94 __PACKAGE__->has_many( Link Here
87
);
117
);
88
118
89
119
90
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-08-04 14:43:31
120
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-16 10:57:50
91
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5Xzfn2C7H+Z8R9PUBPFkYw
121
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Y1eP6naEI2vi94gTHqtubw
92
122
93
123
94
# You can replace this text with custom code or comments, and it will be preserved on regeneration
124
# You can replace this text with custom code or comments, and it will be preserved on regeneration
(-)a/installer/data/mysql/atomicupdate/bug_40517_-_hold_group_table_updates.pl (+31 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "40517",
6
    description => "Add 'borrower' column to hold_groups",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        unless ( column_exists( 'hold_groups', 'borrowernumber' ) ) {
12
            $dbh->do(
13
                q{ALTER TABLE hold_groups ADD COLUMN borrowernumber int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table' AFTER hold_group_id}
14
            );
15
            $dbh->do(
16
                q{
17
                    ALTER TABLE hold_groups ADD KEY `hold_groups_borrowernumber` (`borrowernumber`)
18
                }
19
            );
20
            $dbh->do(
21
                q{
22
                    ALTER TABLE hold_groups ADD CONSTRAINT hold_groups_ibfk_1
23
                    FOREIGN KEY(`borrowernumber`)
24
                    REFERENCES `borrowers` (`borrowernumber`)
25
                    ON DELETE CASCADE;
26
                }
27
            );
28
            say_success( $out, "Added column 'borrowernumber' to hold_groups" );
29
        }
30
    },
31
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +3 lines)
Lines 5066-5071 DROP TABLE IF EXISTS `hold_groups`; Link Here
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',
5070
    KEY `hold_groups_borrowernumber` (`borrowernumber`),
5071
    CONSTRAINT `hold_groups_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE,
5069
    PRIMARY KEY (hold_group_id)
5072
    PRIMARY KEY (hold_group_id)
5070
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5073
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5071
/*!40101 SET character_set_client = @saved_cs_client */;
5074
/*!40101 SET character_set_client = @saved_cs_client */;
5072
- 

Return to bug 40517