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

(-)a/Koha/Schema/Result/Biblio.pm (-2 / +21 lines)
Lines 315-320 __PACKAGE__->has_many( Link Here
315
  { cascade_copy => 0, cascade_delete => 0 },
315
  { cascade_copy => 0, cascade_delete => 0 },
316
);
316
);
317
317
318
=head2 item_groups
319
320
Type: has_many
321
322
Related object: L<Koha::Schema::Result::ItemGroup>
323
324
=cut
325
326
__PACKAGE__->has_many(
327
  "item_groups",
328
  "Koha::Schema::Result::ItemGroup",
329
  { "foreign.biblio_id" => "self.biblionumber" },
330
  { cascade_copy => 0, cascade_delete => 0 },
331
);
332
318
=head2 items
333
=head2 items
319
334
320
Type: has_many
335
Type: has_many
Lines 511-518 __PACKAGE__->has_many( Link Here
511
);
526
);
512
527
513
528
514
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-27 08:42:21
529
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33
515
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fsBT6f/ma1fDlGQoauO7Uw
530
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+wyHrHxnufn5n/hF2mfB6Q
531
=======
532
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35
533
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BILvOleQqOV6/Apcx7kXVg
534
>>>>>>> Bug 24857: Rename Volumes => Item groups (DB)
516
535
517
__PACKAGE__->has_many(
536
__PACKAGE__->has_many(
518
  "biblioitem",
537
  "biblioitem",
(-)a/Koha/Schema/Result/Item.pm (-2 / +21 lines)
Lines 729-734 __PACKAGE__->might_have( Link Here
729
  { cascade_copy => 0, cascade_delete => 0 },
729
  { cascade_copy => 0, cascade_delete => 0 },
730
);
730
);
731
731
732
=head2 item_group_items
733
734
Type: has_many
735
736
Related object: L<Koha::Schema::Result::ItemGroupItem>
737
738
=cut
739
740
__PACKAGE__->has_many(
741
  "item_group_items",
742
  "Koha::Schema::Result::ItemGroupItem",
743
  { "foreign.item_id" => "self.itemnumber" },
744
  { cascade_copy => 0, cascade_delete => 0 },
745
);
746
732
=head2 items_last_borrower
747
=head2 items_last_borrower
733
748
734
Type: might_have
749
Type: might_have
Lines 865-872 __PACKAGE__->has_many( Link Here
865
);
880
);
866
881
867
882
868
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-27 08:42:21
883
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33
869
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SjZn3haOtUZWu1jrMigjNQ
884
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1mLs4vLD2LsJGkBKZCZbXg
885
=======
886
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35
887
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WG9AuZsBgTMEWjlfwFQdeA
888
>>>>>>> Bug 24857: Rename Volumes => Item groups (DB)
870
889
871
__PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" );
890
__PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" );
872
891
(-)a/Koha/Schema/Result/Volume.pm (-27 / +47 lines)
Lines 1-12 Link Here
1
use utf8;
1
use utf8;
2
package Koha::Schema::Result::Volume;
2
package Koha::Schema::Result::ItemGroup;
3
3
4
# Created by DBIx::Class::Schema::Loader
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
6
7
=head1 NAME
7
=head1 NAME
8
8
9
Koha::Schema::Result::Volume
9
Koha::Schema::Result::ItemGroup
10
10
11
=cut
11
=cut
12
12
Lines 15-52 use warnings; Link Here
15
15
16
use base 'DBIx::Class::Core';
16
use base 'DBIx::Class::Core';
17
17
18
=head1 TABLE: C<volumes>
18
=head1 TABLE: C<item_groups>
19
19
20
=cut
20
=cut
21
21
22
__PACKAGE__->table("volumes");
22
__PACKAGE__->table("item_groups");
23
23
24
=head1 ACCESSORS
24
=head1 ACCESSORS
25
25
26
=head2 id
26
=head2 item_group_id
27
27
28
  data_type: 'integer'
28
  data_type: 'integer'
29
  is_auto_increment: 1
29
  is_auto_increment: 1
30
  is_nullable: 0
30
  is_nullable: 0
31
31
32
=head2 biblionumber
32
id for the items group
33
34
=head2 biblio_id
33
35
34
  data_type: 'integer'
36
  data_type: 'integer'
35
  default_value: 0
37
  default_value: 0
36
  is_foreign_key: 1
38
  is_foreign_key: 1
37
  is_nullable: 0
39
  is_nullable: 0
38
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
39
=head2 description
51
=head2 description
40
52
41
  data_type: 'mediumtext'
