X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgl.pl;h=8ac26984cd9eff6078d6c04bd081620bf908b9e7;hb=7070f3a0b8267b58ee39b7b0a524a97951ae64a9;hp=91a15c218b76bb7ca4baca66e2500c241310490d;hpb=4f99ff6136d6198ba3f7a842c903deaaf4e47a1b;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 91a15c218..8ac26984c 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -49,7 +49,6 @@ use SL::DBUtils qw(selectrow_query selectall_hashref_query); use SL::Webdav; use SL::Locale::String qw(t8); use SL::Helper::GlAttachments qw(count_gl_attachments); - require "bin/mozilla/common.pl"; require "bin/mozilla/reportgenerator.pl"; @@ -94,6 +93,7 @@ sub load_record_template { die "invalid template type" unless $template->template_type eq 'gl_transaction'; $template->substitute_variables; + my $payment_suggestion = $::form->{form_defaults}->{amount_1}; # Clean the current $::form before rebuilding it from the template. my $form_defaults = delete $::form->{form_defaults}; @@ -133,8 +133,8 @@ sub load_record_template { $::form->{"accno_id_${row}"} = $item->chart_id; $::form->{"previous_accno_id_${row}"} = $item->chart_id; - $::form->{"debit_${row}"} = $::form->format_amount(\%::myconfig, $item->amount1, 2) if $item->amount1 * 1; - $::form->{"credit_${row}"} = $::form->format_amount(\%::myconfig, $item->amount2, 2) if $item->amount2 * 1; + $::form->{"debit_${row}"} = $::form->format_amount(\%::myconfig, ($payment_suggestion ? $payment_suggestion : $item->amount1), 2) if $item->amount1 * 1; + $::form->{"credit_${row}"} = $::form->format_amount(\%::myconfig, ($payment_suggestion ? $payment_suggestion : $item->amount2), 2) if $item->amount2 * 1; $::form->{"taxchart_${row}"} = $item->tax_id . '--' . $tax->rate; $::form->{"${_}_${row}"} = $item->$_ for qw(source memo project_id); } @@ -422,7 +422,7 @@ sub generate_report { ); # add employee here, so that variable is still known and passed in url when choosing a different sort order in resulting table - my @hidden_variables = qw(accno source reference description notes project_id datefrom dateto employee_id datesort category l_subtotal); + my @hidden_variables = qw(accno source reference description notes project_id datefrom dateto employee_id datesort category l_subtotal department_id); push @hidden_variables, map { "l_${_}" } @columns; my $employee = $form->{employee_id} ? SL::DB::Employee->new(id => $form->{employee_id})->load->name : ''; @@ -1317,7 +1317,6 @@ sub post_transaction { $form->error($err[$errno]); } - undef($form->{callback}); # saving the history if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|gltransaction_| . $form->{id}; @@ -1327,6 +1326,12 @@ sub post_transaction { } # /saving the history + if ($form->{callback} =~ /BankTransaction/) { + print $form->redirect_header($form->{callback}); + $form->redirect($locale->text('GL transaction posted.') . ' ' . $locale->text('ID') . ': ' . $form->{id}); + } + # remove or clarify + undef($form->{callback}); $main::lxdebug->leave_sub(); } @@ -1339,9 +1344,7 @@ sub post { my $locale = $main::locale; if ($::myconfig{mandatory_departments} && !$form->{department_id}) { - $form->{saved_message} = $::locale->text('You have to specify a department.'); - update(); - exit; + $form->error($locale->text('You have to specify a department.')); } $form->{title} = $locale->text("$form->{title} General Ledger Transaction");