X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fgl.pl;h=f26d671572492536f961ce966240c56d832182fb;hb=da202b2d715a4c3f8b24a1f7bd3dbfebb14d0ce0;hp=f5f846037b1a6054844d1ec739fc886f9c74cf70;hpb=b65a230d60e86d2c18a3ab7222379905aea5ecd7;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index f5f846037..f26d67157 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -74,10 +74,6 @@ use strict; # $locale->text('Nov') # $locale->text('Dec') -my $tax; -my $debitlock = 0; -my $creditlock = 0; - sub add { $main::lxdebug->enter_sub(); @@ -96,12 +92,6 @@ sub add { # yep. aber er holt hier auch schon ALL_CHARTS. Aufwand / Nutzen? jb GL->transaction(\%myconfig, \%$form); - map { - $tax .= - qq|$_->{taxdescription} | - . ($_->{rate} * 100) . qq| %| - } @{ $form->{TAX} }; - $form->{rowcount} = 2; $form->{debit} = 0; @@ -136,12 +126,6 @@ sub prepare_transaction { GL->transaction(\%myconfig, \%$form); - map { - $tax .= - qq|$_->{taxdescription} | - . ($_->{rate} * 100) . qq| %| - } @{ $form->{TAX} }; - $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2); # departments @@ -715,19 +699,19 @@ sub update { $form->{"credit_$i"} = 0; $form->{"tax_$i"} = 0; $creditcount--; - $creditlock = 1; + $form->{creditlock} = 1; } if (($creditcount >= 2) && ($debitcount == 2)) { $form->{"debit_$i"} = 0; $form->{"tax_$i"} = 0; $debitcount--; - $debitlock = 1; + $form->{debitlock} = 1; } if (($creditcount == 1) && ($debitcount == 2)) { - $creditlock = 1; + $form->{creditlock} = 1; } if (($creditcount == 2) && ($debitcount == 1)) { - $debitlock = 1; + $form->{debitlock} = 1; } if ($debitcredit && $credittax) { $form->{"taxchart_$i"} = "0--0.00"; @@ -895,7 +879,7 @@ sub display_rows { . $cgi->hidden('-name' => "previous_accno_$i", '-default' => $selected_accno_full) . qq||; - $tax = qq|| . + my $tax_ddbox = qq|| . NTI($cgi->popup_menu('-name' => "taxchart_$i", '-id' => "taxchart_$i", '-style' => 'width:200px', @@ -953,9 +937,9 @@ sub display_rows { my $debitreadonly = ""; my $creditreadonly = ""; if ($i == $form->{rowcount}) { - if ($debitlock) { + if ($form->{debitlock}) { $debitreadonly = "readonly"; - } elsif ($creditlock) { + } elsif ($form->{creditlock}) { $creditreadonly = "readonly"; } } @@ -965,6 +949,8 @@ sub display_rows { '-values' => \@project_values, '-labels' => \%project_labels, '-default' => $form->{"project_id_$i"} )); + my $projectnumber_hidden = qq| + |; my $copy2credit = 'onkeyup="copy_debit_to_credit()"' if $i == 1; @@ -975,7 +961,7 @@ sub display_rows { $form->{"tax_$i"} - $tax|; + $tax_ddbox|; if ($form->{show_details}) { print qq| @@ -983,10 +969,14 @@ sub display_rows { $memo $projectnumber |; - } + } else { print qq| $source_hidden $memo_hidden + $projectnumber_hidden + |; + } + print qq| |; } @@ -1148,7 +1138,14 @@ sub form_header { $form->{title} - + | . + + ($form->{saved_message} ? qq| + + $form->{saved_message} + | : '') . + +qq| @@ -1423,7 +1420,7 @@ sub yes { if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; $form->{addition} = "DELETED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history $form->redirect($locale->text('Transaction deleted!')) @@ -1478,19 +1475,19 @@ sub post_transaction { $form->{"credit_$i"} = 0; $form->{"tax_$i"} = 0; $creditcount--; - $creditlock = 1; + $form->{creditlock} = 1; } if (($creditcount >= 2) && ($debitcount == 2)) { $form->{"debit_$i"} = 0; $form->{"tax_$i"} = 0; $debitcount--; - $debitlock = 1; + $form->{debitlock} = 1; } if (($creditcount == 1) && ($debitcount == 2)) { - $creditlock = 1; + $form->{creditlock} = 1; } if (($creditcount == 2) && ($debitcount == 1)) { - $debitlock = 1; + $form->{debitlock} = 1; } if ($debitcredit && $credittax) { $form->{"taxchart_$i"} = "0--0.00"; @@ -1544,7 +1541,7 @@ sub post_transaction { for my $i (1 .. $form->{rowcount}) { my $dr = $form->{"debit_$i"}; my $cr = $form->{"credit_$i"}; - $tax = $form->{"tax_$i"}; + my $tax = $form->{"tax_$i"}; if ($dr && $cr) { $form->error($locale->text('Cannot post transaction with a debit and credit entry for the same account!')); } @@ -1581,7 +1578,7 @@ sub post_transaction { $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; $form->{addition} = "SAVED"; $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id}; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history @@ -1596,6 +1593,12 @@ sub post { my $form = $main::form; my $locale = $main::locale; + if ($::myconfig{mandatory_departments} && !$form->{department}) { + $form->{saved_message} = $::locale->text('You have to specify a department.'); + update(); + exit; + } + $form->{title} = $locale->text("$form->{title} General Ledger Transaction"); $form->{storno} = 0; @@ -1643,7 +1646,7 @@ sub storno { if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = "ordnumber_$form->{ordnumber}"; $form->{addition} = "STORNO"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history