return 2;
}
- if ($main::form->{continue_options} eq 'break_up') {
- return 0;
- }
+ if (defined $::form->{continue_options}) {
+ if ($::form->{continue_options} eq 'break_up') {
+ return 0;
+ }
- if ($main::form->{continue_options} eq 'insert') {
- for my $i (0..($rowcount-1)){
- push @currency_array, $main::form->{"curr_$i"};
+ if ($::form->{continue_options} eq 'insert') {
+ for my $i (0..($rowcount-1)){
+ push @currency_array, $main::form->{"curr_$i"};
+ }
+ create_and_fill_table($self, @currency_array);
+ return 1;
}
- create_and_fill_table($self, @currency_array);
- return 1;
- }
- my $still_orphaned;
- if ($main::form->{continue_options} eq 'replace') {
- for my $i (0..($rowcount - 1)){
- $still_orphaned = 1;
- for my $item (@currency_array){
- if ($main::form->{"curr_$i"} eq $item){
- $still_orphaned = 0;
- $query = qq|DELETE FROM exchangerate WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
- $self->db_query($query);
- $query = qq|UPDATE ap SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
- $self->db_query($query);
- $query = qq|UPDATE ar SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
- $self->db_query($query);
- $query = qq|UPDATE oe SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
- $self->db_query($query);
- $query = qq|UPDATE customer SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
- $self->db_query($query);
- $query = qq|UPDATE delivery_orders SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
- $self->db_query($query);
- $query = qq|UPDATE vendor SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
- $self->db_query($query);
- last;
+ my $still_orphaned;
+ if ($::form->{continue_options} eq 'replace') {
+ for my $i (0..($rowcount - 1)){
+ $still_orphaned = 1;
+ for my $item (@currency_array){
+ if ($main::form->{"curr_$i"} eq $item){
+ $still_orphaned = 0;
+ $query = qq|DELETE FROM exchangerate WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+ $self->db_query($query);
+ $query = qq|UPDATE ap SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+ $self->db_query($query);
+ $query = qq|UPDATE ar SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+ $self->db_query($query);
+ $query = qq|UPDATE oe SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+ $self->db_query($query);
+ $query = qq|UPDATE customer SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+ $self->db_query($query);
+ $query = qq|UPDATE delivery_orders SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+ $self->db_query($query);
+ $query = qq|UPDATE vendor SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+ $self->db_query($query);
+ last;
+ }
+ }
+ if ($still_orphaned){
+ $main::form->{continue_options} = '';
+ return do_update();
}
}
- if ($still_orphaned){
- $main::form->{continue_options} = '';
- return do_update();
- }
+ create_and_fill_table($self, @currency_array);
+ return 1;
}
- create_and_fill_table($self, @currency_array);
- return 1;
}
#No orphaned currencies, so create table:
# kivitendo behaviour isn't changed by this update
# if payments_changeable is not set in config set it to 0
my $payments_changeable = 0;
- if ($::lx_office_conf{features}->{payments_changeable} == 1 ) {
- $payments_changeable = 1;
- } elsif ($::lx_office_conf{features}->{payments_changeable} == 2 ) {
- $payments_changeable = 2;
+ if (defined $::lx_office_conf{features}{payments_changeable}) {
+ if ($::lx_office_conf{features}->{payments_changeable} == 1 ) {
+ $payments_changeable = 1;
+ } elsif ($::lx_office_conf{features}->{payments_changeable} == 2 ) {
+ $payments_changeable = 2;
+ }
}
my $update_column = "UPDATE defaults SET payments_changeable = '$payments_changeable';";
print_question();
return 2;
} else {
- if ($::form->{do_migrate} eq 'Y') {
+ if (defined $::form->{do_migrate} && $::form->{do_migrate} eq 'Y') {
# if yes, both warehouse and bin must be given
if (!$::form->{import_warehouse} || !$::form->{bin_default}) {
print_question();
$do_sql_migration = 1;
}
}
- my $warehouse = $::form->{import_warehouse} ne '' ? $::form->{import_warehouse} : "Transfer";
- my $bin = $::form->{bin_default} ne '' ? $::form->{bin_default} : "1";
+ my $warehouse = defined $::form->{import_warehouse} && $::form->{import_warehouse} ne '' ? $::form->{import_warehouse} : "Transfer";
+ my $bin = defined $::form->{bin_default} && $::form->{bin_default} ne '' ? $::form->{bin_default} : "1";
$warehouse = $self->dbh->quote($warehouse);
$bin = $self->dbh->quote($bin);