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

(-)a/installer/data/mysql/atomicupdate/bug_38330.pl (+39 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  => "38330",
6
    description => "Make bib-level suppression a biblio table field instead of part of a marc tag",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        if ( !column_exists( 'biblio', 'opac_suppressed' ) ) {
12
            $dbh->do(
13
                q{
14
                ALTER TABLE `biblio`
15
                    ADD COLUMN `opac_suppressed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether the record should be suppressed in the OPAC' AFTER `abstract`;
16
                }
17
            );
18
            say $out "Added column 'biblio.opac_suppressed'";
19
        }
20
21
        if ( !column_exists( 'deletedbiblio', 'opac_suppressed' ) ) {
22
            $dbh->do(
23
                q{
24
                ALTER TABLE `deletedbiblio`
25
                    ADD COLUMN `opac_suppressed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether the record should be suppressed in the OPAC' AFTER `abstract`;
26
                }
27
            );
28
            say $out "Added column 'deletedbiblio.opac_suppressed'";
29
        }
30
31
        $dbh->do(
32
            q{
33
                UPDATE marc_subfield_structure SET kohafield='biblio.opac_suppressed' WHERE tagfield=942 AND tagsubfield='n';
34
            }
35
        );
36
        say $out "Set the 942\$n => biblio.opac_suppressed mapping for all MARC frameworks";
37
        say_warning( $out, "You need to run the `maintenance/touch_all_biblios.pl` script" );
38
    },
39
};
(-)a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml (-1 / +1 lines)
Lines 318-324 tables: Link Here
318
          libopac: "Suppress in OPAC"
318
          libopac: "Suppress in OPAC"
319
          repeatable: 0
319
          repeatable: 0
320
          mandatory: 0
320
          mandatory: 0
321
          kohafield:
321
          kohafield: biblio.opac_suppressed
322
          tab: 9
322
          tab: 9
323
          authorised_value: YES_NO
323
          authorised_value: YES_NO
324
          authtypecode: ""
324
          authtypecode: ""
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 1111-1116 CREATE TABLE `biblio` ( Link Here
1111
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1111
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1112
  `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1112
  `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1113
  `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1113
  `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1114
  `opac_suppressed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether the record should be suppressed in the OPAC',
1114
  PRIMARY KEY (`biblionumber`),
1115
  PRIMARY KEY (`biblionumber`),
1115
  KEY `blbnoidx` (`biblionumber`)
1116
  KEY `blbnoidx` (`biblionumber`)
1116
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1117
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Lines 2575-2580 CREATE TABLE `deletedbiblio` ( Link Here
2575
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2576
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2576
  `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2577
  `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2577
  `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2578
  `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2579
  `opac_suppressed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether the record should be suppressed in the OPAC',
2578
  PRIMARY KEY (`biblionumber`),
2580
  PRIMARY KEY (`biblionumber`),
2579
  KEY `blbnoidx` (`biblionumber`)
2581
  KEY `blbnoidx` (`biblionumber`)
2580
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2582
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2581
- 

Return to bug 38330