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

(-)a/Koha.pm (-1 / +1 lines)
Lines 29-35 use vars qw{ $VERSION }; Link Here
29
# - #4 : the developer version. The 4th number is the database subversion.
29
# - #4 : the developer version. The 4th number is the database subversion.
30
#        used by developers when the database changes. updatedatabase take care of the changes itself
30
#        used by developers when the database changes. updatedatabase take care of the changes itself
31
#        and is automatically called by Auth.pm when needed.
31
#        and is automatically called by Auth.pm when needed.
32
$VERSION = "19.12.00.009";
32
$VERSION = "19.12.00.010";
33
33
34
sub version {
34
sub version {
35
    return $VERSION;
35
    return $VERSION;
(-)a/Koha/Schema/Result/OaiSetsMapping.pm (-2 / +18 lines)
Lines 29-34 __PACKAGE__->table("oai_sets_mappings"); Link Here
29
  is_foreign_key: 1
29
  is_foreign_key: 1
30
  is_nullable: 0
30
  is_nullable: 0
31
31
32
=head2 rule_order
33
34
  data_type: 'integer'
35
  is_nullable: 0
36
37
=head2 rule_operator
38
39
  data_type: 'varchar'
40
  default_value: 'or'
41
  is_nullable: 0
42
  size: 3
43
32
=head2 marcfield
44
=head2 marcfield
33
45
34
  data_type: 'char'
46
  data_type: 'char'
Lines 59-64 __PACKAGE__->table("oai_sets_mappings"); Link Here
59
__PACKAGE__->add_columns(
71
__PACKAGE__->add_columns(
60
  "set_id",
72
  "set_id",
61
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
73
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
74
  "rule_order",
75
  { data_type => "integer", is_nullable => 0 },
76
  "rule_operator",
77
  { data_type => "varchar", default_value => "or", is_nullable => 0, size => 3 },
62
  "marcfield",
78
  "marcfield",
63
  { data_type => "char", is_nullable => 0, size => 3 },
79
  { data_type => "char", is_nullable => 0, size => 3 },
64
  "marcsubfield",
80
  "marcsubfield",
Lines 92-99 __PACKAGE__->belongs_to( Link Here
92
);
108
);
93
109
94
110
95
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
111
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-01-15 16:27:11
96
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:A2fchnI85JftSuruZ1CykQ
112
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:70uqCB/wqEodblvsbKKVvA
97
113
98
114
99
# You can replace this text with custom content, and it will be preserved on regeneration
115
# You can replace this text with custom content, and it will be preserved on regeneration
(-)a/installer/data/mysql/atomicupdate/bug_21520.perl (-28 lines)
Lines 1-28 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do( "ALTER TABLE oai_sets_mappings ADD COLUMN rule_order INT AFTER set_id, ADD COLUMN rule_operator VARCHAR(3) AFTER rule_order" );
4
    $dbh->do( "UPDATE oai_sets_mappings SET rule_operator='or'" );
5
    my $sets = $dbh->selectall_arrayref("SELECT * from oai_sets_mappings ORDER BY set_id", { Slice => {} });
6
    my $i = 0;
7
    my $previous_set_id;
8
    for my $set ( @{$sets}) {
9
        my $set_id = $set->{set_id};
10
11
        if ($previous_set_id && $previous_set_id != $set_id) {
12
            $i = 0;
13
        }
14
15
        if ($i == 0) {
16
            $dbh->do("UPDATE oai_sets_mappings SET rule_operator=NULL WHERE set_id=? LIMIT 1", {}, $set_id);
17
        }
18
19
        $dbh->do("UPDATE oai_sets_mappings SET rule_order=? WHERE set_id=? AND rule_order IS NULL LIMIT 1", {}, $i, $set_id);
20
21
        $i++;
22
        $previous_set_id = $set_id;
23
    }
24
25
    # Always end with this (adjust the bug info)
26
    SetVersion( $DBversion );
27
    print "Upgrade to $DBversion done (Bug 21520 - Add rule_order and rule_operator fields to oai_sets_mappings table)\n";
28
}
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1219-1224 CREATE TABLE `oai_sets_descriptions` ( Link Here
1219
DROP TABLE IF EXISTS `oai_sets_mappings`;
1219
DROP TABLE IF EXISTS `oai_sets_mappings`;
1220
CREATE TABLE `oai_sets_mappings` (
1220
CREATE TABLE `oai_sets_mappings` (
1221
  `set_id` int(11) NOT NULL,
1221
  `set_id` int(11) NOT NULL,
1222
  `rule_order` int NOT NULL,
1223
  `rule_operator` varchar(3) NOT NULL default 'or',
1222
  `marcfield` char(3) NOT NULL,
1224
  `marcfield` char(3) NOT NULL,
1223
  `marcsubfield` char(1) NOT NULL,
1225
  `marcsubfield` char(1) NOT NULL,
1224
  `operator` varchar(8) NOT NULL default 'equal',
1226
  `operator` varchar(8) NOT NULL default 'equal',
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +30 lines)
Lines 20485-20490 INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, Link Here
20485
    print "Upgrade to $DBversion done (Bug 23354 - Add point of sale permissions)\n";
20485
    print "Upgrade to $DBversion done (Bug 23354 - Add point of sale permissions)\n";
20486
}
20486
}
20487
20487
20488
$DBversion = '19.12.00.010';
20489
if( CheckVersion( $DBversion ) ) {
20490
    if( !column_exists( 'oai_sets_mappings', 'rule_order' ) ) {
20491
        $dbh->do( "ALTER TABLE oai_sets_mappings ADD COLUMN rule_order INT AFTER set_id, ADD COLUMN rule_operator VARCHAR(3) AFTER rule_order" );
20492
        $dbh->do( "UPDATE oai_sets_mappings SET rule_operator='or'" );
20493
        my $sets = $dbh->selectall_arrayref("SELECT * from oai_sets_mappings ORDER BY set_id", { Slice => {} });
20494
        my $i = 0;
20495
        my $previous_set_id;
20496
        for my $set ( @{$sets}) {
20497
            my $set_id = $set->{set_id};
20498
    
20499
            if ($previous_set_id && $previous_set_id != $set_id) {
20500
                $i = 0;
20501
            }
20502
    
20503
            if ($i == 0) {
20504
                $dbh->do("UPDATE oai_sets_mappings SET rule_operator=NULL WHERE set_id=? LIMIT 1", {}, $set_id);
20505
            }
20506
    
20507
            $dbh->do("UPDATE oai_sets_mappings SET rule_order=? WHERE set_id=? AND rule_order IS NULL LIMIT 1", {}, $i, $set_id);
20508
    
20509
            $i++;
20510
            $previous_set_id = $set_id;
20511
        }
20512
    }
20513
20514
    SetVersion( $DBversion );
20515
    print "Upgrade to $DBversion done (Bug 21520 - Add rule_order and rule_operator fields to oai_sets_mappings table)\n";
20516
}
20517
20488
# SEE bug 13068
20518
# SEE bug 13068
20489
# if there is anything in the atomicupdate, read and execute it.
20519
# if there is anything in the atomicupdate, read and execute it.
20490
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';
20520
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';
20491
- 

Return to bug 24429