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

(-)a/C4/Installer.pm (-7 / +22 lines)
Lines 151-161 sub marc_framework_sql_list { Link Here
151
        my %cell;
151
        my %cell;
152
        my @frameworklist;
152
        my @frameworklist;
153
        map {
153
        map {
154
            my $name = substr( $_, 0, -4 ); # FIXME: restricted to 3 letter extension
154
            my ( $name, $ext ) = split /\./, $_;
155
            open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
155
            my @lines;
156
            my $line = <$fh>;
156
            if ( $ext =~ /yml/ ) {
157
            $line = Encode::encode('UTF-8', $line) unless ( Encode::is_utf8($line) );
157
                my $yaml = LoadFile("$dir/$requirelevel/$name\.$ext");
158
            my @lines = split /\n/, $line;
158
                @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} };
159
            } else {
160
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
161
                my $line = <$fh>;
162
                $line = Encode::encode('UTF-8', $line) unless ( Encode::is_utf8($line) );
163
                @lines = split /\n/, $line;
164
            }
159
            my $mandatory = ($requirelevel =~ /(mandatory|requi|oblig|necess)/i);
165
            my $mandatory = ($requirelevel =~ /(mandatory|requi|oblig|necess)/i);
160
            push @frameworklist,
166
            push @frameworklist,
161
              {
167
              {
Lines 232-238 sub sample_data_sql_list { Link Here
232
            my @lines;
238
            my @lines;
233
            if ( $ext =~ /yml/ ) {
239
            if ( $ext =~ /yml/ ) {
234
                my $yaml = LoadFile("$dir/$requirelevel/$name\.$ext");
240
                my $yaml = LoadFile("$dir/$requirelevel/$name\.$ext");
235
                @lines = @{ $yaml->{'description'} };
241
                @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} };
236
            } else {
242
            } else {
237
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
243
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
238
                my $line = <$fh>;
244
                my $line = <$fh>;
Lines 485-495 sub load_sql { Link Here
485
                    my $placeholders = join ",", map { "?" } @columns;               # '?,..,?' string
491
                    my $placeholders = join ",", map { "?" } @columns;               # '?,..,?' string
486
                    my $query        = "INSERT INTO $table_name ( $fields ) VALUES ( $placeholders )";
492
                    my $query        = "INSERT INTO $table_name ( $fields ) VALUES ( $placeholders )";
487
                    my $sth          = $dbh->prepare($query);
493
                    my $sth          = $dbh->prepare($query);
494
                    my @multiline    = @{ $table->{$table_name}->{'multiline'} };    # to check multiline values;
488
                    foreach my $row ( @rows ) {
495
                    foreach my $row ( @rows ) {
489
                        my @values = map { $row->{$_} } @columns;
496
                        my @values = map {
497
                                        my $col = $_;
498
                                        ( @multiline and grep { $_ eq $col } @multiline )
499
                                        ? join "\r\n", @{$row->{$col}}                # join multiline values
500
                                        : $row->{$col};
501
                                     } @columns;
490
                        $sth->execute( @values );
502
                        $sth->execute( @values );
491
                    }
503
                    }
492
                }
504
                }
505
                for my $statement ( @{ $yaml->{'sql_statements'} } ) {               # extra SQL statements
506
                    $dbh->do($statement);
507
                }
493
            };
508
            };
494
        }
509
        }
495
        if ($@){
510
        if ($@){
(-)a/installer/data/mysql/en/optional/auth_val.yml (-1 / +5 lines)
Lines 25-30 description: Link Here
25
tables:
25
tables:
26
  - authorised_values:
26
  - authorised_values:
27
      translatable: [ lib ]
27
      translatable: [ lib ]
28
      multiline: []
28
      rows:
29
      rows:
29
        # Reasons for acceptance or rejection of suggestions in acquisitions
30
        # Reasons for acceptance or rejection of suggestions in acquisitions
30
        - category: "SUGGEST"
31
        - category: "SUGGEST"
Lines 45-50 tables: Link Here
45
46
46
  - authorised_values:
47
  - authorised_values:
47
      translatable: [ lib, lib_opac ]
48
      translatable: [ lib, lib_opac ]
49
      multiline: []
48
      rows:
50
      rows:
49
        # Desired formats for requesting new materials
51
        # Desired formats for requesting new materials
50
        - category: "SUGGEST_FORMAT"
52
        - category: "SUGGEST_FORMAT"
Lines 74-79 tables: Link Here
74
76
75
  - authorised_values :
77
  - authorised_values :
76
      translatable: [ lib ]
78
      translatable: [ lib ]
79
      multiline: []
77
      rows:
80
      rows:
78
        # availability statuses
81
        # availability statuses
79
        - category: "LOST"
82
        - category: "LOST"
Lines 181-186 tables: Link Here
181
184
182
  - authorised_values:
185
  - authorised_values:
183
      translatable: [ lib, lib_opac ]
186
      translatable: [ lib, lib_opac ]
187
      multiline: []
184
      rows:
188
      rows:
185
        # OPAC Suggestions reasons
189
        # OPAC Suggestions reasons
186
        - category: "OPAC_SUG"
190
        - category: "OPAC_SUG"
Lines 195-200 tables: Link Here
195
199
196
  - authorised_values:
200
  - authorised_values:
197
      translatable: [ lib ]
201
      translatable: [ lib ]
202
      multiline: []
198
      rows:
203
      rows:
199
        # Report groups
204
        # Report groups
200
        - category: "REPORT_GROUP"
205
        - category: "REPORT_GROUP"
201
- 

Return to bug 13897