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

(-)a/installer/data/mysql/atomicupdate/bug_38330.pl (-1 / +31 lines)
Lines 15-20 return { Link Here
15
                    ADD COLUMN `opac_suppressed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether the record should be suppressed in the OPAC' AFTER `abstract`;
15
                    ADD COLUMN `opac_suppressed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether the record should be suppressed in the OPAC' AFTER `abstract`;
16
                }
16
                }
17
            );
17
            );
18
19
            $dbh->do(
20
                q{
21
                    UPDATE biblio b
22
                    JOIN biblio_metadata m ON b.biblionumber = m.biblionumber
23
                    SET b.opac_suppressed = 
24
                        CASE
25
                            WHEN ExtractValue(m.metadata, '//datafield[@tag="952"]/subfield[@code="n"]') REGEXP '^[01]$' THEN
26
                                ExtractValue(m.metadata, '//datafield[@tag="952"]/subfield[@code="n"]')
27
                            ELSE 0
28
                        END
29
                    WHERE m.metadata LIKE '%<datafield tag="952">%';
30
                }
31
            );
32
18
            say $out "Added column 'biblio.opac_suppressed'";
33
            say $out "Added column 'biblio.opac_suppressed'";
19
        }
34
        }
20
35
Lines 25-30 return { Link Here
25
                    ADD COLUMN `opac_suppressed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether the record should be suppressed in the OPAC' AFTER `abstract`;
40
                    ADD COLUMN `opac_suppressed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether the record should be suppressed in the OPAC' AFTER `abstract`;
26
                }
41
                }
27
            );
42
            );
43
44
            $dbh->do(
45
                q{
46
                    UPDATE deletedbiblio b
47
                    JOIN deletedbiblio_metadata m ON b.biblionumber = m.biblionumber
48
                    SET b.opac_suppressed = 
49
                        CASE
50
                            WHEN ExtractValue(m.metadata, '//datafield[@tag="952"]/subfield[@code="n"]') REGEXP '^[01]$' THEN
51
                                ExtractValue(m.metadata, '//datafield[@tag="952"]/subfield[@code="n"]')
52
                            ELSE 0
53
                        END
54
                    WHERE m.metadata LIKE '%<datafield tag="952">%';
55
                }
56
            );
57
28
            say $out "Added column 'deletedbiblio.opac_suppressed'";
58
            say $out "Added column 'deletedbiblio.opac_suppressed'";
29
        }
59
        }
30
60
Lines 33-38 return { Link Here
33
                UPDATE marc_subfield_structure SET kohafield='biblio.opac_suppressed' WHERE tagfield=942 AND tagsubfield='n';
63
                UPDATE marc_subfield_structure SET kohafield='biblio.opac_suppressed' WHERE tagfield=942 AND tagsubfield='n';
34
            }
64
            }
35
        );
65
        );
66
36
        say $out "Set the 942\$n => biblio.opac_suppressed mapping for all MARC frameworks";
67
        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" );
68
        say_warning( $out, "You need to run the `maintenance/touch_all_biblios.pl` script" );
38
    },
69
    },
39
- 

Return to bug 38330