Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5cdcf572

Von Kivitendo Admin vor etwa 10 Jahren hinzugefügt

  • ID 5cdcf572cfe983e66b14aefde3533614edefbb7e
  • Vorgänger 3c67b164
  • Nachfolger 915e14b7

convert_taxzone - Fall keine Buchungsgruppen berücksichtigen

Für den Fall, daß in dem Mandanten gar keine Buchungsgruppen
konfiguriert sind (z.B. bei einem frischen Schweizer Kontenrahmen), wird
die Umwandlung der Buchungsgruppen übersprungen.

Unterschiede anzeigen:

sql/Pg-upgrade2/convert_taxzone.pl
39 39
    }
40 40
    $sth->finish;
41 41

  
42
    my $taxzone_charts_update_query;
43
    foreach my $taxzone (  @{$::form->{taxzones}} ) {
44
        foreach my $buchungsgruppe (  @{$::form->{buchungsgruppen}} ) {
45
            my $id = $taxzone->{id};
46
            my $income_accno_id = $buchungsgruppe->{"income_accno_id_$id"};
47
            my $expense_accno_id = $buchungsgruppe->{"expense_accno_id_$id"};
48
            # TODO: check if the variables have a value
49
            $taxzone_charts_update_query .= "INSERT INTO taxzone_charts (taxzone_id, buchungsgruppen_id, income_accno_id, expense_accno_id) VALUES ('$taxzone->{id}', '$buchungsgruppe->{id}', $income_accno_id, $expense_accno_id);\n";
42
    # convert Buchungsgruppen to taxzone_charts if any exist
43
    # the default swiss COA doesn't have any, for example
44
    if ( scalar @{ $::form->{buchungsgruppen} } > 0 ) { 
45
        my $taxzone_charts_update_query;
46
        foreach my $taxzone (  @{$::form->{taxzones}} ) {
47
            foreach my $buchungsgruppe (  @{$::form->{buchungsgruppen}} ) {
48
                my $id = $taxzone->{id};
49
                my $income_accno_id = $buchungsgruppe->{"income_accno_id_$id"};
50
                my $expense_accno_id = $buchungsgruppe->{"expense_accno_id_$id"};
51
                # TODO: check if the variables have a value
52
                $taxzone_charts_update_query .= "INSERT INTO taxzone_charts (taxzone_id, buchungsgruppen_id, income_accno_id, expense_accno_id) VALUES ('$taxzone->{id}', '$buchungsgruppe->{id}', $income_accno_id, $expense_accno_id);\n";
53
            };
50 54
        };
55
        $self->db_query($taxzone_charts_update_query) if $taxzone_charts_update_query;
51 56
    };
52
    $self->db_query($taxzone_charts_update_query);
53 57

  
54 58
    my $clean_buchungsgruppen_query = <<SQL;
55 59
alter table buchungsgruppen drop column income_accno_id_0;

Auch abrufbar als: Unified diff