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

(-)a/installer/data/mysql/atomicupdate/bug_17809_pretty_red.perl (-1 / +50 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl -w
2
3
use Modern::Perl;
4
use Carp;
5
use Koha::Database;
6
7
$DBversion = 'XXX';
8
if ( CheckVersion($DBversion) ) {
9
    my $schema = Koha::Database->schema;
10
    $schema->storage->txn_begin;
11
12
    my $number_er = $schema->resultset('AuthorisedValue')->search(
13
        {
14
            authorised_value => 'ER'
15
        }
16
    )->count;
17
    if ( $number_er > 1 ) {
18
        carp
19
          'Check for correct Germany [DE] and Eritrea [ER] authorised values.';
20
    }
21
    my $number_cc = $schema->resultset('AuthorisedValue')->search(
22
        {
23
            authorised_value => 'CC'
24
        }
25
    )->count;
26
    if ( $number_cc > 1 ) {
27
        carp
28
'Check for duplicate authorised values of Cocos (Keeling) Islands [CC].';
29
    }
30
    my $number_gq = $schema->resultset('AuthorisedValue')->search(
31
        {
32
            authorised_value => 'GQ'
33
        }
34
    )->count;
35
    if ( $number_gq > 1 ) {
36
        carp 'Check for duplicate authorised values of Equatorial Guinea [GQ].';
37
    }
38
    my $number_pk = $schema->resultset('AuthorisedValue')->search(
39
        {
40
            authorised_value => 'PK'
41
        }
42
    )->count;
43
    if ( $number_pk > 1 ) {
44
        carp
45
'Check if the authorized value for Poland [PL] matches Pakistan\'s [PK].';
46
    }
47
    SetVersion($DBversion);
48
    print
49
"Upgrade to $DBversion done (Bug 17809 - Correct some authorised values in fr-FR)\n";
50
}

Return to bug 17809