Revision bfdfc9ee
Von Sven Schöling vor etwa 11 Jahren hinzugefügt
sql/Pg-upgrade2/currencies.pl | ||
---|---|---|
69 | 69 |
return 2; |
70 | 70 |
} |
71 | 71 |
|
72 |
if ($main::form->{continue_options} eq 'break_up') { |
|
73 |
return 0; |
|
74 |
} |
|
72 |
if (defined $::form->{continue_options}) { |
|
73 |
if ($::form->{continue_options} eq 'break_up') { |
|
74 |
return 0; |
|
75 |
} |
|
75 | 76 |
|
76 |
if ($main::form->{continue_options} eq 'insert') { |
|
77 |
for my $i (0..($rowcount-1)){ |
|
78 |
push @currency_array, $main::form->{"curr_$i"}; |
|
77 |
if ($::form->{continue_options} eq 'insert') { |
|
78 |
for my $i (0..($rowcount-1)){ |
|
79 |
push @currency_array, $main::form->{"curr_$i"}; |
|
80 |
} |
|
81 |
create_and_fill_table($self, @currency_array); |
|
82 |
return 1; |
|
79 | 83 |
} |
80 |
create_and_fill_table($self, @currency_array); |
|
81 |
return 1; |
|
82 |
} |
|
83 | 84 |
|
84 |
my $still_orphaned; |
|
85 |
if ($main::form->{continue_options} eq 'replace') { |
|
86 |
for my $i (0..($rowcount - 1)){ |
|
87 |
$still_orphaned = 1; |
|
88 |
for my $item (@currency_array){ |
|
89 |
if ($main::form->{"curr_$i"} eq $item){ |
|
90 |
$still_orphaned = 0; |
|
91 |
$query = qq|DELETE FROM exchangerate WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
92 |
$self->db_query($query); |
|
93 |
$query = qq|UPDATE ap SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
94 |
$self->db_query($query); |
|
95 |
$query = qq|UPDATE ar SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
96 |
$self->db_query($query); |
|
97 |
$query = qq|UPDATE oe SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
98 |
$self->db_query($query); |
|
99 |
$query = qq|UPDATE customer SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
100 |
$self->db_query($query); |
|
101 |
$query = qq|UPDATE delivery_orders SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
102 |
$self->db_query($query); |
|
103 |
$query = qq|UPDATE vendor SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
104 |
$self->db_query($query); |
|
105 |
last; |
|
85 |
my $still_orphaned; |
|
86 |
if ($::form->{continue_options} eq 'replace') { |
|
87 |
for my $i (0..($rowcount - 1)){ |
|
88 |
$still_orphaned = 1; |
|
89 |
for my $item (@currency_array){ |
|
90 |
if ($main::form->{"curr_$i"} eq $item){ |
|
91 |
$still_orphaned = 0; |
|
92 |
$query = qq|DELETE FROM exchangerate WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
93 |
$self->db_query($query); |
|
94 |
$query = qq|UPDATE ap SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
95 |
$self->db_query($query); |
|
96 |
$query = qq|UPDATE ar SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
97 |
$self->db_query($query); |
|
98 |
$query = qq|UPDATE oe SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
99 |
$self->db_query($query); |
|
100 |
$query = qq|UPDATE customer SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
101 |
$self->db_query($query); |
|
102 |
$query = qq|UPDATE delivery_orders SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
103 |
$self->db_query($query); |
|
104 |
$query = qq|UPDATE vendor SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|; |
|
105 |
$self->db_query($query); |
|
106 |
last; |
|
107 |
} |
|
108 |
} |
|
109 |
if ($still_orphaned){ |
|
110 |
$main::form->{continue_options} = ''; |
|
111 |
return do_update(); |
|
106 | 112 |
} |
107 | 113 |
} |
108 |
if ($still_orphaned){ |
|
109 |
$main::form->{continue_options} = ''; |
|
110 |
return do_update(); |
|
111 |
} |
|
114 |
create_and_fill_table($self, @currency_array); |
|
115 |
return 1; |
|
112 | 116 |
} |
113 |
create_and_fill_table($self, @currency_array); |
|
114 |
return 1; |
|
115 | 117 |
} |
116 | 118 |
|
117 | 119 |
#No orphaned currencies, so create table: |
Auch abrufbar als: Unified diff
warnings unter 5.12.4