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

(-)a/Koha/Schema/Result/ItemGroup.pm (+156 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::ItemGroup;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::ItemGroup
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<item_groups>
19
20
=cut
21
22
__PACKAGE__->table("item_groups");
23
24
=head1 ACCESSORS
25
26
=head2 item_group_id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
id for the items group
33
34
=head2 biblio_id
35
36
  data_type: 'integer'
37
  default_value: 0
38
  is_foreign_key: 1
39
  is_nullable: 0
40
41
id for the bibliographic record the group belongs to
42
43
=head2 display_order
44
45
  data_type: 'integer'
46
  default_value: 0
47
  is_nullable: 0
48
49
The 'sort order' for item_groups
50
51
=head2 description
52
53
  data_type: 'mediumtext'
54
  is_nullable: 1
55
56
A group description
57
58
=head2 created_on
59
60
  data_type: 'timestamp'
61
  datetime_undef_if_invalid: 1
62
  is_nullable: 1
63
64
Time and date the group was created
65
66
=head2 updated_on
67
68
  data_type: 'timestamp'
69
  datetime_undef_if_invalid: 1
70
  default_value: current_timestamp
71
  is_nullable: 0
72
73
Time and date of the latest change on the group
74
75
=cut
76
77
__PACKAGE__->add_columns(
78
  "item_group_id",
79
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
80
  "biblio_id",
81
  {
82
    data_type      => "integer",
83
    default_value  => 0,
84
    is_foreign_key => 1,
85
    is_nullable    => 0,
86
  },
87
  "display_order",
88
  { data_type => "integer", default_value => 0, is_nullable => 0 },
89
  "description",
90
  { data_type => "mediumtext", is_nullable => 1 },
91
  "created_on",
92
  {
93
    data_type => "timestamp",
94
    datetime_undef_if_invalid => 1,
95
    is_nullable => 1,
96
  },
97
  "updated_on",
98
  {
99
    data_type => "timestamp",
100
    datetime_undef_if_invalid => 1,
101
    default_value => \"current_timestamp",
102
    is_nullable => 0,
103
  },
104
);
105
106
=head1 PRIMARY KEY
107
108
=over 4
109
110
=item * L</item_group_id>
111
112
=back
113
114
=cut
115
116
__PACKAGE__->set_primary_key("item_group_id");
117
118
=head1 RELATIONS
119
120
=head2 biblio
121
122
Type: belongs_to
123
124
Related object: L<Koha::Schema::Result::Biblio>
125
126
=cut
127
128
__PACKAGE__->belongs_to(
129
  "biblio",
130
  "Koha::Schema::Result::Biblio",
131
  { biblionumber => "biblio_id" },
132
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
133
);
134
135
=head2 item_group_items
136
137
Type: has_many
138
139
Related object: L<Koha::Schema::Result::ItemGroupItem>
140
141
=cut
142
143
__PACKAGE__->has_many(
144
  "item_group_items",
145
  "Koha::Schema::Result::ItemGroupItem",
146
  { "foreign.item_group_id" => "self.item_group_id" },
147
  { cascade_copy => 0, cascade_delete => 0 },
148
);
149
150
151
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-02 16:18:20
152
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YO7VdfzHDqBjGHt7vQX7gw
153
154
155
# You can replace this text with custom code or comments, and it will be preserved on regeneration
156
1;
(-)a/Koha/Schema/Result/ItemGroupItem.pm (-1 / +137 lines)
Line 0 Link Here
0
- 
1
use utf8;
2
package Koha::Schema::Result::ItemGroupItem;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::ItemGroupItem
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<item_group_items>
19
20
=cut
21
22
__PACKAGE__->table("item_group_items");
23
24
=head1 ACCESSORS
25
26
=head2 item_group_items_id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
id for the group/item link
33
34
=head2 item_group_id
35
36
  data_type: 'integer'
37
  default_value: 0
38
  is_foreign_key: 1
39
  is_nullable: 0
40
41
foreign key making this table a 1 to 1 join from items to item groups
42
43
=head2 item_id
44
45
  data_type: 'integer'
46
  default_value: 0
47
  is_foreign_key: 1
48
  is_nullable: 0
49
50
foreign key linking this table to the items table
51
52
=cut
53
54
__PACKAGE__->add_columns(
55
  "item_group_items_id",
56
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
57
  "item_group_id",
58
  {
59
    data_type      => "integer",
60
    default_value  => 0,
61
    is_foreign_key => 1,
62
    is_nullable    => 0,
63
  },
64
  "item_id",
65
  {
66
    data_type      => "integer",
67
    default_value  => 0,
68
    is_foreign_key => 1,
69
    is_nullable    => 0,
70
  },
71
);
72
73
=head1 PRIMARY KEY
74
75
=over 4
76
77
=item * L</item_group_items_id>
78
79
=back
80
81
=cut
82
83
__PACKAGE__->set_primary_key("item_group_items_id");
84
85
=head1 UNIQUE CONSTRAINTS
86
87
=head2 C<item_id>
88
89
=over 4
90
91
=item * L</item_id>
92
93
=back
94
95
=cut
96
97
__PACKAGE__->add_unique_constraint("item_id", ["item_id"]);
98
99
=head1 RELATIONS
100
101
=head2 item
102
103
Type: belongs_to
104
105
Related object: L<Koha::Schema::Result::Item>
106
107
=cut
108
109
__PACKAGE__->belongs_to(
110
  "item",
111
  "Koha::Schema::Result::Item",
112
  { itemnumber => "item_id" },
113
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
114
);
115
116
=head2 item_group
117
118
Type: belongs_to
119
120
Related object: L<Koha::Schema::Result::ItemGroup>
121
122
=cut
123
124
__PACKAGE__->belongs_to(
125
  "item_group",
126
  "Koha::Schema::Result::ItemGroup",
127
  { item_group_id => "item_group_id" },
128
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
129
);
130
131
132
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-02 16:18:20
133
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FLtrDLTHqXdzqyOmVvaXJQ
134
135
136
# You can replace this text with custom code or comments, and it will be preserved on regeneration
137
1;

Return to bug 24857