53
  data_type: 'mediumtext'
42
  is_nullable: 1
54
  is_nullable: 1
43
55
56
A group description
57
44
=head2 created_on
58
=head2 created_on
45
59
46
  data_type: 'timestamp'
60
  data_type: 'timestamp'
47
  datetime_undef_if_invalid: 1
61
  datetime_undef_if_invalid: 1
48
  default_value: '0000-00-00 00:00:00'
62
  is_nullable: 1
49
  is_nullable: 0
63
64
Time and date the group was created
50
65
51
=head2 updated_on
66
=head2 updated_on
52
67
Lines 55-80 __PACKAGE__->table("volumes"); Link Here
55
  default_value: current_timestamp
70
  default_value: current_timestamp
56
  is_nullable: 0
71
  is_nullable: 0
57
72
73
Time and date of the latest change on the group
74
58
=cut
75
=cut
59
76
60
__PACKAGE__->add_columns(
77
__PACKAGE__->add_columns(
61
  "id",
78
  "item_group_id",
62
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
79
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
63
  "biblionumber",
80
  "biblio_id",
64
  {
81
  {
65
    data_type      => "integer",
82
    data_type      => "integer",
66
    default_value  => 0,
83
    default_value  => 0,
67
    is_foreign_key => 1,
84
    is_foreign_key => 1,
68
    is_nullable    => 0,
85
    is_nullable    => 0,
69
  },
86
  },
87
  "display_order",
88
  { data_type => "integer", default_value => 0, is_nullable => 0 },
70
  "description",
89
  "description",
71
  { data_type => "mediumtext", is_nullable => 1 },
90
  { data_type => "mediumtext", is_nullable => 1 },
72
  "created_on",
91
  "created_on",
73
  {
92
  {
74
    data_type => "timestamp",
93
    data_type => "timestamp",
75
    datetime_undef_if_invalid => 1,
94
    datetime_undef_if_invalid => 1,
76
    default_value => "0000-00-00 00:00:00",
95
    is_nullable => 1,
77
    is_nullable => 0,
78
  },
96
  },
79
  "updated_on",
97
  "updated_on",
80
  {
98
  {
Lines 89-105 __PACKAGE__->add_columns( Link Here
89
107
90
=over 4
108
=over 4
91
109
92
=item * L</id>
110
=item * L</item_group_id>
93
111
94
=back
112
=back
95
113
96
=cut
114
=cut
97
115
98
__PACKAGE__->set_primary_key("id");
116
__PACKAGE__->set_primary_key("item_group_id");
99
117
100
=head1 RELATIONS
118
=head1 RELATIONS
101
119
102
=head2 biblionumber
120
=head2 biblio
103
121
104
Type: belongs_to
122
Type: belongs_to
105
123
Lines 108-137 Related object: L<Koha::Schema::Result::Biblio> Link Here
108
=cut
126
=cut
109
127
110
__PACKAGE__->belongs_to(
128
__PACKAGE__->belongs_to(
111
  "biblionumber",
129
  "biblio",
112
  "Koha::Schema::Result::Biblio",
130
  "Koha::Schema::Result::Biblio",
113
  { biblionumber => "biblionumber" },
131
  { biblionumber => "biblio_id" },
114
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
132
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
115
);
133
);
116
134
117
=head2 volume_items
135
=head2 item_group_items
118
136
119
Type: has_many
137
Type: has_many
120
138
121
Related object: L<Koha::Schema::Result::VolumeItem>
139
Related object: L<Koha::Schema::Result::ItemGroupItem>
122
140
123
=cut
141
=cut
124
142
125
__PACKAGE__->has_many(
143
__PACKAGE__->has_many(
126
  "volume_items",
144
  "item_group_items",
127
  "Koha::Schema::Result::VolumeItem",
145
  "Koha::Schema::Result::ItemGroupItem",
128
  { "foreign.volume_id" => "self.id" },
146
  { "foreign.item_group_id" => "self.item_group_id" },
129
  { cascade_copy => 0, cascade_delete => 0 },
147
  { cascade_copy => 0, cascade_delete => 0 },
130
);
148
);
131
149
132
150
133
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-04 15:22:18
151
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33
134
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cXvLM2TgY18pxE2ZJBMouw
152
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uB7PHJt6WQHMv/saTCpkOw
135
153
136
=head2 koha_objects_class
154
=head2 koha_objects_class
137
155
Lines 144-152 sub koha_objects_class { Link Here
144
=head2 koha_object_class
162
=head2 koha_object_class
145
163
146
=cut
164
=cut
165
=======
166
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35
167
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1WBTrtEB25MCOwR4nqPpVA
168
>>>>>>> Bug 24857: Rename Volumes => Item groups (DB):Koha/Schema/Result/ItemGroup.pm
147
169
148
sub koha_object_class {
149
    'Koha::Biblio::Volume';
150
}
151
170
171
# You can replace this text with custom code or comments, and it will be preserved on regeneration
152
1;
172
1;
(-)a/Koha/Schema/Result/ItemGroupItem.pm (+155 lines)
Line 0 Link Here
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_group_id>
88
89
=over 4
90
91
=item * L</item_group_id>
92
93
=item * L</item_id>
94
95
=back
96
97
=cut
98
99
__PACKAGE__->add_unique_constraint("item_group_id", ["item_group_id", "item_id"]);
100
101
=head1 RELATIONS
102
103
=head2 item
104
105
Type: belongs_to
106
107
Related object: L<Koha::Schema::Result::Item>
108
109
=cut
110
111
__PACKAGE__->belongs_to(
112
  "item",
113
  "Koha::Schema::Result::Item",
114
  { itemnumber => "item_id" },
115
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
116
);
117
118
=head2 item_group
119
120
Type: belongs_to
121
122
Related object: L<Koha::Schema::Result::ItemGroup>
123
124
=cut
125
126
__PACKAGE__->belongs_to(
127
  "item_group",
128
  "Koha::Schema::Result::ItemGroup",
129
  { item_group_id => "item_group_id" },
130
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
131
);
132
133
134
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33
135
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zfCA4diZgiexDnY1rD6xkQ
136
137
=head2 koha_object_class
138
139
=cut
140
141
sub koha_object_class {
142
    'Koha::Biblio::Volume::Item';
143
}
144
145
=head2 koha_objects_class
146
147
=cut
148
=======
149
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35
150
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UkFl9MLWlH8wy3T/AaVIdQ
151
>>>>>>> Bug 24857: Rename Volumes => Item groups (DB):Koha/Schema/Result/ItemGroupItem.pm
152
153
154
# You can replace this text with custom code or comments, and it will be preserved on regeneration
155
1;
(-)a/Koha/Schema/Result/VolumeItem.pm (-131 lines)
Lines 1-131 Link Here
1
use utf8;
2
package Koha::Schema::Result::VolumeItem;
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::VolumeItem
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<volume_items>
19
20
=cut
21
22
__PACKAGE__->table("volume_items");
23
24
=head1 ACCESSORS
25
26
=head2 id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
=head2 volume_id
33
34
  data_type: 'integer'
35
  default_value: 0
36
  is_foreign_key: 1
37
  is_nullable: 0
38
39
=head2 itemnumber
40
41
  data_type: 'integer'
42
  default_value: 0
43
  is_foreign_key: 1
44
  is_nullable: 0
45
46
=cut
47
48
__PACKAGE__->add_columns(
49
  "id",
50
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
51
  "volume_id",
52
  {
53
    data_type      => "integer",
54
    default_value  => 0,
55
    is_foreign_key => 1,
56
    is_nullable    => 0,
57
  },
58
  "itemnumber",
59
  {
60
    data_type      => "integer",
61
    default_value  => 0,
62
    is_foreign_key => 1,
63
    is_nullable    => 0,
64
  },
65
);
66
67
=head1 PRIMARY KEY
68
69
=over 4
70
71
=item * L</id>
72
73
=back
74
75
=cut
76
77
__PACKAGE__->set_primary_key("id");
78
79
=head1 RELATIONS
80
81
=head2 itemnumber
82
83
Type: belongs_to
84
85
Related object: L<Koha::Schema::Result::Item>
86
87
=cut
88
89
__PACKAGE__->belongs_to(
90
  "itemnumber",
91
  "Koha::Schema::Result::Item",
92
  { itemnumber => "itemnumber" },
93
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
94
);
95
96
=head2 volume
97
98
Type: belongs_to
99
100
Related object: L<Koha::Schema::Result::Volume>
101
102
=cut
103
104
__PACKAGE__->belongs_to(
105
  "volume",
106
  "Koha::Schema::Result::Volume",
107
  { id => "volume_id" },
108
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
109
);
110
111
112
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-03 18:25:20
113
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:i6YHB4Jq+79kVVYmuurzIQ
114
115
=head2 koha_object_class
116
117
=cut
118
119
sub koha_object_class {
120
    'Koha::Biblio::Volume::Item';
121
}
122
123
=head2 koha_objects_class
124
125
=cut
126
127
sub koha_objects_class {
128
    'Koha::Biblio::Volume::Items';
129
}
130
131
1;
(-)a/installer/data/mysql/atomicupdate/bug_24857_item_groups.pl (+49 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
{
4
    bug_number  => "24857",
5
    description => "Add ability to group items on a record",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{
11
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
12
            ('EnableItemGroups','0','','Enable the item groups feature','YesNo');
13
        });
14
15
        $dbh->do(q{
16
            INSERT INTO permissions (module_bit, code, description) VALUES
17
            ( 9, 'manage_item_groups', 'Create, update and delete item groups, add or remove items from a item groups');
18
        });
19
20
        unless ( TableExists('item_groups') ) {
21
            $dbh->do(q{
22
                CREATE TABLE `item_groups` (
23
                    `item_group_id` INT(11) NOT NULL auto_increment COMMENT "id for the items group",
24
                    `biblio_id` INT(11) NOT NULL DEFAULT 0 COMMENT "id for the bibliographic record the group belongs to",
25
                    `display_order` INT(4) NOT NULL DEFAULT 0 COMMENT "The 'sort order' for item_groups",
26
                    `description` MEDIUMTEXT default NULL COMMENT "A group description",
27
                    `created_on` TIMESTAMP NULL COMMENT "Time and date the group was created",
28
                    `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Time and date of the latest change on the group",
29
                    PRIMARY KEY  (`item_group_id`),
30
                    CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
31
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
32
            });
33
        }
34
35
        unless ( TableExists('item_group_items') ) {
36
            $dbh->do(q{
37
                CREATE TABLE `item_group_items` (
38
                    `item_group_items_id` int(11) NOT NULL auto_increment COMMENT "id for the group/item link",
39
                    `item_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key making this table a 1 to 1 join from items to item groups",
40
                    `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table",
41
                    PRIMARY KEY  (`item_group_items_id`),
42
                    UNIQUE KEY (item_group_id,item_id),
43
                    CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
44
                    CONSTRAINT `item_group_items_vifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
45
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
46
            });
47
        }
48
    },
49
}
(-)a/installer/data/mysql/atomicupdate/volumes.perl (-45 lines)
Lines 1-45 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if ( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
5
        ('EnableVolumes','0','','Enable volumes feature','YesNo');
6
    });
7
8
    $dbh->do(q{
9
        INSERT INTO permissions (module_bit, code, description) VALUES
10
        ( 9, 'manage_volumes', 'Create, update and delete volumes, add or remove items from a volume');
11
    });
12
13
    unless ( TableExists('volumes') ) {
14
        $dbh->do(q{
15
            CREATE TABLE `volumes` ( -- information related to bibliographic records in Koha
16
            `id` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha
17
            `biblionumber` INT(11) NOT NULL default 0, -- foreign key linking this table to the biblio table
18
            `display_order` INT(4) NOT NULL default 0, -- specifies the 'sort order' for volumes
19
            `description` MEDIUMTEXT default NULL, -- equivilent to enumchron
20
            `created_on` TIMESTAMP NULL, -- Time and date the volume was created
21
            `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Time and date of the latest change on the volume (description)
22
            PRIMARY KEY  (`id`),
23
            CONSTRAINT `volumes_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
24
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
25
        });
26
    }
27
28
    unless ( TableExists('volume_items') ) {
29
        $dbh->do(q{
30
            CREATE TABLE `volume_items` ( -- information related to bibliographic records in Koha
31
            `id` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha
32
            `volume_id` int(11) NOT NULL default 0, -- foreign key making this table a 1 to 1 join from items to volumes
33
            `itemnumber` int(11) NOT NULL default 0, -- foreign key linking this table to the items table
34
            PRIMARY KEY  (`id`),
35
            UNIQUE KEY (volume_id,itemnumber),
36
            CONSTRAINT `volume_items_iifk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
37
            CONSTRAINT `volume_items_vifk_1` FOREIGN KEY (`volume_id`) REFERENCES `volumes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
38
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
39
        });
40
    }
41
42
    # Always end with this (adjust the bug info)
43
    SetVersion( $DBversion );
44
    print "Upgrade to $DBversion done (Bug XXXXX - Add ability to define volumes for items on a record)\n";
45
}
(-)a/installer/data/mysql/kohastructure.sql (-21 / +21 lines)
Lines 1808-1841 CREATE TABLE `club_fields` ( Link Here
1808
/*!40101 SET character_set_client = @saved_cs_client */;
1808
/*!40101 SET character_set_client = @saved_cs_client */;
1809
1809
1810
--
1810
--
1811
-- Table structure for table `volumes`
1811
-- Table structure for table `item_groups`
1812
--
1812
--
1813
1813
1814
DROP TABLE IF EXISTS `volumes`;
1814
DROP TABLE IF EXISTS `item_groups`;
1815
CREATE TABLE `volumes` ( -- information related to bibliographic records in Koha
1815
CREATE TABLE `item_groups` (
1816
  `id` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha
1816
  `item_group_id` INT(11) NOT NULL auto_increment COMMENT "id for the items group",
1817
  `biblionumber` INT(11) NOT NULL default 0, -- foreign key linking this table to the biblio table
1817
  `biblio_id` INT(11) NOT NULL DEFAULT 0 COMMENT "id for the bibliographic record the group belongs to",
1818
  `display_order` INT(4) NOT NULL default 0, -- specifies the 'sort order' for volumes
1818
  `display_order` INT(4) NOT NULL DEFAULT 0 COMMENT "The 'sort order' for item_groups",
1819
  `description` MEDIUMTEXT default NULL, -- equivilent to enumchron
1819
  `description` MEDIUMTEXT default NULL COMMENT "A group description",
1820
  `created_on` TIMESTAMP NULL, -- Time and date the volume was created
1820
  `created_on` TIMESTAMP NULL COMMENT "Time and date the group was created",
1821
  `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Time and date of the latest change on the volume (description)
1821
  `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Time and date of the latest change on the group",
1822
  PRIMARY KEY  (`id`),
1822
  PRIMARY KEY  (`item_group_id`),
1823
  CONSTRAINT `volumes_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1823
  CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1824
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1824
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1825
1825
1826
--
1826
--
1827
-- Table structure for table `volume_items`
1827
-- Table structure for table `item_group_items`
1828
--
1828
--
1829
1829
1830
DROP TABLE IF EXISTS `volume_items`;
1830
DROP TABLE IF EXISTS `item_group_items`;
1831
CREATE TABLE `volume_items` ( -- information related to bibliographic records in Koha
1831
CREATE TABLE `item_group_items` (
1832
  `id` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha
1832
  `item_group_items_id` int(11) NOT NULL auto_increment COMMENT "id for the group/item link",
1833
  `volume_id` int(11) NOT NULL default 0, -- foreign key making this table a 1 to 1 join from items to volumes
1833
  `item_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key making this table a 1 to 1 join from items to item groups",
1834
  `itemnumber` int(11) NOT NULL default 0, -- foreign key linking this table to the items table
1834
  `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table",
1835
  PRIMARY KEY  (`id`),
1835
  PRIMARY KEY  (`item_group_items_id`),
1836
  UNIQUE KEY (volume_id,itemnumber),
1836
  UNIQUE KEY (item_group_id,item_id),
1837
  CONSTRAINT `volume_items_iifk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1837
  CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1838
  CONSTRAINT `volume_items_vifk_1` FOREIGN KEY (`volume_id`) REFERENCES `volumes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1838
  CONSTRAINT `item_group_items_vifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
1839
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1839
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1840
1840
1841
--
1841
--
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 199-205 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
199
('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''),
199
('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''),
200
('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'),
200
('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'),
201
('EnableSearchHistory','0','','Enable or disable search history','YesNo'),
201
('EnableSearchHistory','0','','Enable or disable search history','YesNo'),
202
('EnableVolumes','0','','Enable volumes feature','YesNo'),
202
('EnableItemGroups','0','','Enable the item groups feature','YesNo'),
203
('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'),
203
('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'),
204
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
204
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
205
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
205
('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'),
(-)a/installer/data/mysql/mandatory/userpermissions.sql (-2 / +1 lines)
Lines 49-55 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
49
   ( 9, 'edit_items', 'Edit items'),
49
   ( 9, 'edit_items', 'Edit items'),
50
   ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'),
50
   ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'),
51
   ( 9, 'delete_all_items', 'Delete all items at once'),
51
   ( 9, 'delete_all_items', 'Delete all items at once'),
52
   ( 9, 'manage_volumes', 'Create, update and delete volumes, add or remove items from a volume'),
52
   ( 9, 'manage_item_groups', 'Create, update and delete item groups, add or remove items from a item groups'),
53
   (10, 'payout', 'Perform account payout action'),
53
   (10, 'payout', 'Perform account payout action'),
54
   (10, 'refund', 'Perform account refund action'),
54
   (10, 'refund', 'Perform account refund action'),
55
   (10, 'discount', 'Perform account discount action'),
55
   (10, 'discount', 'Perform account discount action'),
56
- 

Return to bug 24857