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

(-)a/C4/Installer.pm (-7 / +22 lines)
Lines 150-160 sub marc_framework_sql_list { Link Here
150
        my %cell;
150
        my %cell;
151
        my @frameworklist;
151
        my @frameworklist;
152
        map {
152
        map {
153
            my $name = substr( $_, 0, -4 ); # FIXME: restricted to 3 letter extension
153
            my ( $name, $ext ) = split /\./, $_;
154
            open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
154
            my @lines;
155
            my $line = <$fh>;
155
            if ( $ext =~ /yml/ ) {
156
            $line = Encode::encode('UTF-8', $line) unless ( Encode::is_utf8($line) );
156
                my $yaml = LoadFile("$dir/$requirelevel/$name\.$ext");
157
            my @lines = split /\n/, $line;
157
                @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} };
158
            } else {
159
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
160
                my $line = <$fh>;
161
                $line = Encode::encode('UTF-8', $line) unless ( Encode::is_utf8($line) );
162
                @lines = split /\n/, $line;
163
            }
158
            my $mandatory = ($requirelevel =~ /(mandatory|requi|oblig|necess)/i);
164
            my $mandatory = ($requirelevel =~ /(mandatory|requi|oblig|necess)/i);
159
            push @frameworklist,
165
            push @frameworklist,
160
              {
166
              {
Lines 231-237 sub sample_data_sql_list { Link Here
231
            my @lines;
237
            my @lines;
232
            if ( $ext =~ /yml/ ) {
238
            if ( $ext =~ /yml/ ) {
233
                my $yaml = LoadFile("$dir/$requirelevel/$name\.$ext");
239
                my $yaml = LoadFile("$dir/$requirelevel/$name\.$ext");
234
                @lines = @{ $yaml->{'description'} };
240
                @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} };
235
            } else {
241
            } else {
236
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
242
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
237
                my $line = <$fh>;
243
                my $line = <$fh>;
Lines 484-494 sub load_sql { Link Here
484
                    my $placeholders = join ",", map { "?" } @columns;               # '?,..,?' string
490
                    my $placeholders = join ",", map { "?" } @columns;               # '?,..,?' string
485
                    my $query        = "INSERT INTO $table_name ( $fields ) VALUES ( $placeholders )";
491
                    my $query        = "INSERT INTO $table_name ( $fields ) VALUES ( $placeholders )";
486
                    my $sth          = $dbh->prepare($query);
492
                    my $sth          = $dbh->prepare($query);
493
                    my @multiline    = @{ $table->{$table_name}->{'multiline'} };    # to check multiline values;
487
                    foreach my $row ( @rows ) {
494
                    foreach my $row ( @rows ) {
488
                        my @values = map { $row->{$_} } @columns;
495
                        my @values = map {
496
                                        my $col = $_;
497
                                        ( @multiline and grep { $_ eq $col } @multiline )
498
                                        ? join "\r\n", @{$row->{$col}}                # join multiline values
499
                                        : $row->{$col};
500
                                     } @columns;
489
                        $sth->execute( @values );
501
                        $sth->execute( @values );
490
                    }
502
                    }
491
                }
503
                }
504
                for my $statement ( @{ $yaml->{'sql_statements'} } ) {               # extra SQL statements
505
                    $dbh->do($statement);
506
                }
492
            };
507
            };
493
        }
508
        }
494
        if ($@){
509
        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