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

(-)a/installer/data/mysql/atomicupdate/bug_18928.perl (-69 / +77 lines)
Lines 1-79 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    if ( column_exists( 'default_circ_rules', 'holdallowed' ) ) {
3
4
        $dbh->do("
4
    if ( TableExists('default_circ_rules') ) {
5
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
5
        if ( column_exists( 'default_circ_rules', 'holdallowed' ) ) {
6
            SELECT NULL, NULL, NULL, 'holdallowed', holdallowed
6
            $dbh->do("
7
            FROM default_circ_rules
7
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
8
        ");
8
                SELECT NULL, NULL, NULL, 'holdallowed', holdallowed
9
        $dbh->do("
9
                FROM default_circ_rules
10
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
10
            ");
11
            SELECT NULL, NULL, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy
11
            $dbh->do("
12
            FROM default_circ_rules
12
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
13
        ");
13
                SELECT NULL, NULL, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy
14
        $dbh->do("
14
                FROM default_circ_rules
15
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
15
            ");
16
            SELECT NULL, NULL, NULL, 'returnbranch', returnbranch
16
            $dbh->do("
17
            FROM default_circ_rules
17
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
18
        ");
18
                SELECT NULL, NULL, NULL, 'returnbranch', returnbranch
19
        $dbh->do("DROP TABLE default_circ_rules");
19
                FROM default_circ_rules
20
            ");
21
            $dbh->do("DROP TABLE default_circ_rules");
22
        }
20
    }
23
    }
21
24
22
    if ( column_exists( 'default_branch_circ_rules', 'holdallowed' ) ) {
25
    if ( TableExists('default_branch_circ_rules') ) {
23
        $dbh->do("
26
        if ( column_exists( 'default_branch_circ_rules', 'holdallowed' ) ) {
24
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
27
            $dbh->do("
25
            SELECT NULL, branchcode, NULL, 'holdallowed', holdallowed
28
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
26
            FROM default_branch_circ_rules
29
                SELECT NULL, branchcode, NULL, 'holdallowed', holdallowed
27
        ");
30
                FROM default_branch_circ_rules
28
        $dbh->do("
31
            ");
29
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
32
            $dbh->do("
30
            SELECT NULL, branchcode, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy
33
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
31
            FROM default_branch_circ_rules
34
                SELECT NULL, branchcode, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy
32
        ");
35
                FROM default_branch_circ_rules
33
        $dbh->do("
36
            ");
34
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
37
            $dbh->do("
35
            SELECT NULL, branchcode, NULL, 'returnbranch', returnbranch
38
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
36
            FROM default_branch_circ_rules
39
                SELECT NULL, branchcode, NULL, 'returnbranch', returnbranch
37
        ");
40
                FROM default_branch_circ_rules
38
        $dbh->do("DROP TABLE default_branch_circ_rules");
41
            ");
42
            $dbh->do("DROP TABLE default_branch_circ_rules");
43
        }
39
    }
44
    }
40
45
41
    if ( column_exists( 'branch_item_rules', 'holdallowed' ) ) {
46
    if ( TableExists('branch_item_rules') ) {
42
        $dbh->do("
47
        if ( column_exists( 'branch_item_rules', 'holdallowed' ) ) {
43
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
48
            $dbh->do("
44
            SELECT NULL, branchcode, itemtype, 'holdallowed', holdallowed
49
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
45
            FROM branch_item_rules
50
                SELECT NULL, branchcode, itemtype, 'holdallowed', holdallowed
46
        ");
51
                FROM branch_item_rules
47
        $dbh->do("
52
            ");
48
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
53
            $dbh->do("
49
            SELECT NULL, branchcode, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy
54
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
50
            FROM branch_item_rules
55
                SELECT NULL, branchcode, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy
51
        ");
56
                FROM branch_item_rules
52
        $dbh->do("
57
            ");
53
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
58
            $dbh->do("
54
            SELECT NULL, branchcode, itemtype, 'returnbranch', returnbranch
59
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
55
            FROM branch_item_rules
60
                SELECT NULL, branchcode, itemtype, 'returnbranch', returnbranch
56
        ");
61
                FROM branch_item_rules
57
        $dbh->do("DROP TABLE branch_item_rules");
62
            ");
63
            $dbh->do("DROP TABLE branch_item_rules");
64
        }
58
    }
65
    }
59
66
60
    if ( column_exists( 'default_branch_item_rules', 'holdallowed' ) ) {
67
    if ( TableExists('default_branch_item_rules') ) {
61
        $dbh->do("
68
        if ( column_exists( 'default_branch_item_rules', 'holdallowed' ) ) {
62
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
69
            $dbh->do("
63
            SELECT NULL, NULL, itemtype, 'holdallowed', holdallowed
70
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
64
            FROM default_branch_item_rules
71
                SELECT NULL, NULL, itemtype, 'holdallowed', holdallowed
65
        ");
72
                FROM default_branch_item_rules
66
        $dbh->do("
73
            ");
67
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
74
            $dbh->do("
68
            SELECT NULL, NULL, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy
75
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
69
            FROM default_branch_item_rules
76
                SELECT NULL, NULL, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy
70
        ");
77
                FROM default_branch_item_rules
71
        $dbh->do("
78
            ");
72
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
79
            $dbh->do("
73
            SELECT NULL, NULL, itemtype, 'returnbranch', returnbranch
80
                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
74
            FROM default_branch_item_rules
81
                SELECT NULL, NULL, itemtype, 'returnbranch', returnbranch
75
        ");
82
                FROM default_branch_item_rules
76
        $dbh->do("DROP TABLE default_branch_item_rules");
83
            ");
84
            $dbh->do("DROP TABLE default_branch_item_rules");
85
        }
77
    }
86
    }
78
87
79
    SetVersion( $DBversion );
88
    SetVersion( $DBversion );
80
- 

Return to bug 18928