X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=f438f1c9bdbaf5ca593bd4da814526351d525eb5;hb=7c7d58ebe9550b153ec01f5e10e512da57612648;hp=beb6093f358a883028d6b08c7063417c980d5de3;hpb=554034c0587282b99d58cf42758b2f836367f2eb;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index beb6093f3..f438f1c9b 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -146,7 +146,7 @@ sub invoice_links { my $editing = $form->{id}; - $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes id shipto_id)); + $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded currency cp_id intnotes id shipto_id)); IS->get_customer(\%myconfig, \%$form); @@ -158,7 +158,7 @@ sub invoice_links { $form->restore_vars(qw(id)); IS->retrieve_invoice(\%myconfig, \%$form); - $form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id shipto_id)); + $form->restore_vars(qw(payment_id language_id taxzone_id currency intnotes cp_id shipto_id)); $form->restore_vars(qw(taxincluded)) if $form->{id}; $form->restore_vars(qw(salesman_id)) if $editing; @@ -332,7 +332,9 @@ sub form_header { $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; $form->{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency}; $TMPL_VAR{currencies} = NTI($::request->{cgi}->popup_menu('-name' => 'currency', '-default' => $form->{"currency"}, - '-values' => \@values, '-labels' => \%labels)) if scalar @values; + '-values' => \@values, '-labels' => \%labels, + '-onchange' => "document.getElementById('update_button').click();" + )) if scalar @values; push @custom_hiddens, "forex"; push @custom_hiddens, "exchangerate" if $form->{forex}; @@ -385,7 +387,6 @@ sub form_footer { $main::auth->assert('invoice_edit'); $form->{invtotal} = $form->{invsubtotal}; - $form->{oldinvtotal} = $form->{invtotal}; # note rows $form->{rows} = max 2, @@ -445,6 +446,8 @@ sub form_footer { $totalpaid += $form->{"paid_$i"}; } + $form->{oldinvtotal} = $form->{invtotal}; + print $form->parse_html_template('is/form_footer', { is_type_credit_note => ($form->{type} eq "credit_note"), totalpaid => $totalpaid, @@ -482,8 +485,6 @@ sub update { my ($recursive_call) = @_; - $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call; - $form->{print_and_post} = 0 if $form->{second_run}; my $taxincluded = $form->{taxincluded} ? "checked" : ''; $form->{update} = 1; @@ -492,6 +493,9 @@ sub update { $form->{taxincluded} ||= $taxincluded; + if (!$form->{forex}) { # read exchangerate from input field (not hidden) + $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call; + } $form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy'); $form->{exchangerate} = $form->{forex} if $form->{forex};