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

(-)a/installer/data/mysql/atomicupdate/bug_35635_add_opac_mandatory.pl (+30 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_failure say_success say_info);
3
4
return {
5
    bug_number  => "35635",
6
    description => "Add opac_mandatory column to borrower_attribute_type table",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        if ( !column_exists( 'borrower_attribute_types', 'opac_mandatory' ) ) {
12
            $dbh->do(
13
                q{
14
                    ALTER TABLE borrower_attribute_types
15
                    ADD COLUMN `opac_mandatory` tinyint(1) DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not on the OPAC'
16
                    AFTER `mandatory`
17
                }
18
            );
19
20
            say $out "Added column 'borrower_attribute_types.opac_mandatory'";
21
22
            $dbh->do(q{
23
                UPDATE borrower_attribute_types
24
                SET opac_mandatory = 1 WHERE mandatory = 1;
25
            });
26
            say $out "Update opac_mandatory to match mandatory column";
27
        }
28
    },
29
30
};
(-)a/installer/data/mysql/kohastructure.sql (-2 / +2 lines)
Lines 1260-1266 CREATE TABLE `borrower_attribute_types` ( Link Here
1260
  `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1260
  `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1261
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1261
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1262
  `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1262
  `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1263
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1263
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not in the staff client',
1264
  `opac_mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not in the OPAC',
1264
  PRIMARY KEY (`code`),
1265
  PRIMARY KEY (`code`),
1265
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1266
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1266
  KEY `category_code` (`category_code`),
1267
  KEY `category_code` (`category_code`),
1267
- 

Return to bug 35635